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

Protected Attributes

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

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

45 : LifeCycleEvent("", ""),
47 //_growthRates(0),
48 MatingFuncPtr(0),
50 //,GetPatchFecundityFuncPtr(0)
51 {
53 
54  add_parameter("mating_system",INT,true,true,1,6, updater);
55  add_parameter("mating_proportion",DBL,false,true,0,1,updater);
56  add_parameter("mating_males",INT,false,false,0,0, updater);
57 // add_parameter("growth_model", INT, false, true, 1, 7, updater);
58 // add_parameter("growth_rate", DBL, false, false, 0, 0, updater);
59 
61  add_parameter("mean_fecundity",DBL,false,false,0,0, updater);
62  add_parameter("fecundity_dist_stdev",DBL,false,false,0,0, updater);
63  add_parameter("fecundity_distribution",STR,false,false,0,0, updater);
64 
66  add_parameter("sex_ratio_mode",STR,false,false,0,0, updater);
67 }
Individual *(LCE_Breed_base::* MatingFuncPtr)(Patch *, Individual *, unsigned int)
Definition: LCEbreed.h:53
int _mating_system
Definition: LCEbreed.h:47
bool(LCE_Breed_base::* CheckMatingConditionFuncPtr)(Patch *thePatch)
Definition: LCEbreed.h:56
Implementation of the ParamUpdaterBase interface.
Definition: param.h:348
LifeCycleEvent(const char *name, const char *trait_link)
Cstor.
Definition: lifecycleevent.h:98
Individual *(LCE_Breed_base::* DoBreedFuncPtr)(Individual *mother, Individual *father, unsigned int LocalPatch)
Definition: LCEbreed.h:54
virtual void add_parameter(Param *param)
Interface to add a parameter to the set.
Definition: simcomponent.h:112
Definition: types.h:78
TMatrix * _mean_fecundity
Definition: LCEbreed.h:61
double(LCE_Breed_base::* FecundityFuncPtr)(double mean)
Definition: LCEbreed.h:55
bool setFecundity()
Definition: LCEbreed.cc:277
bool setMatingSystem()
Definition: LCEbreed.cc:78
Definition: types.h:78
bool setSexRatio()
Definition: LCEbreed.cc:244
double _mating_proportion
Definition: LCEbreed.h:50
sex_t(LCE_Breed_base::* GetOffsprgSex)()
Definition: LCEbreed.h:57
Definition: types.h:78
virtual LCE_Breed_base::~LCE_Breed_base ( )
inlinevirtual

References _mean_fecundity.

67 {if(_mean_fecundity) delete _mean_fecundity;}
TMatrix * _mean_fecundity
Definition: LCEbreed.h:61

Member Function Documentation

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

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

Referenced by setMatingSystem().

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

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

382 {
383  Individual *newind;
384 
385  if(mother == father) {
386  newind = _popPtr->getNewIndividual();
387  //cloning:
388  (*newind) = (*mother);
389 
390  newind->reset_counters();
391  newind->setFather(NULL);
392  newind->setFatherID(0);
393  newind->setMother(mother);
394  newind->setMotherID(mother->getID());
395  newind->setIsSelfed(true);
396  newind->setHome(LocalPatch);
397  newind->setAge(0);
398  _do_inherit = false;
399  } else {
400  newind = _popPtr->makeNewIndividual(mother, father, getOffsprgSex(), LocalPatch);
401  _do_inherit = true;
402  }
403 
404  return newind;
405 }
void setIsSelfed(bool s)
Definition: individual.h:114
unsigned long getID()
Definition: individual.h:122
void setFather(Individual *f)
Definition: individual.h:109
void setFatherID(unsigned long value)
Definition: individual.h:107
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:104
void setMotherID(unsigned long value)
Definition: individual.h:108
Individual * getNewIndividual()
Creates a blank individual which has to be "decorated" later.
Definition: indfactory.h:85
void setMother(Individual *m)
Definition: individual.h:110
bool _do_inherit
Definition: LCEbreed.h:51
void reset_counters()
Resets the mating and fecundity counters.
Definition: individual.h:210
void setHome(unsigned short value)
Definition: individual.h:111
void setAge(unsigned short value)
Definition: individual.h:105
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81
This class contains traits along with other individual information (sex, pedigree, etc. ).
Definition: individual.h:49
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

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

