Nemo
2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
|
Parameters container, implemented in each SimComponent. More...
#include <param.h>
Public Member Functions | |
ParamSet () | |
ParamSet (const ParamSet &PS) | |
~ParamSet () | |
void | reset () |
Put the container in the unset state, reset each Param it contains. More... | |
void | clear () |
Empties the parameter containers (no delete). More... | |
bool | check_consistency () |
Checks for the status of the required parameters. More... | |
void | show_up () |
print info to stdout. More... | |
void | print (ofstream &FILE, bool commentOut=false) |
print all set parameters to the outpout file stream More... | |
int | size () |
Returns the number of parameters contained. More... | |
map< string, Param * > & | getAllParams () |
Returns the complete list of parameters. More... | |
ParamSet & | operator= (const ParamSet &PS) |
Accessors to Param members. | |
void | add_param (Param *param) |
Adds the param argument to the list. More... | |
void | add_param (string Name, param_t Type, bool mandatory, bool isBounded, double low_bnd, double up_bnd) |
Adds a new param specified by arguments to the list. More... | |
void | add_param (string Name, param_t Type, bool mandatory, bool isBounded, double low_bnd, double up_bnd, ParamUpdaterBase *updater) |
bool | set_param (string Name, string Arg) |
Look for a param named "Name" and try to set it with the "Arg" argument string. More... | |
Param * | find_param (string name) |
Look for a param "name" in its parameters list. More... | |
Param * | get_param (string name) |
Look for a param "name" in its parameters list. More... | |
bool | has_param (string name) |
Look for a param "name" in its parameters list. More... | |
bool | update_param (string Name, unsigned int generation) |
Calls the updating procedure of each of its Param. More... | |
void | setName (string value) |
Sets the container's name. More... | |
void | setIsRequired (bool value) |
Sets the _isRequired flag meaning this container is mandatory and must be set in order to run a simulation. More... | |
void | setOwner (SimComponent *owner) |
Sets the pointer to the SimComponents that owns this set. More... | |
bool | isSet () |
Accessor to the status flag. More... | |
string | getName () |
Name accessor. More... | |
bool | isRequired () |
Accessor to the mandatory flag. More... | |
bool | isSet (string name) |
Accessor to the parameters status flag. More... | |
bool | isMatrix (string name) |
Check if the parameter "name" is of matrix type. More... | |
bool | isTemporal (string name) |
Check if the parameter "name" has temporal arguments. More... | |
string | getArg (string name) |
Accessor to the parameters argument string. More... | |
double | getValue (string name) |
Accessor the parameters value. More... | |
void | getMatrix (string name, TMatrix *mat) |
Accessor to the parameters matrix. More... | |
list< ParamUpdaterBase * > | getUpdaters () |
Collects the parameter updaters from the set of parameters. More... | |
Private Attributes | |
string | _name |
The name of the component. More... | |
bool | _isSet |
Flag is true if all mandatory parameters are correctly set from user's input file. More... | |
bool | _isRequired |
Flaf is true if component is required (mandatory) to run a simulation (e.g. More... | |
map< string, Param * > | _params |
List of parameters indexed by name. More... | |
SimComponent * | _myOwner |
Pointer to the component that declared this parameter. More... | |
Parameters container, implemented in each SimComponent.
A SimComponent is added to the set of active components of a simulation only if all its required parameters are set (isSet = true).
|
inline |
ParamSet::ParamSet | ( | const ParamSet & | PS | ) |
References _params.
ParamSet::~ParamSet | ( | ) |
|
inline |
Adds the param argument to the list.
References _params, and Param::getName().
Referenced by add_param(), SimComponent::add_parameter(), and ParamManager::ParamManager().
|
inline |
Adds a new param specified by arguments to the list.
Name | the name of the parameter |
Type | the type of the parameter |
mandatory | specifies if this parameter is required and must be set for the container to gain the "set" status |
isBounded | specified whether this parameter is bounded |
low_bnd | the lower value the parameter can take, used if isBounded is true |
up_bnd | the upper value the parameter can take, used if isBounded is true |
References add_param().
void ParamSet::add_param | ( | string | Name, |
param_t | Type, | ||
bool | mandatory, | ||
bool | isBounded, | ||
double | low_bnd, | ||
double | up_bnd, | ||
ParamUpdaterBase * | updater | ||
) |
References _myOwner, _params, and ParamUpdaterBase::addParam().
bool ParamSet::check_consistency | ( | ) |
Checks for the status of the required parameters.
References _isRequired, _isSet, _name, _params, message(), and warning().
|
inline |
Param * ParamSet::find_param | ( | string | name | ) |
Param * ParamSet::get_param | ( | string | name | ) |
Look for a param "name" in its parameters list.
References _name, _params, and fatal().
Referenced by SimComponent::get_parameter(), getArg(), getMatrix(), getValue(), isMatrix(), isSet(), isTemporal(), LCE_StatServiceNotifier::setOccurence(), and update_param().
|
inline |
|
inline |
Accessor to the parameters argument string.
References get_param().
Referenced by LCE_Resize::execute(), SimRunner::init(), LCE_Selection_base::set_fit_model(), LCE_Selection_base::set_local_optima(), LCE_Disperse_EvolDisp::setParameters(), LCE_Patch_Extinction::setParameters(), LCE_StatServiceNotifier::setParameters(), TProtoDeletMutations_bitstring::setSelectionParameters(), Metapop::setSourceParameters(), and LCE_Resize::updateParameters().
|
inline |
Accessor to the parameters matrix.
References get_param().
Referenced by LCE_Selection_base::set_local_optima(), LCE_Disperse_base::setBaseParameters(), LCE_Breed_Disperse::setParameters(), LCE_Resize::setParameters(), LCE_QuantiInit::setParameters(), LCE_Init_BDMI::setParameters(), LCE_NtrlInit::setParameters(), Metapop::setPatchCapacities(), LCE_Selection_base::setSelectionMatrix(), and LCE_Resize::updateParameters().
|
inline |
Name accessor.
References _name.
Referenced by SimComponent::get_name().
list< ParamUpdaterBase * > ParamSet::getUpdaters | ( | ) |
Collects the parameter updaters from the set of parameters.
References _params.
Referenced by SimComponent::loadUpdaters().
|
inline |
Accessor the parameters value.
References get_param().
Referenced by SimComponent::get_parameter_value(), SimRunner::init(), SimRunner::init_random_seed(), LCE_Disperse_base::setBaseParameters(), LCE_Disperse_base::setLatticeMatrix(), LCE_Breed_base::setMatingSystem(), LCE_Disperse_EvolDisp::setParameters(), LCE_StatServiceNotifier::setParameters(), Metapop::setPopulationParameters(), and Metapop::setSourceParameters().
bool ParamSet::has_param | ( | string | name | ) |
Look for a param "name" in its parameters list.
References _params.
Referenced by SimComponent::has_parameter().
|
inline |
Check if the parameter "name" is of matrix type.
References get_param().
Referenced by LCE_Breed_Disperse::setParameters(), LCE_Resize::setParameters(), and Metapop::setPopulationParameters().
|
inline |
|
inline |
Accessor to the status flag.
References _isSet.
Referenced by Metapop::init(), SimRunner::init(), SimRunner::init_random_seed(), LCE_Selection_base::loadFileServices(), LCE_StatServiceNotifier::loadStatServices(), LCE_Selection_base::set_fit_model(), LCE_Selection_base::set_local_optima(), LCE_Selection_base::set_sel_model(), LCE_Disperse_base::setBaseParameters(), LCE_Disperse_base::setIsland_PropagulePool_Matrix(), LCE_Disperse_base::setLatticeMatrix(), LCE_Breed_base::setMatingSystem(), LCE_Breed_Disperse::setParameters(), LCE_Disperse_EvolDisp::setParameters(), LCE_QuantiInit::setParameters(), LCE_StatServiceNotifier::setParameters(), Metapop::setPopulationParameters(), LCE_Selection_base::setSelectionMatrix(), and Metapop::setSourceParameters().
|
inline |
|
inline |
References _isRequired, _isSet, _name, and _params.
void ParamSet::print | ( | ofstream & | FILE, |
bool | commentOut = false |
||
) |
print all set parameters to the outpout file stream
References _params, Param::getArg(), Param::getName(), and Param::isSet().
void ParamSet::reset | ( | ) |
bool ParamSet::set_param | ( | string | Name, |
string | Arg | ||
) |
Look for a param named "Name" and try to set it with the "Arg" argument string.
Name | the name of the parameter to find in the list |
Arg | the argument string as found in the init params |
References _params, and error().
Referenced by LCE_Resize::execute().
|
inline |
Sets the _isRequired flag meaning this container is mandatory and must be set in order to run a simulation.
References _isRequired.
Referenced by ParamManager::ParamManager(), and SimComponent::set_paramset().
|
inline |
Sets the container's name.
References _name.
Referenced by ParamManager::ParamManager(), and SimComponent::set_paramset().
|
inline |
Sets the pointer to the SimComponents that owns this set.
References _myOwner.
Referenced by ParamManager::ParamManager(), and SimComponent::set_paramset().
void ParamSet::show_up | ( | ) |
|
inline |
bool ParamSet::update_param | ( | string | Name, |
unsigned int | generation | ||
) |
Calls the updating procedure of each of its Param.
References get_param(), and Param::update().
|
private |
Flaf is true if component is required (mandatory) to run a simulation (e.g.
Referenced by check_consistency(), isRequired(), operator=(), and setIsRequired().
|
private |
Flag is true if all mandatory parameters are correctly set from user's input file.
Referenced by check_consistency(), isSet(), operator=(), and reset().
|
private |
Pointer to the component that declared this parameter.
Referenced by add_param(), and setOwner().
|
private |
The name of the component.
Referenced by check_consistency(), get_param(), getName(), operator=(), setName(), and show_up().
|
private |
List of parameters indexed by name.
Referenced by add_param(), check_consistency(), clear(), find_param(), get_param(), getAllParams(), getUpdaters(), has_param(), operator=(), ParamSet(), print(), reset(), set_param(), show_up(), size(), and ~ParamSet().