Parallel PopGen Package
Sim_Model::bool_piecewise< Functor_first, Functor_second > Struct Template Reference

functor: returns the result of function f1 until generation inflection_point, then returns the result of function f2 More...

Public Member Functions

 bool_piecewise ()
 default constructor More...
 
 bool_piecewise (int inflection_point, int generation_shift=0)
 constructor More...
 
 bool_piecewise (Functor_first f1_in, Functor_second f2_in, int inflection_point, int generation_shift=0)
 constructor More...
 
__host__ __forceinline__ bool operator() (const int generation) const
 Preserving and Sampling operator, returns boolean b to turn on/off preserving and sampling in generation generation of the simulation. More...
 

Public Attributes

int inflection_point
 generation in which the boolean function switches from f1 to f2 More...
 
int generation_shift
 number of generations to shift function backwards More...
 
Functor_first f1
 first boolean function More...
 
Functor_second f2
 second boolean function More...
 

Detailed Description

template<typename Functor_first, typename Functor_second>
struct Sim_Model::bool_piecewise< Functor_first, Functor_second >

functor: returns the result of function f1 until generation inflection_point, then returns the result of function f2

Takes in two template types: the function to be returned before the inflection_point and the function for after the inflection_point.
Piecewise bool functors can be nested within each other and with pulse bool functors for a myriad of different sampling and preserving strategies, e.g.:

Sampling strategy that takes time samples of generation 0 & generations [100,110] inclusive (& final generation is always sampled).

typedef Sim_Model::bool_off sampling_off;
typedef Sim_Model::bool_on sampling_on;
pulse_on sample_generation_0; //default will pulse on at generation 0
switch_on sample_gen_0_100_XX(sample_generation_0,sampling_on(),100); //samples starting generation, will start sampling at generation after 100
switch_off sample_gen_0_100_110(sample_gen_0_100_XX,sampling_off(),111); //sampling strategy, will take time samples of generation 0 & generations [100,110] inclusive (& final generation is always sampled)

Note mutations present in these generations will be preserved until the final generation of the simulation.

Definition at line 311 of file go_fish.cuh.

Constructor & Destructor Documentation

§ bool_piecewise() [1/3]

template<typename Functor_first , typename Functor_second >
Sim_Model::bool_piecewise< Functor_first, Functor_second >::bool_piecewise ( )
inline

default constructor

inflection_point = 0
generation_shift = 0
Function f1 assigned default constructor of Functor_first
Function f2 assigned default constructor of Functor_second

Definition at line 636 of file template_inline_simulation_functors.cuh.

§ bool_piecewise() [2/3]

template<typename Functor_first , typename Functor_second >
Sim_Model::bool_piecewise< Functor_first, Functor_second >::bool_piecewise ( int  inflection_point,
int  generation_shift = 0 
)
inline

constructor

Function f1 assigned default constructor of Functor_first
Function f2 assigned default constructor of Functor_second

Parameters
generation_shift(optional input) default 0

Definition at line 641 of file template_inline_simulation_functors.cuh.

§ bool_piecewise() [3/3]

template<typename Functor_first , typename Functor_second >
Sim_Model::bool_piecewise< Functor_first, Functor_second >::bool_piecewise ( Functor_first  f1_in,
Functor_second  f2_in,
int  inflection_point,
int  generation_shift = 0 
)
inline

constructor

Parameters
generation_shift(optional input) default 0

Definition at line 644 of file template_inline_simulation_functors.cuh.

Member Function Documentation

§ operator()()

template<typename Functor_first , typename Functor_second >
__host__ __forceinline__ bool Sim_Model::bool_piecewise< Functor_first, Functor_second >::operator() ( const int  generation) const

Preserving and Sampling operator, returns boolean b to turn on/off preserving and sampling in generation generation of the simulation.

if(generation >= inflection_point+generation_shift) b = f2(generation)
else b = f1(generation)

Definition at line 649 of file template_inline_simulation_functors.cuh.

Member Data Documentation

§ inflection_point

template<typename Functor_first , typename Functor_second >
int Sim_Model::bool_piecewise< Functor_first, Functor_second >::inflection_point

generation in which the boolean function switches from f1 to f2

Definition at line 312 of file go_fish.cuh.

§ generation_shift

template<typename Functor_first , typename Functor_second >
int Sim_Model::bool_piecewise< Functor_first, Functor_second >::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 313 of file go_fish.cuh.

§ f1

template<typename Functor_first , typename Functor_second >
Functor_first Sim_Model::bool_piecewise< Functor_first, Functor_second >::f1

first boolean function

Definition at line 314 of file go_fish.cuh.

§ f2

template<typename Functor_first , typename Functor_second >
Functor_second Sim_Model::bool_piecewise< Functor_first, Functor_second >::f2

second boolean function

Definition at line 315 of file go_fish.cuh.


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