Nemo  2.3.46
LCE_Breed Class Reference

Implementation of the basic breeding and mating procedures, does not link to any trait. More...

#include <LCEbreed.h>

+ Inheritance diagram for LCE_Breed:
+ Collaboration diagram for LCE_Breed:

Public Member Functions

 LCE_Breed ()
 
virtual ~LCE_Breed ()
 
Implementations
virtual bool setParameters ()
 
virtual void execute ()
 
virtual LifeCycleEventclone ()
 
virtual void loadFileServices (FileServices *loader)
 
virtual void loadStatServices (StatServices *loader)
 
virtual age_t removeAgeClass ()
 
virtual age_t addAgeClass ()
 
virtual age_t requiredAgeClass ()
 
- Public Member Functions inherited from LCE_Breed_base
 LCE_Breed_base ()
 
virtual ~LCE_Breed_base ()
 
virtual IndividualgetFatherPtr (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Calls the mating function according to the model chosen using the function pointer, used to get the father from the mother in a patch. More...
 
Individualbreed (Individual *mother, Individual *father, unsigned int LocalPatch)
 Makes a new individual with the right parents. More...
 
Individualbreed_cloning (Individual *mother, Individual *father, unsigned int LocalPatch)
 Makes a new individual by doing a deep copy of the mother (copies the mother's genes into the offspring). More...
 
IndividualmakeOffspring (Individual *ind)
 Last step of the breeding process, does inheritance and mutation of the parents' genes. More...
 
Individualdo_breed (Individual *mother, Individual *father, unsigned int LocalPatch)
 Calls the breeding function unsing its pointer. More...
 
bool checkMatingCondition (Patch *thePatch)
 Checks if any mating will take place in the patch passed as argument. More...
 
bool checkNoSelfing (Patch *thePatch)
 Checks whether mating will take place in the current patch when mating is not selfing or cloning. More...
 
bool checkPolygyny (Patch *thePatch)
 Checks whether mating will take place in the current patch when mating is polygynous. More...
 
bool checkSelfing (Patch *thePatch)
 Checks whether mating will take place in the current patch when mating is selfing. More...
 
bool checkCloning (Patch *thePatch)
 Checks whether mating will take place in the current patch when mating is cloning. More...
 
bool setMatingSystem ()
 
bool setFecundity ()
 
bool setSexRatio ()
 
double getMatingProportion ()
 
double getMeanFecundity (unsigned int patch)
 
int getMatingSystem ()
 
bool doInheritance ()
 
double getPoissonFecundity (double mean)
 
double getFixedFecundity (double mean)
 
double getGaussianFecundity (double mean)
 
double getFecundity (unsigned int patch)
 
double getFecundity (double mean)
 
sex_t getOffsprgSex ()
 
sex_t getOffsprgSexRandom ()
 
sex_t getOffsprgSexFixed ()
 
sex_t getOffsprgSexSelfing ()
 
sex_t getOffsprgSexCloning ()
 
IndividualRandomMating (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male drawn randomly from a patch. More...
 
IndividualfullPolyginy (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to the alpha male of the patch. More...
 
IndividualfullPolyginy_manyMales (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to one of the first _mating_males males of the patch. More...
 
IndividualpartialPolyginy (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male from a patch chosen at random if _mating_proportion != 1, or the first male otherwise. More...
 
IndividualpartialPolyginy_manyMales (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male from a patch chosen at random if _mating_proportion != 1, or one of the _mating_males first males otherwise. More...
 
IndividualfullMonoginy (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male with same index as mother (if available) from the focal patch. More...
 
IndividualpartialMonoginy (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a pointer to a male with same index as mother (if available) from the focal patch. More...
 
IndividualfullSelfing (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns the mother pointer. More...
 
IndividualpartialSelfing (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns the mother pointer or a random female if _mating_proportion != 1. More...
 
Individualrandom_hermaphrodite (Patch *thePatch, Individual *mother, unsigned int motherIndex)
 Returns a random female from the patch, will be the same mother with probability 1/N (Wright-Fisher model). More...
 
- Public Member Functions inherited from LifeCycleEvent
 LifeCycleEvent (const char *name, const char *trait_link)
 Cstor. More...
 
virtual ~LifeCycleEvent ()
 
virtual void init (Metapop *popPtr)
 Sets the pointer to the current Metapop and the trait link if applicable. More...
 
virtual bool attach_trait (string trait)
 
virtual void set_paramset (std::string name, bool required, SimComponent *owner)
 
virtual void set_event_name (std::string &name)
 Set the name of the event (name of the ParamSet) and add the corresponding parameter to the set. More...
 
virtual void set_event_name (const char *name)
 
virtual string & get_event_name ()
 Accessor to the LCE's name. More...
 
virtual int get_rank ()
 Accessor to the LCE rank in the life cycle. More...
 
virtual void set_pop_ptr (Metapop *popPtr)
 Accessors for the population pointer. More...
 
virtual Metapopget_pop_ptr ()
 
- Public Member Functions inherited from SimComponent
 SimComponent ()
 
virtual ~SimComponent ()
 
virtual void loadUpdaters (UpdaterServices *loader)
 Loads the parameters and component updater onto the updater manager. More...
 
virtual void set_paramset (ParamSet *paramset)
 Sets the ParamSet member. More...
 
virtual void set_paramsetFromCopy (const ParamSet &PSet)
 Reset the set of parameters from a another set. More...
 
virtual ParamSetget_paramset ()
 ParamSet accessor. More...
 
virtual void add_parameter (Param *param)
 Interface to add a parameter to the set. More...
 
virtual void add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd)
 Interface to add a parameter to the set. More...
 
virtual void add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd, ParamUpdaterBase *updater)
 Interface to add a parameter and its updater to the set. More...
 
virtual Paramget_parameter (std::string name)
 Param getter. More...
 
virtual double get_parameter_value (std::string name)
 Param value getter. More...
 
virtual string get_name ()
 Returnd the name of the ParamSet, i.e. More...
 

Additional Inherited Members

- Protected Attributes inherited from LCE_Breed_base
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...
 

Detailed Description

Implementation of the basic breeding and mating procedures, does not link to any trait.

Individuals mate according to the mating system chosen. The mated adults are not removed from the population. The offspring containers are filled with the new generation. Note that they are first emptied if still containing offspring individuals when starting the breeding process.

The population's age is set to ALL. The mating and realized fecundity counters of the reproducing males and females are updated.

See also
LCE_Breed_base

Constructor & Destructor Documentation

LCE_Breed::LCE_Breed ( )
inline

Referenced by clone().

351 : LifeCycleEvent("breed","") { }
LifeCycleEvent(const char *name, const char *trait_link)
Cstor.
Definition: lifecycleevent.h:98
virtual LCE_Breed::~LCE_Breed ( )
inlinevirtual
353 { }

Member Function Documentation

virtual age_t LCE_Breed::addAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

References OFFSPRG.

365 {return OFFSPRG;}
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
virtual LifeCycleEvent* LCE_Breed::clone ( )
inlinevirtual

Implements LifeCycleEvent.

References LCE_Breed().

360 {return new LCE_Breed();}
LCE_Breed()
Definition: LCEbreed.h:351
void LCE_Breed::execute ( )
virtual

Implements LifeCycleEvent.

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

421 {
422  Patch* patch;
423  Individual* mother;
424  Individual* father;
425  Individual* NewOffsprg;
426  unsigned int nbBaby;
427 #ifdef _DEBUG_
428  message("LCE_Breed::execute (Patch nb: %i offsprg nb: %i adlt nb: %i)\n"
430 #endif
431 
432  if(_popPtr->size(OFFSPRG) != 0) {
433  warning("offspring containers not empty at time of breeding, flushing.\n");
434  _popPtr->flush(OFFSx);
435  }
436  //because mean fecundity can be patch-specific, we have to check whether the patch number changed
438 
439  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i++) {
440 
441  patch = _popPtr->getPatch(i);
442 
443  if( !checkMatingCondition(patch) ) continue;
444 
445  unsigned int cnt =0;
446  for(unsigned int size = patch->size(FEM, ADLTx), indexOfMother = 0;
447  indexOfMother < size;
448  indexOfMother++)
449  {
450  mother = patch->get(FEM, ADLTx, indexOfMother);
451 
452  nbBaby = (unsigned int)mother->setFecundity( getFecundity(i) ) ; //allows for patch-specific fec
453  cnt += nbBaby;
454  //-----------------------------------------------------------------------
455  while(nbBaby != 0) {
456 
457  father = this->getFatherPtr(patch, mother, indexOfMother);
458 
459  NewOffsprg = makeOffspring( do_breed(mother, father, i) );
460 
461  patch->add(NewOffsprg->getSex(), OFFSx, NewOffsprg);
462 
463  nbBaby--;
464  }//_END__WHILE
465 
466  }
467  }
468 }
void message(const char *message,...)
Definition: output.cc:40
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
double getFecundity(unsigned int patch)
Definition: LCEbreed.h:102
unsigned int getNbCols()
Gives the number of columns.
Definition: tmatrix.h:142
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
virtual Individual * getFatherPtr(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.
Definition: LCEbreed.h:75
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
TMatrix * _mean_fecundity
Definition: LCEbreed.h:61
Individual * do_breed(Individual *mother, Individual *father, unsigned int LocalPatch)
Calls the breeding function unsing its pointer.
Definition: LCEbreed.h:148
void warning(const char *str,...)
Definition: output.cc:56
Definition: types.h:42
bool checkMatingCondition(Patch *thePatch)
Checks if any mating will take place in the patch passed as argument.
Definition: LCEbreed.h:157
bool setFecundity()
Definition: LCEbreed.cc:277
double setFecundity(double value)
Sets the fecundity to the value given and returns it.
Definition: individual.h:207
void flush()
Removes all individual pointers and flush them into the recycling pool.
Definition: metapop.h:796
Definition: types.h:42
Individual * get(sex_t SEX, age_idx AGE, unsigned int at)
Returns a pointer to the individual sitting at the index passed.
Definition: metapop.h:523
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
sex_t getSex()
Definition: individual.h:129
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
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:540
Definition: types.h:37
Individual * makeOffspring(Individual *ind)
Last step of the breeding process, does inheritance and mutation of the parents' genes.
Definition: LCEbreed.cc:362
virtual void LCE_Breed::loadFileServices ( FileServices loader)
inlinevirtual

Implements SimComponent.

362 {}
virtual void LCE_Breed::loadStatServices ( StatServices loader)
inlinevirtual

Implements SimComponent.

363 {}
virtual age_t LCE_Breed::removeAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

364 {return 0;}
virtual age_t LCE_Breed::requiredAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

References ADULTS.

366 {return ADULTS;}
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
bool LCE_Breed::setParameters ( )
virtual

Reimplemented from LCE_Breed_base.

References LCE_Breed_base::setParameters().

414 {
416 }
virtual bool setParameters()
Definition: LCEbreed.cc:71

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