Nemo  2.3.46
LCE_Disperse_ConstDisp Class Reference

Dispersal event with constant dispersal rates. More...

#include <LCEdisperse.h>

+ Inheritance diagram for LCE_Disperse_ConstDisp:
+ Collaboration diagram for LCE_Disperse_ConstDisp:

Public Member Functions

 LCE_Disperse_ConstDisp ()
 
virtual ~LCE_Disperse_ConstDisp ()
 
bool setParameters (string prefix)
 
void Migrate ()
 
void Migrate_propagule ()
 
void MigratePatch (sex_t SEX, unsigned int LocalPatch)
 
void MigratePatch_AbsorbingBorder (sex_t SEX, unsigned int LocalPatch)
 
Implementations
virtual bool setParameters ()
 
virtual void execute ()
 
virtual LifeCycleEventclone ()
 
- Public Member Functions inherited from LCE_Disperse_base
 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)
 
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 ()
 
void set_isForward (bool val)
 
bool checkForwardDispersalMatrix (TMatrix *mat)
 
bool checkBackwardDispersalMatrix (TMatrix *mat)
 
void allocateDispMatrix (sex_t sex, unsigned int dim)
 
bool setDispMatrix ()
 
bool setReducedDispMatrix ()
 The reduced dispersal matrix contains the indices of the patches to which each patch is connected. More...
 
bool updateDispMatrix ()
 
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 side, double phi_mal, double phi_fem, double disp_mal, double disp_fem)
 
bool setLatticeTorrusMatrix (int side, double disp_mal, double disp_fem, TMatrix *grid)
 
bool setLatticeAbsorbingMatrix ()
 
bool setLatticeReflectingMatrix (int side, TMatrix *grid)
 
unsigned int getDispersalModel ()
 
double getPropaguleProb ()
 
unsigned int getPropaguleTarget (unsigned int home)
 
virtual void loadFileServices (FileServices *loader)
 
virtual void loadStatServices (StatServices *loader)
 
virtual age_t removeAgeClass ()
 
virtual age_t addAgeClass ()
 
virtual age_t requiredAgeClass ()
 
- Public Member Functions inherited from LifeCycleEvent
 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 Metapopget_pop_ptr ()
 
- Public Member Functions inherited from SimComponent
 SimComponent ()
 
virtual ~SimComponent ()
 
virtual void loadUpdaters (UpdaterServices *loader)
 Loads the parameters and component updater onto the updater manager. 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 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...
 

Private Attributes

void(LCE_Disperse_ConstDisp::* doMigration )(void)
 
void(LCE_Disperse_ConstDisp::* doPatchMigration )(sex_t SEX, unsigned int local_patch)
 

Additional Inherited Members

- Protected Attributes inherited from LCE_Disperse_base
unsigned int _npatch
 
- Protected Attributes inherited from LifeCycleEvent
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...
 
- Protected Attributes inherited from SimComponent
ParamSet_paramSet
 The parameters container. More...
 

Detailed Description

Dispersal event with constant dispersal rates.

Sets and uses the dispersal matrices according to the dispersal model chosen. Dispersal models implemented so far are:

  • 1: Island Model with migrant pool
  • 2: Island Model with propagule pool
  • 3: Stepping stone model in 1 dimension (ring population)
  • 4: Lattice model (stepping stone in 2D)

Constructor & Destructor Documentation

LCE_Disperse_ConstDisp::LCE_Disperse_ConstDisp ( )

References LCE_Disperse_base::addParameters(), and setParameters().

Referenced by clone().

1145 : LifeCycleEvent ("disperse",""), doMigration(0), doPatchMigration(0)
1146 {
1147 
1150 
1151  LCE_Disperse_base::addParameters("dispersal", updater);
1152 }
void(LCE_Disperse_ConstDisp::* doMigration)(void)
Definition: LCEdisperse.h:126
Implementation of the ParamUpdaterBase interface.
Definition: param.h:348
LifeCycleEvent(const char *name, const char *trait_link)
Cstor.
Definition: lifecycleevent.h:98
void addParameters(string prefix, ParamUpdaterBase *updater)
Definition: LCEdisperse.cc:62
virtual bool setParameters()
Definition: LCEdisperse.h:143
void(LCE_Disperse_ConstDisp::* doPatchMigration)(sex_t SEX, unsigned int local_patch)
Definition: LCEdisperse.h:127
virtual LCE_Disperse_ConstDisp::~LCE_Disperse_ConstDisp ( )
inlinevirtual
132 {}

