Parallel PopGen Package
Sim_Model::selection_population_specific< Functor_sel, Functor_sel_pop > Struct Template Reference

functor: one population, pop, has a different, selection function, s_pop, all other have function s More...

Public Member Functions

 selection_population_specific ()
 default constructor More...
 
 selection_population_specific (Functor_sel s_in, Functor_sel_pop s_pop_in, int pop, 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 pop
 population with specific selection function More...
 
int generation_shift
 number of generations to shift function backwards More...
 
Functor_sel s
 selection function applied to all other populations More...
 
Functor_sel_pop s_pop
 population specific selection function for pop More...
 

Detailed Description

template<typename Functor_sel, typename Functor_sel_pop>
struct Sim_Model::selection_population_specific< Functor_sel, Functor_sel_pop >

functor: one population, pop, has a different, selection function, s_pop, all other have function s

Takes in two template types: the function to be returned for the rest of the populations and the function for the specific population, pop.
Population specific selection functors can be nested within each other and with piecewise 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).

Examples:
Example3-Compilation.

Definition at line 72 of file go_fish.cuh.

Constructor & Destructor Documentation

§ selection_population_specific() [1/2]

template<typename Functor_sel , typename Functor_sel_pop >
Sim_Model::selection_population_specific< Functor_sel, Functor_sel_pop >::selection_population_specific ( )
inline

default constructor

pop = 0
generation_shift = 0
Function s assigned default constructor of Functor_sel
Function s_pop assigned default constructor of Functor_sel_pop

Definition at line 115 of file template_inline_simulation_functors.cuh.

§ selection_population_specific() [2/2]

template<typename Functor_sel , typename Functor_sel_pop >
Sim_Model::selection_population_specific< Functor_sel, Functor_sel_pop >::selection_population_specific ( Functor_sel  s_in,
Functor_sel_pop  s_pop_in,
int  pop,
int  generation_shift = 0 
)
inline

constructor

Parameters
generation_shift(optional input) default 0

Definition at line 118 of file template_inline_simulation_functors.cuh.

Member Function Documentation

§ operator()()

template<typename Functor_sel , typename Functor_sel_pop >
__device__ __forceinline__ float Sim_Model::selection_population_specific< Functor_sel, Functor_sel_pop >::operator() ( const int  population,
const int  generation,
const float  freq 
) const

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

if(pop == population) s = s_pop(population, generation-generation_shift, freq)
else s = s(population, generation-generation_shift, freq)

Definition at line 122 of file template_inline_simulation_functors.cuh.

Member Data Documentation

§ pop

template<typename Functor_sel, typename Functor_sel_pop>
int Sim_Model::selection_population_specific< Functor_sel, Functor_sel_pop >::pop

population with specific selection function

Definition at line 74 of file go_fish.cuh.

§ generation_shift

template<typename Functor_sel, typename Functor_sel_pop>
int Sim_Model::selection_population_specific< Functor_sel, Functor_sel_pop >::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 75 of file go_fish.cuh.

§ s

template<typename Functor_sel, typename Functor_sel_pop>
Functor_sel Sim_Model::selection_population_specific< Functor_sel, Functor_sel_pop >::s

selection function applied to all other populations

Definition at line 76 of file go_fish.cuh.

§ s_pop

template<typename Functor_sel, typename Functor_sel_pop>
Functor_sel_pop Sim_Model::selection_population_specific< Functor_sel, Functor_sel_pop >::s_pop

population specific selection function for pop

Definition at line 77 of file go_fish.cuh.


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