Referenced by setMatingSystem().

200  {
201  if(thePatch->size(MAL, ADLTx) != 0) thePatch->flush(MAL, ADLTx, this->_popPtr);
202 
203  return (thePatch->size(FEM, ADLTx) != 0);
204  }
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:634
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Definition: types.h:42
Definition: types.h:37
Definition: types.h:37
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

References CheckMatingConditionFuncPtr.

Referenced by LCE_Breed_Selection::execute(), and LCE_Breed::execute().

158  {
159  return (this->* CheckMatingConditionFuncPtr) (thePatch);
160  }
bool(LCE_Breed_base::* CheckMatingConditionFuncPtr)(Patch *thePatch)
Definition: LCEbreed.h:56
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

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

Referenced by setMatingSystem().

166  {
167  return (thePatch->size(FEM, ADLTx) != 0 && thePatch->size(MAL, ADLTx) != 0);
168  }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Definition: types.h:42
Definition: types.h:37
Definition: types.h:37
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

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

Referenced by setMatingSystem().

175  {
176  if(thePatch->size(FEM, ADLTx) == 0 || thePatch->size(MAL, ADLTx) == 0) return false;
177 
178 // if(thePatch->size(MAL, ADLTx) < _mating_males) _mating_males = thePatch->size(MAL, ADLTx);
179 
180  _alpha_male = (unsigned int)RAND::Uniform(thePatch->size(MAL, ADLTx));
181 
182  return true;
183  }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Definition: types.h:42
unsigned int _alpha_male
Definition: LCEbreed.h:49
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:101
Definition: types.h:37
Definition: types.h:37
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

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

Referenced by setMatingSystem().

190  {
191  if(thePatch->size(MAL, ADLTx) != 0) thePatch->flush(MAL, ADLTx, this->_popPtr);
192  return (thePatch->size(FEM, ADLTx) != 0);
193  }
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:634
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Definition: types.h:42
Definition: types.h:37
Definition: types.h:37
Individual* LCE_Breed_base::do_breed ( Individual mother,
Individual father,
unsigned int  LocalPatch 
)
inline

Calls the breeding function unsing its pointer.

Used to distinguish cloning from other mating systems.

References DoBreedFuncPtr.

Referenced by LCE_Breed_Selection::do_breed_selection_FecFitness(), LCE_Breed_Selection::do_breed_selection_OffSurvival(), and LCE_Breed::execute().

149  {
150  return (this->* DoBreedFuncPtr)(mother, father, LocalPatch);
151  }
Individual *(LCE_Breed_base::* DoBreedFuncPtr)(Individual *mother, Individual *father, unsigned int LocalPatch)
Definition: LCEbreed.h:54
bool LCE_Breed_base::doInheritance ( )
inline

References _do_inherit.

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

96 {return _do_inherit;}
bool _do_inherit
Definition: LCEbreed.h:51
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

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

Referenced by setMatingSystem().

273  {
274  if(thePatch->size(MAL, ADLTx) < motherIndex+1)
275  return RandomMating(thePatch, mother, motherIndex);
276  else
277  return thePatch->get(MAL, ADLTx, motherIndex);
278  }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Individual * RandomMating(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to a male drawn randomly from a patch.
Definition: LCEbreed.h:214
Definition: types.h:42
Definition: types.h:37
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
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)

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

Referenced by partialPolyginy(), and setMatingSystem().

224  { return thePatch->get(MAL, ADLTx, _alpha_male); }
Definition: types.h:42
unsigned int _alpha_male
Definition: LCEbreed.h:49
Definition: types.h:37
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
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)

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

Referenced by partialPolyginy_manyMales(), and setMatingSystem().

232  {
233  if(thePatch->size(MAL,ADLTx) < _mating_males)
234  return thePatch->get(MAL, ADLTx, RAND::Uniform( thePatch->size(MAL, ADLTx) ) );
235  else
236  return thePatch->get(MAL, ADLTx, RAND::Uniform( _mating_males ) );
237  }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Definition: types.h:42
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:101
Definition: types.h:37
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
unsigned int _mating_males
Definition: LCEbreed.h:48
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)

