Nemo  2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
LCE_Breed_Disperse Class Reference

Performs breeding and migration in one, migration rates are backward rates. More...

#include <LCEcomposite.h>

+ Inheritance diagram for LCE_Breed_Disperse:
+ Collaboration diagram for LCE_Breed_Disperse:

Public Member Functions

 LCE_Breed_Disperse ()
 
virtual ~LCE_Breed_Disperse ()
 
void do_breed_disperse ()
 
void do_breed_disperse_propagule ()
 
unsigned int numFemOffspring (Patch *patch)
 
unsigned int numFemOffspring_colonizers (Patch *patch)
 The number of females produced in case a max number of colonizers was specified. More...
 
unsigned int numMalOffspring_notrandom (Patch *patch)
 The number of males produced is always zero when the mating system is not random mating. More...
 
unsigned int numMalOffspring_random (Patch *patch)
 
unsigned int numMalOffspring_random_colonizers (Patch *patch)
 
Growth Functions
unsigned int instantGrowth (Patch *patch, sex_t SEX)
 The number of offspring produced corresponds to the carrying capacity of the patch. More...
 
unsigned int logisticGrowth (Patch *patch, sex_t SEX)
 The number of offspring produced is given by the logistic growth function. More...
 
unsigned int stochasticLogisticGrowth (Patch *patch, sex_t SEX)
 The number of offspring produced is drawn from a Poisson with mean equal to the logistic growth predicate. More...
 
unsigned int conditionalLogisticGrowth (Patch *patch, sex_t SEX)
 The number of offspring produced depends on the adult density. More...
 
unsigned int conditionalStochasticLogisticGrowth (Patch *patch, sex_t SEX)
 The number of offspring produced depends on the adult density, similar to 'conditionalLogisticGrowth' except that this time, the fecundities are drawn from Poisson distributions. More...
 
unsigned int fixedFecundityGrowth (Patch *patch, sex_t SEX)
 The number of offspring produced is equal to the carrying capacity multiplied by the mean fecundity of the focal patch. More...
 
unsigned int stochasticFecundityGrowth (Patch *patch, sex_t SEX)
 The number of offspring produced is a random number drawn from a Poisson distribution with mean equal to the carrying capacity multiplied by the mean fecundity of the focal patch. More...
 
Mating Functions
Individualmate_random (sex_t SEX, Patch *patch, unsigned int LocalPatch)
 
Individualmate_random_hermaphrodite (sex_t SEX, Patch *patch, unsigned int LocalPatch)
 
Individualmate_selfing (sex_t SEX, Patch *patch, unsigned int LocalPatch)
 
Individualmate_full_selfing (sex_t SEX, Patch *patch, unsigned int LocalPatch)
 
Individualmate_cloning (sex_t SEX, Patch *patch, unsigned int LocalPatch)
 
IndividualmakeOffspring (Individual *ind)
 
void breed_disperse (sex_t SEX, Patch *patch, unsigned int LocalPatch, unsigned int size)
 
Individualget_parent (sex_t SEX, sex_t DispSex, Patch *LocalPatch, unsigned int patchNbr)
 
Implementations
virtual bool setParameters ()
 
virtual void execute ()
 
virtual LifeCycleEventclone ()
 
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 ()
 
- Public Member Functions inherited from LCE_Breed_base
 LCE_Breed_base ()
 
virtual ~LCE_Breed_base ()
 
