Nemo
2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
|
Class to manage the sets of parameters of the simulation components. More...
#include <basicsimulation.h>
Public Member Functions | |
ParamManager () | |
Cstor. More... | |
~ParamManager () | |
void | add_paramset (ParamSet *paramset) |
Adds a ParamSet to the list of the parameter sets of the simulation. More... | |
ParamSet * | get_paramset (string &name) |
Looks for paramset with "name" in the list of parameter sets. More... | |
void | build_allParams () |
Clears and fills the _allParams list with the ParamSet's of the simulation components. More... | |
list< ParamSet * > & | get_allParams () |
Accessor of the whole list of the parameter sets. More... | |
bool | set_parameters (map< string, string > &simparams, bool silent) |
Sets the parameters of the simulation with the argument strings given in input. More... | |
bool | param_consistency_check () |
Checks if all the mandatory parameters are set so that the simulation can be launched. More... | |
void | build_records (map< string, vector< string > > &initParams) |
Builds the list of simulation parameters from the parsed input file(s). More... | |
list< map< string, string > > & | get_simRecords () |
Accessor to the simulations parameter list. More... | |
map< string, string > & | get_firstRecord () |
Accessor to the first element in the simulations parameter list. More... | |
int | get_nbSims () |
Accessor to the size of the simulations parameter list, i.e. More... | |
![]() | |
ComponentManager () | |
~ComponentManager () | |
void | build_component_list () |
Clears and builds the list of all components from the lists of trait prototype templates and life cycle event templates. More... | |
void | add_component (SimComponent *cmpt) |
Push a component at the back of the component list. More... | |
void | add_trait (TraitPrototype *trait) |
Add a trait prototype to the template and component lists. More... | |
void | add_LCE (LifeCycleEvent *event) |
Add a life cycle event to the template and component lists. More... | |
TraitPrototype * | get_trait (string name) |
Search for component with "name" in the trait prototype list. More... | |
LifeCycleEvent * | get_LCE (string name) |
Search for component with "name" in the life cycle events list. More... | |
Protected Attributes | |
list< ParamSet * > | _allParams |
A list of all the parameter sets of all the simulation components loaded in the _component list of the ComponentManager. More... | |
map< string, string > | _inputParams |
A map of the parameters and their arguments of the current (running) simulation. More... | |
map< unsigned int, list< pair< string, string > > > | _temporalParams |
Lists of parameters to be updated during a simulation indexed by generation update time. More... | |
list< map< string, string > > | _simRecords |
Sets of parameters of all the simulations to perform. More... | |
ParamSet | _paramSet |
The ParamSet param set of the simulation. More... | |
![]() | |
list< SimComponent * > | _components |
List of all the simulation components. More... | |
list< TraitPrototype * > | _TTrait_Templates |
List of all trait prototypes of the simulation, a subset of _components list. More... | |
list< LifeCycleEvent * > | _LCE_Templates |
List of all the life-cycle events of the simulation, a subset of _components list. More... | |
Private Member Functions | |
string | setFilename (string &fstring, unsigned int sim, vector< string > &args, vector< unsigned int > &arg_no, bool check_arg_no) |
string | stripFormatString (string &str, unsigned int &index) |
string | setArgString (string &fmt, string &arg, unsigned int arg_pos) |
string | lowercase (string &input) |
Class to manage the sets of parameters of the simulation components.
This class performs parameters setting and checking for the whole set of the simulation components. Provides access to derived classes to the complete list of parameter sets. Also sets the list of simulations parameters in case of sequential parameters found in input. It stores and builds the simulation parameters set.
ParamManager::ParamManager | ( | ) |
Cstor.
Builds the simulation PramaSet.
References _paramSet, ParamSet::add_param(), BOOL, INT, ParamSet::setIsRequired(), ParamSet::setName(), ParamSet::setOwner(), and STR.
|
inline |
|
inline |
Adds a ParamSet to the list of the parameter sets of the simulation.
References _allParams.
Referenced by BinaryDataLoader::extractPop().
void ParamManager::build_allParams | ( | ) |
Clears and fills the _allParams list with the ParamSet's of the simulation components.
References _allParams, ComponentManager::_components, and _paramSet.
Referenced by SIMenv::loadDefaultComponents(), SimRunner::run(), and SimBuilder::SimBuilder().
void ParamManager::build_records | ( | map< string, vector< string > > & | initParams | ) |
Builds the list of simulation parameters from the parsed input file(s).
References _simRecords, fatal(), and setFilename().
Referenced by SimRunner::run().
|
inline |
Accessor of the whole list of the parameter sets.
References _allParams.
|
inline |
|
inline |
Accessor to the size of the simulations parameter list, i.e.
the number of simulations to perform.
References _simRecords.
ParamSet * ParamManager::get_paramset | ( | string & | name | ) |
Looks for paramset with "name" in the list of parameter sets.
References _allParams.
Referenced by SimRunner::Replicate_LOOP().
|
inline |
|
private |
bool ParamManager::param_consistency_check | ( | ) |
Checks if all the mandatory parameters are set so that the simulation can be launched.
ParamSet::check_consistency()
returned true References _allParams, and error().
Referenced by set_parameters().
bool ParamManager::set_parameters | ( | map< string, string > & | simparams, |
bool | silent | ||
) |
Sets the parameters of the simulation with the argument strings given in input.
Scans the _allParams list to set the parameters present in the input map simparams. Each ParamSet checks internally for the presence of a Param with the given name string and sets its value with the given argument, if present.
Note: all ParamSet owning a Param with the same name will use the same argument string. The input map is not a multimap, each param name is present only once.
simparams | a map containing the parameter names and their argument string |
silent | will be silent about parameters that could not be set. |
param_consistency_check()
function References _allParams, _inputParams, _myenv, error(), fatal(), MPIenv::isMaster(), message(), param_consistency_check(), and warning().
Referenced by SimBuilder::build_currentParams().
|
private |
References error(), and fatal().
Referenced by setFilename().
|
private |
References fatal(), setArgString(), stripFormatString(), and warning().
Referenced by build_records().
|
private |
References fatal().
Referenced by setFilename().
|
protected |
A list of all the parameter sets of all the simulation components loaded in the _component list of the ComponentManager.
Referenced by add_paramset(), build_allParams(), SimBuilder::build_currentParams(), get_allParams(), get_paramset(), param_consistency_check(), SimRunner::reset(), and set_parameters().
|
protected |
A map of the parameters and their arguments of the current (running) simulation.
Referenced by set_parameters().
|
protected |
The ParamSet param set of the simulation.
Referenced by build_allParams(), SimRunner::init(), SimRunner::init_random_seed(), ParamManager(), and SimBuilder::SimBuilder().
|
protected |
Sets of parameters of all the simulations to perform.
Referenced by build_records(), get_firstRecord(), get_nbSims(), get_simRecords(), and SimRunner::run().
|
protected |
Lists of parameters to be updated during a simulation indexed by generation update time.