|
Nemo
2.4.0b
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
|
This structure stores one parameter, its definition and its string argument. More...
#include <param.h>
Collaboration diagram for Param:Public Member Functions | |
| Param (string &Name, param_t Type, bool mandatory, bool bounded, double low_bnd, double up_bnd, SimComponent *owner, ParamUpdaterBase *updater) | |
| Constructor. More... | |
| Param (const Param &P) | |
| Copy cstor, provides shallow copy of the parameter definition, do not copy arguments. More... | |
| virtual | ~Param () |
| void | reset () |
| Clears the _isSet flag and the argument string. More... | |
| void | setName (string value) |
| Sets the parameter's name. More... | |
| void | setArg (string value) |
| Sets the parameter's argument. More... | |
| void | setType (param_t value) |
| Sets the parameter's type (see types.h) More... | |
| void | setIsSet (bool value) |
| Sets the _isSet flag. More... | |
| void | setIsBounded (bool value) |
| Sets the _isBounded flag. More... | |
| void | setIsRequired (bool value) |
| Sets the isRequired flag. More... | |
| void | setBounds (double low_bnd, double up_bnd) |
| Sets the bounds. More... | |
| void | setOwner (SimComponent *owner) |
| Sets the pointer to owner. More... | |
| void | setUpdater (ParamUpdaterBase *updater) |
| Sets the pointer to the updater object. More... | |
| void | setAtGeneration (unsigned int generation) |
| string | getName () |
| string | getArg () |
| param_t | getType () |
| bool | isSet () |
| bool | isBounded () |
| bool | isRequired () |
| bool | isTemporal () |
| bool | hasMultipleArgs () |
| bool | hasExternalFile () |
| double | getBound (unsigned int i) |
| SimComponent * | getOwner () |
| ParamUpdaterBase * | getUpdater () |
| deque< unsigned int > | getUpdatingDates () |
| deque< string > | getTemporalArgs () |
| vector< string > | getMultiArgs () |
| vector< string > | getExternalFiles () |
| bool | set (string arg, string &errmsg) |
| Sets the _isSet flag to true and _arg to arg if the arg is of the right type and whithin the bounds. More... | |
| bool | update (unsigned int generation) |
| Updates the parameter value at a given generation during the simulation. More... | |
| double | getValue () |
| Returns the argument value according to its type. More... | |
| bool | isMatrix () |
| Checks if the argument is of matrix type. More... | |
| void | getMatrix (TMatrix *mat) |
| Sets the matrix from the argument string if the parameter is set and of matrix type. More... | |
| void | getVariableMatrix (vector< vector< double > > *mat) |
| void | parse_matrix (TMatrix *mat) |
| Parses the matrix from the argument string. More... | |
| void | parse_variable_matrix (vector< vector< double > > *mat) |
| bool | parseArgument (string &arg) |
| bool | parseTemporalArgument (const string &arg) |
| bool | parseAgeSpecArgument (const string &arg) |
| bool | parseSubParamArgument (const string &arg) |
| string | checkArgumentForExpansion (string arg) |
| string | getArgumentFromFile (string file) |
| void | show_up () |
| Print state to stdout. More... | |
Private Attributes | |
| string | _name |
| The name of the parameter as read in the init file. More... | |
| string | _arg |
| The argument string, set by the ParamsParser upon initialization. More... | |
| string | _input_arg |
| The input argument string, kept untouched as a backup for logging. More... | |
| param_t | _type |
| The type of the argument, must one of DBL, INT, BOOL, STR or MAT (see types.h). More... | |
| bool | _isSet |
| Flag set once the parameter has recieved the right argument. More... | |
| bool | _isBounded |
| Flag telling if the parameter has a bounded argument value. More... | |
| bool | _isRequired |
| Flag telling if this parameter is mandatory. More... | |
| double | _bounds [2] |
| The argument value boundaries. More... | |
| unsigned int | _setAtGeneration |
| Generation at which the parameter has been set/updated. More... | |
| SimComponent * | _myOwner |
| Pointer to the component that declared this parameter. More... | |
| ParamUpdaterBase * | _myUpdater |
| Pointer to an ParamUpdater object. More... | |
| vector< string > | _externalFile |
| External argument file. More... | |
| bool | _hasExternalFile |
| map< unsigned int, string > | _temporalArgs |
| The temporal arguments. More... | |
| bool | _isTemporal |
| Flag telling if this parameter has temporal arguments. More... | |
| vector< string > | _multiArgs |
| Multiple arguments. More... | |
| bool | _hasMultipleArgs |
This structure stores one parameter, its definition and its string argument.
Parameters are aggregated into a ParamSet.
| Param::Param | ( | string & | Name, |
| param_t | Type, | ||
| bool | mandatory, | ||
| bool | bounded, | ||
| double | low_bnd, | ||
| double | up_bnd, | ||
| SimComponent * | owner, | ||
| ParamUpdaterBase * | updater | ||
| ) |
Constructor.
| Name | the name of the parameter as read in the init file |
| Type | the type of the parameter argument (see types.h), used to convert the argument string into a value |
| mandatory | specifies whether this parameter is mandatory for the ParamSet owning it |
| bounded | specifies whether the values this parameter can take are bounded |
| low_bnd | the lower bound of the parameter value |
| up_bnd | the upper bound |
| owner | pointer to the SimComponents that owns this parameter |
| updater | the param updater object used to update the parameter's state during a simulation |
References _bounds.
| Param::Param | ( | const Param & | P | ) |
Copy cstor, provides shallow copy of the parameter definition, do not copy arguments.
References _bounds.
|
virtual |
References _myUpdater.
| string Param::checkArgumentForExpansion | ( | string | arg | ) |
References getArgumentFromFile().
Referenced by parseArgument(), parseTemporalArgument(), and set().
|
inline |
Referenced by LCE_Cross::loadFileServices(), TProtoNeutralGenes::loadFileServices(), TProtoQuanti::loadFileServices(), Metapop::loadPopFromBinarySource(), ParamSet::print(), TProtoQuanti::setAlleleModel(), LCE_Breed_base::setFecundity(), BinaryDataSaver::setParameters(), LCE_BreedAssortativeMating::setParameters(), LCE_Breed_Disperse::setParameters(), LCE_Cross::setParameters(), LCE_QuantiModifier::setParameters(), TProtoQuanti::setParameters(), and TProtoDispersal::setRandom().
| string Param::getArgumentFromFile | ( | string | file | ) |
References _externalFile, _hasExternalFile, fatal(), StreamParser::readArguments(), and tstring::removeFirstCharOf().
Referenced by checkArgumentForExpansion().
|
inline |
|
inline |
| void Param::getMatrix | ( | TMatrix * | mat | ) |
Sets the matrix from the argument string if the parameter is set and of matrix type.
Passes the param 'mat' to function Param::parse_matrix.
| mat | a TMatrix ptr, mat dimensions and values will be reset to the values read in the init file. |
References _isSet, _name, isMatrix(), parse_matrix(), and warning().
Referenced by LCE_Selection_base::loadFileServices(), Metapop::loadFileServices(), LCE_FileServicesNotifier::loadFileServices(), TProtoBDMI::loadFileServices(), TProtoDeletMutations_bitstring::loadFileServices(), TProtoNeutralGenes::loadFileServices(), TProtoQuanti::loadFileServices(), LCE_PhenotypeExpression::set_g_value_matrix(), 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(), TProtoQuanti::setContinuousMutationModel_full_pleio(), TProtoQuanti::setDiallelicMutationModel(), TProtoQuanti::setDominanceParameters(), TProtoDeletMutations_bitstring::setEffectsFromInput(), TProtoQuanti::setEpistasisParameters(), LCE_Breed_base::setFecundity(), TTProtoWithMap::setGeneticMapParameters(), TProtoQuanti::setHeritabilityParams(), TProtoQuanti::setInitialValuesParams(), TProtoQuanti::setMutationCorrelation(), TProtoQuanti::setMutationModel_no_pleio(), TProtoQuanti::setMutationModel_var_pleio(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance(), TProtoQuanti::setMutationSigmaFromQuantiMutationVariance_no_pleio(), TTProtoWithMap::setNumLociPerChromosome(), LCE_StatServiceNotifier::setOccurence(), LCE_QuantiModifier::setParameters(), TProtoBDMI::setParameters(), LCE_Breed_Wolbachia::setParameters(), and TProtoDispersal::setRandom().
| vector< string > Param::getMultiArgs | ( | ) |
References _arg, _hasMultipleArgs, and _multiArgs.
Referenced by LCE_FileServicesNotifier::loadFileServices(), LCE_Selection_base::set_sel_model(), LCE_Selection_base::setParameters(), and Metapop::setSourceParameters().
|
inline |
|
inline |
| deque< string > Param::getTemporalArgs | ( | ) |
References _temporalArgs.
Referenced by LCE_StatServiceNotifier::setOccurence().
|
inline |
| deque< unsigned int > Param::getUpdatingDates | ( | ) |
| double Param::getValue | ( | ) |
Returns the argument value according to its type.
References _arg, _isSet, _type, isMatrix(), and STR.
Referenced by LCE_Selection_base::loadFileServices(), Metapop::loadFileServices(), LCE_FileServicesNotifier::loadFileServices(), TProtoBDMI::loadFileServices(), TProtoDeletMutations_bitstring::loadFileServices(), TProtoNeutralGenes::loadFileServices(), TProtoQuanti::loadFileServices(), LCE_PhenotypeExpression::set_g_value_matrix(), LCE_Patch_Extinction::set_matrix_param(), TProtoDispersal::setNonRandom(), and LCE_StatServiceNotifier::setOccurence().
| void Param::getVariableMatrix | ( | vector< vector< double > > * | mat | ) |
References _isSet, _name, isMatrix(), parse_variable_matrix(), and warning().
Referenced by TProtoQuanti::readMatrixFromQuantiMutationMatrix(), TTProtoWithMap::setGeneticMapParameters(), LCE_Disperse_EvolDisp::setParameters(), and LCE_Disperse_base::setReducedMatricesBySex().
|
inline |
|
inline |
Referenced by Metapop::setSourceParameters().
|
inline |
|
inline |
Checks if the argument is of matrix type.
References MAT.
Referenced by getMatrix(), getValue(), getVariableMatrix(), LCE_Selection_base::loadFileServices(), Metapop::loadFileServices(), LCE_FileServicesNotifier::loadFileServices(), TProtoBDMI::loadFileServices(), TProtoDeletMutations_bitstring::loadFileServices(), TProtoNeutralGenes::loadFileServices(), TProtoQuanti::loadFileServices(), LCE_PhenotypeExpression::set_g_value_matrix(), LCE_Patch_Extinction::set_matrix_param(), TProtoQuanti::setInitialValuesParams(), LCE_StatServiceNotifier::setOccurence(), LCE_QuantiModifier::setParameters(), and LCE_Selection_base::setSelectionMatrix().
|
inline |
|
inline |
Referenced by LCE_Breed_base::isWrightFisher(), LCE_Selection_base::loadFileServices(), Metapop::loadFileServices(), LCE_FileServicesNotifier::loadFileServices(), TProtoBDMI::loadFileServices(), TProtoDeletMutations_bitstring::loadFileServices(), TProtoNeutralGenes::loadFileServices(), TProtoQuanti::loadFileServices(), ParamSet::print(), TProtoNeutralGenes::resetParameterFromSource(), LCE_Selection_base::set_sel_model(), LCE_Disperse_base::setBaseParameters(), TProtoQuanti::setContinuousMutationModel_no_pleio(), TTProtoWithMap::setGeneticMapParameters(), TProtoQuanti::setHeritabilityParams(), TProtoQuanti::setInitialValuesParams(), LCE_Breed_base::setMatingSystem(), TProtoDispersal::setNonRandom(), BinaryDataSaver::setParameters(), LCE_Breed_Disperse::setParameters(), LCE_Cross::setParameters(), LCE_Breed_Quanti::setParameters(), LCE_FileServicesNotifier::setParameters(), LCE_Init_BDMI::setParameters(), TProtoDeletMutations_bitstring::setParameters(), TProtoNeutralGenes::setParameters(), TProtoDispersal::setRandom(), and LCE_Resize::updateParameters().
|
inline |
Referenced by LCE_StatServiceNotifier::setOccurence().
| void Param::parse_matrix | ( | TMatrix * | mat | ) |
Parses the matrix from the argument string.
| mat | a TMatrix ptr, mat dimensions and values will be reset to the values read in the init file. |
References _arg, _name, fatal(), TMatrix::reset(), and TMatrix::set().
Referenced by getMatrix().
| void Param::parse_variable_matrix | ( | vector< vector< double > > * | mat | ) |
| bool Param::parseAgeSpecArgument | ( | const string & | arg | ) |
Referenced by parseArgument().
| bool Param::parseArgument | ( | string & | arg | ) |
Parse an argument string enclosed in '( )', might hold temporal or multiple values.
References _hasMultipleArgs, _isTemporal, _multiArgs, _myUpdater, _name, _temporalArgs, checkArgumentForExpansion(), error(), parseAgeSpecArgument(), parseTemporalArgument(), tstring::removeEnclosingChar(), tstring::removeLeadingWhiteSpace(), tstring::replaceChar(), tstring::splitExcludeEnclosedDelimiters(), and warning().
Referenced by set().
| bool Param::parseTemporalArgument | ( | const string & | arg | ) |
References _name, _temporalArgs, checkArgumentForExpansion(), error(), tstring::removeFirstCharOf(), tstring::removeLeadingWhiteSpace(), tstring::split(), and tstring::str2uint().
Referenced by parseArgument().
| void Param::reset | ( | ) |
Clears the _isSet flag and the argument string.
References _arg, _externalFile, _hasExternalFile, _hasMultipleArgs, _input_arg, _isSet, _isTemporal, _multiArgs, _setAtGeneration, and _temporalArgs.
Referenced by LCE_Breed_Selection_Disperse::setParameters().
| bool Param::set | ( | string | arg, |
| string & | errmsg | ||
| ) |
Sets the _isSet flag to true and _arg to arg if the arg is of the right type and whithin the bounds.
Called at simulation setup (i.e. generation 0). For parameter update during the simulation, check the Param::update member function.
!a matrix may also be specified!! in that case, we don't check values here
References _arg, _bounds, _externalFile, _input_arg, _isBounded, _isSet, _type, BOOL, checkArgumentForExpansion(), DBL, INT, tstring::isanumber(), MAT, parseArgument(), tstring::str2dble(), and tstring::str2int().
Referenced by update().
|
inline |
Sets the parameter's argument.
Referenced by TTProtoWithMap::recordRandomMap(), TProtoDispersal::setParameters(), TTProtoWithMap::setRecombinationMapRandom(), and TProtoDeletMutations_bitstring::write_effects_to_parameter().
|
inline |
|
inline |
|
inline |
Sets the _isBounded flag.
|
inline |
Sets the isRequired flag.
|
inline |
Sets the _isSet flag.
Referenced by TTProtoWithMap::recordRandomMap(), TProtoDispersal::setParameters(), TTProtoWithMap::setRecombinationMapRandom(), and TProtoDeletMutations_bitstring::write_effects_to_parameter().
|
inline |
Sets the parameter's name.
|
inline |
Sets the pointer to owner.
|
inline |
|
inline |
Sets the pointer to the updater object.
| void Param::show_up | ( | ) |
| bool Param::update | ( | unsigned int | generation | ) |
Updates the parameter value at a given generation during the simulation.
References _name, _temporalArgs, error(), and set().
Referenced by ParamSet::update_param().
|
private |
The argument string, set by the ParamsParser upon initialization.
Referenced by getMultiArgs(), getValue(), parse_matrix(), parse_variable_matrix(), reset(), set(), and show_up().
|
private |
External argument file.
Referenced by getArgumentFromFile(), reset(), and set().
|
private |
Referenced by getArgumentFromFile(), and reset().
|
private |
Referenced by getMultiArgs(), parseArgument(), and reset().
|
private |
|
private |
Flag telling if the parameter has a bounded argument value.
Referenced by set().
|
private |
Flag telling if this parameter is mandatory.
A SimComponent with a mandatory parameter in the 'unset' state will not be selected to be part of a running simulation component.
|
private |
Flag set once the parameter has recieved the right argument.
Referenced by getMatrix(), getValue(), getVariableMatrix(), reset(), set(), and show_up().
|
private |
Flag telling if this parameter has temporal arguments.
Referenced by parseArgument(), and reset().
|
private |
Multiple arguments.
Referenced by getMultiArgs(), parseArgument(), and reset().
|
private |
Pointer to the component that declared this parameter.
|
private |
Pointer to an ParamUpdater object.
Referenced by parseArgument(), and ~Param().
|
private |
The name of the parameter as read in the init file.
Referenced by getMatrix(), getVariableMatrix(), parse_matrix(), parseArgument(), parseTemporalArgument(), show_up(), and update().
|
private |
|
private |
The temporal arguments.
Referenced by getTemporalArgs(), getUpdatingDates(), parseArgument(), parseTemporalArgument(), reset(), and update().
|
private |
The type of the argument, must one of DBL, INT, BOOL, STR or MAT (see types.h).
Referenced by getValue(), and set().
1.9.1 -- Nemo is hosted on