Referenced by setMatingSystem().

300  {
301  return mother;
302  }
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

References MatingFuncPtr.

Referenced by LCE_Breed_Selection::do_breed_selection_FecFitness(), LCE_Breed_Selection::do_breed_selection_OffSurvival(), LCE_Breed::execute(), LCE_Breed_Wolbachia::wolbachia_model_1(), and LCE_Breed_Wolbachia::wolbachia_model_2().

76  {
77  return (this->*MatingFuncPtr)(thePatch, mother, motherIndex);
78  }
Individual *(LCE_Breed_base::* MatingFuncPtr)(Patch *, Individual *, unsigned int)
Definition: LCEbreed.h:53
double LCE_Breed_base::getFecundity ( unsigned int  patch)
inline

References FecundityFuncPtr, and TMatrix::get().

Referenced by LCE_Breed_Selection::do_breed_selection_FecFitness(), LCE_Breed_Selection::do_breed_selection_OffSurvival(), LCE_Breed::execute(), LCE_Breed_Wolbachia::wolbachia_model_1(), and LCE_Breed_Wolbachia::wolbachia_model_2().

102 {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:120
TMatrix * _mean_fecundity
Definition: LCEbreed.h:61
double(LCE_Breed_base::* FecundityFuncPtr)(double mean)
Definition: LCEbreed.h:55
double LCE_Breed_base::getFecundity ( double  mean)
inline

References FecundityFuncPtr.

103 {return (this->* FecundityFuncPtr)(mean);}
double(LCE_Breed_base::* FecundityFuncPtr)(double mean)
Definition: LCEbreed.h:55
double LCE_Breed_base::getFixedFecundity ( double  mean)
inline

Referenced by setFecundity().

98 {return mean;}
double LCE_Breed_base::getGaussianFecundity ( double  mean)
inline

References RAND::Gaussian().

Referenced by setFecundity().

99  {
100  double fec; do{fec = mean + RAND::Gaussian(_sd_fecundity);}while(fec < 0);
101  return fec;}
double _sd_fecundity
Definition: LCEbreed.h:50
static double Gaussian(double sigma)
Definition: Uniform.h:238
double LCE_Breed_base::getMatingProportion ( )
inline

References _mating_proportion.

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

93 {return _mating_proportion;}
double _mating_proportion
Definition: LCEbreed.h:50
int LCE_Breed_base::getMatingSystem ( )
inline

References _mating_system.

Referenced by LCE_Breed_Disperse::setParameters().

95 {return _mating_system;}
int _mating_system
Definition: LCEbreed.h:47
double LCE_Breed_base::getMeanFecundity ( unsigned int  patch)
inline

References TMatrix::get().

Referenced by LCE_Breed_Selection::do_breed_selection_FecFitness(), LCE_Breed_Disperse::fixedFecundityGrowth(), LCE_Breed_Wolbachia::setParameters(), LCE_Breed_Selection::setParameters(), LCE_Breed_Disperse::stochasticFecundityGrowth(), and LCE_Breed_Wolbachia::wolbachia_model_2().

94 {return _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:120
TMatrix * _mean_fecundity
Definition: LCEbreed.h:61
sex_t LCE_Breed_base::getOffsprgSex ( )
inline

References GetOffsprgSex.

Referenced by breed(), and breed_cloning().

104 {return (this->* GetOffsprgSex) ();}
sex_t(LCE_Breed_base::* GetOffsprgSex)()
Definition: LCEbreed.h:57
sex_t LCE_Breed_base::getOffsprgSexCloning ( )
inline

References FEM.

Referenced by setSexRatio().

108 {return FEM;}
Definition: types.h:37
sex_t LCE_Breed_base::getOffsprgSexFixed ( )

References RAND::RandBool().

Referenced by setSexRatio().

353 {
354  static bool sex = RAND::RandBool();
355  sex ^= 1;
356  return (sex_t)sex;
357 }
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:36
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:139
sex_t LCE_Breed_base::getOffsprgSexRandom ( )
inline

References RAND::RandBool().

Referenced by setSexRatio().

105 {return (sex_t)RAND::RandBool();}
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:36
static bool RandBool()
Returns a random boolean.
Definition: Uniform.h:139
sex_t LCE_Breed_base::getOffsprgSexSelfing ( )
inline

References FEM.

Referenced by setSexRatio().

107 {return FEM;}
Definition: types.h:37
double LCE_Breed_base::getPoissonFecundity ( double  mean)
inline

References RAND::Poisson().

Referenced by setFecundity().

97 {return RAND::Poisson(mean);}
static double Poisson(double mean)
From the Numerical Recieps.
Definition: Uniform.h:196
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 );
Parameters
indthe offspring, as returned by the do_breed function.

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(), and LCE_Breed::execute().

363 {
364  unsigned int cat = ind->getPedigreeClass();
365 
366  ind->getMother()->DidHaveABaby(cat);
367  if(cat!=4) ind->getFather()->DidHaveABaby(cat);
368 
369  return ind->create(doInheritance(), true);
370 }
Individual * getFather()
Definition: individual.h:126
Individual * getMother()
Definition: individual.h:127
bool doInheritance()
Definition: LCEbreed.h:96
void DidHaveABaby(unsigned int category)
Increments the mating and realized fecundity counters according to the pedigree class of the offsprin...
Definition: individual.h:225
Individual * create()
Creates an individual's genotypes and phenotypes with recombination and mutations.
Definition: individual.h:362
unsigned int getPedigreeClass()
Returns the pedigree class of the individual, as set during offspring creation.
Definition: individual.h:179
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

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

Referenced by setMatingSystem().

287  {
288  if(RAND::Uniform() > _mating_proportion || thePatch->size(MAL, ADLTx) < motherIndex+1)
289  return RandomMating(thePatch, mother, motherIndex);
290  else
291  return thePatch->get(MAL, ADLTx, motherIndex);
292  }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Individual * RandomMating(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to a male drawn randomly from a patch.
Definition: LCEbreed.h:214
Definition: types.h:42
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:101
Definition: types.h:37
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
double _mating_proportion
Definition: LCEbreed.h:50
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)

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

Referenced by setMatingSystem().

245  {
247  return RandomMating(thePatch, mother, 0);
248  else
249  return fullPolyginy(thePatch, 0, 0);
250  }
Individual * fullPolyginy(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to the alpha male of the patch.
Definition: LCEbreed.h:223
Individual * RandomMating(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to a male drawn randomly from a patch.
Definition: LCEbreed.h:214
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:101
double _mating_proportion
Definition: LCEbreed.h:50
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)

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

Referenced by setMatingSystem().

259  {
261  return RandomMating(thePatch, mother, 0);
262  else
263  return fullPolyginy_manyMales(thePatch, mother, 0);
264  }
Individual * RandomMating(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to a male drawn randomly from a patch.
Definition: LCEbreed.h:214
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:101
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:231
double _mating_proportion
Definition: LCEbreed.h:50
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)

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

Referenced by setMatingSystem().

310  {
311  unsigned int fem;
313  do {
314  fem = RAND::Uniform(thePatch->size(FEM, ADLTx));
315  } while(fem == motherIndex && thePatch->size(FEM, ADLTx) != 1);
316  return thePatch->get(FEM, ADLTx, fem);
317  }else
318  return mother;
319  }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Definition: types.h:42
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:101
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
Definition: types.h:37
double _mating_proportion
Definition: LCEbreed.h:50
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)

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