virtual IndividualgetFatherPtr (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Calls the mating function according to the model chosen using the function pointer, used to get the father from the mother in a patch. More...
 
void NonWrightFisherPopulation ()
 
void WrightFisherPopulation ()
 
Individualbreed (Individual *mother, Individual *father, unsigned int LocalPatch)
 Makes a new individual with the right parents. More...
 
Individualbreed_cloning (Individual *mother, Individual *father, unsigned int LocalPatch)
 Makes a new individual by doing a deep copy of the mother (copies the mother's genes into the offspring). More...
 
IndividualmakeOffspring (Individual *ind)
 Last step of the breeding process, does inheritance and mutation of the parents' genes. More...
 
Individualdo_breed (Individual *mother, Individual *father, unsigned int LocalPatch)
 Calls the breeding function unsing its pointer. More...
 
bool checkMatingCondition (Patch *thePatch)
 Checks if any mating will take place in the patch passed as argument. More...
 
bool checkNoSelfing (Patch *thePatch)
 Checks whether mating will take place in the current patch when mating is not selfing or cloning. More...
 
bool checkPolygyny (Patch *thePatch)
 Checks whether mating will take place in the current patch when mating is polygynous. More...
 
bool checkSelfing (Patch *thePatch)
 Checks whether mating will take place in the current patch when mating is selfing. More...
 
bool checkCloning (Patch *thePatch)
 Checks whether mating will take place in the current patch when mating is cloning. More...
 
bool setMatingSystem ()
 
bool setFecundity ()
 
bool setSexRatio ()
 
double getMatingProportion ()
 
double getMeanFecundity (unsigned int patch)
 
int getMatingSystem ()
 
bool doInheritance ()
 
double getPoissonFecundity (double mean)
 
double getFixedFecundity (double mean)
 
double getGaussianFecundity (double mean)
 
double getLogNormalFecundity (double mean)
 
double getFecundity (unsigned int patch)
 
double getFecundity (double mean)
 
sex_t getOffsprgSex ()
 
sex_t getOffsprgSexRandom ()
 
sex_t getOffsprgSexFixed ()
 
sex_t getOffsprgSexSelfing ()
 
sex_t getOffsprgSexCloning ()
 
IndividualRandomMating (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male drawn randomly from a patch. More...
 
IndividualfullPolyginy (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to the alpha male of the patch. More...
 
IndividualfullPolyginy_manyMales (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to one of the first _mating_males males of the patch. More...
 
IndividualpartialPolyginy (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male from a patch chosen at random if _mating_proportion != 1, or the first male otherwise. More...
 
IndividualpartialPolyginy_manyMales (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male from a patch chosen at random if _mating_proportion != 1, or one of the _mating_males first males otherwise. More...
 
IndividualfullMonoginy (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male with same index as mother (if available) from the focal patch. More...
 
IndividualpartialMonoginy (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male with same index as mother (if available) from the focal patch. More...
 
IndividualfullSelfing (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns the mother pointer. More...
 
IndividualpartialSelfing (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns the mother pointer or a random female if _mating_proportion != 1. More...
 
Individualrandom_hermaphrodite (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a random female from the patch, will be the same mother with probability 1/N (Wright-Fisher model). More...
 
- 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...
 
virtual bool has_parameter (std::string name)
 Param getter. More...
 
- 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)
 
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 ()
 
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)
 
bool isForward ()
 
bool isByNumber ()
 
unsigned int getDispersalModel ()
 
double getPropaguleProb ()
 
unsigned int getPropaguleTarget (unsigned int home)
 

Protected Attributes

Individual *(LCE_Breed_Disperse::* _make_offspring )(sex_t SEX, Patch *patch, unsigned int LocalPatch)
 
unsigned int(LCE_Breed_Disperse::* _get_numFemOffspring )(Patch *patch)
 
unsigned int(LCE_Breed_Disperse::* _get_numMalOffspring )(Patch *patch)
 
unsigned int(LCE_Breed_Disperse::* _get_patchFecundity )(Patch *patch, sex_t SEX)
 
- Protected Attributes inherited from LCE_Breed_base
void(LCE_Breed_base::* PopModelFuncPtr )(void)
 
TMatrix _mean_fecundity
 
- 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...
 
- Protected Attributes inherited from LCE_Disperse_base
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...
 

Private Attributes

void(LCE_Breed_Disperse::* _breed_disperse )()
 
int _num_colonizers
 Maximum size of a patch after colonisation. More...
 
sex_t _dispersing_sex
 Which part of the population is dispersing its gametes. More...
 
double * _growthRates
 Patch-specific growth rates. More...
 

Detailed Description

Performs breeding and migration in one, migration rates are backward rates.

Inherits parameters from LCE_Breed_base and LCE_Disperse_base. Population size is constant, There is no demographic stochasticity with this LCE. The number of colonizers of extinct patches can be set differently from the patch carrying capacities.

Constructor & Destructor Documentation

◆ LCE_Breed_Disperse()

LCE_Breed_Disperse::LCE_Breed_Disperse ( )
44 : LifeCycleEvent("breed_disperse",""),_breed_disperse(0),
47{
49
50 LCE_Disperse_base::addParameters("breed_disperse", updater);
51
52 add_parameter("breed_disperse_dispersing_sex", STR, false, false, 0, 0, updater);
53 add_parameter("breed_disperse_colonizers", INT,false,false,0,0, updater);
54 add_parameter("breed_disperse_growth_model", INT, false, true, 1, 7, updater);
55 add_parameter("breed_disperse_growth_rate", DBL, false, false, 0, 0, updater);
56}
unsigned int(LCE_Breed_Disperse::* _get_numMalOffspring)(Patch *patch)
Definition: LCEcomposite.h:61
sex_t _dispersing_sex
Which part of the population is dispersing its gametes.
Definition: LCEcomposite.h:53
unsigned int(LCE_Breed_Disperse::* _get_patchFecundity)(Patch *patch, sex_t SEX)
Definition: LCEcomposite.h:62
double * _growthRates
Patch-specific growth rates.
Definition: LCEcomposite.h:56
void(LCE_Breed_Disperse::* _breed_disperse)()
Definition: LCEcomposite.h:47
Individual *(LCE_Breed_Disperse::* _make_offspring)(sex_t SEX, Patch *patch, unsigned int LocalPatch)
Definition: LCEcomposite.h:59
int _num_colonizers
Maximum size of a patch after colonisation.
Definition: LCEcomposite.h:50
virtual bool setParameters()
Definition: LCEcomposite.cc:60
unsigned int(LCE_Breed_Disperse::* _get_numFemOffspring)(Patch *patch)
Definition: LCEcomposite.h:60
void addParameters(string prefix, ParamUpdaterBase *updater)
Definition: LCEdisperse.cc:62
Base class of the Life Cycle Events, declares the LCE interface.
Definition: lifecycleevent.h:73
Implementation of the ParamUpdaterBase interface.
Definition: param.h:363
virtual void add_parameter(Param *param)
Interface to add a parameter to the set.
Definition: simcomponent.h:112
@ FEM
Definition: types.h:37
@ DBL
Definition: types.h:78
@ STR
Definition: types.h:78
@ INT
Definition: types.h:78

References SimComponent::add_parameter(), LCE_Disperse_base::addParameters(), DBL, INT, setParameters(), and STR.

Referenced by clone().

+ Here is the caller graph for this function:

◆ ~LCE_Breed_Disperse()

virtual LCE_Breed_Disperse::~LCE_Breed_Disperse ( )
inlinevirtual
68{if(_growthRates) delete [] _growthRates;}

References _growthRates.

Member Function Documentation

◆ addAgeClass()

virtual age_t LCE_Breed_Disperse::addAgeClass ( )
inlinevirtual

Reimplemented from LCE_Disperse_base.

Reimplemented in LCE_Breed_Selection_Disperse.

203{return OFFSPRG;}
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50

References OFFSPRG.

◆ breed_disperse()

void LCE_Breed_Disperse::breed_disperse ( sex_t  SEX,
Patch patch,
unsigned int  LocalPatch,
unsigned int  size 
)

◆ clone()

virtual LifeCycleEvent * LCE_Breed_Disperse::clone ( )
inlinevirtual

Implements LifeCycleEvent.

Reimplemented in LCE_Breed_Selection_Disperse.

198{return new LCE_Breed_Disperse();}
LCE_Breed_Disperse()
Definition: LCEcomposite.cc:44

References LCE_Breed_Disperse().

◆ conditionalLogisticGrowth()

unsigned int LCE_Breed_Disperse::conditionalLogisticGrowth ( Patch patch,
sex_t  SEX 
)
inline

The number of offspring produced depends on the adult density.

A minimum number of offspring is produced when less than half of the carrying capacity of adults is present. It is logistic otherwise.

149 {
150 if (patch->size(SEX, ADLTx) < patch->get_K(SEX)/2) {
151 return fixedFecundityGrowth(patch, SEX);
152 } else {
153 return logisticGrowth(patch, SEX);
154 }
155 }
unsigned int fixedFecundityGrowth(Patch *patch, sex_t SEX)
The number of offspring produced is equal to the carrying capacity multiplied by the mean fecundity o...
Definition: LCEcomposite.h:168
unsigned int logisticGrowth(Patch *patch, sex_t SEX)
The number of offspring produced is given by the logistic growth function.
Definition: LCEcomposite.h:131
unsigned int get_K()
Definition: metapop.h:479
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:496
@ ADLTx
Definition: types.h:42

References ADLTx, fixedFecundityGrowth(), Patch::get_K(), logisticGrowth(), and Patch::size().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ conditionalStochasticLogisticGrowth()

unsigned int LCE_Breed_Disperse::conditionalStochasticLogisticGrowth ( Patch patch,
sex_t  SEX 
)
inline

The number of offspring produced depends on the adult density, similar to 'conditionalLogisticGrowth' except that this time, the fecundities are drawn from Poisson distributions.

159 {
160 if (patch->size(SEX, ADLTx) < patch->get_K(SEX)/2) {
161 return stochasticFecundityGrowth(patch, SEX);
162 } else {
163 return stochasticLogisticGrowth(patch, SEX);
164 }
165 }
unsigned int stochasticFecundityGrowth(Patch *patch, sex_t SEX)
The number of offspring produced is a random number drawn from a Poisson distribution with mean equal...
Definition: LCEcomposite.h:174
unsigned int stochasticLogisticGrowth(Patch *patch, sex_t SEX)
The number of offspring produced is drawn from a Poisson with mean equal to the logistic growth predi...
Definition: LCEcomposite.h:142

References ADLTx, Patch::get_K(), Patch::size(), stochasticFecundityGrowth(), and stochasticLogisticGrowth().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ do_breed_disperse()

void LCE_Breed_Disperse::do_breed_disperse ( )
242{
243 Patch* patch;
244 unsigned int nfem, nmal;
245
246 for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
247
248 patch = _popPtr->getPatch(i);
249
250 if(patch->size(OFFSx) != 0) patch->flush(OFFSx, _popPtr);
251
252 nfem = (this->* _get_numFemOffspring)(patch);
253 nmal = (this->* _get_numMalOffspring)(patch);
254
255 for(unsigned int j = 0; j < nfem; j++)
256 patch->add(FEM, OFFSx,
258 );
259
260 //the colonizer counter must be set now, not in get_parent(),
261 //otherwise colonizers will be counted twice, once per parent
262 if(patch->size(ADULTS) == 0) patch->nbKolonisers += nfem;
263
264 for(unsigned int j = 0; j < nmal; j++)
265 patch->add(MAL, OFFSx,
267 );
268
269 if(patch->size(ADULTS) == 0) patch->nbKolonisers += nmal;
270 }
271}
Individual * makeOffspring(Individual *ind)
Last step of the breeding process, does inheritance and mutation of the parents' genes.
Definition: LCEbreed.cc:407
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81
unsigned int getPatchNbr()
Definition: metapop.h:276
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:257
Second class in the metapopulation design structure, between the Metapop and Individual classes.
Definition: metapop.h:430
void add(sex_t SEX, age_idx AGE, Individual *ind)
Adds an individual to the appropriate container, increments its size, eventually resizing it.
Definition: metapop.h:549
void flush(sex_t SEX, age_idx AGE, Metapop *pop)
Removes all individual pointers of the appropriate sex and age class and flush them into the recyclin...
Definition: metapop.h:643
@ MAL
Definition: types.h:37
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
@ OFFSx
Definition: types.h:42

References _get_numFemOffspring, _get_numMalOffspring, _make_offspring, LifeCycleEvent::_popPtr, Patch::add(), ADULTS, FEM, Patch::flush(), Metapop::getPatch(), Metapop::getPatchNbr(), LCE_Breed_base::makeOffspring(), MAL, OFFSx, and Patch::size().

Referenced by do_breed_disperse_propagule(), and setParameters().

+ Here is the caller graph for this function:

◆ do_breed_disperse_propagule()

void LCE_Breed_Disperse::do_breed_disperse_propagule ( )
276{
279}
void do_breed_disperse()
Definition: LCEcomposite.cc:241
bool setIsland_PropagulePool_Matrix()
Definition: LCEdisperse.cc:567

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

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ execute()

void LCE_Breed_Disperse::execute ( )
virtual

Implements LifeCycleEvent.

Reimplemented in LCE_Breed_Selection_Disperse.

213{
214#ifdef _DEBUG_
215 message("LCE_Breed_Disperse::execute (Patch nb: %i offsprg nb: %i adlt nb: %i "
217#endif
218
219 if(_npatch != _popPtr->getPatchNbr()) {
221 if(!updateDispMatrix()) fatal("bailing out\n");
222 }
223
225
226 (this->*_breed_disperse)();
227
228#ifdef _DEBUG_
229 unsigned int a = 0, b = 0, c = 0;
230 for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i++){
231 a += _popPtr->getPatch(i)->nbEmigrant;
232 b += _popPtr->getPatch(i)->nbImigrant;
233 c += _popPtr->getPatch(i)->nbPhilopat;
234 }
235 message("immigrate: %f, emigrants: %i, imigrants: %i)\n",(double)b/(b+c), a, b);
236#endif
237}
void reset_counters()
Definition: LCEdisperse.cc:387
bool updateDispMatrix()
Definition: LCEdisperse.cc:362
unsigned int _npatch
Number of patches in the population.
Definition: LCEdisperse.h:60
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together.
Definition: metapop.h:310
unsigned short nbEmigrant
Definition: metapop.h:452
unsigned short nbPhilopat
Definition: metapop.h:452
unsigned short nbImigrant
Definition: metapop.h:452
void fatal(const char *str,...)
Definition: output.cc:96
void message(const char *message,...)
Definition: output.cc:40

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

◆ fixedFecundityGrowth()

unsigned int LCE_Breed_Disperse::fixedFecundityGrowth ( Patch patch,
sex_t  SEX 
)
inline

The number of offspring produced is equal to the carrying capacity multiplied by the mean fecundity of the focal patch.

169 {
170 return patch->get_K(SEX)*LCE_Breed_base::getMeanFecundity(patch->getID());
171 }
double getMeanFecundity(unsigned int patch)
Definition: LCEbreed.h:95
unsigned int getID()
Definition: metapop.h:478

References Patch::get_K(), Patch::getID(), and LCE_Breed_base::getMeanFecundity().

Referenced by conditionalLogisticGrowth(), and setParameters().

+ Here is the caller graph for this function:

◆ get_parent()

Individual * LCE_Breed_Disperse::get_parent ( sex_t  SEX,
sex_t  DispSex,
Patch LocalPatch,
unsigned int  patchNbr 
)
345{
346 unsigned int SourcePatch = 0;
347 Patch* src_patch;
348
349 //this algorithm does not check for the availability of migrants in connected patches
350 //it may thus hang if all connected patches are empty
351 //one work around is to impose a maximum number of trials before it abandons the search
352
353 do {
354
355 SourcePatch = LCE_Disperse_base::getMigrationPatchBackward(DispSex, LocalPatch);
356 src_patch = _popPtr->getPatchPtr(SourcePatch);
357
358
359 } while (src_patch->size( SEX, ADLTx ) == 0);
360 //redraw if source patch is empty; we don't use DispSex because it may be different from the SEX we want (e.g. DispSex = mal for pollen dispersal with hermaphrodites where SEX = fem)
361
362 //set migrant counters for the stats
363 if(LocalPatch != SourcePatch) {
364 src_patch->nbEmigrant++;
365
366 if( local_patch->size(ADLTx) != 0 ) // only count immigrants, not colonizers
367 local_patch->nbImigrant++;
368
369 } else
370 src_patch->nbPhilopat++;
371
372 //return a pointer to an individual randomly chosen from the source patch:
373 return src_patch->get(SEX, ADLTx, RAND::Uniform( src_patch->size( SEX, ADLTx ) ) );
374}
unsigned int getMigrationPatchBackward(sex_t SEX, unsigned int LocalPatch)
Definition: LCEdisperse.cc:1241
Patch * getPatchPtr(unsigned int patch)
A secure version of the getPatch() method.
Definition: metapop.h:260
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:532
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:125

References LifeCycleEvent::_popPtr, ADLTx, Patch::get(), LCE_Disperse_base::getMigrationPatchBackward(), Metapop::getPatchPtr(), Patch::nbEmigrant, Patch::nbImigrant, Patch::nbPhilopat, Patch::size(), and RAND::Uniform().

Referenced by mate_cloning(), mate_full_selfing(), mate_random(), mate_random_hermaphrodite(), and mate_selfing().

+ Here is the caller graph for this function:

◆ instantGrowth()

unsigned int LCE_Breed_Disperse::instantGrowth ( Patch patch,
sex_t  SEX 
)
inline

The number of offspring produced corresponds to the carrying capacity of the patch.

127 {
128 return patch->get_K(SEX);
129 }

References Patch::get_K().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ loadFileServices()

virtual void LCE_Breed_Disperse::loadFileServices ( FileServices loader)
inlinevirtual

Reimplemented from LCE_Disperse_base.

Reimplemented in LCE_Breed_Selection_Disperse.

199{}

◆ loadStatServices()

virtual void LCE_Breed_Disperse::loadStatServices ( StatServices loader)
inlinevirtual

Reimplemented from LCE_Disperse_base.

Reimplemented in LCE_Breed_Selection_Disperse.

200{}

◆ logisticGrowth()

unsigned int LCE_Breed_Disperse::logisticGrowth ( Patch patch,
sex_t  SEX 
)
inline

The number of offspring produced is given by the logistic growth function.

132 {
133 double K = (double)patch->get_K(SEX);
134 double r = _growthRates[ patch->getID() ];
135 double N = (double)patch->size(ADLTx);
136 if( K <= N )
137 return K;
138 else
139 return (unsigned int)ceil(N + r*N*((K-N)/K));
140 }

References _growthRates, ADLTx, Patch::get_K(), Patch::getID(), and Patch::size().

Referenced by conditionalLogisticGrowth(), setParameters(), and stochasticLogisticGrowth().

+ Here is the caller graph for this function:

◆ makeOffspring()

Individual * LCE_Breed_Disperse::makeOffspring ( Individual ind)

◆ mate_cloning()

Individual * LCE_Breed_Disperse::mate_cloning ( sex_t  SEX,
Patch patch,
unsigned int  LocalPatch 
)
336{
337 Individual *mom = get_parent(FEM, FEM, patch, LocalPatch);
338 return LCE_Breed_base::breed_cloning(mom, mom, LocalPatch);
339}
This class contains traits along with other individual information (sex, pedigree,...
Definition: individual.h:49
Individual * get_parent(sex_t SEX, sex_t DispSex, Patch *LocalPatch, unsigned int patchNbr)
Definition: LCEcomposite.cc:343
Individual * breed_cloning(Individual *mother, Individual *father, unsigned int LocalPatch)
Makes a new individual by doing a deep copy of the mother (copies the mother's genes into the offspri...
Definition: LCEbreed.cc:426

References LCE_Breed_base::breed_cloning(), FEM, and get_parent().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ mate_full_selfing()

Individual * LCE_Breed_Disperse::mate_full_selfing ( sex_t  SEX,
Patch patch,
unsigned int  LocalPatch 
)
327{
328 Individual *mom = get_parent(FEM, FEM, patch, LocalPatch);
329
330 return _popPtr->makeNewIndividual(mom, mom, FEM, LocalPatch);
331}
Individual * makeNewIndividual(Individual *mother, Individual *father, sex_t sex, unsigned short homepatch)
Creates an individual with pointers to parents, sex and home ID set but no genetic data.
Definition: indfactory.cc:152

References LifeCycleEvent::_popPtr, FEM, get_parent(), and IndFactory::makeNewIndividual().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ mate_random()

Individual * LCE_Breed_Disperse::mate_random ( sex_t  SEX,
Patch patch,
unsigned int  LocalPatch 
)
284{
285 return _popPtr->makeNewIndividual(get_parent(FEM, FEM, patch, LocalPatch),
286 get_parent(MAL, MAL, patch, LocalPatch),
287 SEX, LocalPatch);
288}

References LifeCycleEvent::_popPtr, FEM, get_parent(), IndFactory::makeNewIndividual(), and MAL.

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ mate_random_hermaphrodite()

Individual * LCE_Breed_Disperse::mate_random_hermaphrodite ( sex_t  SEX,
Patch patch,
unsigned int  LocalPatch 
)
294{
295 return _popPtr->makeNewIndividual(get_parent(FEM, FEM, patch, LocalPatch),
296 get_parent(FEM, _dispersing_sex, patch, LocalPatch),
297 FEM, LocalPatch);
298}

References _dispersing_sex, LifeCycleEvent::_popPtr, FEM, get_parent(), and IndFactory::makeNewIndividual().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ mate_selfing()

Individual * LCE_Breed_Disperse::mate_selfing ( sex_t  SEX,
Patch patch,
unsigned int  LocalPatch 
)
303{
304 Individual *mom, *dad;
305 // cout << "--- choosing mum in patch "<<LocalPatch<<" ("<<patch->size(FEM, ADLTx)<<")\n";
306 mom = get_parent(FEM, FEM, patch, LocalPatch);
307
308 // cout << "--- choosing dad \n";
309
310 if( RAND::Uniform() > this->getMatingProportion() ) {
311 //random mating
312 do{
313 dad = get_parent(FEM, _dispersing_sex, patch, LocalPatch);
314 }while(dad == mom && _popPtr->getPatchNbr() != 1 && patch->size(FEM,ADLTx) != 1);
315 } else
316 dad = mom;
317
318 // cout << "--- make offspring by crossing "<<mom->getID()<<" with "<<dad->getID()<<endl;
319
320
321 return _popPtr->makeNewIndividual(mom, dad, FEM, LocalPatch);
322}
double getMatingProportion()
Definition: LCEbreed.h:94

References _dispersing_sex, LifeCycleEvent::_popPtr, ADLTx, FEM, get_parent(), LCE_Breed_base::getMatingProportion(), Metapop::getPatchNbr(), IndFactory::makeNewIndividual(), Patch::size(), and RAND::Uniform().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ numFemOffspring()

unsigned int LCE_Breed_Disperse::numFemOffspring ( Patch patch)
inline
75 {
76 if (patch->size(FEM, ADLTx) == 0 && _dispersing_sex != FEM)//to avoid choosing a local female when there is none
77 return 0;
78 else
79 return (this->*_get_patchFecundity)(patch, FEM);
80 }

References _dispersing_sex, _get_patchFecundity, ADLTx, FEM, and Patch::size().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ numFemOffspring_colonizers()

unsigned int LCE_Breed_Disperse::numFemOffspring_colonizers ( Patch patch)
inline

The number of females produced in case a max number of colonizers was specified.

84 {
85 if(patch->get_isExtinct()) {
86 //check if only one sex sends gametes around, capturing the case of pollen dispersal
87 if(_dispersing_sex != FEM)
88 return 0;
89 else
90 return _num_colonizers;
91 } else
92 return (this->*_get_patchFecundity)(patch, FEM);
93 }
bool get_isExtinct()
Definition: metapop.h:484

References _dispersing_sex, _get_patchFecundity, _num_colonizers, FEM, and Patch::get_isExtinct().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ numMalOffspring_notrandom()

unsigned int LCE_Breed_Disperse::numMalOffspring_notrandom ( Patch patch)
inline

The number of males produced is always zero when the mating system is not random mating.

97 {
98 return 0;
99 }

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ numMalOffspring_random()

unsigned int LCE_Breed_Disperse::numMalOffspring_random ( Patch patch)
inline
102 { //return 0 if only males gametes migrate and there is no females in the patch
103 //to avoid choosing a local female when there is none
104 //(we assume it doesn't make sense to have only female gametes migrating)
105 if (patch->size(FEM, ADLTx) == 0 && _dispersing_sex != FEM)
106 return 0;
107 else
108 return (this->*_get_patchFecundity)(patch, MAL);
109 }

References _dispersing_sex, _get_patchFecundity, ADLTx, FEM, MAL, and Patch::size().

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ numMalOffspring_random_colonizers()

unsigned int LCE_Breed_Disperse::numMalOffspring_random_colonizers ( Patch patch)
inline
112 {
113 if(patch->get_isExtinct()) {
114 //check if only one sex sends gametes around, capturing the case of pollen dispersal
115 if(_dispersing_sex != FEM)
116 return 0;
117 else
118 return _num_colonizers;
119 } else
120 return (this->*_get_patchFecundity)(patch, MAL);
121 }

References _dispersing_sex, _get_patchFecundity, _num_colonizers, FEM, Patch::get_isExtinct(), and MAL.

Referenced by setParameters().

+ Here is the caller graph for this function:

◆ removeAgeClass()

virtual age_t LCE_Breed_Disperse::removeAgeClass ( )
inlinevirtual

Reimplemented from LCE_Disperse_base.

Reimplemented in LCE_Breed_Selection_Disperse.

202{return NONE;}
#define NONE
No age flag.
Definition: types.h:48

References NONE.

◆ requiredAgeClass()

virtual age_t LCE_Breed_Disperse::requiredAgeClass ( )
inlinevirtual

Reimplemented from LCE_Disperse_base.

Reimplemented in LCE_Breed_Selection_Disperse.

204{return ADULTS;}

References ADULTS.

◆ resetParameterFromSource()

virtual bool LCE_Breed_Disperse::resetParameterFromSource ( std::string  param,
SimComponent cmpt 
)
inlinevirtual

Reimplemented from LCE_Disperse_base.

Reimplemented in LCE_Breed_Selection_Disperse.

201{return false;}

◆ setParameters()

bool LCE_Breed_Disperse::setParameters ( )
virtual

Reimplemented from LCE_Breed_base.

Reimplemented in LCE_Breed_Selection_Disperse.

61{
62 if(!LCE_Breed_base::setParameters()) return false;
63
65
66 if(!LCE_Disperse_base::setBaseParameters("breed_disperse")) return false;
67
68 _num_colonizers = (int)get_parameter_value("breed_disperse_colonizers");
69
70 //some default settings, reset below depending on mating system
75
76 if(get_parameter("breed_disperse_dispersing_sex")->isSet()) {
77
78 if (get_parameter("breed_disperse_dispersing_sex")->getArg() == "female") {
80 } else if (get_parameter("breed_disperse_dispersing_sex")->getArg() == "male") {
82 } else {
83 error("the \"breed_disperse_dispersing_sex\" parameter only takes \"female\" or \"male\" as argument\n");
84 }
85
86 } else { //default
88 }
89
90 //check mating system:
91 unsigned int model = this->getMatingSystem();
92
93 if(model == 2 || model == 3) {
94
95 return error("Polygyny and Monogamy are not implemented within the breed_disperse LCE.\n");
96
97 } else if(model == 1) { //promiscuity/random mating
98
100
104
105 } else if(model == 4) { //selfing
106
107 if(this->getMatingProportion() != 1)
109 else
111
112 } else if(model == 5) { //cloning
113
115
116 } else if(model == 6) { //random mating among hermaphrodites (selfing = 1/N)
117
119
120 }
121
122 //check dispersal model:
123 model = this->getDispersalModel();
124
125 if(model == 2) //propagule-pool island model
127 else
129
130 //growth model
131 if(_paramSet->isSet("breed_disperse_growth_model"))
132 model = get_parameter_value("breed_disperse_growth_model");
133 else
134 model = 1;
135
136 switch (model) {
137 case 1:
139 break;
140 case 2:
142 break;
143 case 3:
145 break;
146 case 4:
148 break;
149 case 5:
151 break;
152 case 6:
154 break;
155 case 7:
157 break;
158 default:
160 break;
161 }
162 //mean fecundity
163 if(_mean_fecundity.get(0,0) == -1) //wasn't set
164 if(model > 3 && model < 8) //4 - 7: conditional logistic growth, fecundity growth
165 return error("parameter \"mean_fecundity\" is needed with growth models 4 to 7 in LCE breed_disperse\n");
166
167 //growth rate
168 if (model > 1 && model < 6) {
169
170 if(!_paramSet->isSet("breed_disperse_growth_rate")) {
171
172 return error("parameter \"breed_disperse_growth_rate\" needs to be set\n");
173
174 }
175
176 if(_growthRates) delete [] _growthRates;
177 _growthRates = new double [ _popPtr->getPatchNbr() ];
178
179 if(_paramSet->isMatrix("breed_disperse_growth_rate")) {
180
181 TMatrix tmp;
182
183 _paramSet->getMatrix("breed_disperse_growth_rate", &tmp);
184
185 if(tmp.getNbCols() != _popPtr->getPatchNbr()){
186 return error("matrix argument to \"breed_disperse_growth_rate\" has wrong number of elements,\
187 must equal the number of patches.\n");
188 }
189
190 for (unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
191 _growthRates[i] = tmp.get(0, i);
192 }
193
194
195 } else { //not a matrix
196
197 _growthRates[0] = get_parameter_value("breed_disperse_growth_rate");
198
199 for (unsigned int i = 1; i < _popPtr->getPatchNbr(); i++) {
201 }
202 }
203
204
205 }
206
207 return true;
208}
unsigned int conditionalLogisticGrowth(Patch *patch, sex_t SEX)
The number of offspring produced depends on the adult density.
Definition: LCEcomposite.h:148
unsigned int numMalOffspring_random_colonizers(Patch *patch)
Definition: LCEcomposite.h:111
Individual * mate_selfing(sex_t SEX, Patch *patch, unsigned int LocalPatch)
Definition: LCEcomposite.cc:302
Individual * mate_full_selfing(sex_t SEX, Patch *patch, unsigned int LocalPatch)
Definition: LCEcomposite.cc:326
unsigned int numMalOffspring_notrandom(Patch *patch)
The number of males produced is always zero when the mating system is not random mating.
Definition: LCEcomposite.h:96
unsigned int conditionalStochasticLogisticGrowth(Patch *patch, sex_t SEX)
The number of offspring produced depends on the adult density, similar to 'conditionalLogisticGrowth'...
Definition: LCEcomposite.h:158
Individual * mate_cloning(sex_t SEX, Patch *patch, unsigned int LocalPatch)
Definition: LCEcomposite.cc:335
unsigned int numFemOffspring(Patch *patch)
Definition: LCEcomposite.h:74
unsigned int numFemOffspring_colonizers(Patch *patch)
The number of females produced in case a max number of colonizers was specified.
Definition: LCEcomposite.h:83
unsigned int numMalOffspring_random(Patch *patch)
Definition: LCEcomposite.h:101
Individual * mate_random(sex_t SEX, Patch *patch, unsigned int LocalPatch)
Definition: LCEcomposite.cc:283
Individual * mate_random_hermaphrodite(sex_t SEX, Patch *patch, unsigned int LocalPatch)
Definition: LCEcomposite.cc:292
unsigned int instantGrowth(Patch *patch, sex_t SEX)
The number of offspring produced corresponds to the carrying capacity of the patch.
Definition: LCEcomposite.h:126
void do_breed_disperse_propagule()
Definition: LCEcomposite.cc:275
int getMatingSystem()
Definition: LCEbreed.h:96
TMatrix _mean_fecundity
Definition: LCEbreed.h:62
virtual bool setParameters()
Definition: LCEbreed.cc:75
bool setBaseParameters(string prefix)
Definition: LCEdisperse.cc:88
void set_isForward(bool val)
Definition: LCEdisperse.h:81
unsigned int getDispersalModel()
Definition: LCEdisperse.h:107
void getMatrix(string name, TMatrix *mat)
Accessor to the parameters matrix.
Definition: param.h:304
bool isMatrix(string name)
Check if the parameter "name" is of matrix type.
Definition: param.h:296
bool isSet()
Accessor to the status flag.
Definition: param.h:288
string getArg()
Definition: param.h:138
bool isSet()
Definition: param.h:140
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:143
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
double get(unsigned int i, unsigned int j)
Accessor to element at row i and column j.
Definition: tmatrix.h:147
unsigned int getNbCols()
Gives the number of columns.
Definition: tmatrix.h:169
int error(const char *str,...)
Definition: output.cc:77

References _breed_disperse, _dispersing_sex, _get_numFemOffspring, _get_numMalOffspring, _get_patchFecundity, _growthRates, _make_offspring, LCE_Breed_base::_mean_fecundity, _num_colonizers, SimComponent::_paramSet, LifeCycleEvent::_popPtr, conditionalLogisticGrowth(), conditionalStochasticLogisticGrowth(), do_breed_disperse(), do_breed_disperse_propagule(), error(), FEM, fixedFecundityGrowth(), TMatrix::get(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getArg(), LCE_Disperse_base::getDispersalModel(), LCE_Breed_base::getMatingProportion(), LCE_Breed_base::getMatingSystem(), ParamSet::getMatrix(), TMatrix::getNbCols(), Metapop::getPatchNbr(), instantGrowth(), ParamSet::isMatrix(), Param::isSet(), ParamSet::isSet(), logisticGrowth(), MAL, mate_cloning(), mate_full_selfing(), mate_random(), mate_random_hermaphrodite(), mate_selfing(), numFemOffspring(), numFemOffspring_colonizers(), numMalOffspring_notrandom(), numMalOffspring_random(), numMalOffspring_random_colonizers(), LCE_Disperse_base::set_isForward(), LCE_Disperse_base::setBaseParameters(), LCE_Breed_base::setParameters(), stochasticFecundityGrowth(), and stochasticLogisticGrowth().

Referenced by LCE_Breed_Disperse(), and LCE_Breed_Selection_Disperse::setParameters().

+ Here is the caller graph for this function:

◆ stochasticFecundityGrowth()

unsigned int LCE_Breed_Disperse::stochasticFecundityGrowth ( Patch patch,
sex_t  SEX 
)
inline

The number of offspring produced is a random number drawn from a Poisson distribution with mean equal to the carrying capacity multiplied by the mean fecundity of the focal patch.

175 {
176 return RAND::Uniform(patch->get_K(SEX)*LCE_Breed_base::getMeanFecundity(patch->getID()));
177 }

References Patch::get_K(), Patch::getID(), LCE_Breed_base::getMeanFecundity(), and RAND::Uniform().

Referenced by conditionalStochasticLogisticGrowth(), and setParameters().

+ Here is the caller graph for this function:

◆ stochasticLogisticGrowth()

unsigned int LCE_Breed_Disperse::stochasticLogisticGrowth ( Patch patch,
sex_t  SEX 
)
inline

The number of offspring produced is drawn from a Poisson with mean equal to the logistic growth predicate.

143 {
144 return (unsigned int)RAND::Poisson((double)logisticGrowth(patch, SEX));
145 }
static double Poisson(double mean)
From the Numerical Recieps.
Definition: Uniform.h:220

References logisticGrowth(), and RAND::Poisson().

Referenced by conditionalStochasticLogisticGrowth(), and setParameters().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _breed_disperse

void(LCE_Breed_Disperse::* LCE_Breed_Disperse::_breed_disperse) ()
private

Referenced by execute(), and setParameters().

◆ _dispersing_sex

sex_t LCE_Breed_Disperse::_dispersing_sex
private

◆ _get_numFemOffspring

unsigned int(LCE_Breed_Disperse::* LCE_Breed_Disperse::_get_numFemOffspring) (Patch *patch)
protected

◆ _get_numMalOffspring

unsigned int(LCE_Breed_Disperse::* LCE_Breed_Disperse::_get_numMalOffspring) (Patch *patch)
protected

◆ _get_patchFecundity

unsigned int(LCE_Breed_Disperse::* LCE_Breed_Disperse::_get_patchFecundity) (Patch *patch, sex_t SEX)
protected

◆ _growthRates

double* LCE_Breed_Disperse::_growthRates
private

Patch-specific growth rates.

Referenced by logisticGrowth(), setParameters(), and ~LCE_Breed_Disperse().

◆ _make_offspring

Individual *(LCE_Breed_Disperse::* LCE_Breed_Disperse::_make_offspring) (sex_t SEX, Patch *patch, unsigned int LocalPatch)
protected

◆ _num_colonizers

int LCE_Breed_Disperse::_num_colonizers
private

Maximum size of a patch after colonisation.

Referenced by numFemOffspring_colonizers(), numMalOffspring_random_colonizers(), and setParameters().


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

Generated for Nemo v2.3.56 by  doxygen 1.9.0 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR