Nemo  2.4.0b
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 ()
 
bool isWrightFisher ()
 
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

TMatrix _mean_fecundity
 
Function pointers
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 )()
 
void(LCE_Breed_base::* PopModelFuncPtr )(void)
 
- 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

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 ( )
47 : LifeCycleEvent("", ""),
50 //_growthRates(0),
51 MatingFuncPtr(0),
54 
55 {
57 
58  add_parameter("mating_system",INT,true,true,1,6, updater);
59  add_parameter("mating_proportion",DBL,false,true,0,1,updater);
60  add_parameter("mating_males",INT,false,false,0,0, updater);
61  add_parameter("mating_isWrightFisher", BOOL, false, false, 0, 0, updater);
62 
63 // add_parameter("growth_model", INT, false, true, 1, 7, updater);
64 // add_parameter("growth_rate", DBL, false, false, 0, 0, updater);
65 
67  add_parameter("mean_fecundity",DBL,false,false,0,0, updater);
68  add_parameter("fecundity_dist_stdev",DBL,false,false,0,0, updater);
69  add_parameter("fecundity_distribution",STR,false,false,0,0, updater);
70 
72  add_parameter("sex_ratio_mode",STR,false,false,0,0, updater);
73 }
unsigned int _alpha_male
Definition: LCEbreed.h:51
bool _do_inherit
Definition: LCEbreed.h:53
double _sd_fecundity
Definition: LCEbreed.h:52
sex_t(LCE_Breed_base::* GetOffsprgSex)()
Definition: LCEbreed.h:64
double(LCE_Breed_base::* FecundityFuncPtr)(double mean)
Definition: LCEbreed.h:62
void(LCE_Breed_base::* PopModelFuncPtr)(void)
Definition: LCEbreed.h:65
Individual *(LCE_Breed_base::* DoBreedFuncPtr)(Individual *mother, Individual *father, unsigned int LocalPatch)
Definition: LCEbreed.h:61
double _mating_proportion
Definition: LCEbreed.h:52
bool setMatingSystem()
Definition: LCEbreed.cc:84
bool setFecundity()
Definition: LCEbreed.cc:253
bool(LCE_Breed_base::* CheckMatingConditionFuncPtr)(Patch *thePatch)
Definition: LCEbreed.h:63
unsigned int _mating_males
Definition: LCEbreed.h:50
TMatrix _mean_fecundity
Definition: LCEbreed.h:68
int _mating_system
Definition: LCEbreed.h:49
bool setSexRatio()
Definition: LCEbreed.cc:213
Individual *(LCE_Breed_base::* MatingFuncPtr)(Patch *, Individual *, unsigned int)
Definition: LCEbreed.h:60
LifeCycleEvent(const char *name, const char *trait_link)
Cstor.
Definition: lifecycleevent.h:98
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
74 {}

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
354 {
355  return _popPtr->makeNewIndividual(mother, father, getOffsprgSex(), LocalPatch);
356 }
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:114
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81

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

Referenced by setMatingSystem().

◆ 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
361 {
362  Individual *newind;
363 
364  if(mother == father) {
365  newind = _popPtr->getNewIndividual();
366  //cloning:
367  (*newind) = (*mother);
368 
369  newind->reset_counters();
370  newind->setFather(NULL);
371  newind->setFatherID(0);
372  newind->setMother(mother);
373  newind->setMotherID(mother->getID());
374  newind->setIsSelfed(true);
375  newind->setHome(LocalPatch);
376  newind->setAge(0);
377  _do_inherit = false;
378  } else {
379  newind = _popPtr->makeNewIndividual(mother, father, getOffsprgSex(), LocalPatch);
380  _do_inherit = true;
381  }
382 
383  return newind;
384 }
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().

◆ 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
216  {
217  if(thePatch->size(MAL, ADLTx) != 0) thePatch->flush(MAL, ADLTx, this->_popPtr);
218 
219  return (thePatch->size(FEM, ADLTx) != 0);
220  }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:498
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:685
@ 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().

◆ 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
174  {
175  return (this->* CheckMatingConditionFuncPtr) (thePatch);
176  }

References CheckMatingConditionFuncPtr.

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

◆ 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
182  {
183  return (thePatch->size(FEM, ADLTx) != 0 && thePatch->size(MAL, ADLTx) != 0);
184  }

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

Referenced by setMatingSystem().

◆ 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
191  {
192  if(thePatch->size(FEM, ADLTx) == 0 || thePatch->size(MAL, ADLTx) == 0) return false;
193 
194 // if(thePatch->size(MAL, ADLTx) < _mating_males) _mating_males = thePatch->size(MAL, ADLTx);
195 
196  _alpha_male = (unsigned int)RAND::Uniform(thePatch->size(MAL, ADLTx));
197 
198  return true;
199  }
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:124

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

Referenced by setMatingSystem().

◆ 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
206  {
207  if(thePatch->size(MAL, ADLTx) != 0) thePatch->flush(MAL, ADLTx, this->_popPtr);
208  return (thePatch->size(FEM, ADLTx) != 0);
209  }

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

Referenced by setMatingSystem().

◆ do_breed()

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

◆ doInheritance()

bool LCE_Breed_base::doInheritance ( )
inline

◆ 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
289  {
290  if(thePatch->size(MAL, ADLTx) < motherIndex+1)
291  return RandomMating(thePatch, mother, motherIndex);
292  else
293  return thePatch->get(MAL, ADLTx, motherIndex);
294  }
Individual * RandomMating(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to a male drawn randomly from a patch.
Definition: LCEbreed.h:230
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:534

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

Referenced by setMatingSystem().

◆ 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)
240  { return thePatch->get(MAL, ADLTx, _alpha_male); }

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

Referenced by partialPolyginy(), and setMatingSystem().

◆ 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)
248  {
249  if(thePatch->size(MAL,ADLTx) < _mating_males)
250  return thePatch->get(MAL, ADLTx, RAND::Uniform( thePatch->size(MAL, ADLTx) ) );
251  else
252  return thePatch->get(MAL, ADLTx, RAND::Uniform( _mating_males ) );
253  }

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

Referenced by partialPolyginy_manyMales(), and setMatingSystem().

◆ 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)
316  {
317  return mother;
318  }

Referenced by setMatingSystem().

◆ 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
83  {
84  return (this->*MatingFuncPtr)(thePatch, mother, motherIndex);
85  }

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

◆ getFecundity() [1/2]

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

References FecundityFuncPtr.

◆ getFecundity() [2/2]

double LCE_Breed_base::getFecundity ( unsigned int  patch)
inline

◆ getFixedFecundity()

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

Referenced by setFecundity().

◆ getGaussianFecundity()

double LCE_Breed_base::getGaussianFecundity ( double  mean)
inline
106  {
107  double fec; do{fec = mean + RAND::Gaussian(_sd_fecundity);}while(fec < 0);
108  return fec;}
static double Gaussian(double sigma)
Definition: Uniform.h:261

References _sd_fecundity, and RAND::Gaussian().

Referenced by setFecundity().

◆ getLogNormalFecundity()

double LCE_Breed_base::getLogNormalFecundity ( double  mean)
inline
109  {
110  double fec; do{fec = mean + RAND::LogNormal(mean, _sd_fecundity);}while(fec < 0);
111  return fec;}
static double LogNormal(double zeta, double sigma)
Definition: Uniform.h:357

References _sd_fecundity, and RAND::LogNormal().

Referenced by setFecundity().

◆ getMatingProportion()

double LCE_Breed_base::getMatingProportion ( )
inline

◆ getMatingSystem()

◆ getMeanFecundity()

◆ getOffsprgSex()

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

References GetOffsprgSex.

Referenced by breed(), and breed_cloning().

◆ getOffsprgSexCloning()

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

References FEM.

Referenced by setSexRatio().

◆ getOffsprgSexFixed()

sex_t LCE_Breed_base::getOffsprgSexFixed ( )
332 {
333  static bool sex = RAND::RandBool();
334  sex ^= 1;
335  return (sex_t)sex;
336 }
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:162
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:36

References RAND::RandBool().

Referenced by setSexRatio().

◆ getOffsprgSexRandom()

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

References RAND::RandBool().

Referenced by setSexRatio().

◆ getOffsprgSexSelfing()

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

References FEM.

Referenced by setSexRatio().

◆ getPoissonFecundity()

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

References RAND::Poisson().

Referenced by setFecundity().

◆ isWrightFisher()

bool LCE_Breed_base::isWrightFisher ( )
inline
120 {return get_parameter("mating_isWrightFisher")->isSet();}
bool isSet()
Definition: param.h:140
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139

References SimComponent::get_parameter(), and Param::isSet().

Referenced by LCE_Breed::addAgeClass().

◆ 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 );
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:82
Individual * makeOffspring(Individual *ind)
Last step of the breeding process, does inheritance and mutation of the parents' genes.
Definition: LCEbreed.cc:341
Individual * do_breed(Individual *mother, Individual *father, unsigned int LocalPatch)
Calls the breeding function unsing its pointer.
Definition: LCEbreed.h:164
Second class in the metapopulation design structure, between the Metapop and Individual classes.
Definition: metapop.h:432
unsigned int getID()
Definition: metapop.h:481
@ OFFSx
Definition: types.h:42
Parameters
indthe offspring, as returned by the do_breed function.
342 {
343  unsigned int cat = ind->getPedigreeClass();
344 
345  ind->getMother()->DidHaveABaby(cat);
346  if(cat!=4) ind->getFather()->DidHaveABaby(cat);
347 
348  return ind->create(doInheritance(), true);
349 }
Individual * create()
Creates an individual's genotypes and phenotypes with recombination and mutations.
Definition: individual.h:362
Individual * getMother()
Definition: individual.h:127
Individual * getFather()
Definition: individual.h:126
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:103

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

Referenced by LCE_Breed_Disperse::do_breed_disperse_in_empty_patch(), LCE_Breed_Disperse::do_breed_disperse_in_patch(), 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().

◆ NonWrightFisherPopulation()

void LCE_Breed_base::NonWrightFisherPopulation ( )
389 {
390  Patch* patch;
391  Individual* mother;
392  Individual* father;
393  Individual* NewOffsprg;
394  unsigned int nbBaby;
395 
396 #ifdef _DEBUG_
397  message("LCE_Breed::execute::NonWrightFisherPopulation::mating system: %i; mean fecundity[0]: %f",
399 #endif
400 
401  //because mean fecundity can be patch-specific, we have to check whether the patch number changed
403 
404  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
405 
406  patch = _popPtr->getPatch(i);
407 
408  if( !checkMatingCondition(patch) ) continue;
409 
410  for(unsigned int size = patch->size(FEM, ADLTx), indexOfMother = 0;
411  indexOfMother < size;
412  indexOfMother++)
413  {
414  mother = patch->get(FEM, ADLTx, indexOfMother);
415 
416  nbBaby = (unsigned int)mother->setFecundity( getFecundity(i) ) ; //allows for patch-specific fec
417  //-----------------------------------------------------------------------
418  while(nbBaby != 0) {
419 
420  father = this->getFatherPtr(patch, mother, indexOfMother);
421 
422  NewOffsprg = makeOffspring( do_breed(mother, father, i) );
423 
424  patch->add(NewOffsprg->getSex(), OFFSx, NewOffsprg);
425 
426  nbBaby--;
427  }//_END__WHILE
428 
429  }
430  }
431 
432 #ifdef _DEBUG_
433  message("done, new offsprg nb: %i \n",_popPtr->size( OFFSPRG ));
434 #endif
435 }
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:173
double getFecundity(unsigned int patch)
Definition: LCEbreed.h:112
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together.
Definition: metapop.h:312
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:551
unsigned int ncols() const
Definition: tmatrix.h:216
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(), TMatrix::ncols(), OFFSPRG, OFFSx, setFecundity(), Individual::setFecundity(), Metapop::size(), and Patch::size().

Referenced by setMatingSystem().

◆ 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
303  {
304  if(RAND::Uniform() > _mating_proportion || thePatch->size(MAL, ADLTx) < motherIndex+1)
305  return RandomMating(thePatch, mother, motherIndex);
306  else
307  return thePatch->get(MAL, ADLTx, motherIndex);
308  }

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

Referenced by setMatingSystem().

◆ 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)
261  {
263  return RandomMating(thePatch, mother, 0);
264  else
265  return fullPolyginy(thePatch, 0, 0);
266  }
Individual * fullPolyginy(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to the alpha male of the patch.
Definition: LCEbreed.h:239

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

Referenced by setMatingSystem().

◆ 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)
275  {
277  return RandomMating(thePatch, mother, 0);
278  else
279  return fullPolyginy_manyMales(thePatch, mother, 0);
280  }
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:247

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