Referenced by setMatingSystem().

327  {
328  return thePatch->get(FEM, ADLTx, RAND::Uniform(thePatch->size(FEM, ADLTx)) );
329  }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Definition: types.h:42
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:101
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
Definition: types.h:37
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)

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

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

215  { return thePatch->get(MAL, ADLTx, RAND::Uniform(thePatch->size(MAL, ADLTx)) ); }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Definition: types.h:42
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:101
Definition: types.h:37
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
bool LCE_Breed_base::setFecundity ( )

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

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

278 {
279  // FECUNDITY
280  if (_mean_fecundity) delete _mean_fecundity;
281 
282  _mean_fecundity = new TMatrix();
283 
284  if (get_parameter("mean_fecundity")->isMatrix()) {
285 
286  get_parameter("mean_fecundity")->getMatrix(_mean_fecundity);
287 
288  if(_mean_fecundity->getNbRows() != 1) {
289  error("\"mean_fecundity\" accepts a single number or a single array with patch-specific values.\n");
290  return false;
291  }
292 
294  error("\"mean_fecundity\" accepts an array of max num patches in length.\n");
295  return false;
296  }
297  else if (_mean_fecundity->getNbCols() < _popPtr->getPatchNbr())
298  {
299  unsigned int npat = _mean_fecundity->getNbCols();
300 
301  TMatrix tmp(*_mean_fecundity);
302 
304 
305  for (unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
306  _mean_fecundity->set(0, i, tmp.get(0 , i % npat));
307  }
308  }
309  } else {
310  _mean_fecundity->reset(1, _popPtr->getPatchNbr()); //single array
311  _mean_fecundity->assign(get_parameter_value("mean_fecundity"));//will be set to -1 if param isn't set
312  }
313 
314 
315 
316  if(get_parameter("fecundity_distribution")->isSet()) {
317 
318  string dist = get_parameter("fecundity_distribution")->getArg();
319 
320  if( dist.compare("fixed") == 0 )
321 
323 
324  else if( dist.compare("poisson") == 0 )
325 
327 
328  else if( dist.compare("normal") == 0 ) {
329 
331 
332  if(get_parameter("fecundity_dist_stdev")->isSet())
333  _sd_fecundity = get_parameter_value("fecundity_dist_stdev");
334  else {
335  error("parameter \"fecundity_dist_stdev\" is missing!\n");
336  return false;
337  }
338 
339  } else {
340  error("unknown fecundity distribution parameter's argument!\n");
341  return false;
342  }
343 
344  } else { //default distribution is Poisson:
346  }
347  return true;
348 }
double getPoissonFecundity(double mean)
Definition: LCEbreed.h:97
double getFixedFecundity(double mean)
Definition: LCEbreed.h:98
double _sd_fecundity
Definition: LCEbreed.h:50
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:143
void assign(double val)
Assigns a value to all element of the matrix.
Definition: tmatrix.h:92
unsigned int getNbCols()
Gives the number of columns.
Definition: tmatrix.h:142
unsigned int getNbRows()
Gives the number of rows.
Definition: tmatrix.h:139
void getMatrix(TMatrix *mat)
Sets the matrix from the argument string if the parameter is set and of matrix type.
Definition: param.cc:329
unsigned int getPatchNbr()
Definition: metapop.h:270
int error(const char *str,...)
Definition: output.cc:73
void set(unsigned int i, unsigned int j, double val)
Sets element at row i and column j to value val.
Definition: tmatrix.h:85
TMatrix * _mean_fecundity
Definition: LCEbreed.h:61
double(LCE_Breed_base::* FecundityFuncPtr)(double mean)
Definition: LCEbreed.h:55
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
double getGaussianFecundity(double mean)
Definition: LCEbreed.h:99
string getArg()
Definition: param.h:136
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
void reset(unsigned int rows, unsigned int cols)
Re-allocate the existing matrix with assigned rows and cols dimensions.
Definition: tmatrix.h:97
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:81
bool isSet()
Definition: param.h:138
bool LCE_Breed_base::setMatingSystem ( )

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

Referenced by LCE_Breed_base(), and setParameters().

79 {
80  _mating_system = (int)this->get_parameter_value("mating_system");
81 
82  if(get_parameter("mating_proportion")->isSet())
83  _mating_proportion = this->get_parameter_value("mating_proportion");
84  else
86 
87  if(_paramSet->isSet("mating_males"))
88  _mating_males = (int)_paramSet->getValue("mating_males");
89  else
90  _mating_males = 1;
91 
92  //set the mating functions ptr:
95  _do_inherit = true; //is true unless the mating system is cloning
96 
97  switch(_mating_system) {
98  //random mating:
99  case 1:
100  {
102  break;
103  }
104  //polygyny:
105  case 2:
106  {
107  if(_mating_proportion == 1)
108  if(_mating_males == 1)
110  else
112  else
113  if(_mating_males == 1)
115  else
117 
119  break;
120  }
121  //monogamy:
122  case 3:
123  {
124  if(_mating_proportion == 1)
126  else
128 
129  break;
130  }
131  //selfing:
132  case 4:
133  {
134  if(_mating_proportion == 1)
136  else
138 
140  break;
141  }
142  //cloning
143  case 5:
144  {
145  if(_mating_proportion == 1)
147  else
149 
152  // _do_inherit = false;
153  break;
154  }
155  //random mating in Wright-Fisher model with hermaphrodites:
156  case 6:
157  {
160  break;
161  }
162 
163  }
164 
165  //Growth model
166 // unsigned int model;
167 // if(_paramSet->isSet("growth_model"))
168 // model = get_parameter_value("growth_model");
169 // else
170 // model = 1;
171 //
172 // switch (model) {
173 // case 1:
174 // GetPatchFecundityFuncPtr = &LCE_Breed_base::instantGrowth;
175 // break;
176 // case 2:
177 // GetPatchFecundityFuncPtr = &LCE_Breed_base::logisticGrowth;
178 // break;
179 // case 3:
180 // GetPatchFecundityFuncPtr = &LCE_Breed_base::stochasticLogisticGrowth;
181 // break;
182 // case 4:
183 // GetPatchFecundityFuncPtr = &LCE_Breed_base::conditionalLogisticGrowth;
184 // break;
185 // case 5:
186 // GetPatchFecundityFuncPtr = &LCE_Breed_base::conditionalStochasticLogisticGrowth;
187 // break;
188 // case 6:
189 // GetPatchFecundityFuncPtr = &LCE_Breed_base::fixedFecundityGrowth;
190 // break;
191 // case 7:
192 // GetPatchFecundityFuncPtr = &LCE_Breed_base::stochasticFecundityGrowth;
193 // break;
194 // default:
195 // GetPatchFecundityFuncPtr = &LCE_Breed_base::instantGrowth;
196 // break;
197 // }
198 //
199 // //growth rate
200 // if (model > 1 && model < 6) {
201 //
202 // if(!_paramSet->isSet("growth_rate")) {
203 // error("parameter \"growth_rate\" needs to be set\n");
204 // return false;
205 // }
206 //
207 // if(_growthRates) delete [] _growthRates;
208 // _growthRates = new double [ _popPtr->getPatchNbr() ];
209 //
210 // if(_paramSet->isMatrix("growth_rate")) {
211 //
212 // TMatrix tmp;
213 //
214 // _paramSet->getMatrix("growth_rate", &tmp);
215 //
216 // if(tmp.getNbCols() != _popPtr->getPatchNbr()){
217 // error("matrix argument to \"growth_rate\" has wrong number of elements,\
218 // must equal the number of patches.\n");
219 // return false;
220 // }
221 //
222 // for (unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
223 // _growthRates[i] = tmp.get(0, i);
224 // }
225 //
226 //
227 // } else { //not a matrix
228 //
229 // _growthRates[0] = get_parameter_value("growth_rate");
230 //
231 // for (unsigned int i = 1; i < _popPtr->getPatchNbr(); i++) {
232 // _growthRates[i] = _growthRates[0];
233 // }
234 // }
235 //
236 //
237 // }
238 
239  return true;
240 }
Individual *(LCE_Breed_base::* MatingFuncPtr)(Patch *, Individual *, unsigned int)
Definition: LCEbreed.h:53
int _mating_system
Definition: LCEbreed.h:47
bool checkPolygyny(Patch *thePatch)
Checks whether mating will take place in the current patch when mating is polygynous.
Definition: LCEbreed.h:174
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:258
Individual * partialSelfing(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns the mother pointer or a random female if _mating_proportion != 1.
Definition: LCEbreed.h:309
bool(LCE_Breed_base::* CheckMatingConditionFuncPtr)(Patch *thePatch)
Definition: LCEbreed.h:56
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:143
bool checkSelfing(Patch *thePatch)
Checks whether mating will take place in the current patch when mating is selfing.
Definition: LCEbreed.h:189
Individual * fullPolyginy(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to the alpha male of the patch.
Definition: LCEbreed.h:223
Individual * breed(Individual *mother, Individual *father, unsigned int LocalPatch)
Makes a new individual with the right parents.
Definition: LCEbreed.cc:374
Individual *(LCE_Breed_base::* DoBreedFuncPtr)(Individual *mother, Individual *father, unsigned int LocalPatch)
Definition: LCEbreed.h:54
Individual * fullSelfing(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns the mother pointer.
Definition: LCEbreed.h:299
bool checkCloning(Patch *thePatch)
Checks whether mating will take place in the current patch when mating is cloning.
Definition: LCEbreed.h:199
Individual * RandomMating(Patch *thePatch, Individual *mother, unsigned int motherIndex)
Returns a pointer to a male drawn randomly from a patch.
Definition: LCEbreed.h:214
bool _do_inherit
Definition: LCEbreed.h:51
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:381
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:272
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:326
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:244
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
double getValue(string name)
Accessor the parameters value.
Definition: param.h:287
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
bool isSet()
Accessor to the status flag.
Definition: param.h:273
unsigned int _mating_males
Definition: LCEbreed.h:48
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:231
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:286
double _mating_proportion
Definition: LCEbreed.h:50
bool isSet()
Definition: param.h:138
bool checkNoSelfing(Patch *thePatch)
Checks whether mating will take place in the current patch when mating is not selfing or cloning...
Definition: LCEbreed.h:165
bool LCE_Breed_base::setParameters ( )
virtual

Implements SimComponent.

Reimplemented in LCE_Breed, LCE_Breed_Selection_Disperse, LCE_Breed_Selection, LCE_Breed_Wolbachia, and LCE_Breed_Disperse.

References setFecundity(), setMatingSystem(), and setSexRatio().

Referenced by LCE_Breed_Disperse::setParameters(), LCE_Breed_Wolbachia::setParameters(), LCE_Breed_Selection::setParameters(), and LCE_Breed::setParameters().

72 {
73  return ( setMatingSystem() && setFecundity() && setSexRatio() );
74 }
bool setFecundity()
Definition: LCEbreed.cc:277
bool setMatingSystem()
Definition: LCEbreed.cc:78
bool setSexRatio()
Definition: LCEbreed.cc:244
bool LCE_Breed_base::setSexRatio ( )

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

Referenced by LCE_Breed_base(), and setParameters().

245 {
246  // SEX-RATIO
247 
248  if(get_parameter("sex_ratio_mode")->isSet()) {
249 
250  if(get_parameter("sex_ratio_mode")->getArg().compare("fixed") == 0)
251 
253 
254  else if(get_parameter("sex_ratio_mode")->getArg().compare("random") != 0) {
255 
256  error("\"sex_ratio_mode\" parameter argument must be either \"fixed\" or \"random\".");
257  return false;
258  } else
260  } else {
261 
262  switch(_mating_system) {
264  break;
266  break;
268  break;
270  }
271  }
272  return true;
273 }
int _mating_system
Definition: LCEbreed.h:47
sex_t getOffsprgSexCloning()
Definition: LCEbreed.h:108
sex_t getOffsprgSexSelfing()
Definition: LCEbreed.h:107
int error(const char *str,...)
Definition: output.cc:73
sex_t getOffsprgSexFixed()
Definition: LCEbreed.cc:352
sex_t getOffsprgSexRandom()
Definition: LCEbreed.h:105
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
sex_t(LCE_Breed_base::* GetOffsprgSex)()
Definition: LCEbreed.h:57

Member Data Documentation

unsigned int LCE_Breed_base::_alpha_male
private
bool LCE_Breed_base::_do_inherit
private
unsigned int LCE_Breed_base::_mating_males
private
double LCE_Breed_base::_mating_proportion
private
int LCE_Breed_base::_mating_system
private
TMatrix* LCE_Breed_base::_mean_fecundity
protected
double LCE_Breed_base::_sd_fecundity
private

Referenced by setFecundity().

bool(LCE_Breed_base::* LCE_Breed_base::CheckMatingConditionFuncPtr)(Patch *thePatch)
private
Individual*(LCE_Breed_base::* LCE_Breed_base::DoBreedFuncPtr)(Individual *mother, Individual *father, unsigned int LocalPatch)
private

Referenced by do_breed(), and setMatingSystem().

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

Referenced by getFecundity(), and setFecundity().

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

Referenced by getOffsprgSex(), and setSexRatio().

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

Referenced by getFatherPtr(), and setMatingSystem().


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

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