Member Function Documentation

virtual LifeCycleEvent* LCE_Disperse_ConstDisp::clone ( )
inlinevirtual

Implements LifeCycleEvent.

Reimplemented in LCE_SeedDisp.

References LCE_Disperse_ConstDisp().

145 {return new LCE_Disperse_ConstDisp();}
LCE_Disperse_ConstDisp()
Definition: LCEdisperse.cc:1144
void LCE_Disperse_ConstDisp::execute ( )
virtual

Implements LifeCycleEvent.

References LCE_Disperse_base::_npatch, LifeCycleEvent::_popPtr, ADULTS, doMigration, fatal(), Metapop::getPatch(), Metapop::getPatchNbr(), message(), Patch::nbEmigrant, OFFSPRG, LCE_Disperse_base::reset_counters(), Metapop::size(), and LCE_Disperse_base::updateDispMatrix().

1194 {
1195 #ifdef _DEBUG_
1196  message("LCE_Disperse_ConstDisp::execute (Patch nb: %i offsprg nb: %i adlt nb: %i "
1198 #endif
1199  //check wether the number of patches changed during simulation:
1200  if(_npatch != _popPtr->getPatchNbr()) {
1202  if(!updateDispMatrix()) fatal("bailing out\n");
1203  }
1204 
1205  reset_counters();
1206 
1207  (this->*doMigration)();
1208 
1209 #ifdef _DEBUG_
1210  unsigned int c = 0;
1211  for(unsigned int i = 0; i < _npatch; i++)
1212  c += _popPtr->getPatch(i)->nbEmigrant;
1213  message("emigrants nb: %i)\n",c);
1214 #endif
1215 }
void(LCE_Disperse_ConstDisp::* doMigration)(void)
Definition: LCEdisperse.h:126
void message(const char *message,...)
Definition: output.cc:40
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
void reset_counters()
Definition: LCEdisperse.cc:290
void fatal(const char *str,...)
Definition: output.cc:90
bool updateDispMatrix()
Definition: LCEdisperse.cc:265
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int _npatch
Definition: LCEdisperse.h:60
unsigned int getPatchNbr()
Definition: metapop.h:270
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81
unsigned short nbEmigrant
Definition: metapop.h:444
void LCE_Disperse_ConstDisp::Migrate ( )

References LCE_Disperse_base::_npatch, LifeCycleEvent::_popPtr, doPatchMigration, FEM, Patch::get_isExtinct(), Metapop::getPatch(), MAL, Patch::nbKolonisers, PDISPx, Patch::size(), and LCE_Disperse_base::swapPostDisp().

Referenced by Migrate_propagule(), and setParameters().

1220 {
1221  Patch *patch;
1222 
1223  for(unsigned int i = 0; i < _npatch; i++) {
1224 
1225  patch = _popPtr->getPatch(i);
1226 
1227  (this->*doPatchMigration)(FEM, i);
1228 
1229  (this->*doPatchMigration)(MAL, i);
1230 
1231  //set coloniser counter
1232  if(patch->get_isExtinct())
1233  patch->nbKolonisers = patch->size(PDISPx);
1234  else
1235  patch->nbKolonisers = -1; //value used in stat_demo to check for colonization
1236 
1237  }//end for nb_patch
1238 
1239  //put back the indviduals into the offspring container
1240  swapPostDisp();
1241 }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int _npatch
Definition: LCEdisperse.h:60
bool get_isExtinct()
Definition: metapop.h:475
void swapPostDisp()
Definition: LCEdisperse.cc:277
Definition: types.h:37
void(LCE_Disperse_ConstDisp::* doPatchMigration)(sex_t SEX, unsigned int local_patch)
Definition: LCEdisperse.h:127
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81
Definition: types.h:37
short nbKolonisers
Definition: metapop.h:445
Definition: types.h:42
void LCE_Disperse_ConstDisp::Migrate_propagule ( )

References Migrate(), and LCE_Disperse_base::setIsland_PropagulePool_Matrix().

Referenced by setParameters().

1246 {
1248  Migrate();
1249 }
void Migrate()
Definition: LCEdisperse.cc:1219
bool setIsland_PropagulePool_Matrix()
Definition: LCEdisperse.cc:469
void LCE_Disperse_ConstDisp::MigratePatch ( sex_t  SEX,
unsigned int  LocalPatch 
)

References LCE_Disperse_base::_npatch, LifeCycleEvent::_popPtr, LCE_Disperse_base::getMigrationPatchForward(), Metapop::getPatch(), Metapop::move(), Patch::nbEmigrant, Patch::nbImigrant, Patch::nbPhilopat, OFFSx, PDISPx, and Patch::size().

Referenced by setParameters().

1254 {
1255  Patch* patch = _popPtr->getPatch(LocalPatch);
1256  unsigned int AimedPatch;
1257  unsigned int Limit = _npatch -1;
1258 
1259  while( patch->size(SEX, OFFSx) != 0 ) {
1260 
1261  do{
1262  AimedPatch = getMigrationPatchForward(SEX, LocalPatch);
1263  }while ( AimedPatch > Limit );
1264 
1265  _popPtr->move(SEX, OFFSx, LocalPatch, PDISPx, AimedPatch, 0);
1266 
1267  if(LocalPatch != AimedPatch) {
1268  patch->nbEmigrant++;
1269  _popPtr->getPatch(AimedPatch)->nbImigrant++;
1270  } else
1271  patch->nbPhilopat++;
1272 
1273  }//end while
1274 }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned short nbImigrant
Definition: metapop.h:444
unsigned int _npatch
Definition: LCEdisperse.h:60
void move(sex_t SEX, age_idx from_age, unsigned int from_deme, age_idx to_age, unsigned int to_deme, unsigned int at)
Moves an individual from a deme to an other one, both demes sizes are modified.
Definition: metapop.h:786
Definition: types.h:42
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81
unsigned short nbPhilopat
Definition: metapop.h:444
unsigned short nbEmigrant
Definition: metapop.h:444
Definition: types.h:42
unsigned int getMigrationPatchForward(sex_t SEX, unsigned int LocalPatch)
Definition: LCEdisperse.cc:1102
void LCE_Disperse_ConstDisp::MigratePatch_AbsorbingBorder ( sex_t  SEX,
unsigned int  LocalPatch 
)

References LCE_Disperse_base::_npatch, LifeCycleEvent::_popPtr, Patch::get(), LCE_Disperse_base::getMigrationPatchForward(), Metapop::getPatch(), Metapop::move(), Patch::nbEmigrant, Patch::nbImigrant, Patch::nbPhilopat, OFFSx, PDISPx, IndFactory::recycle(), Patch::remove(), and Patch::size().

Referenced by setParameters().

1279 {
1280  Patch* patch = _popPtr->getPatch(LocalPatch);
1281  unsigned int AimedPatch;
1282 
1283  while( patch->size(SEX, OFFSx) != 0 ) {
1284 
1285  do{
1286  AimedPatch = getMigrationPatchForward(SEX, LocalPatch);
1287  }while ( AimedPatch > _npatch );
1288 
1289  if(AimedPatch == _npatch) {
1290  _popPtr->recycle( patch->get(SEX, OFFSx, 0) );
1291  patch->remove(SEX, OFFSx, 0);
1292  } else
1293  _popPtr->move(SEX, OFFSx, LocalPatch, PDISPx, AimedPatch, 0);
1294 
1295  if(LocalPatch != AimedPatch) {
1296  patch->nbEmigrant++;
1297  if(AimedPatch < _npatch)
1298  _popPtr->getPatch(AimedPatch)->nbImigrant++;
1299  } else
1300  patch->nbPhilopat++;
1301 
1302  }//end while
1303 }
void recycle(Individual *ind)
Put an individual in the recycling pool.
Definition: indfactory.h:62
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Individual * remove(sex_t SEX, age_idx AGE, unsigned int at)
Removes the individual sitting at the given index in the appropriate container.
Definition: metapop.h:564
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned short nbImigrant
Definition: metapop.h:444
unsigned int _npatch
Definition: LCEdisperse.h:60
void move(sex_t SEX, age_idx from_age, unsigned int from_deme, age_idx to_age, unsigned int to_deme, unsigned int at)
Moves an individual from a deme to an other one, both demes sizes are modified.
Definition: metapop.h:786
Definition: types.h:42
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81
unsigned short nbPhilopat
Definition: metapop.h:444
unsigned short nbEmigrant
Definition: metapop.h:444
Definition: types.h:42
unsigned int getMigrationPatchForward(sex_t SEX, unsigned int LocalPatch)
Definition: LCEdisperse.cc:1102
bool LCE_Disperse_ConstDisp::setParameters ( string  prefix)

References doMigration, doPatchMigration, error(), SimComponent::get_parameter_value(), LCE_Disperse_base::getDispersalModel(), Migrate(), Migrate_propagule(), MigratePatch(), MigratePatch_AbsorbingBorder(), and LCE_Disperse_base::setBaseParameters().

1157 {
1158 
1159  if(!LCE_Disperse_base::setBaseParameters(prefix)) return false;
1160 
1161  switch ( getDispersalModel() ) {
1162  case 0: //dispersal matrix given in input
1163  case 1:
1164  case 3:
1165  case 4:
1167  break;
1168  case 2:
1170  break;
1171  default:
1172  return error("\nDispersal model '%i' not yet implemented\n",getDispersalModel());
1173  }
1174 
1175  switch ((int)get_parameter_value(prefix + "_border_model")) {
1176  case -1:
1177  case 1:
1178  case 2:
1180  break;
1181  case 3:
1183  break;
1184  default:
1185  return error("\nDispersal border model '%i' not yet implemented\n",
1186  (int)get_parameter_value(prefix + "_border_model"));
1187  }
1188  return true;
1189 }
unsigned int getDispersalModel()
Definition: LCEdisperse.h:98
void(LCE_Disperse_ConstDisp::* doMigration)(void)
Definition: LCEdisperse.h:126
void Migrate()
Definition: LCEdisperse.cc:1219
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:143
bool setBaseParameters(string prefix)
Definition: LCEdisperse.cc:81
int error(const char *str,...)
Definition: output.cc:73
void MigratePatch(sex_t SEX, unsigned int LocalPatch)
Definition: LCEdisperse.cc:1253
void(LCE_Disperse_ConstDisp::* doPatchMigration)(sex_t SEX, unsigned int local_patch)
Definition: LCEdisperse.h:127
void Migrate_propagule()
Definition: LCEdisperse.cc:1245
void MigratePatch_AbsorbingBorder(sex_t SEX, unsigned int LocalPatch)
Definition: LCEdisperse.cc:1278
virtual bool LCE_Disperse_ConstDisp::setParameters ( )
inlinevirtual

Implements SimComponent.

Reimplemented in LCE_SeedDisp.

References setParameters().

Referenced by LCE_Disperse_ConstDisp(), setParameters(), and LCE_SeedDisp::setParameters().

143 {return setParameters("dispersal");}
virtual bool setParameters()
Definition: LCEdisperse.h:143

Member Data Documentation

void(LCE_Disperse_ConstDisp::* LCE_Disperse_ConstDisp::doMigration)(void)
private

Referenced by execute(), and setParameters().

void(LCE_Disperse_ConstDisp::* LCE_Disperse_ConstDisp::doPatchMigration)(sex_t SEX, unsigned int local_patch)
private

Referenced by Migrate(), and setParameters().


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

Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR