8 #ifndef TEMPLATE_INLINE_SIMULATION_FUNCTORS_CUH_ 9 #define TEMPLATE_INLINE_SIMULATION_FUNCTORS_CUH_ 51 template <
typename Functor_demography,
typename Functor_inbreeding>
52 inline selection_constant::selection_constant(
float gamma, Functor_demography demography, Functor_inbreeding F,
int forward_generation_shift ){
s = gamma/(2*demography(0,forward_generation_shift)/(1+F(0,forward_generation_shift))); }
68 template <
typename Functor_demography,
typename Functor_inbreeding>
70 slope = gamma_slope/(2*demography(0,forward_generation_shift)/(1+F(0,forward_generation_shift)));
71 intercept = gamma_intercept/(2*demography(0,forward_generation_shift)/(1+F(0,forward_generation_shift)));
86 template <
typename Functor_demography,
typename Functor_inbreeding>
88 A = gamma_A/(2*demography(0,forward_generation_shift)/(1+F(0,forward_generation_shift)));
89 D = gamma_D/(2*demography(0,forward_generation_shift)/(1+F(0,forward_generation_shift)));
114 template <
typename Functor_sel,
typename Functor_sel_pop>
117 template <
typename Functor_sel,
typename Functor_sel_pop>
121 template <
typename Functor_sel,
typename Functor_sel_pop>
147 template <
typename Functor_sel1,
typename Functor_sel2>
150 template <
typename Functor_sel1,
typename Functor_sel2>
154 template <
typename Functor_sel1,
typename Functor_sel2>
212 template <
typename Functor_p,
typename Functor_p_pop>
215 template <
typename Functor_p,
typename Functor_p_pop>
219 template <
typename Functor_p,
typename Functor_p_pop>
245 template <
typename Functor_p1,
typename Functor_p2>
248 template <
typename Functor_p1,
typename Functor_p2>
252 template <
typename Functor_p1,
typename Functor_p2>
344 template <
typename Functor_d,
typename Functor_d_pop>
347 template <
typename Functor_d,
typename Functor_d_pop>
351 template <
typename Functor_d,
typename Functor_d_pop>
389 template <
typename Functor_d1,
typename Functor_d2>
392 template <
typename Functor_d1,
typename Functor_d2>
396 template <
typename Functor_d1,
typename Functor_d2>
433 if(pop_FROM == pop_TO){
return 1-(
num_pop-1)*
m; }
468 template <
typename Functor_m1>
470 template <
typename Functor_m1>
475 template <
typename Functor_m1>
477 if(pop_FROM ==
pop1 && pop_TO ==
pop2)
return m;
478 return rest(pop_FROM, pop_TO, generation);
513 template <
typename Functor_m1,
typename Functor_m2>
516 template <
typename Functor_m1,
typename Functor_m2>
520 template <
typename Functor_m1,
typename Functor_m2>
596 template <
typename Functor_default,
typename Functor_action>
601 template <
typename Functor_default,
typename Functor_action>
604 template <
typename Functor_default,
typename Functor_action>
609 template <
typename Functor_default,
typename Functor_action>
635 template <
typename Functor_first,
typename Functor_second>
640 template <
typename Functor_first,
typename Functor_second>
643 template <
typename Functor_first,
typename Functor_second>
648 template <
typename Functor_first,
typename Functor_second>
selection_population_specific()
default constructor
int initial_population_size
initial population size
int num_pop
number of population participating in equal migration
int N
population size (individuals) constant
Functor_m2 m2
second migration function
__host__ __device__ __forceinline__ int operator()(const int population, const int generation) const
Demographic operator, returns population size (individuals), N, for a given population, generation
float D
Offset of sine wave.
float rate
logistic growth rate
float m
migration rate from pop i to pop j =/= i
int inflection_point
generation in which the Demographic function switches from d1 to d2
selection_sine_wave()
default constructor
float pi
Frequency of sine wave.
float A
Amplitude of sine wave.
selection_piecewise()
default constructor
selection_linear_frequency_dependent()
default constructor
__host__ __device__ __forceinline__ int operator()(const int population, const int generation) const
Demographic operator, returns population size (individuals), N, for a given population, generation
__host__ __device__ __forceinline__ int operator()(const int population, const int generation) const
Demographic operator, returns population size (individuals), N, for a given population, generation
int generation_shift
number of generations to shift function backwards
__host__ __device__ __forceinline__ float operator()(const int pop_FROM, const int pop_TO, const int generation) const
Migration operator, returns migration rate, mig_rate, which is the proportion of chromosomes in pop_T...
float A
Amplitude of sine wave.
float rho
Phase of sine wave.
__host__ __forceinline__ bool operator()(const int generation) const
Preserving and Sampling operator, returns boolean b to turn on/off preserving and sampling in generat...
Functor_sel_pop s_pop
population specific selection function for pop
int generation_shift
number of generations to shift function backwards
__host__ __device__ __forceinline__ int operator()(const int population, const int generation) const
Demographic operator, returns population size (individuals), N, for a given population, generation
float pi
Frequency of sine wave.
int pop
population with specific demography function
Namespace of functions for controlling GO_Fish simulations.
__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
Functor_sel s
selection function applied to all other populations
float p
parameter constant
demography_logistic_growth()
default constructor
__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
int generation_shift
number of generations to shift function backwards
__host__ __forceinline__ float operator()(const int population, const int generation) const
Inbreeding/Mutation/Dominance operator, returns parameter p for a given population, generation
float D
Offset of sine wave.
Functor_d2 d2
second demographic function
migration_constant_directional()
default constructor
Functor_d1 d1
first demographic function
F_mu_h_sine_wave()
default constructor
float slope
slope of selection coefficient's linear dependence on frequency
Functor_d d
demographic function applied to all other populations
demography_constant()
default constructor
int generation_shift
number of generations to shift function backwards
Functor_p1 p1
first parameter function
int inflection_point
generation in which the migration function switches from m1 to m2
int generation_shift
number of generations to shift function backwards
__host__ __forceinline__ float operator()(const int population, const int generation) const
Inbreeding/Mutation/Dominance operator, returns parameter p for a given population, generation
int generation_shift
number of generations to shift function backwards
bool_pulse()
default constructor
__host__ __forceinline__ float operator()(const int population, const int generation) const
Inbreeding/Mutation/Dominance operator, returns parameter p for a given population, generation
int generation_shift
number of generations to shift function backwards
int pulse
generation in which the boolean pulse f_action is emitted
demography_population_specific()
default constructor
int inflection_point
generation in which the boolean function switches from f1 to f2
F_mu_h_constant()
default constructor
F_mu_h_population_specific()
default constructor
float A
Amplitude of sine wave.
demography_sine_wave()
default constructor
Functor_m1 rest
migration function specifying migration in remaining migration directions
__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
Functor_p p
parameter function applied to all other populations
Functor_d_pop d_pop
population specific demographic function for pop
__host__ __device__ __forceinline__ float operator()(const int pop_FROM, const int pop_TO, const int generation) const
Migration operator, returns migration rate, mig_rate, which is the proportion of chromosomes in pop_T...
int generation_shift
number of generations to shift function backwards
int inflection_point
generation in which the selection function switches from s1 to s2
Functor_m1 m1
first migration function
Functor_sel1 s1
first selection function
float m
migration rate from pop1 to pop2
__host__ __forceinline__ bool operator()(const int generation) const
Preserving and Sampling operator, returns boolean b to turn on/off preserving and sampling in generat...
Functor_p2 p2
second parameter function
migration_constant_equal()
default constructor
selection_constant()
default constructor
float D
Offset of sine wave.
int generation_shift
number of generations to shift function backwards
int generation_shift
number of generations to shift function backwards
migration_piecewise()
default constructor
Functor_second f2
second boolean function
float rho
Phase of sine wave.
int generation_shift
number of generations to shift function backwards
float pi
Frequency of sine wave.
float intercept
selection coefficient's intercept with frequency 0
int generation_shift
number of generations to shift function backwards
Functor_sel2 s2
second selection function
__host__ __device__ __forceinline__ int operator()(const int population, const int generation) const
Functor_first f1
first boolean function
Functor_p_pop p_pop
population specific parameter function for pop
demography_piecewise()
default constructor
__host__ __device__ __forceinline__ float operator()(const int pop_FROM, const int pop_TO, const int generation) const
Migration operator, returns migration rate, mig_rate, which is the proportion of chromosomes in pop_T...
int inflection_point
generation in which the Inbreeding/Mutation/Dominance function switches from p1 to p2 ...
float rate
exponential growth rate
float rho
Phase of sine wave.
__host__ __forceinline__ float operator()(const int population, const int generation) const
Inbreeding/Mutation/Dominance operator, returns parameter p for a given population, generation
int pop
population with specific selection function
int carrying_capacity
carrying capacity
bool_piecewise()
default constructor
Functor_default f_default
default boolean function
int initial_population_size
initial population size
__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
demography_exponential_growth()
default constructor
F_mu_h_piecewise()
default constructor
Functor_action f_action
boolean function emitted at generation pulse
int generation_shift
number of generations to shift function backwards
__host__ __forceinline__ bool operator()(const int generation) const
Preserving and Sampling operator, returns boolean b to turn on/off preserving and sampling in generat...
float s
selection coefficient
__host__ __forceinline__ bool operator()(const int generation) const
Preserving and Sampling operator, returns boolean b to turn on/off preserving and sampling in generat...
int generation_shift
number of generations to shift function backwards
int pop
population with specific parameter function
__host__ __device__ __forceinline__ int operator()(const int population, const int generation) const
Demographic operator, returns population size (individuals), N, for a given population, generation
__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