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

Base class for the breeding (and mating) life cycle events. More...

#include <LCEbreed.h>

+ Inheritance diagram for LCE_Breed_base:
+ Collaboration diagram for LCE_Breed_base:

Public Member Functions

 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...
 
Implementations
virtual bool setParameters ()
 
Parameter setters/updaters
bool setMatingSystem ()
 
bool setFecundity ()
 
bool setSexRatio ()
 
Accessors
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 ()
 
Mating functions
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 ()
 
virtual void execute ()=0
 Execute the event on the pop. More...
 
virtual LifeCycleEventclone ()=0
 Cloning interface. More...
 
virtual age_t removeAgeClass ()=0
 Removes the returned age-class flag(s) from the current Metapop age-class flags. More...
 
virtual age_t addAgeClass ()=0
 Adds the returned age-class flag(s) to the current Metapop age-class flags. More...
 
virtual age_t requiredAgeClass ()=0
 Specifies what age-classes are required by the LCE to execute. More...
 
- Public Member Functions inherited from SimComponent
 SimComponent ()
 
virtual ~SimComponent ()
 
virtual void loadFileServices (FileServices *loader)=0
 Loads the component's FileHandler onto the FileServices. More...
 
virtual void loadStatServices (StatServices *loader)=0
 Loads the component's StatHandler onto the StatServices. More...
 
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...
 
virtual bool resetParameterFromSource (std::string param, SimComponent *cmpt)=0
 

Protected Attributes

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...
 

Private Attributes

Individual *(LCE_Breed_base::* MatingFuncPtr )(Patch *, Individual *, unsigned int)
 
Individual *(LCE_Breed_base::* DoBreedFuncPtr )(Individual *mother, Individual *father, unsigned int LocalPatch)
 
double(LCE_Breed_base::* FecundityFuncPtr )(double mean)
 
bool(LCE_Breed_base::* CheckMatingConditionFuncPtr )(Patch *thePatch)
 
sex_t(LCE_Breed_base::* GetOffsprgSex )()
 
Parameters
int _mating_system
 
unsigned int _mating_males
 
unsigned int _alpha_male
 
double _mating_proportion
 
double _sd_fecundity
 
bool _do_inherit
 

Detailed Description

Base class for the breeding (and mating) life cycle events.

This class registers the whole set of basic mating parameters. Sets the function pointers for the mating system, fecundity and sex-ratio models, and breeding conditions checker (mostly checks for state of individual containers).

Constructor & Destructor Documentation

◆ LCE_Breed_base()

LCE_Breed_base::LCE_Breed_base ( )
45: LifeCycleEvent("", ""),
48//_growthRates(0),
52
53{
55
56 add_parameter("mating_system",INT,true,true,1,6, updater);
57 add_parameter("mating_proportion",DBL,false,true,0,1,updater);
58 add_parameter("mating_males",INT,false,false,0,0, updater);
59 add_parameter("mating_isWrightFisher", BOOL, false, false, 0, 0, updater);
60
61// add_parameter("growth_model", INT, false, true, 1, 7, updater);
62// add_parameter("growth_rate", DBL, false, false, 0, 0, updater);
63
65 add_parameter("mean_fecundity",DBL,false,false,0,0, updater);
66 add_parameter("fecundity_dist_stdev",DBL,false,false,0,0, updater);
67 add_parameter("fecundity_distribution",STR,false,false,0,0, updater);
68
70 add_parameter("sex_ratio_mode",STR,false,false,0,0, updater);
71}
unsigned int _alpha_male
Definition: LCEbreed.h:49
Individual *(LCE_Breed_base::* MatingFuncPtr)(Patch *, Individual *, unsigned int)
Definition: LCEbreed.h:53
bool _do_inherit
Definition: LCEbreed.h:51
double _sd_fecundity
Definition: LCEbreed.h:50
sex_t(LCE_Breed_base::* GetOffsprgSex)()
Definition: LCEbreed.h:57
double(LCE_Breed_base::* FecundityFuncPtr)(double mean)
Definition: LCEbreed.h:55
void(LCE_Breed_base::* PopModelFuncPtr)(void)
Definition: LCEbreed.h:61
double _mating_proportion
Definition: LCEbreed.h:50
bool setMatingSystem()
Definition: LCEbreed.cc:82
bool setFecundity()
Definition: LCEbreed.cc:319
Individual *(LCE_Breed_base::* DoBreedFuncPtr)(Individual *mother, Individual *father, unsigned int LocalPatch)
Definition: LCEbreed.h:54
bool(LCE_Breed_base::* CheckMatingConditionFuncPtr)(Patch *thePatch)
Definition: LCEbreed.h:56
unsigned int _mating_males
Definition: LCEbreed.h:48
TMatrix _mean_fecundity
Definition: LCEbreed.h:62
int _mating_system
Definition: LCEbreed.h:47
bool setSexRatio()
Definition: LCEbreed.cc:279
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
@ DBL
Definition: types.h:78
@ BOOL
Definition: types.h:78
@ STR
Definition: types.h:78
@ INT
Definition: types.h:78

References SimComponent::add_parameter(), BOOL, DBL, INT, setFecundity(), setMatingSystem(), setSexRatio(), and STR.

◆ ~LCE_Breed_base()

virtual LCE_Breed_base::~LCE_Breed_base ( )
inlinevirtual
68{}

Member Function Documentation

◆ breed()

Individual * LCE_Breed_base::breed ( Individual mother,
Individual father,
unsigned int  LocalPatch 
)

Makes a new individual with the right parents.

Calls IndFactory::makeNewIndividual. The sex of the offspring is determined by a call to getOffsprgSex(). Recombination and mutation are done later, in the makeOffspring() procedure.

Parameters
motherpointer to the mother
fatherpointer to the father
LocalPatchindex of the natal patch
420{
421 return _popPtr->makeNewIndividual(mother, father, getOffsprgSex(), LocalPatch);
422}
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
sex_t getOffsprgSex()
Definition: LCEbreed.h:108
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81

References LifeCycleEvent::_popPtr, getOffsprgSex(), and IndFactory::makeNewIndividual().

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

◆ breed_cloning()

Individual * LCE_Breed_base::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 offspring).

Calls IndFactory::getNewIndividual() and then copy the mother into the new offspring.

Parameters
motherpointer to the mother
fatherpointer to the father (of no use here)
LocalPatchindex of the natal patch
427{
428 Individual *newind;
429
430 if(mother == father) {
431 newind = _popPtr->getNewIndividual();
432 //cloning:
433 (*newind) = (*mother);
434
435 newind->reset_counters();
436 newind->setFather(NULL);
437 newind->setFatherID(0);
438 newind->setMother(mother);
439 newind->setMotherID(mother->getID());
440 newind->setIsSelfed(true);
441 newind->setHome(LocalPatch);
442 newind->setAge(0);
443 _do_inherit = false;
444 } else {
445 newind = _popPtr->makeNewIndividual(mother, father, getOffsprgSex(), LocalPatch);
446 _do_inherit = true;
447 }
448
449 return newind;
450}
Individual * getNewIndividual()
Creates a blank individual which has to be "decorated" later.
Definition: indfactory.h:85
This class contains traits along with other individual information (sex, pedigree,...
Definition: individual.h:49
void setFather(Individual *f)
Definition: individual.h:109
unsigned long getID()
Definition: individual.h:122
void reset_counters()
Resets the mating and fecundity counters.
Definition: individual.h:210
void setMother(Individual *m)
Definition: individual.h:110
void setIsSelfed(bool s)
Definition: individual.h:114
void setHome(unsigned short value)
Definition: individual.h:111
void setMotherID(unsigned long value)
Definition: individual.h:108
void setFatherID(unsigned long value)
Definition: individual.h:107
void setAge(unsigned short value)
Definition: individual.h:105

References _do_inherit, LifeCycleEvent::_popPtr, Individual::getID(), IndFactory::getNewIndividual(), getOffsprgSex(), IndFactory::makeNewIndividual(), Individual::reset_counters(), Individual::setAge(), Individual::setFather(), Individual::setFatherID(), Individual::setHome(), Individual::setIsSelfed(), Individual::setMother(), and Individual::setMotherID().

Referenced by LCE_Breed_Disperse::mate_cloning(), and setMatingSystem().

+ Here is the caller graph for this function:

◆ checkCloning()

bool LCE_Breed_base::checkCloning ( Patch thePatch)
inline

Checks whether mating will take place in the current patch when mating is cloning.

Only females must be present. Males containers are flushed if not empty.

Parameters
thePatchthe focal patch
208 {
209 if(thePatch->size(MAL, ADLTx) != 0) thePatch->flush(MAL, ADLTx, this->_popPtr);
210
211 return (thePatch->size(FEM, ADLTx) != 0);
212 }
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
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
@ FEM
Definition: types.h:37
@ MAL
Definition: types.h:37
@ ADLTx
Definition: types.h:42

References LifeCycleEvent::_popPtr, ADLTx, FEM, Patch::flush(), MAL, and Patch::size().

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

◆ checkMatingCondition()

bool LCE_Breed_base::checkMatingCondition ( Patch thePatch)
inline

Checks if any mating will take place in the patch passed as argument.

Is called prior to breeding in each patch. Calls the check function using its pointer.

Parameters
thePatchthe focal patch
166 {
167 return (this->* CheckMatingConditionFuncPtr) (thePatch);
168 }

References CheckMatingConditionFuncPtr.

Referenced by LCE_Breed_Selection::execute(), NonWrightFisherPopulation(), LCE_Breed_Quanti::NonWrightFisherPopulation(), WrightFisherPopulation(), and LCE_Breed_Quanti::WrightFisherPopulation().

+ Here is the caller graph for this function:

◆ checkNoSelfing()

bool LCE_Breed_base::checkNoSelfing ( Patch thePatch)
inline

Checks whether mating will take place in the current patch when mating is not selfing or cloning.

Males and females must be present in the patch for mating to occur.

Parameters
thePatchthe focal patch
174 {
175 return (thePatch->size(FEM, ADLTx) != 0 && thePatch->size(MAL, ADLTx) != 0);
176 }

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

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

◆ checkPolygyny()

bool LCE_Breed_base::checkPolygyny ( Patch thePatch)
inline

Checks whether mating will take place in the current patch when mating is polygynous.

Males and females must be present in the patch for mating to occur.

Parameters
thePatchthe focal patch
183 {
184 if(thePatch->size(FEM, ADLTx) == 0 || thePatch->size(MAL, ADLTx) == 0) return false;
185
186// if(thePatch->size(MAL, ADLTx) < _mating_males) _mating_males = thePatch->size(MAL, ADLTx);
187
188 _alpha_male = (unsigned int)RAND::Uniform(thePatch->size(MAL, ADLTx));
189
190 return true;
191 }
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:125

References _alpha_male, ADLTx, FEM, MAL, Patch::size(), and RAND::Uniform().

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

◆ checkSelfing()

bool LCE_Breed_base::checkSelfing ( Patch thePatch)
inline

Checks whether mating will take place in the current patch when mating is selfing.

Only females must be present.

Parameters
thePatchthe focal patch
198 {
199 if(thePatch->size(MAL, ADLTx) != 0) thePatch->flush(MAL, ADLTx, this->_popPtr);
200 return (thePatch->size(FEM, ADLTx) != 0);
201 }

References LifeCycleEvent::_popPtr, ADLTx, FEM, Patch::flush(), MAL, and Patch::size().

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

◆ do_breed()

Individual * LCE_Breed_base::do_breed ( Individual mother,
Individual father,
unsigned int  LocalPatch 
)
inline

◆ doInheritance()

bool LCE_Breed_base::doInheritance ( )
inline
97{return _do_inherit;}

References _do_inherit.

Referenced by makeOffspring(), and LCE_Breed_Selection::makeOffspringWithSelection().

+ Here is the caller graph for this function:

◆ fullMonoginy()

Individual * LCE_Breed_base::fullMonoginy ( Patch thePatch,
Individual mother,
unsigned int  motherIndex 
)
inline

Returns a pointer to a male with same index as mother (if available) from the focal patch.

If the male is not available, one is drawn randomly from the patch.

Parameters
thePatchthe focal patch.
motherthe mother to mate with (unused here)
motherIndexindex of the mother in the patch adult female container
281 {
282 if(thePatch->size(MAL, ADLTx) < motherIndex+1)
283 return RandomMating(thePatch, mother, motherIndex);
284 else
285 return thePatch->get(MAL, ADLTx, motherIndex);
286 }
Individual * RandomMating(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to a male drawn randomly from a patch.
Definition: LCEbreed.h:222
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

References ADLTx, Patch::get(), MAL, RandomMating(), and Patch::size().

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

◆ fullPolyginy()

Individual * LCE_Breed_base::fullPolyginy ( Patch thePatch,
Individual mother,
unsigned int  motherIndex 
)
inline

Returns a pointer to the alpha male of the patch.

The alpha male of a patch is set in the LCE_Breed_base::checkPolygyny function called before mating.

Parameters
thePatchthe focal patch.
motherthe mother to mate with (unused here).
motherIndexindex of the mother in the patch adult female container (unused here)
232 { return thePatch->get(MAL, ADLTx, _alpha_male); }

References _alpha_male, ADLTx, Patch::get(), and MAL.

Referenced by partialPolyginy(), and setMatingSystem().

+ Here is the caller graph for this function:

◆ fullPolyginy_manyMales()

Individual * LCE_Breed_base::fullPolyginy_manyMales ( Patch thePatch,
Individual mother,
unsigned int  motherIndex 
)
inline

Returns a pointer to one of the first _mating_males males of the patch.

Parameters
thePatchthe focal patch.
motherthe mother to mate with (unused here).
motherIndexindex of the mother in the patch adult female container (unused here)
240 {
241 if(thePatch->size(MAL,ADLTx) < _mating_males)
242 return thePatch->get(MAL, ADLTx, RAND::Uniform( thePatch->size(MAL, ADLTx) ) );
243 else
244 return thePatch->get(MAL, ADLTx, RAND::Uniform( _mating_males ) );
245 }

References _mating_males, ADLTx, Patch::get(), MAL, Patch::size(), and RAND::Uniform().

Referenced by partialPolyginy_manyMales(), and setMatingSystem().

+ Here is the caller graph for this function:

◆ fullSelfing()

Individual * LCE_Breed_base::fullSelfing ( Patch thePatch,
Individual mother,
unsigned int  motherIndex 
)
inline

Returns the mother pointer.

Parameters
thePatchthe focal patch.
motherthe mother to mate with (returned here)
motherIndexindex of the mother in the patch adult female container (unused here)
308 {
309 return mother;
310 }

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

◆ getFatherPtr()

virtual Individual * LCE_Breed_base::getFatherPtr ( Patch thePatch,
Individual mother,
unsigned int  motherIndex 
)
inlinevirtual

Calls the mating function according to the model chosen using the function pointer, used to get the father from the mother in a patch.

Parameters
thePatchpointer to the focal patch where mating is taking place
motherpointer to the mother, returned when mating is done by self-fertilization or cloning
motherIndexindex of the mother in the current patch female container, used in the polyginy an monoginy mating systems
Returns
the pointer to the father following the mating scheme chosen
77 {
78 return (this->*MatingFuncPtr)(thePatch, mother, motherIndex);
79 }

References MatingFuncPtr.

Referenced by LCE_Breed_Selection::do_breed_selection_FecFitness(), LCE_Breed_Selection::do_breed_selection_OffSurvival(), NonWrightFisherPopulation(), LCE_Breed_Quanti::NonWrightFisherPopulation(), LCE_Breed_Wolbachia::wolbachia_model_1(), LCE_Breed_Wolbachia::wolbachia_model_2(), WrightFisherPopulation(), and LCE_Breed_Quanti::WrightFisherPopulation().

+ Here is the caller graph for this function:

◆ getFecundity() [1/2]

double LCE_Breed_base::getFecundity ( double  mean)
inline
107{return (this->* FecundityFuncPtr)(mean);}

References FecundityFuncPtr.

◆ getFecundity() [2/2]

double LCE_Breed_base::getFecundity ( unsigned int  patch)
inline
106{return (this->* FecundityFuncPtr)(_mean_fecundity.get(0, patch));}
double get(unsigned int i, unsigned int j)
Accessor to element at row i and column j.
Definition: tmatrix.h:147

References FecundityFuncPtr, and TMatrix::get().

Referenced by LCE_Breed_Selection::do_breed_selection_FecFitness(), LCE_Breed_Selection::do_breed_selection_OffSurvival(), NonWrightFisherPopulation(), LCE_Breed_Quanti::NonWrightFisherPopulation(), LCE_Breed_Wolbachia::wolbachia_model_1(), and LCE_Breed_Wolbachia::wolbachia_model_2().

+ Here is the caller graph for this function:

◆ getFixedFecundity()

double LCE_Breed_base::getFixedFecundity ( double  mean)
inline
99{return (mean < 0) ? 0 : mean;}

Referenced by setFecundity().

+ Here is the caller graph for this function:

◆ getGaussianFecundity()

double LCE_Breed_base::getGaussianFecundity ( double  mean)
inline
100 {
101 double fec; do{fec = mean + RAND::Gaussian(_sd_fecundity);}while(fec < 0);
102 return fec;}
static double Gaussian(double sigma)
Definition: Uniform.h:262

References _sd_fecundity, and RAND::Gaussian().

Referenced by setFecundity().

+ Here is the caller graph for this function:

◆ getLogNormalFecundity()

double LCE_Breed_base::getLogNormalFecundity ( double  mean)
inline
103 {
104 double fec; do{fec = mean + RAND::LogNormal(mean, _sd_fecundity);}while(fec < 0);
105 return fec;}
static double LogNormal(double zeta, double sigma)
Definition: Uniform.h:358

References _sd_fecundity, and RAND::LogNormal().

Referenced by setFecundity().

+ Here is the caller graph for this function:

◆ getMatingProportion()

double LCE_Breed_base::getMatingProportion ( )
inline
94{return _mating_proportion;}

References _mating_proportion.

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

+ Here is the caller graph for this function:

◆ getMatingSystem()

int LCE_Breed_base::getMatingSystem ( )
inline
96{return _mating_system;}

References _mating_system.

Referenced by LCE_Breed_Quanti::NonWrightFisherPopulation(), and LCE_Breed_Disperse::setParameters().

+ Here is the caller graph for this function:

◆ getMeanFecundity()

◆ getOffsprgSex()

sex_t LCE_Breed_base::getOffsprgSex ( )
inline
108{return (this->* GetOffsprgSex) ();}

References GetOffsprgSex.

Referenced by breed(), and breed_cloning().

+ Here is the caller graph for this function:

◆ getOffsprgSexCloning()

sex_t LCE_Breed_base::getOffsprgSexCloning ( )
inline
112{return FEM;}

References FEM.

Referenced by setSexRatio().

+ Here is the caller graph for this function:

◆ getOffsprgSexFixed()

sex_t LCE_Breed_base::getOffsprgSexFixed ( )
398{
399 static bool sex = RAND::RandBool();
400 sex ^= 1;
401 return (sex_t)sex;
402}
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:163
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:36

References RAND::RandBool().

Referenced by setSexRatio().

+ Here is the caller graph for this function:

◆ getOffsprgSexRandom()

sex_t LCE_Breed_base::getOffsprgSexRandom ( )
inline
109{return (sex_t)RAND::RandBool();}

References RAND::RandBool().

Referenced by setSexRatio().

+ Here is the caller graph for this function:

◆ getOffsprgSexSelfing()

sex_t LCE_Breed_base::getOffsprgSexSelfing ( )
inline
111{return FEM;}

References FEM.

Referenced by setSexRatio().

+ Here is the caller graph for this function:

◆ getPoissonFecundity()

double LCE_Breed_base::getPoissonFecundity ( double  mean)
inline
98{return RAND::Poisson(mean);}
static double Poisson(double mean)
From the Numerical Recieps.
Definition: Uniform.h:220

References RAND::Poisson().

Referenced by setFecundity().

+ Here is the caller graph for this function:

◆ makeOffspring()

Individual * LCE_Breed_base::makeOffspring ( Individual ind)

Last step of the breeding process, does inheritance and mutation of the parents' genes.

Calls Individual::create(do_inherit, do_mutate) with do_inherit set following the local _do_inherit value. Updates the parent's fecundity counters. A breeding session looks like that:

Individual* newind;
Patch* natalPatch;
newind = makeOffspring( do_breed( mother, father = getFatherPtr(natalPatch, mother, motherIndex), LocalPatch = natalPatch->getID() ) )
natalPatch->add( newind->getSex(), OFFSx, newind );
Individual * do_breed(Individual *mother, Individual *father, unsigned int LocalPatch)
Calls the breeding function unsing its pointer.
Definition: LCEbreed.h:156
virtual Individual * getFatherPtr(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Calls the mating function according to the model chosen using the function pointer,...
Definition: LCEbreed.h:76
Individual * makeOffspring(Individual *ind)
Last step of the breeding process, does inheritance and mutation of the parents' genes.
Definition: LCEbreed.cc:407
Second class in the metapopulation design structure, between the Metapop and Individual classes.
Definition: metapop.h:430
unsigned int getID()
Definition: metapop.h:478
@ OFFSx
Definition: types.h:42
Parameters
indthe offspring, as returned by the do_breed function.
408{
409 unsigned int cat = ind->getPedigreeClass();
410
411 ind->getMother()->DidHaveABaby(cat);
412 if(cat!=4) ind->getFather()->DidHaveABaby(cat);
413
414 return ind->create(doInheritance(), true);
415}
Individual * getFather()
Definition: individual.h:126
Individual * getMother()
Definition: individual.h:127
Individual * create()
Creates an individual's genotypes and phenotypes with recombination and mutations.
Definition: individual.h:362
void DidHaveABaby(unsigned int category)
Increments the mating and realized fecundity counters according to the pedigree class of the offsprin...
Definition: individual.h:225
unsigned int getPedigreeClass()
Returns the pedigree class of the individual, as set during offspring creation.
Definition: individual.h:179
bool doInheritance()
Definition: LCEbreed.h:97

References Individual::create(), Individual::DidHaveABaby(), doInheritance(), Individual::getFather(), Individual::getMother(), and Individual::getPedigreeClass().

Referenced by LCE_Breed_Disperse::do_breed_disperse(), LCE_Breed_Selection::do_breed_selection_FecFitness(), LCE_Breed_Selection::do_breed_selection_WrightFisher_1sex(), LCE_Breed_Selection::do_breed_selection_WrightFisher_2sex(), NonWrightFisherPopulation(), LCE_Breed_Quanti::NonWrightFisherPopulation(), WrightFisherPopulation(), and LCE_Breed_Quanti::WrightFisherPopulation().

+ Here is the caller graph for this function:

◆ NonWrightFisherPopulation()

void LCE_Breed_base::NonWrightFisherPopulation ( )
455{
456 Patch* patch;
457 Individual* mother;
458 Individual* father;
459 Individual* NewOffsprg;
460 unsigned int nbBaby;
461
462#ifdef _DEBUG_
463 message("LCE_Breed::execute::NonWrightFisherPopulation::mating system: %i; mean fecundity[0]: %f",
465#endif
466
467 for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
468
469 patch = _popPtr->getPatch(i);
470
471 if( !checkMatingCondition(patch) ) continue;
472
473 for(unsigned int size = patch->size(FEM, ADLTx), indexOfMother = 0;
474 indexOfMother < size;
475 indexOfMother++)
476 {
477 mother = patch->get(FEM, ADLTx, indexOfMother);
478
479 nbBaby = (unsigned int)mother->setFecundity( getFecundity(i) ) ; //allows for patch-specific fec
480 //-----------------------------------------------------------------------
481 while(nbBaby != 0) {
482
483 father = this->getFatherPtr(patch, mother, indexOfMother);
484
485 NewOffsprg = makeOffspring( do_breed(mother, father, i) );
486
487 patch->add(NewOffsprg->getSex(), OFFSx, NewOffsprg);
488
489 nbBaby--;
490 }//_END__WHILE
491
492 }
493 }
494
495#ifdef _DEBUG_
496 message("done, new offsprg nb: %i \n",_popPtr->size( OFFSPRG ));
497#endif
498}
double setFecundity(double value)
Sets the fecundity to the value given and returns it.
Definition: individual.h:207
sex_t getSex()
Definition: individual.h:129
bool checkMatingCondition(Patch *thePatch)
Checks if any mating will take place in the patch passed as argument.
Definition: LCEbreed.h:165
double getFecundity(unsigned int patch)
Definition: LCEbreed.h:106
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together.
Definition: metapop.h:310
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
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 message(const char *message,...)
Definition: output.cc:40
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50

References _mating_system, _mean_fecundity, LifeCycleEvent::_popPtr, Patch::add(), ADLTx, checkMatingCondition(), do_breed(), FEM, Patch::get(), TMatrix::get(), getFatherPtr(), getFecundity(), Metapop::getPatch(), Metapop::getPatchNbr(), Individual::getSex(), makeOffspring(), message(), OFFSPRG, OFFSx, Individual::setFecundity(), Metapop::size(), and Patch::size().

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

◆ partialMonoginy()

Individual * LCE_Breed_base::partialMonoginy ( Patch thePatch,
Individual mother,
unsigned int  motherIndex 
)
inline

Returns a pointer to a male with same index as mother (if available) from the focal patch.

If the male is not available or _mating_proportion != 1, one is drawn randomly from the patch.

Parameters
thePatchthe focal patch.
motherthe mother to mate with (unused here)
motherIndexindex of the mother in the patch adult female container
295 {
296 if(RAND::Uniform() > _mating_proportion || thePatch->size(MAL, ADLTx) < motherIndex+1)
297 return RandomMating(thePatch, mother, motherIndex);
298 else
299 return thePatch->get(MAL, ADLTx, motherIndex);
300 }

References _mating_proportion, ADLTx, Patch::get(), MAL, RandomMating(), Patch::size(), and RAND::Uniform().

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

◆ partialPolyginy()

Individual * LCE_Breed_base::partialPolyginy ( Patch thePatch,
Individual mother,
unsigned int  motherIndex 
)
inline

Returns a pointer to a male from a patch chosen at random if _mating_proportion != 1, or the first male otherwise.

Parameters
thePatchthe focal patch.
motherthe mother to mate with (unused here).
motherIndexindex of the mother in the patch adult female container (unused here)
253 {
255 return RandomMating(thePatch, mother, 0);
256 else
257 return fullPolyginy(thePatch, 0, 0);
258 }
Individual * fullPolyginy(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to the alpha male of the patch.
Definition: LCEbreed.h:231

References _mating_proportion, fullPolyginy(), RandomMating(), and RAND::Uniform().

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

◆ partialPolyginy_manyMales()

Individual * LCE_Breed_base::partialPolyginy_manyMales ( Patch thePatch,
Individual mother,
unsigned int  motherIndex 
)
inline

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.

Parameters
thePatchthe focal patch.
motherthe mother to mate with (unused here).
motherIndexindex of the mother in the patch adult female container (unused here)
267 {
269 return RandomMating(thePatch, mother, 0);
270 else
271 return fullPolyginy_manyMales(thePatch, mother, 0);
272 }
Individual * fullPolyginy_manyMales(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to one of the first _mating_males males of the patch.
Definition: LCEbreed.h:239

References _mating_proportion, fullPolyginy_manyMales(), RandomMating(), and RAND::Uniform().

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

◆ partialSelfing()

Individual * LCE_Breed_base::partialSelfing ( Patch thePatch,
Individual mother,
unsigned int  motherIndex 
)
inline

Returns the mother pointer or a random female if _mating_proportion != 1.

Parameters
thePatchthe focal patch.
motherthe mother to mate with (returned here)
motherIndexindex of the mother in the patch adult female container (unused here)
318 {
319 unsigned int fem;
321 do {
322 fem = RAND::Uniform(thePatch->size(FEM, ADLTx));
323 } while(fem == motherIndex && thePatch->size(FEM, ADLTx) != 1);
324 return thePatch->get(FEM, ADLTx, fem);
325 }else
326 return mother;
327 }

References _mating_proportion, ADLTx, FEM, Patch::get(), Patch::size(), and RAND::Uniform().

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

◆ random_hermaphrodite()

Individual * LCE_Breed_base::random_hermaphrodite ( Patch thePatch,
Individual mother,
unsigned int  motherIndex 
)
inline

Returns a random female from the patch, will be the same mother with probability 1/N (Wright-Fisher model).

Parameters
thePatchthe focal patch.
motherthe mother to mate with (unused here)
motherIndexindex of the mother in the patch adult female container (unused here)
335 {
336 return thePatch->get(FEM, ADLTx, RAND::Uniform(thePatch->size(FEM, ADLTx)) );
337 }

References ADLTx, FEM, Patch::get(), Patch::size(), and RAND::Uniform().

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

◆ RandomMating()

Individual * LCE_Breed_base::RandomMating ( Patch thePatch,
Individual mother,
unsigned int  motherIndex 
)
inline

Returns a pointer to a male drawn randomly from a patch.

Parameters
thePatchthe focal patch.
motherthe mother to mate with (unused here)
motherIndexindex of the mother in the patch adult female container (unused here)
223 { return thePatch->get(MAL, ADLTx, RAND::Uniform(thePatch->size(MAL, ADLTx)) ); }

References ADLTx, Patch::get(), MAL, Patch::size(), and RAND::Uniform().

Referenced by fullMonoginy(), partialMonoginy(), partialPolyginy(), partialPolyginy_manyMales(), and setMatingSystem().

+ Here is the caller graph for this function:

◆ setFecundity()

bool LCE_Breed_base::setFecundity ( )
320{
321 // FECUNDITY
322
324
325 if (get_parameter("mean_fecundity")->isMatrix()) {
326
327 get_parameter("mean_fecundity")->getMatrix(&_mean_fecundity);
328
329 if(_mean_fecundity.nrows() != 1) {
330 return error("\"mean_fecundity\" accepts a single number or a single array with patch-specific values.\n");
331 }
332
334 return error("\"mean_fecundity\" accepts an array of max num patches in length.\n");
335 }
337 {
338 // recycle values provided in input until PtachNbr values are reached
339 unsigned int npat = _mean_fecundity.ncols();
340
342
344
345 for (unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
346 _mean_fecundity.set(0, i, tmp.get(0 , i % npat));
347 }
348 }
349 } else {
350 //input parameter is not a matrix, copy value into the patch array:
351
353 }
354
355
356 if(get_parameter("fecundity_distribution")->isSet()) {
357
358 string dist = get_parameter("fecundity_distribution")->getArg();
359
360 if( dist == "fixed" || dist == "fix" )
361
363
364 else if( dist == "poisson" )
365
367
368 else if( dist == "normal" || dist == "lognormal" ) {
369
370 if(get_parameter("fecundity_dist_stdev")->isSet())
371 {
372 _sd_fecundity = get_parameter_value("fecundity_dist_stdev");
373
374 } else {
375
376 return error("parameter \"fecundity_dist_stdev\" is missing for \"normal\" fecundity distribution\n");
377 }
378
379 if(dist == "normal")
381
382 if(dist == "lognormal")
384
385 } else {
386 return error("unknown fecundity distribution parameter's argument!\n");
387 }
388
389 } else { //default distribution is Poisson:
391 }
392 return true;
393}
double getFixedFecundity(double mean)
Definition: LCEbreed.h:99
double getGaussianFecundity(double mean)
Definition: LCEbreed.h:100
double getLogNormalFecundity(double mean)
Definition: LCEbreed.h:103
double getPoissonFecundity(double mean)
Definition: LCEbreed.h:98
string getArg()
Definition: param.h:138
void getMatrix(TMatrix *mat)
Sets the matrix from the argument string if the parameter is set and of matrix type.
Definition: param.cc:357
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
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
void reset(unsigned int rows, unsigned int cols)
Re-allocate the existing matrix with assigned rows and cols dimensions.
Definition: tmatrix.h:116
unsigned int ncols()
Definition: tmatrix.h:170
void set(unsigned int i, unsigned int j, double val)
Sets element at row i and column j to value val.
Definition: tmatrix.h:102
unsigned int nrows()
Definition: tmatrix.h:167
int error(const char *str,...)
Definition: output.cc:77

References _mean_fecundity, LifeCycleEvent::_popPtr, _sd_fecundity, error(), FecundityFuncPtr, TMatrix::get(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getArg(), getFixedFecundity(), getGaussianFecundity(), getLogNormalFecundity(), Param::getMatrix(), Metapop::getPatchNbr(), getPoissonFecundity(), TMatrix::ncols(), TMatrix::nrows(), TMatrix::reset(), and TMatrix::set().

Referenced by LCE_Breed::execute(), LCE_Breed_Quanti::execute(), LCE_Breed_base(), and setParameters().

+ Here is the caller graph for this function:

◆ setMatingSystem()

bool LCE_Breed_base::setMatingSystem ( )
83{
84 _mating_system = (int)this->get_parameter_value("mating_system");
85
86 if(get_parameter("mating_proportion")->isSet())
87 _mating_proportion = this->get_parameter_value("mating_proportion");
88 else
90
91 if(_paramSet->isSet("mating_males"))
92 _mating_males = (int)_paramSet->getValue("mating_males");
93 else
94 _mating_males = 1;
95
96 //set the mating functions ptr:
98
100
101 _do_inherit = true; //is true unless the mating system is cloning
102
103 //by default, the population is not kept at constant size, ie not Wright-Fisher
105
106 if(get_parameter("mating_isWrightFisher")->isSet())
108
109
110 switch(_mating_system) {
111 //random mating:
112 case 1:
113 {
115 break;
116 }
117 //polygyny:
118 case 2:
119 {
120 if(_mating_proportion == 1)
121 if(_mating_males == 1)
123 else
125 else
126 if(_mating_males == 1)
128 else
130
132 break;
133 }
134 //monogamy:
135 case 3:
136 {
137 if(_mating_proportion == 1)
139 else
141
142 break;
143 }
144 //selfing:
145 case 4:
146 {
147 if(_mating_proportion == 1)
149 else
151
153
154 if(_popPtr->get_parameter("patch_capacity")->isSet()){
155
156 fatal("\"mating_system 4\" should be better initialized together with \"patch_nbfem ...\" and \"patch_nbmal 0\". \n");
157
158 }
159
160 break;
161 }
162 //cloning
163 case 5:
164 {
165 if(_mating_proportion == 1)
167 else
169
171
173
174 if(_popPtr->get_parameter("patch_capacity")->isSet()){
175
176 fatal("\"mating_system 5\" should be better initialized together with \"patch_nbfem ...\" and \"patch_nbmal 0\". \n");
177
178 }
179
180 break;
181 }
182 //random mating with hermaphrodites:
183 case 6:
184 {
187
188 if(_popPtr->get_parameter("patch_capacity")->isSet()){
189
190 fatal("\"mating_system 6\" should be better initialized together with \"patch_nbfem ...\" and \"patch_nbmal 0\". \n");
191
192 }
193
194 break;
195 }
196
197 }
198
199
200 //Growth model
201// unsigned int model;
202// if(_paramSet->isSet("growth_model"))
203// model = get_parameter_value("growth_model");
204// else
205// model = 1;
206//
207// switch (model) {
208// case 1:
209// GetPatchFecundityFuncPtr = &LCE_Breed_base::instantGrowth;
210// break;
211// case 2:
212// GetPatchFecundityFuncPtr = &LCE_Breed_base::logisticGrowth;
213// break;
214// case 3:
215// GetPatchFecundityFuncPtr = &LCE_Breed_base::stochasticLogisticGrowth;
216// break;
217// case 4:
218// GetPatchFecundityFuncPtr = &LCE_Breed_base::conditionalLogisticGrowth;
219// break;
220// case 5:
221// GetPatchFecundityFuncPtr = &LCE_Breed_base::conditionalStochasticLogisticGrowth;
222// break;
223// case 6:
224// GetPatchFecundityFuncPtr = &LCE_Breed_base::fixedFecundityGrowth;
225// break;
226// case 7:
227// GetPatchFecundityFuncPtr = &LCE_Breed_base::stochasticFecundityGrowth;
228// break;
229// default:
230// GetPatchFecundityFuncPtr = &LCE_Breed_base::instantGrowth;
231// break;
232// }
233//
234// //growth rate
235// if (model > 1 && model < 6) {
236//
237// if(!_paramSet->isSet("growth_rate")) {
238// error("parameter \"growth_rate\" needs to be set\n");
239// return false;
240// }
241//
242// if(_growthRates) delete [] _growthRates;
243// _growthRates = new double [ _popPtr->getPatchNbr() ];
244//
245// if(_paramSet->isMatrix("growth_rate")) {
246//
247// TMatrix tmp;
248//
249// _paramSet->getMatrix("growth_rate", &tmp);
250//
251// if(tmp.getNbCols() != _popPtr->getPatchNbr()){
252// error("matrix argument to \"growth_rate\" has wrong number of elements,\
253// must equal the number of patches.\n");
254// return false;
255// }
256//
257// for (unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
258// _growthRates[i] = tmp.get(0, i);
259// }
260//
261//
262// } else { //not a matrix
263//
264// _growthRates[0] = get_parameter_value("growth_rate");
265//
266// for (unsigned int i = 1; i < _popPtr->getPatchNbr(); i++) {
267// _growthRates[i] = _growthRates[0];
268// }
269// }
270//
271//
272// }
273
274 return true;
275}
bool checkPolygyny(Patch *thePatch)
Checks whether mating will take place in the current patch when mating is polygynous.
Definition: LCEbreed.h:182
Individual * partialMonoginy(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to a male with same index as mother (if available) from the focal patch.
Definition: LCEbreed.h:294
void NonWrightFisherPopulation()
Definition: LCEbreed.cc:454
void WrightFisherPopulation()
Definition: LCEbreed.cc:502
Individual * random_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 m...
Definition: LCEbreed.h:334
Individual * partialPolyginy(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to a male from a patch chosen at random if _mating_proportion != 1,...
Definition: LCEbreed.h:252
Individual * breed(Individual *mother, Individual *father, unsigned int LocalPatch)
Makes a new individual with the right parents.
Definition: LCEbreed.cc:419
Individual * partialSelfing(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns the mother pointer or a random female if _mating_proportion != 1.
Definition: LCEbreed.h:317
Individual * partialPolyginy_manyMales(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to a male from a patch chosen at random if _mating_proportion != 1,...
Definition: LCEbreed.h:266
Individual * fullMonoginy(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to a male with same index as mother (if available) from the focal patch.
Definition: LCEbreed.h:280
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
bool checkCloning(Patch *thePatch)
Checks whether mating will take place in the current patch when mating is cloning.
Definition: LCEbreed.h:207
bool checkNoSelfing(Patch *thePatch)
Checks whether mating will take place in the current patch when mating is not selfing or cloning.
Definition: LCEbreed.h:173
Individual * fullSelfing(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns the mother pointer.
Definition: LCEbreed.h:307
bool checkSelfing(Patch *thePatch)
Checks whether mating will take place in the current patch when mating is selfing.
Definition: LCEbreed.h:197
double getValue(string name)
Accessor the parameters value.
Definition: param.h:302
bool isSet()
Accessor to the status flag.
Definition: param.h:288
bool isSet()
Definition: param.h:140
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
void fatal(const char *str,...)
Definition: output.cc:96

References _do_inherit, _mating_males, _mating_proportion, _mating_system, SimComponent::_paramSet, LifeCycleEvent::_popPtr, breed(), breed_cloning(), checkCloning(), CheckMatingConditionFuncPtr, checkNoSelfing(), checkPolygyny(), checkSelfing(), DoBreedFuncPtr, fatal(), fullMonoginy(), fullPolyginy(), fullPolyginy_manyMales(), fullSelfing(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), ParamSet::getValue(), Param::isSet(), ParamSet::isSet(), MatingFuncPtr, NonWrightFisherPopulation(), partialMonoginy(), partialPolyginy(), partialPolyginy_manyMales(), partialSelfing(), PopModelFuncPtr, random_hermaphrodite(), RandomMating(), and WrightFisherPopulation().

Referenced by LCE_Breed_base(), and setParameters().

+ Here is the caller graph for this function:

◆ setParameters()

◆ setSexRatio()

bool LCE_Breed_base::setSexRatio ( )
280{
281 // SEX-RATIO
282
283 // by default, the gender is set randomly (Bernoulli trial)
284
286
287 // this can be changed to a fixed 1:1 male:female ratio
288 if(get_parameter("sex_ratio_mode")->isSet()) {
289
290 if(get_parameter("sex_ratio_mode")->getArg() == "fixed") {
291
293
294 } else if(get_parameter("sex_ratio_mode")->getArg() != "random") {
295
296 return error("\"sex_ratio_mode\" parameter argument must be either \"fixed\" or \"random\".");
297
298 }
299
300 }
301
302 // gender-setting function differs for selfing and cloning species
303 // in those two cases, only one sex is modeled; females
304
305 switch(_mating_system) {
307 break;
309 break;
311 break;
312 }
313
314 return true;
315}
sex_t getOffsprgSexSelfing()
Definition: LCEbreed.h:111
sex_t getOffsprgSexRandom()
Definition: LCEbreed.h:109
sex_t getOffsprgSexFixed()
Definition: LCEbreed.cc:397
sex_t getOffsprgSexCloning()
Definition: LCEbreed.h:112

References _mating_system, error(), SimComponent::get_parameter(), GetOffsprgSex, getOffsprgSexCloning(), getOffsprgSexFixed(), getOffsprgSexRandom(), and getOffsprgSexSelfing().

Referenced by LCE_Breed_base(), and setParameters().

+ Here is the caller graph for this function:

◆ WrightFisherPopulation()

void LCE_Breed_base::WrightFisherPopulation ( )
503{
504 Patch* patch = 0;
505 Individual* mother = 0;
506 Individual* father = 0;
507 Individual* NewOffsprg = 0;
508 unsigned int indexOfMother = 0;
509 unsigned int size = 0;
510
511#ifdef _DEBUG_
512 message("LCE_Breed::execute::WrightFisherPopulation::");
513#endif
514
515 for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
516
517 patch = _popPtr->getPatch(i);
518
519 if( !checkMatingCondition(patch) ) continue;
520
521 size = patch->size(FEM, ADLTx);
522
523 for(unsigned int s = 0; s < 2; ++s) { //filling male and female offspring containers
524 //-----------------------------------------------------------------------
525 for(unsigned int c = 0; c < patch->get_K(sex_t(s)); ++c)
526 {
527 indexOfMother = RAND::Uniform(size);
528
529 mother = patch->get(FEM, ADLTx, indexOfMother );
530
531 father = this->getFatherPtr(patch, mother, indexOfMother);
532
533 NewOffsprg = makeOffspring( do_breed(mother, father, i) );
534
535 NewOffsprg->setSex(sex_t(s));
536
537 patch->add(sex_t(s), OFFSx, NewOffsprg);
538 }//END FOR ind
539 } //END FOR sex
540 } //END FOR patch
541
542#ifdef _DEBUG_
543 message("done, new offsprg nb: %i \n",_popPtr->size( OFFSPRG ));
544#endif
545}
void setSex(sex_t sex)
Definition: individual.h:112
unsigned int get_K()
Definition: metapop.h:479

References LifeCycleEvent::_popPtr, Patch::add(), ADLTx, checkMatingCondition(), do_breed(), FEM, Patch::get(), Patch::get_K(), getFatherPtr(), Metapop::getPatch(), Metapop::getPatchNbr(), makeOffspring(), message(), OFFSPRG, OFFSx, Individual::setSex(), Metapop::size(), Patch::size(), and RAND::Uniform().

Referenced by setMatingSystem().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _alpha_male

unsigned int LCE_Breed_base::_alpha_male
private

Referenced by checkPolygyny(), and fullPolyginy().

◆ _do_inherit

bool LCE_Breed_base::_do_inherit
private

◆ _mating_males

unsigned int LCE_Breed_base::_mating_males
private

◆ _mating_proportion

double LCE_Breed_base::_mating_proportion
private

◆ _mating_system

int LCE_Breed_base::_mating_system
private

◆ _mean_fecundity

◆ _sd_fecundity

double LCE_Breed_base::_sd_fecundity
private

◆ CheckMatingConditionFuncPtr

bool(LCE_Breed_base::* LCE_Breed_base::CheckMatingConditionFuncPtr) (Patch *thePatch)
private

◆ DoBreedFuncPtr

Individual *(LCE_Breed_base::* LCE_Breed_base::DoBreedFuncPtr) (Individual *mother, Individual *father, unsigned int LocalPatch)
private

Referenced by do_breed(), and setMatingSystem().

◆ FecundityFuncPtr

double(LCE_Breed_base::* LCE_Breed_base::FecundityFuncPtr) (double mean)
private

Referenced by getFecundity(), and setFecundity().

◆ GetOffsprgSex

sex_t(LCE_Breed_base::* LCE_Breed_base::GetOffsprgSex) ()
private

Referenced by getOffsprgSex(), and setSexRatio().

◆ MatingFuncPtr

Individual *(LCE_Breed_base::* LCE_Breed_base::MatingFuncPtr) (Patch *, Individual *, unsigned int)
private

Referenced by getFatherPtr(), and setMatingSystem().

◆ PopModelFuncPtr

void(LCE_Breed_base::* LCE_Breed_base::PopModelFuncPtr) (void)
protected

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