Nemo  2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
SimComponent Class Referenceabstract

Interface to all basic components of a simulation (traits, life cycle events, pop, etc. ). More...

#include <simcomponent.h>

+ Inheritance diagram for SimComponent:
+ Collaboration diagram for SimComponent:

Public Member Functions

 SimComponent ()
 
virtual ~SimComponent ()
 
Services interface
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...
 
Parameters handling


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_paramset (std::string name, bool required, SimComponent *owner)
 Sets a new ParamSet and name it. More...
 
virtual void set_paramsetFromCopy (const ParamSet &PSet)
 Reset the set of parameters from a another set. More...
 
virtual ParamSetget_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 Paramget_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

ParamSet_paramSet
 The parameters container. More...
 

Detailed Description

Interface to all basic components of a simulation (traits, life cycle events, pop, etc. ).

Implements the interface to handle the files and stats handler, the parameter updaters, and the parameters container. Contains the component's parameters and declares the interface to interact with its parameters.

Constructor & Destructor Documentation

◆ SimComponent()

SimComponent::SimComponent ( )
inline
52: _paramSet(0) {}//{ cout << "calling SimComponent()" << endl;}
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48

◆ ~SimComponent()

virtual SimComponent::~SimComponent ( )
inlinevirtual
54{if(_paramSet != NULL) delete _paramSet;}

References _paramSet.

Member Function Documentation

◆ add_parameter() [1/3]

◆ add_parameter() [2/3]

virtual void SimComponent::add_parameter ( std::string  Name,
param_t  Type,
bool  isRequired,
bool  isBounded,
double  low_bnd,
double  up_bnd 
)
inlinevirtual

Interface to add a parameter to the set.

Parameters
NameThe param string name as read in the init file
TypeThe type of the argument (DBL=double, INT=integer, BOOL=boolean, STR=string, etc., see type.h)
isRequiredTrue if the parameter is mandatory
isBoundedTrue if the parameter takes bounded values as argument
low_bndThe lower value the argument can take
up_bndThe upper value the argument can take
123 {_paramSet->add_param(Name, Type, isRequired, isBounded, low_bnd, up_bnd, 0);}

References _paramSet, and ParamSet::add_param().

◆ add_parameter() [3/3]

virtual void SimComponent::add_parameter ( std::string  Name,
param_t  Type,
bool  isRequired,
bool  isBounded,
double  low_bnd,
double  up_bnd,
ParamUpdaterBase updater 
)
inlinevirtual

Interface to add a parameter and its updater to the set.

Parameters
NameThe param string name as read in the init file
TypeThe type of the argument (DBL=double, INT=integer, BOOL=boolean, STR=string, etc., see type.h)
isRequiredTrue if the parameter is mandatory
isBoundedTrue if the parameter takes bounded values as argument
low_bndThe lower value the argument can take
up_bndThe upper value the argument can take
updatera pointer to a ParamUpdaterBase object used to reset its value during a simulation
135 {_paramSet->add_param(Name, Type, isRequired, isBounded, low_bnd, up_bnd, updater);}

References _paramSet, and ParamSet::add_param().

◆ get_name()

virtual string SimComponent::get_name ( )
inlinevirtual

Returnd the name of the ParamSet, i.e.

the name of the component.

146{return _paramSet->getName();}
string getName()
Name accessor.
Definition: param.h:290

References _paramSet, and ParamSet::getName().

◆ get_parameter()

virtual Param * SimComponent::get_parameter ( std::string  name)
inlinevirtual

Param getter.

Asks the ParamSet to return a pointer to Param name.

See also
ParamSet::get_param
139{return _paramSet->get_param(name);}
Param * get_param(string name)
Look for a param "name" in its parameters list.
Definition: param.cc:637

References _paramSet, and ParamSet::get_param().