Referenced by setMatingSystem().

◆ 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)
326  {
327  unsigned int fem;
329  do {
330  fem = RAND::Uniform(thePatch->size(FEM, ADLTx));
331  } while(fem == motherIndex && thePatch->size(FEM, ADLTx) != 1);
332  return thePatch->get(FEM, ADLTx, fem);
333  }else
334  return mother;
335  }

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

Referenced by setMatingSystem().

◆ 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)
343  {
344  return thePatch->get(FEM, ADLTx, RAND::Uniform(thePatch->size(FEM, ADLTx)) );
345  }

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

Referenced by setMatingSystem().

◆ 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)
231  { return thePatch->get(MAL, ADLTx, RAND::Uniform(thePatch->size(MAL, ADLTx)) ); }

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

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

◆ setFecundity()

bool LCE_Breed_base::setFecundity ( )
254 {
255  // FECUNDITY
256 
258 
259  if (get_parameter("mean_fecundity")->isMatrix()) {
260 
261  get_parameter("mean_fecundity")->getMatrix(&_mean_fecundity);
262 
263  if(_mean_fecundity.nrows() != 1) {
264  return error("\"mean_fecundity\" accepts a single number or a single array with patch-specific values.\n");
265  }
266 
268  return error("\"mean_fecundity\" accepts an array of max num patches in length.\n");
269  }
270  else if (_mean_fecundity.ncols() < _popPtr->getPatchNbr())
271  {
272  // recycle values provided in input until PtachNbr values are reached
273  unsigned int npat = _mean_fecundity.ncols();
274 
276 
278 
279  for (unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
280  _mean_fecundity.set(0, i, tmp.get(0 , i % npat));
281  }
282  }
283  } else {
284  //input parameter is not a matrix, copy value into the patch array:
285 
287  }
288 
289 
290  if(get_parameter("fecundity_distribution")->isSet()) {
291 
292  string dist = get_parameter("fecundity_distribution")->getArg();
293 
294  if( dist == "fixed" || dist == "fix" )
295 
297 
298  else if( dist == "poisson" )
299 
301 
302  else if( dist == "normal" || dist == "lognormal" ) {
303 
304  if(get_parameter("fecundity_dist_stdev")->isSet())
305  {
306  _sd_fecundity = get_parameter_value("fecundity_dist_stdev");
307 
308  } else {
309 
310  return error("parameter \"fecundity_dist_stdev\" is missing for \"normal\" fecundity distribution\n");
311  }
312 
313  if(dist == "normal")
315 
316  if(dist == "lognormal")
318 
319  } else {
320  return error("unknown fecundity distribution parameter's argument!\n");
321  }
322 
323  } else { //default distribution is Poisson:
325  }
326  return true;
327 }
double getFixedFecundity(double mean)
Definition: LCEbreed.h:105
double getGaussianFecundity(double mean)
Definition: LCEbreed.h:106
double getLogNormalFecundity(double mean)
Definition: LCEbreed.h:109
double getPoissonFecundity(double mean)
Definition: LCEbreed.h:104
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:378
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:143
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:50
void reset(unsigned int rows, unsigned int cols)
Re-allocate the existing matrix with assigned rows and cols dimensions and all elements to 0.
Definition: tmatrix.h:161
void set(unsigned int i, unsigned int j, double val)
Sets element at row i and column j to value val.
Definition: tmatrix.h:103
unsigned int nrows() const
Definition: tmatrix.h:213
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_Quanti::execute(), LCE_Breed_base(), NonWrightFisherPopulation(), and setParameters().

◆ setMatingSystem()

