Nemo
2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
|
Base class of the Life Cycle Events, declares the LCE interface. More...
#include <lifecycleevent.h>
Public Member Functions | |
LifeCycleEvent (const char *name, const char *trait_link) | |
Cstor. More... | |
virtual | ~LifeCycleEvent () |
virtual void | init (Metapop *popPtr) |
Sets the pointer to the current Metapop and the trait link if applicable. More... | |
virtual bool | attach_trait (string trait) |
virtual void | set_paramset (std::string name, bool required, SimComponent *owner) |
virtual void | set_event_name (std::string &name) |
Set the name of the event (name of the ParamSet) and add the corresponding parameter to the set. More... | |
virtual void | set_event_name (const char *name) |
virtual string & | get_event_name () |
Accessor to the LCE's name. More... | |
virtual int | get_rank () |
Accessor to the LCE rank in the life cycle. More... | |
virtual void | set_pop_ptr (Metapop *popPtr) |
Accessors for the population pointer. More... | |
virtual Metapop * | get_pop_ptr () |
LCE interface | |
virtual void | execute ()=0 |
Execute the event on the pop. More... | |
virtual LifeCycleEvent * | clone ()=0 |
Cloning interface. More... | |
virtual age_t | removeAgeClass ()=0 |
Removes the returned age-class flag(s) from the current Metapop age-class flags. More... | |
virtual age_t | addAgeClass ()=0 |
Adds the returned age-class flag(s) to the current Metapop age-class flags. More... | |
virtual age_t | requiredAgeClass ()=0 |
Specifies what age-classes are required by the LCE to execute. More... | |
![]() | |
SimComponent () | |
virtual | ~SimComponent () |
virtual void | loadFileServices (FileServices *loader)=0 |
Loads the component's FileHandler onto the FileServices. More... | |
virtual void | loadStatServices (StatServices *loader)=0 |
Loads the component's StatHandler onto the StatServices. More... | |
virtual void | loadUpdaters (UpdaterServices *loader) |
Loads the parameters and component updater onto the updater manager. More... | |
virtual bool | setParameters ()=0 |
Default interface needed to initialize the component's variables from its input parameters value. More... | |
virtual void | set_paramset (ParamSet *paramset) |
Sets the ParamSet member. More... | |
virtual void | set_paramsetFromCopy (const ParamSet &PSet) |
Reset the set of parameters from a another set. More... | |
virtual ParamSet * | get_paramset () |
ParamSet accessor. More... | |
virtual void | add_parameter (Param *param) |
Interface to add a parameter to the set. More... | |
virtual void | add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd) |
Interface to add a parameter to the set. More... | |
virtual void | add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd, ParamUpdaterBase *updater) |
Interface to add a parameter and its updater to the set. More... | |
virtual Param * | get_parameter (std::string name) |
Param getter. More... | |
virtual double | get_parameter_value (std::string name) |
Param value getter. More... | |
virtual string | get_name () |
Returnd the name of the ParamSet, i.e. More... | |
virtual bool | has_parameter (std::string name) |
Param getter. More... | |
virtual bool | resetParameterFromSource (std::string param, SimComponent *cmpt)=0 |
Protected Attributes | |
std::string | _event_name |
The param name to be read in the init file. More... | |
Metapop * | _popPtr |
The ptr to the current Metapop. More... | |
std::string | _LCELinkedTraitType |
The name of the linked trait. More... | |
int | _LCELinkedTraitIndex |
The index in the individual's trait table of the linked trait. More... | |
![]() | |
ParamSet * | _paramSet |
The parameters container. More... | |
Base class of the Life Cycle Events, declares the LCE interface.
A Life Cycle Event (LCE) is a population operator that modifies the state of the population at each iteration of the life cycle. It declares the execute() method that is called during the life cycle loop (Metapop::Cycle()). No interface is given to manage the periodicity of the event, the execute() method is called at each iteration. The periodicity check must thus be implemented in the derived class, within the exectute() method.
Each LCE has a link to the current Metapop instance and a link to a particular trait which are set by LifeCycleEvent::init() at simulation initialization time (called by Metapop::setLifeCycle() through Metapop::init() and SimRunner::setup()). The linked trait can be specified in the constructor by its type identifier (a character string literal) or later, at runtime. In the first case, the trait's index will be set by a call to IndFactory::getTraitIndex() at initialization (see LifeCycleEvent::init()). In the later case, the trait to link with must be specified at initialization time and LifeCycleEvent::init() must be overloaded. The linked trait type (or name) can then be specified by the user in the init file and set in the derived class init() method before explicitly calling LifeCycleEvent::init() which will set the linked trait's index (see LCE_Breed_Selection::init() for an example). That index is then used to easily access the given trait through the Individual interface (see Individual::getTrait()).
Each LCE also has a name by which it is called from the user's defined parameter file to specify when in the life cycle that particular event has to be executed. The position in the life cycle is the LCE's rank (i.e. the value given in input to the parameter "name"). As only one rank value is allowed per LCE, it is executed only once in the life cycle, this is a limitation that might be removed in future versions if need be!
The main action of an LCE is often to move individuals between populations, between age-classes or both. The changes done to the population age structure by a particular LCE are tracked through the removeAgeClass() and addAgeClass() interface methods called after each execution of an LCE. The metapopulation age flag is thus updated by these two functions.
Note: Overloading LifeCycleEvent::init(). If more than one trait is used by your LCE, think about overloading the init() function to allow the registration of several trait links within your derived LCE. The init() method will also be overloaded if you add additional parameters to the LCE's ParamSet. In any cases, LifeCycleEvent::init() MUST be called in your init() function to properly set the metapop pointer (unless you copy the code into your function...).
Note: the LCEs must be inited after a call to IndFactory::makePrototype() has been issued so that the trait links can be set!
|
inline |
Cstor.
name | the name of the LCE as it must appear in the parameter input file |
trait_link | the name of the linked trait used by this LCE |
References set_event_name().
|
inlinevirtual |
|
pure virtual |
Adds the returned age-class flag(s) to the current Metapop age-class flags.
Implemented in BinaryDataSaver, LCE_Breed, LCE_Breed_Disperse, LCE_Breed_Selection, LCE_Breed_Selection_Disperse, LCE_Disperse_base, LCE_Regulation, LCE_Aging, LCE_Patch_Extinction, LCE_Cross, LCE_Resize, LCE_QuantiInit, LCE_QuantiModifier, LCE_Breed_Quanti, LCE_Selection_base, LCE_ParamUpdaterNotifier, LCE_FileServicesNotifier, LCE_StatServiceNotifier, LCE_Init_BDMI, LCE_NtrlInit, and LCE_Breed_Wolbachia.
Referenced by Metapop::setCurrentAge().
|
inlinevirtual |
References _event_name, _LCELinkedTraitIndex, _LCELinkedTraitType, _popPtr, error(), and IndFactory::getTraitIndex().
Referenced by init().
|
pure virtual |
Cloning interface.
Implemented in BinaryDataSaver, LCE_Breed, LCE_Breed_Disperse, LCE_Breed_Selection, LCE_Breed_Selection_Disperse, LCE_Disperse_ConstDisp, LCE_SeedDisp, LCE_Disperse_EvolDisp, LCE_Regulation, LCE_Aging, LCE_Patch_Extinction, LCE_Cross, LCE_Resize, LCE_QuantiInit, LCE_QuantiModifier, LCE_Breed_Quanti, LCE_Selection_base, LCE_ParamUpdaterNotifier, LCE_FileServicesNotifier, LCE_StatServiceNotifier, LCE_Init_BDMI, LCE_NtrlInit, and LCE_Breed_Wolbachia.
|
pure virtual |
Execute the event on the pop.
Implemented in BinaryDataSaver, LCE_Breed, LCE_Breed_Disperse, LCE_Breed_Selection, LCE_Breed_Selection_Disperse, LCE_Disperse_ConstDisp, LCE_Disperse_EvolDisp, LCE_Regulation, LCE_Aging, LCE_Patch_Extinction, LCE_Cross, LCE_Resize, LCE_QuantiInit, LCE_QuantiModifier, LCE_Breed_Quanti, LCE_Selection_base, LCE_ParamUpdaterNotifier, LCE_FileServicesNotifier, LCE_StatServiceNotifier, LCE_Init_BDMI, LCE_NtrlInit, and LCE_Breed_Wolbachia.
|
inlinevirtual |
|
inlinevirtual |
References _popPtr.
Referenced by LCE_ParamUpdaterNotifier::execute(), and LCE_FileServicesNotifier::execute().
|
inlinevirtual |
Accessor to the LCE rank in the life cycle.
References _event_name, and SimComponent::get_parameter_value().
Referenced by BinaryDataSaver::FHwrite(), BinaryDataSaver::setParameters(), and LCE_StatServiceNotifier::setParameters().
|
inlinevirtual |
Sets the pointer to the current Metapop and the trait link if applicable.
DEV: Don't forget to explicitly call this function (LifeCycleEvent::init()
) when you overload it!
popPtr | the pointer to the current instance of Metapop |
References _LCELinkedTraitType, _popPtr, attach_trait(), fatal(), and SimComponent::setParameters().
Referenced by SimRunner::init_components().
|
pure virtual |
Removes the returned age-class flag(s) from the current Metapop age-class flags.
Implemented in BinaryDataSaver, LCE_Breed, LCE_Breed_Disperse, LCE_Breed_Selection, LCE_Breed_Selection_Disperse, LCE_Disperse_base, LCE_Regulation, LCE_Aging, LCE_Patch_Extinction, LCE_Cross, LCE_Resize, LCE_QuantiInit, LCE_QuantiModifier, LCE_Breed_Quanti, LCE_Selection_base, LCE_ParamUpdaterNotifier, LCE_FileServicesNotifier, LCE_StatServiceNotifier, LCE_Init_BDMI, LCE_NtrlInit, and LCE_Breed_Wolbachia.
Referenced by Metapop::setCurrentAge().
|
pure virtual |
Specifies what age-classes are required by the LCE to execute.
Implemented in BinaryDataSaver, LCE_Breed, LCE_Breed_Disperse, LCE_Breed_Selection, LCE_Breed_Selection_Disperse, LCE_Disperse_base, LCE_Regulation, LCE_Aging, LCE_Patch_Extinction, LCE_Cross, LCE_Resize, LCE_QuantiInit, LCE_QuantiModifier, LCE_Breed_Quanti, LCE_Selection_base, LCE_ParamUpdaterNotifier, LCE_FileServicesNotifier, LCE_StatServiceNotifier, LCE_Init_BDMI, LCE_NtrlInit, and LCE_Breed_Wolbachia.
|
inlinevirtual |
References _event_name, and set_paramset().
|
inlinevirtual |
Set the name of the event (name of the ParamSet) and add the corresponding parameter to the set.
References _event_name, and set_paramset().
Referenced by LCE_SeedDisp::LCE_SeedDisp(), and LifeCycleEvent().
|
inlinevirtual |
Reimplemented from SimComponent.
References SimComponent::add_parameter(), INT, and SimComponent::set_paramset().
Referenced by set_event_name().
|
inlinevirtual |
|
protected |
The param name to be read in the init file.
Referenced by attach_trait(), get_event_name(), get_rank(), set_event_name(), and LCE_Selection_base::setParameters().
|
protected |
The index in the individual's trait table of the linked trait.
A value of -1 means the link is broken.
Referenced by LCE_Selection_base::addPhenotypicSD(), attach_trait(), LCE_Breed_Wolbachia::hasInfectedFemale(), LCE_NtrlInit::init_allele_freq(), LCE_QuantiInit::init_allele_freq(), LCE_QuantiInit::init_trait_value(), LCE_Init_BDMI::init_value(), LCE_Breed_Wolbachia::inoculate_wolbachia(), LCE_QuantiModifier::setIndPhenotype(), LCE_Breed_Quanti::setIndPhenotype(), LCE_Breed_Wolbachia::wolbachia_model_1(), and LCE_Breed_Wolbachia::wolbachia_model_2().
|
protected |
The name of the linked trait.
Referenced by attach_trait(), and init().
|
protected |
The ptr to the current Metapop.
Referenced by LCE_Selection_base::addPhenotypicSD(), attach_trait(), LCE_Breed_base::breed(), LCE_Breed_base::breed_cloning(), LCE_Breed_Selection_Disperse::breed_selection_disperse(), LCE_Resize::buildNewPatchArrayNoBackup(), LCE_Resize::buildNewPatchArrayWithBackup(), LCE_Breed_base::checkCloning(), LCE_Breed_base::checkSelfing(), LCE_Cross::create_individual_ancestors(), LCE_Breed_Disperse::do_breed_disperse(), LCE_Patch_Extinction::do_flush(), LCE_Patch_Extinction::do_remove(), LCE_Selection_base::doViabilitySelection(), LCE_Disperse_EvolDisp::evoldisp(), BinaryDataSaver::execute(), LCE_Breed::execute(), LCE_Breed_Disperse::execute(), LCE_Breed_Selection::execute(), LCE_Breed_Selection_Disperse::execute(), LCE_Disperse_ConstDisp::execute(), LCE_Disperse_EvolDisp::execute(), LCE_Regulation::execute(), LCE_Aging::execute(), LCE_Patch_Extinction::execute(), LCE_Cross::execute(), LCE_Resize::execute(), LCE_QuantiInit::execute(), LCE_QuantiModifier::execute(), LCE_Breed_Quanti::execute(), LCE_Selection_base::execute(), LCE_ParamUpdaterNotifier::execute(), LCE_Init_BDMI::execute(), LCE_NtrlInit::execute(), LCE_Breed_Wolbachia::execute(), LCE_Resize::fillPatchNoBackup(), LCE_Resize::fillPatchWithBackup(), LCE_Resize::fillPop(), BinaryDataSaver::finish(), LCE_Disperse_EvolDisp::fixdisp(), LCE_Cross::generatePedigree(), LCE_Breed_Disperse::get_parent(), get_pop_ptr(), LCE_Selection_base::getMaxFitness(), LCE_Selection_base::getMaxPatchFitness(), LCE_Selection_base::getMeanFitness(), LCE_Selection_base::getMeanPatchFitness(), LCE_Breed_Wolbachia::hasInfectedFemale(), init(), LCE_NtrlInit::init_allele_freq(), LCE_QuantiInit::init_allele_freq(), LCE_QuantiInit::init_trait_value(), LCE_Init_BDMI::init_value(), LCE_Breed_Wolbachia::inoculate_wolbachia(), LCE_FileServicesNotifier::loadFileServices(), LCE_Breed_Selection::makeOffspringWithSelection(), LCE_Breed_Disperse::mate_full_selfing(), LCE_Breed_Disperse::mate_random(), LCE_Breed_Disperse::mate_random_hermaphrodite(), LCE_Breed_Disperse::mate_selfing(), LCE_Disperse_ConstDisp::Migrate(), LCE_Disperse_ConstDisp::MigratePatch(), LCE_Disperse_ConstDisp::MigratePatch_AbsorbingBorder(), LCE_Disperse_ConstDisp::MigratePatchByNumber(), LCE_Breed_base::NonWrightFisherPopulation(), LCE_Breed_Quanti::NonWrightFisherPopulation(), BinaryDataSaver::printOffsetTable(), LCE_Resize::regulate(), LCE_Resize::regulateAgeClassNoBackup(), LCE_Regulation::regulatePatch(), LCE_Resize::removeDesignatedPatch(), LCE_Disperse_base::reset_counters(), LCE_Cross::sampleAmongPop(), LCE_Cross::sampleWithinPop(), LCE_Selection_base::set_local_optima(), LCE_Patch_Extinction::set_matrix_param(), LCE_Selection_base::set_param_rate_of_change(), set_pop_ptr(), LCE_Selection_base::set_sel_model(), LCE_Selection_base::set_std_rate_of_change(), LCE_Disperse_base::setBaseParameters(), LCE_Breed_base::setFecundity(), LCE_Breed_base::setMatingSystem(), LCE_Breed_Selection::setNonSelectedTraitTable(), BinaryDataSaver::setParameters(), LCE_Breed_Disperse::setParameters(), LCE_Disperse_EvolDisp::setParameters(), LCE_QuantiInit::setParameters(), LCE_QuantiModifier::setParameters(), LCE_Breed_Quanti::setParameters(), LCE_Selection_base::setParameters(), LCE_Init_BDMI::setParameters(), LCE_NtrlInit::setParameters(), LCE_Breed_Wolbachia::setParameters(), LCE_Disperse_base::setPropaguleTargets(), LCE_Selection_base::setSelectionMatrix(), LCE_Breed_Quanti::setVefromVa(), BinaryDataSaver::storeData(), LCE_Disperse_base::swapPostDisp(), LCE_Resize::updateParameters(), LCE_Resize::updatePatchCapacities(), LCE_Breed_Wolbachia::wolbachia_model_1(), LCE_Breed_Wolbachia::wolbachia_model_2(), LCE_Breed_base::WrightFisherPopulation(), and LCE_Breed_Quanti::WrightFisherPopulation().