Nemo
2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
|
The base class of the dispersal LCEs, all events move offspring to the post-dispersal patch containers. More...
#include <LCEdisperse.h>
Public Member Functions | |
LCE_Disperse_base () | |
virtual | ~LCE_Disperse_base () |
Deallocates the disp matrix. More... | |
bool | setBaseParameters (string prefix) |
void | setParamPrefix (string pref) |
void | addParameters (string prefix, ParamUpdaterBase *updater) |
void | setIndentityDispMatrix (TMatrix *mat) |
unsigned int | getMigrationPatchForward (sex_t SEX, unsigned int LocalPatch) |
unsigned int | getMigrationPatchBackward (sex_t SEX, unsigned int LocalPatch) |
void | setPropaguleTargets () |
void | swapPostDisp () |
void | reset_counters () |
Dispersal Matrix | |
void | set_isForward (bool val) |
bool | checkForwardDispersalMatrix (TMatrix *mat) |
bool | checkBackwardDispersalMatrix (TMatrix *mat) |
void | allocateDispMatrix (sex_t sex, unsigned int dim) |
bool | updateDispMatrix () |
bool | setDispMatrix () |
bool | setReducedMatricesBySex (sex_t SEX, Param &connectivity, Param &rate) |
bool | setReducedDispMatrix () |
The reduced dispersal matrix contains the indices of the patches to which each patch is connected. More... | |
bool | setIsland_MigrantPool_Matrix () |
bool | setIsland_PropagulePool_Matrix () |
bool | setSteppingStone1DMatrix () |
bool | setLatticeMatrix () |
Sets the dispersal matrices for the Lattice dispersal model. More... | |
bool | setBasicLatticeMatrix (int rows, int cols, double phi_mal, double phi_fem, double disp_mal, double disp_fem) |
bool | setLatticeTorrusMatrix (int rows, int cols, double disp_mal, double disp_fem, TMatrix *grid) |
bool | setLatticeAbsorbingMatrix () |
bool | setLatticeReflectingMatrix (int rows, int cols, TMatrix *grid) |
Accessors | |
bool | isForward () |
bool | isByNumber () |
unsigned int | getDispersalModel () |
double | getPropaguleProb () |
unsigned int | getPropaguleTarget (unsigned int home) |
Implementations | |
virtual void | loadFileServices (FileServices *loader) |
virtual void | loadStatServices (StatServices *loader) |
virtual bool | resetParameterFromSource (std::string param, SimComponent *cmpt) |
virtual age_t | removeAgeClass () |
virtual age_t | addAgeClass () |
virtual age_t | requiredAgeClass () |
![]() | |
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 () |
virtual void | execute ()=0 |
Execute the event on the pop. More... | |
virtual LifeCycleEvent * | clone ()=0 |
Cloning interface. More... | |
![]() | |
SimComponent () | |
virtual | ~SimComponent () |
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... | |
Protected Attributes | |
unsigned int | _npatch |
Number of patches in the population. More... | |
vector< vector< double > > | _reducedDispMat [2] |
Matrix containing the indexes of the patches connected to each patch. More... | |
vector< vector< double > > | _reducedDispMatProba [2] |
Matrix containing the probability to migrate to/from the connected patches. More... | |
![]() | |
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... | |
Private Attributes | |
int | _disp_model |
double | _disp_propagule_prob |
vector< unsigned int > | _PropaguleTargets |
double | _fem_rate |
double | _mal_rate |
bool | _isForward |
bool | _isByNumber |
TMatrix * | _DispMatrix [2] |
The sex-specific dispersal matrices, [0] for males, [1] for females, might be used as connectivity matrix as well. More... | |
string | _prefix |
Parameter name prefix (dispersal, seed_disp, breed_disp, etc.) More... | |
Friends | |
class | LCE_Disperse_ConstDisp |
class | LCE_Disperse_EvolDisp |
The base class of the dispersal LCEs, all events move offspring to the post-dispersal patch containers.
Stores the dispersal matrices and dispersal model parameters and interface.
LCE_Disperse_base::LCE_Disperse_base | ( | ) |
References _DispMatrix.
|
virtual |
|
inlinevirtual |
Implements LifeCycleEvent.
Reimplemented in LCE_Breed_Disperse, and LCE_Breed_Selection_Disperse.
References NONE.
void LCE_Disperse_base::addParameters | ( | string | prefix, |
ParamUpdaterBase * | updater | ||
) |
References SimComponent::add_parameter(), BOOL, DBL, INT, MAT, and STR.
Referenced by LCE_Breed_Disperse::LCE_Breed_Disperse(), LCE_Disperse_ConstDisp::LCE_Disperse_ConstDisp(), LCE_Disperse_EvolDisp::LCE_Disperse_EvolDisp(), and LCE_SeedDisp::LCE_SeedDisp().
References _DispMatrix, and TMatrix::reset().
Referenced by setIsland_MigrantPool_Matrix(), setIsland_PropagulePool_Matrix(), setLatticeMatrix(), and setSteppingStone1DMatrix().
bool LCE_Disperse_base::checkBackwardDispersalMatrix | ( | TMatrix * | mat | ) |
References error(), TMatrix::get(), TMatrix::getNbCols(), and TMatrix::getNbRows().
Referenced by setBaseParameters(), and setDispMatrix().
bool LCE_Disperse_base::checkForwardDispersalMatrix | ( | TMatrix * | mat | ) |
References error(), TMatrix::get(), TMatrix::getNbCols(), and TMatrix::getNbRows().
Referenced by setBaseParameters(), and setDispMatrix().
|
inline |
References _disp_model.
Referenced by LCE_Disperse_EvolDisp::execute(), setDispMatrix(), LCE_Breed_Disperse::setParameters(), LCE_Breed_Selection_Disperse::setParameters(), LCE_Disperse_EvolDisp::setParameters(), LCE_Disperse_ConstDisp::setParameters(), and updateDispMatrix().
References _reducedDispMat, _reducedDispMatProba, and RAND::Uniform().
Referenced by LCE_Breed_Disperse::get_parent().
References _reducedDispMat, _reducedDispMatProba, and RAND::Uniform().
Referenced by LCE_Disperse_ConstDisp::MigratePatch(), and LCE_Disperse_ConstDisp::MigratePatch_AbsorbingBorder().
|
inline |
References _disp_propagule_prob.
Referenced by LCE_Disperse_EvolDisp::Migrate_Island_Propagule(), and setIsland_PropagulePool_Matrix().
References _PropaguleTargets.
Referenced by LCE_Disperse_EvolDisp::Migrate_Island_Propagule(), and setIsland_PropagulePool_Matrix().
|
inline |
References _isByNumber.
Referenced by LCE_Disperse_ConstDisp::setParameters().
|
inline |
References _isForward.
|
inlinevirtual |
Implements SimComponent.
Reimplemented in LCE_Breed_Disperse, and LCE_Breed_Selection_Disperse.
|
inlinevirtual |
Implements SimComponent.
Reimplemented in LCE_Breed_Disperse, and LCE_Breed_Selection_Disperse.
|
inlinevirtual |
Implements LifeCycleEvent.
Reimplemented in LCE_Breed_Disperse, and LCE_Breed_Selection_Disperse.
References NONE.
|
inlinevirtual |
Implements LifeCycleEvent.
Reimplemented in LCE_Breed_Disperse, and LCE_Breed_Selection_Disperse.
References OFFSPRG.
void LCE_Disperse_base::reset_counters | ( | ) |
References _npatch, LifeCycleEvent::_popPtr, Patch::flush(), Metapop::getPatch(), PDISPx, and Patch::reset_counters().
Referenced by LCE_Breed_Disperse::execute(), LCE_Breed_Selection_Disperse::execute(), LCE_Disperse_ConstDisp::execute(), and LCE_Disperse_EvolDisp::execute().
|
inlinevirtual |
Implements SimComponent.
Reimplemented in LCE_Breed_Disperse, and LCE_Breed_Selection_Disperse.
|
inline |
References _isForward.
Referenced by LCE_Breed_Disperse::setParameters().
bool LCE_Disperse_base::setBaseParameters | ( | string | prefix | ) |
References _disp_model, _disp_propagule_prob, _DispMatrix, _fem_rate, _isByNumber, _isForward, _mal_rate, _npatch, SimComponent::_paramSet, LifeCycleEvent::_popPtr, _prefix, _reducedDispMat, _reducedDispMatProba, checkBackwardDispersalMatrix(), checkForwardDispersalMatrix(), error(), FEM, SimComponent::get_parameter(), ParamSet::getMatrix(), Metapop::getPatchNbr(), ParamSet::getValue(), Param::isSet(), ParamSet::isSet(), MAL, setDispMatrix(), setIndentityDispMatrix(), setReducedDispMatrix(), setReducedMatricesBySex(), and warning().
Referenced by LCE_Breed_Disperse::setParameters(), and LCE_Disperse_ConstDisp::setParameters().
bool LCE_Disperse_base::setBasicLatticeMatrix | ( | int | rows, |
int | cols, | ||
double | phi_mal, | ||
double | phi_fem, | ||
double | disp_mal, | ||
double | disp_fem | ||
) |
References _DispMatrix, _npatch, _prefix, TMatrix::assign(), error(), FEM, TMatrix::get(), SimComponent::get_parameter_value(), MAL, TMatrix::set(), setLatticeAbsorbingMatrix(), setLatticeReflectingMatrix(), and setLatticeTorrusMatrix().
Referenced by setLatticeMatrix().
bool LCE_Disperse_base::setDispMatrix | ( | ) |
References _DispMatrix, _isForward, checkBackwardDispersalMatrix(), checkForwardDispersalMatrix(), error(), FEM, getDispersalModel(), MAL, setIsland_MigrantPool_Matrix(), setIsland_PropagulePool_Matrix(), setLatticeMatrix(), setReducedDispMatrix(), and setSteppingStone1DMatrix().
Referenced by setBaseParameters(), and updateDispMatrix().
void LCE_Disperse_base::setIndentityDispMatrix | ( | TMatrix * | mat | ) |
References _npatch, TMatrix::assign(), TMatrix::reset(), and TMatrix::set().
Referenced by setBaseParameters().
bool LCE_Disperse_base::setIsland_MigrantPool_Matrix | ( | ) |
References _DispMatrix, _fem_rate, _mal_rate, _npatch, allocateDispMatrix(), FEM, MAL, and TMatrix::set().
Referenced by setDispMatrix().
bool LCE_Disperse_base::setIsland_PropagulePool_Matrix | ( | ) |
References _DispMatrix, _fem_rate, _mal_rate, _npatch, SimComponent::_paramSet, _prefix, allocateDispMatrix(), error(), FEM, getPropaguleProb(), getPropaguleTarget(), ParamSet::isSet(), MAL, TMatrix::set(), and setPropaguleTargets().
Referenced by LCE_Breed_Selection_Disperse::breed_selection_disperse_propagule(), LCE_Breed_Disperse::do_breed_disperse_propagule(), LCE_Disperse_ConstDisp::Migrate_propagule(), and setDispMatrix().
bool LCE_Disperse_base::setLatticeAbsorbingMatrix | ( | ) |
References _DispMatrix, _isForward, _npatch, FEM, TMatrix::get(), MAL, TMatrix::plus(), and TMatrix::set().
Referenced by setBasicLatticeMatrix().
bool LCE_Disperse_base::setLatticeMatrix | ( | ) |
Sets the dispersal matrices for the Lattice dispersal model.
Each matrix has 'patch number' x 'patch number' cells unless the lattice model is the absorbing boundaries model where we add the sink patch.
The "dispersal_lattice_range" parameter defines the number of neighbouring patches to disperse into. Option 1 sets this number to 4 (left and right, up and down patches) whereas option 2 allows to disperse to the 8 neighbouring patches, including the patches on the diagonals.
References _fem_rate, _mal_rate, _npatch, SimComponent::_paramSet, _prefix, allocateDispMatrix(), error(), FEM, SimComponent::get_parameter_value(), ParamSet::getValue(), ParamSet::isSet(), MAL, message(), and setBasicLatticeMatrix().
Referenced by setDispMatrix(), and LCE_Disperse_EvolDisp::setParameters().
References _DispMatrix, _isForward, _npatch, FEM, TMatrix::get(), MAL, TMatrix::rowSum(), TMatrix::set(), and TMatrix::transpose().
Referenced by setBasicLatticeMatrix().
bool LCE_Disperse_base::setLatticeTorrusMatrix | ( | int | rows, |
int | cols, | ||
double | disp_mal, | ||
double | disp_fem, | ||
TMatrix * | grid | ||
) |
References _DispMatrix, _prefix, FEM, TMatrix::get(), SimComponent::get_parameter_value(), MAL, and TMatrix::set().
Referenced by setBasicLatticeMatrix().
|
inline |
void LCE_Disperse_base::setPropaguleTargets | ( | ) |
References LifeCycleEvent::_popPtr, _PropaguleTargets, Metapop::getPatchNbr(), and RAND::Uniform().
Referenced by LCE_Disperse_EvolDisp::execute(), and setIsland_PropagulePool_Matrix().
bool LCE_Disperse_base::setReducedDispMatrix | ( | ) |
The reduced dispersal matrix contains the indices of the patches to which each patch is connected.
The connected patches are further ordered in descending order of the migration rates. The migration rates are stored in a reduced dispersal matrix. The original dispersal matrices are cleared (de-allocated). This offers a double speed-up compared to the classical method.
References _DispMatrix, _isForward, _npatch, _prefix, _reducedDispMat, _reducedDispMatProba, FEM, SimComponent::get_parameter_value(), MAL, message(), and TMatrix::show_up().
Referenced by setBaseParameters(), setDispMatrix(), and LCE_Disperse_EvolDisp::setParameters().
References _isByNumber, _npatch, _reducedDispMat, _reducedDispMatProba, error(), FEM, and Param::getVariableMatrix().
Referenced by setBaseParameters().
bool LCE_Disperse_base::setSteppingStone1DMatrix | ( | ) |
References _DispMatrix, _fem_rate, _isForward, _mal_rate, _npatch, _prefix, allocateDispMatrix(), TMatrix::assign(), FEM, SimComponent::get_parameter_value(), MAL, message(), TMatrix::set(), and TMatrix::transpose().
Referenced by setDispMatrix().
void LCE_Disperse_base::swapPostDisp | ( | ) |
References _npatch, LifeCycleEvent::_popPtr, FEM, Metapop::getPatch(), MAL, OFFSx, PDISPx, and Patch::swap().
Referenced by LCE_Disperse_EvolDisp::execute(), and LCE_Disperse_ConstDisp::Migrate().
bool LCE_Disperse_base::updateDispMatrix | ( | ) |
References error(), getDispersalModel(), and setDispMatrix().
Referenced by LCE_Breed_Disperse::execute(), LCE_Breed_Selection_Disperse::execute(), and LCE_Disperse_ConstDisp::execute().
|
friend |
|
friend |
|
private |
Referenced by getDispersalModel(), setBaseParameters(), and LCE_Disperse_EvolDisp::setParameters().
|
private |
Referenced by getPropaguleProb(), setBaseParameters(), and LCE_Disperse_EvolDisp::setParameters().
|
private |
The sex-specific dispersal matrices, [0] for males, [1] for females, might be used as connectivity matrix as well.
Referenced by allocateDispMatrix(), LCE_Disperse_base(), setBaseParameters(), setBasicLatticeMatrix(), setDispMatrix(), setIsland_MigrantPool_Matrix(), setIsland_PropagulePool_Matrix(), setLatticeAbsorbingMatrix(), setLatticeReflectingMatrix(), setLatticeTorrusMatrix(), setReducedDispMatrix(), setSteppingStone1DMatrix(), and ~LCE_Disperse_base().
|
private |
|
private |
Referenced by isByNumber(), setBaseParameters(), and setReducedMatricesBySex().
|
private |
|
private |
|
protected |
Number of patches in the population.
Referenced by LCE_Disperse_EvolDisp::evoldisp(), LCE_Breed_Disperse::execute(), LCE_Breed_Selection_Disperse::execute(), LCE_Disperse_ConstDisp::execute(), LCE_Disperse_EvolDisp::execute(), LCE_Disperse_EvolDisp::fixdisp(), LCE_Disperse_ConstDisp::Migrate(), LCE_Disperse_EvolDisp::Migrate_Island(), LCE_Disperse_EvolDisp::Migrate_Island_Propagule(), LCE_Disperse_EvolDisp::Migrate_SteppingStone1D(), LCE_Disperse_ConstDisp::MigratePatch(), LCE_Disperse_ConstDisp::MigratePatch_AbsorbingBorder(), LCE_Disperse_ConstDisp::MigratePatchByNumber(), reset_counters(), setBaseParameters(), setBasicLatticeMatrix(), setIndentityDispMatrix(), setIsland_MigrantPool_Matrix(), setIsland_PropagulePool_Matrix(), setLatticeAbsorbingMatrix(), setLatticeMatrix(), setLatticeReflectingMatrix(), LCE_Disperse_EvolDisp::setParameters(), setReducedDispMatrix(), setReducedMatricesBySex(), setSteppingStone1DMatrix(), and swapPostDisp().
|
private |
Parameter name prefix (dispersal, seed_disp, breed_disp, etc.)
Referenced by setBaseParameters(), setBasicLatticeMatrix(), setIsland_PropagulePool_Matrix(), setLatticeMatrix(), setLatticeTorrusMatrix(), LCE_Disperse_EvolDisp::setParameters(), setParamPrefix(), setReducedDispMatrix(), and setSteppingStone1DMatrix().
|
private |
Referenced by getPropaguleTarget(), and setPropaguleTargets().
|
protected |
Matrix containing the indexes of the patches connected to each patch.
Has npatch rows, varying number of columns per row.
Referenced by getMigrationPatchBackward(), getMigrationPatchForward(), LCE_Disperse_EvolDisp::Migrate_Lattice(), LCE_Disperse_ConstDisp::MigratePatchByNumber(), setBaseParameters(), LCE_Disperse_EvolDisp::setParameters(), setReducedDispMatrix(), and setReducedMatricesBySex().
|
protected |
Matrix containing the probability to migrate to/from the connected patches.
Mirror the _reducedDispMat.
Referenced by getMigrationPatchBackward(), getMigrationPatchForward(), LCE_Disperse_ConstDisp::MigratePatchByNumber(), setBaseParameters(), setReducedDispMatrix(), and setReducedMatricesBySex().