Parallel PopGen Package
Sim_Model::bool_pulse< Functor_default, Functor_action > Struct Template Reference

functor: returns the result of function f_default except at generation pulse returns the result of function f_action More...

Public Member Functions

 bool_pulse ()
 default constructor More...
 
 bool_pulse (int pulse, int generation_shift=0)
 constructor More...
 
 bool_pulse (Functor_default f_default_in, Functor_action f_action, int pulse, 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 pulse
 generation in which the boolean pulse f_action is emitted More...
 
int generation_shift
 number of generations to shift function backwards More...
 
Functor_default f_default
 default boolean function More...
 
Functor_action f_action
 boolean function emitted at generation pulse More...
 

Detailed Description

template<typename Functor_default, typename Functor_action>
struct Sim_Model::bool_pulse< Functor_default, Functor_action >

functor: returns the result of function f_default except at generation pulse returns the result of function f_action

Takes in two template types: the default function and the action function to be return at generation pulse.
Pulse bool functors can be nested within each other and with piecewise 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.

Examples:
Example3-Compilation.

Definition at line 298 of file go_fish.cuh.

Constructor & Destructor Documentation

§ bool_pulse() [1/3]

template<typename Functor_default , typename Functor_action >
Sim_Model::bool_pulse< Functor_default, Functor_action >::bool_pulse ( )
inline

default constructor

pulse = 0
generation_shift = 0
Function f_default assigned default constructor of Functor_default
Function f_action assigned default constructor of Functor_action

Definition at line 597 of file template_inline_simulation_functors.cuh.

§ bool_pulse() [2/3]

template<typename Functor_default , typename Functor_action >
Sim_Model::bool_pulse< Functor_default, Functor_action >::bool_pulse ( int  pulse,
int  generation_shift = 0 
)
inline

constructor

Function f_default assigned default constructor of Functor_default
Function f_action assigned default constructor of Functor_action

Parameters
generation_shift(optional input) default 0

Definition at line 602 of file template_inline_simulation_functors.cuh.

§ bool_pulse() [3/3]

template<typename Functor_default , typename Functor_action >
Sim_Model::bool_pulse< Functor_default, Functor_action >::bool_pulse ( Functor_default  f_default_in,
Functor_action  f_action_in,
int  pulse,
int  generation_shift = 0 
)
inline

constructor

Parameters
generation_shift(optional input) default 0

Definition at line 605 of file template_inline_simulation_functors.cuh.

Member Function Documentation

§ operator()()

template<typename Functor_default , typename Functor_action >
__host__ __forceinline__ bool Sim_Model::bool_pulse< Functor_default, Functor_action >::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 == pulse + generation_shift) b = f_action(generation)
else b = f_default(generation)

Definition at line 610 of file template_inline_simulation_functors.cuh.

Member Data Documentation

§ pulse

template<typename Functor_default, typename Functor_action>
int Sim_Model::bool_pulse< Functor_default, Functor_action >::pulse

generation in which the boolean pulse f_action is emitted

Definition at line 299 of file go_fish.cuh.

§ generation_shift

template<typename Functor_default, typename Functor_action>
int Sim_Model::bool_pulse< Functor_default, Functor_action >::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 300 of file go_fish.cuh.

§ f_default

template<typename Functor_default, typename Functor_action>
Functor_default Sim_Model::bool_pulse< Functor_default, Functor_action >::f_default

default boolean function

Definition at line 301 of file go_fish.cuh.

§ f_action

template<typename Functor_default, typename Functor_action>
Functor_action Sim_Model::bool_pulse< Functor_default, Functor_action >::f_action

boolean function emitted at generation pulse

Definition at line 302 of file go_fish.cuh.


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