bool LCE_Breed_base::setMatingSystem ( )
85 {
86  _mating_system = (int)this->get_parameter_value("mating_system");
87 
88  if(get_parameter("mating_proportion")->isSet())
89  _mating_proportion = this->get_parameter_value("mating_proportion");
90  else
92 
93  if(_paramSet->isSet("mating_males"))
94  _mating_males = (int)_paramSet->getValue("mating_males");
95  else
96  _mating_males = 1;
97 
98  //set the mating functions ptr:
100 
102 
103  _do_inherit = true; //is true unless the mating system is cloning
104 
105  //by default, the population is not kept at constant size, ie not Wright-Fisher
107 
108  if(get_parameter("mating_isWrightFisher")->isSet()) {
109 
111 
112  // check if LCE aging is part of the life cycle and complain
113  if( SIMenv::MainSim->get_LCE("aging")->get_parameter("aging")->isSet() )
114  warning("the \"aging\" LCE is not compatible with \"mating_isWrightFisher\"\n\
115 >>>> \"aging\" will empty the population and may cause extinction!\n\
116 >>>> Remove \"aging\" form the life cycle if you want a Wright-Fisher population\n");
117  }
118 
119  switch(_mating_system) {
120  //random mating:
121  case 1:
122  {
124  break;
125  }
126  //polygyny:
127  case 2:
128  {
129  if(_mating_proportion == 1)
130  if(_mating_males == 1)
132  else
134  else
135  if(_mating_males == 1)
137  else
139 
141  break;
142  }
143  //monogamy:
144  case 3:
145  {
146  if(_mating_proportion == 1)
148  else
150 
151  break;
152  }
153  //selfing:
154  case 4:
155  {
156  if(_mating_proportion == 1)
158  else
160 
162 
163  if(_popPtr->get_parameter("patch_capacity")->isSet()){
164 
165  fatal("\"mating_system 4\" should be better initialized together with \"patch_nbfem ...\" and \"patch_nbmal 0\". \n");
166 
167  }
168 
169  break;
170  }
171  //cloning
172  case 5:
173  {
174  if(_mating_proportion == 1)
176  else
178 
180 
182 
183  if(_popPtr->get_parameter("patch_capacity")->isSet()){
184 
185  fatal("\"mating_system 5\" should be better initialized together with \"patch_nbfem ...\" and \"patch_nbmal 0\". \n");
186 
187  }
188 
189  break;
190  }
191  //random mating with hermaphrodites:
192  case 6:
193  {
196 
197  if(_popPtr->get_parameter("patch_capacity")->isSet()){
198 
199  fatal("\"mating_system 6\" should be better initialized together with \"patch_nbfem ...\" and \"patch_nbmal 0\". \n");
200 
201  }
202 
203  break;
204  }
205 
206  }
207 
208  return true;
209 }
bool checkPolygyny(Patch *thePatch)
Checks whether mating will take place in the current patch when mating is polygynous.
Definition: LCEbreed.h:190
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:274
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:302
void NonWrightFisherPopulation()
Definition: LCEbreed.cc:388
Individual * fullSelfing(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns the mother pointer.
Definition: LCEbreed.h:315
void WrightFisherPopulation()
Definition: LCEbreed.cc:439
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:260
Individual * breed(Individual *mother, Individual *father, unsigned int LocalPatch)
Makes a new individual with the right parents.
Definition: LCEbreed.cc:353
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:288
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:342
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:360
bool checkCloning(Patch *thePatch)
Checks whether mating will take place in the current patch when mating is cloning.
Definition: LCEbreed.h:215
bool checkNoSelfing(Patch *thePatch)
Checks whether mating will take place in the current patch when mating is not selfing or cloning.
Definition: LCEbreed.h:181
Individual * partialSelfing(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns the mother pointer or a random female if _mating_proportion != 1.
Definition: LCEbreed.h:325
bool checkSelfing(Patch *thePatch)
Checks whether mating will take place in the current patch when mating is selfing.
Definition: LCEbreed.h:205
double getValue(string name)
Accessor the parameters value.
Definition: param.h:302
bool isSet()
Accessor to the status flag.
Definition: param.h:288
static SimRunner * MainSim
Definition: simenv.h:42
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
void fatal(const char *str,...)
Definition: output.cc:96
void warning(const char *str,...)
Definition: output.cc:58

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(), SIMenv::MainSim, MatingFuncPtr, NonWrightFisherPopulation(), partialMonoginy(), partialPolyginy(), partialPolyginy_manyMales(), partialSelfing(), PopModelFuncPtr, random_hermaphrodite(), RandomMating(), warning(), and WrightFisherPopulation().

Referenced by LCE_Breed_base(), and setParameters().

◆ setParameters()

◆ setSexRatio()

bool LCE_Breed_base::setSexRatio ( )
214 {
215  // SEX-RATIO
216 
217  // by default, the gender is set randomly (Bernoulli trial)
218 
220 
221  // this can be changed to a fixed 1:1 male:female ratio
222  if(get_parameter("sex_ratio_mode")->isSet()) {
223 
224  if(get_parameter("sex_ratio_mode")->getArg() == "fixed") {
225 
227 
228  } else if(get_parameter("sex_ratio_mode")->getArg() != "random") {
229 
230  return error("\"sex_ratio_mode\" parameter argument must be either \"fixed\" or \"random\".");
231 
232  }
233 
234  }
235 
236  // gender-setting function differs for selfing and cloning species
237  // in those two cases, only one sex is modeled; females
238 
239  switch(_mating_system) {
241  break;
243  break;
245  break;
246  }
247 
248  return true;
249 }
sex_t getOffsprgSexSelfing()
Definition: LCEbreed.h:117
sex_t getOffsprgSexRandom()
Definition: LCEbreed.h:115
sex_t getOffsprgSexFixed()
Definition: LCEbreed.cc:331
sex_t getOffsprgSexCloning()
Definition: LCEbreed.h:118

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

Referenced by LCE_Breed_base(), and setParameters().

◆ WrightFisherPopulation()

void LCE_Breed_base::WrightFisherPopulation ( )
440 {
441  Patch* patch = 0;
442  Individual* mother = 0;
443  Individual* father = 0;
444  Individual* NewOffsprg = 0;
445  unsigned int indexOfMother = 0;
446  unsigned int num_fem = 0, num_offsprg = 0;
447 
448 #ifdef _DEBUG_
449  message("LCE_Breed::execute::WrightFisherPopulation::");
450 #endif
451 
452  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
453 
454  patch = _popPtr->getPatch(i);
455 
456  if( !checkMatingCondition(patch) ) continue;
457 
458  num_fem = patch->size(FEM, ADLTx);
459 
460  for(unsigned int s = 0; s < 2; ++s) { //filling male and female offspring containers
461  //-----------------------------------------------------------------------
462  num_offsprg = patch->get_K(sex_t(s));
463 
464  patch->resize(sex_t(s), OFFSx, num_offsprg);
465 
466  for(unsigned int c = 0; c < num_offsprg; ++c)
467  {
468  indexOfMother = RAND::Uniform(num_fem);
469 
470  mother = patch->get(FEM, ADLTx, indexOfMother );
471 
472  father = this->getFatherPtr(patch, mother, indexOfMother);
473 
474  NewOffsprg = makeOffspring( do_breed(mother, father, i) );
475 
476  NewOffsprg->setSex(sex_t(s));
477 
478  patch->set(sex_t(s), OFFSx, c, NewOffsprg);
479  }//END FOR ind
480  } //END FOR sex
481 
482  // we do the generation change here directly
483  patch->flush(ADLTx, _popPtr); //first move adults to recycling pool
484  patch->move(FEM, OFFSx, ADLTx); //moves offspring to adult containers, resets offsprg size to 0
485  patch->move(MAL, OFFSx, ADLTx);
486  } //END FOR patch
487 
488 #ifdef _DEBUG_
489  message("done, new patch size: %i \n",_popPtr->size());
490 #endif
491 }
void setSex(sex_t sex)
Definition: individual.h:112
unsigned int get_K()
Definition: metapop.h:482
void move(sex_t SEX, age_idx from, age_idx to, unsigned int at)
Moves an individual from an age class to an other one.
Definition: metapop.h:611
void set(sex_t SEX, age_idx AGE, unsigned int at, Individual *ind)
Modifies the appropriate container with value of the pointer given.
Definition: metapop.h:543
void resize(sex_t SEX, age_idx AGE, size_t new_size)
Reserves a certain range of values that are assigned to 0 in a given container.
Definition: metapop.h:574

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

Referenced by setMatingSystem().

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)
protected

◆ DoBreedFuncPtr

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

Referenced by do_breed(), and setMatingSystem().

◆ FecundityFuncPtr

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

Referenced by getFecundity(), and setFecundity().

◆ GetOffsprgSex

sex_t(LCE_Breed_base::* LCE_Breed_base::GetOffsprgSex) ()
protected

Referenced by getOffsprgSex(), and setSexRatio().

◆ MatingFuncPtr

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

◆ 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.4.0b by  doxygen 1.9.1 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR