Parallel PopGen Package
Sim_Model::migration_constant_directional< Functor_m1 > Struct Template Reference

functor: migration flows at rate m from pop1 to pop2 and function rest for all other migration rates More...

Public Member Functions

 migration_constant_directional ()
 default constructor More...
 
 migration_constant_directional (float m, int pop1, int pop2, Functor_m1 rest_in)
 constructor More...
 
__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_TO from pop_FROM for a given generation More...
 

Public Attributes

float m
 migration rate from pop1 to pop2 More...
 
int pop1
 pop_FROM More...
 
int pop2
 pop_TO More...
 
Functor_m1 rest
 migration function specifying migration in remaining migration directions More...
 

Detailed Description

template<typename Functor_m1>
struct Sim_Model::migration_constant_directional< Functor_m1 >

functor: migration flows at rate m from pop1 to pop2 and function rest for all other migration rates

Takes in one template type: the migration function to be returned for all other migration directions than from pop1 to pop2.
Constant directional migration functors can be nested within each other and with piecewise migration functors for multiple migration directions and multiple time functions, e.g.:

Using both demographic and migration functors, population 0 splits in two, forming population 1 in the first generation. Population 1's size increases exponentially afterwards with no further migration between the groups

typedef Sim_Model::demography_constant dem_constant;
dem_constant d_pop0(100000), d_pop1(0);
dem_pop_constant_constant d_generation_0(d_pop0,d_pop1,1); //at the start of the simulation, the first population pop0 starts out at 100,000 individuals, pop1 doesn't exist yet
dem_constant d_pop0_1(90000); dem_exponential d_pop1_1(0.01, 10000, 1); //shifts exponential back one generation so it starts at 10,000
dem_pop_constant_exponential d_remaining_generations(d_pop0_1,d_pop1_1,1); //in the first generation, 10,000 individuals from pop0 move to start pop1, which grows exponentially afterwards at a rate of 1%
Sim_Model::demography_piecewise<dem_pop_constant_constant,dem_pop_constant_exponential> demography_model(d_generation_0,d_remaining_generations,1);
typedef Sim_Model::migration_constant_equal mig_const_equal;
mig_const_equal m0; //no migration
mig_const_equal_const_dir m_pop0_pop1(1.f,0,1,m0); //pop1 made up entirely of individuals from pop0, no other population contributing to pop0
mig_const_equal_const_dir_const_dir m_pop1_pop1(0.f,1,1,m_pop0_pop1); //pop1 made up entirely of individuals from pop0 (since pop1 previously did not exist, no migration from previous pop1 generation!)
split_pop0_gen1 m_generation_1(m0,m_pop1_pop1,1); //no migration in generation 0, splits pop1 off from pop0 in generation 1
Sim_Model::migration_piecewise<split_pop0_gen1,mig_const_equal> migration_model(m_generation_1,m0,2); //no further migration between groups

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

Examples:
Example2-DaDi.

Definition at line 243 of file go_fish.cuh.

Constructor & Destructor Documentation

§ migration_constant_directional() [1/2]

template<typename Functor_m1 >
Sim_Model::migration_constant_directional< Functor_m1 >::migration_constant_directional ( )
inline

default constructor

m = 0
pop1 = 0
pop2 = 0
Function rest assigned default constructor of Functor_m1

Definition at line 469 of file template_inline_simulation_functors.cuh.

§ migration_constant_directional() [2/2]

template<typename Functor_m1 >
Sim_Model::migration_constant_directional< Functor_m1 >::migration_constant_directional ( float  m,
int  pop1,
int  pop2,
Functor_m1  rest_in 
)
inline

constructor

Definition at line 471 of file template_inline_simulation_functors.cuh.

Member Function Documentation

§ operator()()

template<typename Functor_m1 >
__host__ __device__ __forceinline__ float Sim_Model::migration_constant_directional< Functor_m1 >::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_TO from pop_FROM for a given generation

if(pop_FROM == pop1 && pop_TO == pop2) mig_rate = m
else mig_rate = rest(pop_FROM,pop_TO,generation)

Definition at line 476 of file template_inline_simulation_functors.cuh.

Member Data Documentation

§ m

template<typename Functor_m1 >
float Sim_Model::migration_constant_directional< Functor_m1 >::m

migration rate from pop1 to pop2

Definition at line 245 of file go_fish.cuh.

§ pop1

template<typename Functor_m1 >
int Sim_Model::migration_constant_directional< Functor_m1 >::pop1

pop_FROM

Definition at line 246 of file go_fish.cuh.

§ pop2

template<typename Functor_m1 >
int Sim_Model::migration_constant_directional< Functor_m1 >::pop2

pop_TO

Definition at line 247 of file go_fish.cuh.

§ rest

template<typename Functor_m1 >
Functor_m1 Sim_Model::migration_constant_directional< Functor_m1 >::rest

migration function specifying migration in remaining migration directions

Definition at line 248 of file go_fish.cuh.


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