Referenced by TTProtoWithMap::areGeneticMapParamSet(), LCE_Cross::execute(), LCE_Resize::execute(), TTProtoWithMap::isRecombinationFree(), LCE_Cross::loadFileServices(), LCE_Selection_base::loadFileServices(), Metapop::loadFileServices(), LCE_FileServicesNotifier::loadFileServices(), TProtoBDMI::loadFileServices(), TProtoDeletMutations_bitstring::loadFileServices(), TProtoNeutralGenes::loadFileServices(), TProtoQuanti::loadFileServices(), LCE_Breed_Wolbachia::loadFileServices(), Metapop::loadPopFromBinarySource(), TTProtoWithMap::recordRandomMap(), TProtoNeutralGenes::resetParameterFromSource(), LCE_Selection_base::set_local_optima(), LCE_Patch_Extinction::set_matrix_param(), LCE_Selection_base::set_param_rate_of_change(), LCE_Selection_base::set_sel_model(), LCE_Selection_base::set_std_rate_of_change(), LCE_Disperse_base::setBaseParameters(), TProtoQuanti::setContinuousMutationModel(), TProtoQuanti::setDiallelicMutationModel(), TProtoQuanti::setDominanceParameters(), TProtoDeletMutations_bitstring::setEffectsFromInput(), LCE_Breed_base::setFecundity(), TTProtoWithMap::setGeneticMapParameters(), LCE_Breed_base::setMatingSystem(), TProtoQuanti::setMutationParameters(), TProtoDispersal::setNonRandom(), TTProtoWithMap::setNumLociPerChromosome(), BinaryDataSaver::setParameters(), LCE_Breed_Disperse::setParameters(), LCE_Breed_Selection::setParameters(), LCE_Breed_Selection_Disperse::setParameters(), LCE_Disperse_EvolDisp::setParameters(), LCE_Patch_Extinction::setParameters(), LCE_Cross::setParameters(), LCE_QuantiInit::setParameters(), LCE_QuantiModifier::setParameters(), LCE_Breed_Quanti::setParameters(), LCE_Selection_base::setParameters(), LCE_FileServicesNotifier::setParameters(), TProtoBDMI::setParameters(), LCE_Init_BDMI::setParameters(), TProtoDeletMutations_bitstring::setParameters(), TProtoDispersal::setParameters(), TProtoNeutralGenes::setParameters(), TProtoQuanti::setParameters(), LCE_Breed_Wolbachia::setParameters(), TProtoDispersal::setRandom(), TTProtoWithMap::setRecombinationMapRandom(), LCE_Selection_base::setSelectionMatrix(), TProtoDeletMutations_bitstring::setSelectionParameters(), LCE_Breed_base::setSexRatio(), Metapop::setSourceParameters(), LCE_Resize::updateParameters(), and TProtoDeletMutations_bitstring::write_effects_to_parameter().

◆ get_parameter_value()

virtual double SimComponent::get_parameter_value ( std::string  name)
inlinevirtual

Param value getter.

Asks the ParamSet to return the value of Param name.

See also
ParamSet::getValue
143{return _paramSet->getValue(name);}
double getValue(string name)
Accessor the parameters value.
Definition: param.h:302

References _paramSet, and ParamSet::getValue().

Referenced by LifeCycleEvent::get_rank(), TTProtoWithMap::isRecombinationFree(), Metapop::loadFileServices(), LCE_Selection_base::set_param_rate_of_change(), LCE_Selection_base::set_sel_model(), LCE_Selection_base::set_std_rate_of_change(), LCE_Disperse_base::setBasicLatticeMatrix(), TProtoQuanti::setContinuousMutationModel(), TProtoQuanti::setDiallelicMutationModel(), TProtoQuanti::setDominanceParameters(), LCE_Breed_base::setFecundity(), TTProtoWithMap::setGeneticMapParameters(), LCE_Disperse_base::setLatticeMatrix(), LCE_Disperse_base::setLatticeTorrusMatrix(), LCE_Breed_base::setMatingSystem(), TProtoQuanti::setMutationParameters(), TProtoDispersal::setNonRandom(), BinaryDataSaver::setParameters(), LCE_Breed_Disperse::setParameters(), LCE_Breed_Selection::setParameters(), LCE_Breed_Selection_Disperse::setParameters(), LCE_Patch_Extinction::setParameters(), LCE_Cross::setParameters(), LCE_Resize::setParameters(), LCE_QuantiModifier::setParameters(), LCE_FileServicesNotifier::setParameters(), TProtoBDMI::setParameters(), TProtoDeletMutations_bitstring::setParameters(), TProtoDispersal::setParameters(), TProtoNeutralGenes::setParameters(), TProtoQuanti::setParameters(), TProtoWolbachia::setParameters(), LCE_Breed_Wolbachia::setParameters(), LCE_Disperse_ConstDisp::setParameters(), LCE_Disperse_base::setReducedDispMatrix(), LCE_Selection_base::setSelectionMatrix(), TProtoDeletMutations_bitstring::setSelectionParameters(), and LCE_Disperse_base::setSteppingStone1DMatrix().

◆ get_paramset()

virtual ParamSet * SimComponent::get_paramset ( )
inlinevirtual

ParamSet accessor.

108{return _paramSet;}

References _paramSet.

Referenced by LCE_Resize::execute(), BinaryDataLoader::extractPop(), and LCE_StatServiceNotifier::loadStatServices().

+ Here is the caller graph for this function:

◆ has_parameter()

virtual bool SimComponent::has_parameter ( std::string  name)
inlinevirtual

Param getter.

Asks the ParamSet if it has a parameter named name.

See also
ParamSet::has_param
150{return _paramSet->has_param(name);}
bool has_param(string name)
Look for a param "name" in its parameters list.
Definition: param.cc:651

References _paramSet, and ParamSet::has_param().

Referenced by Metapop::loadPopFromBinarySource().

+ Here is the caller graph for this function:

◆ loadFileServices()

◆ loadStatServices()

◆ loadUpdaters()

virtual void SimComponent::loadUpdaters ( UpdaterServices loader)
inlinevirtual

Loads the parameters and component updater onto the updater manager.

Parameters
loaderthe updater manager

Reimplemented in LCE_ParamUpdaterNotifier.

68 {
69 list<ParamUpdaterBase*> updaters = _paramSet->getUpdaters();
70 //remove duplicates:
71 updaters.unique();
72 for (list<ParamUpdaterBase*>::iterator u = updaters.begin(); u != updaters.end(); u++) {
73 loader->attach( (*u) );
74 }
75 }
list< ParamUpdaterBase * > getUpdaters()
Collects the parameter updaters from the set of parameters.
Definition: param.cc:592
virtual void attach(Handler *H)
Attach the updater to the stack.
Definition: updaterservices.cc:89

References _paramSet, UpdaterServices::attach(), and ParamSet::getUpdaters().

Referenced by UpdaterServices::load().

+ Here is the caller graph for this function:

◆ resetParameterFromSource()

◆ set_paramset() [1/2]

virtual void SimComponent::set_paramset ( ParamSet paramset)
inlinevirtual

◆ set_paramset() [2/2]

virtual void SimComponent::set_paramset ( std::string  name,
bool  required,
SimComponent owner 
)
inlinevirtual

Sets a new ParamSet and name it.

Parameters
namethe name of the parameters container
requiredtag whether the component is required to run a simulation
ownera reference to the owner of the ParamSet (should be this).

Reimplemented in LifeCycleEvent.

93 {
94 if(_paramSet != NULL) delete _paramSet;
95 _paramSet = new ParamSet();
96 _paramSet->setName(name);
97 _paramSet->setIsRequired(required);
98 _paramSet->setOwner(owner);
99 }
Parameters container, implemented in each SimComponent.
Definition: param.h:206
void setName(string value)
Sets the container's name.
Definition: param.h:282
void setOwner(SimComponent *owner)
Sets the pointer to the SimComponents that owns this set.
Definition: param.h:286
void setIsRequired(bool value)
Sets the _isRequired flag meaning this container is mandatory and must be set in order to run a simul...
Definition: param.h:284

References _paramSet, ParamSet::setIsRequired(), ParamSet::setName(), and ParamSet::setOwner().

◆ set_paramsetFromCopy()

virtual void SimComponent::set_paramsetFromCopy ( const ParamSet PSet)
inlinevirtual

Reset the set of parameters from a another set.

Parameters
PSetthe parameter set to copy parameters from
103 {
104 if(_paramSet != NULL) delete _paramSet;
105 _paramSet = new ParamSet(PSet);
106 }

References _paramSet.

◆ setParameters()

Member Data Documentation

◆ _paramSet


The documentation for this class was generated from the following file:

Generated for Nemo v2.3.56 by  doxygen 1.9.0 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR