Parallel PopGen Package
Sim_Model::selection_piecewise< Functor_sel1, Functor_sel2 > Struct Template Reference

functor: selection function changes from s1 to s2 at generation inflection_point More...

Public Member Functions

 selection_piecewise ()
 default constructor More...
 
 selection_piecewise (Functor_sel1 s1_in, Functor_sel2 s2_in, int inflection_point, int generation_shift=0)
 constructor More...
 
__device__ __forceinline__ float operator() (const int population, const int generation, const float freq) const
 selection operator, returns selection coefficient, s, for a given population, generation, freq More...
 

Public Attributes

int inflection_point
 generation in which the selection function switches from s1 to s2 More...
 
int generation_shift
 number of generations to shift function backwards More...
 
Functor_sel1 s1
 first selection function More...
 
Functor_sel2 s2
 second selection function More...
 

Detailed Description

template<typename Functor_sel1, typename Functor_sel2>
struct Sim_Model::selection_piecewise< Functor_sel1, Functor_sel2 >

functor: selection function changes from s1 to s2 at generation inflection_point

Takes in two template types: the function to be returned before the inflection_point and the function for after the inflection_point.
Piecewise selection functors can be nested within each other and with population specific selection functors for multiple populations and multiple time functions, e.g.:

3 populations with different selection coefficients where mutations in the 1st are neutral, in the 2nd are deleterious, and in the 3rd are beneficial up to generation 300 when selection relaxes and they become neutral

constant neutral;
constant purifying(-0.01);
constant positive(0.01);
population_specific_constant first_second(neutral,purifying,1);
piecewise_constant third(positive,neutral,300);

The modularity of these functor templates allow selection models to be extended to any number of populations and piecewise selection functions (including user defined functions).

Definition at line 85 of file go_fish.cuh.

Constructor & Destructor Documentation

§ selection_piecewise() [1/2]

template<typename Functor_sel1 , typename Functor_sel2 >
Sim_Model::selection_piecewise< Functor_sel1, Functor_sel2 >::selection_piecewise ( )
inline

default constructor

inflection_point = 0
generation_shift = 0
Function s1 assigned default constructor of Functor_sel1
Function s2 assigned default constructor of Functor_sel2

Definition at line 148 of file template_inline_simulation_functors.cuh.

§ selection_piecewise() [2/2]

template<typename Functor_sel1 , typename Functor_sel2 >
Sim_Model::selection_piecewise< Functor_sel1, Functor_sel2 >::selection_piecewise ( Functor_sel1  s1_in,
Functor_sel2  s2_in,
int  inflection_point,
int  generation_shift = 0 
)
inline

constructor

Parameters
generation_shift(optional input) default 0

Definition at line 151 of file template_inline_simulation_functors.cuh.

Member Function Documentation

§ operator()()

template<typename Functor_sel1 , typename Functor_sel2 >
__device__ __forceinline__ float Sim_Model::selection_piecewise< Functor_sel1, Functor_sel2 >::operator() ( const int  population,
const int  generation,
const float  freq 
) const

selection operator, returns selection coefficient, s, for a given population, generation, freq

if(generation >= inflection_point+generation_shift) s = s2(population, generation-generation_shift, freq)
else s = s1(population, generation-generation_shift, freq)

Definition at line 155 of file template_inline_simulation_functors.cuh.

Member Data Documentation

§ inflection_point

template<typename Functor_sel1 , typename Functor_sel2 >
int Sim_Model::selection_piecewise< Functor_sel1, Functor_sel2 >::inflection_point

generation in which the selection function switches from s1 to s2

Definition at line 87 of file go_fish.cuh.

§ generation_shift

template<typename Functor_sel1 , typename Functor_sel2 >
int Sim_Model::selection_piecewise< Functor_sel1, Functor_sel2 >::generation_shift

number of generations to shift function backwards

useful if you are starting the simulation from a previous simulation state and this function is expecting to start at 0 or any scenario where you want to shift the generation of the function relative to the simulation generation

Definition at line 88 of file go_fish.cuh.

§ s1

template<typename Functor_sel1 , typename Functor_sel2 >
Functor_sel1 Sim_Model::selection_piecewise< Functor_sel1, Functor_sel2 >::s1

first selection function

Definition at line 89 of file go_fish.cuh.

§ s2

template<typename Functor_sel1 , typename Functor_sel2 >
Functor_sel2 Sim_Model::selection_piecewise< Functor_sel1, Functor_sel2 >::s2

second selection function

Definition at line 90 of file go_fish.cuh.


The documentation for this struct was generated from the following files: