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

A class to perform crosses within patches, implements the NC1 mating design. More...

#include <LCEmisc.h>

+ Inheritance diagram for LCE_Cross:
+ Collaboration diagram for LCE_Cross:

Public Member Functions

 LCE_Cross ()
 
virtual ~LCE_Cross ()
 
void sampleAmongPop (Patch *patch, deque< Individual * > &males, unsigned int nsire)
 
void sampleWithinPop (Patch *patch, deque< Individual * > &males, deque< Individual * > &females, unsigned int nsire)
 
void generatePedigree ()
 
bool create_individual_ancestors (Individual *ind)
 
virtual bool setParameters ()
 
virtual void execute ()
 
virtual LifeCycleEventclone ()
 
virtual void loadFileServices (FileServices *loader)
 
virtual void loadStatServices (StatServices *loader)
 
virtual bool resetParameterFromSource (std::string param, SimComponent *cmpt)
 
virtual age_t removeAgeClass ()
 
virtual age_t addAgeClass ()
 
virtual age_t requiredAgeClass ()
 
- Public Member Functions inherited from LifeCycleEvent
 LifeCycleEvent (const char *name, const char *trait_link)
 Cstor. More...
 
virtual ~LifeCycleEvent ()
 
virtual void init (Metapop *popPtr)
 Sets the pointer to the current Metapop and the trait link if applicable. More...
 
virtual bool attach_trait (string trait)
 
virtual void set_paramset (std::string name, bool required, SimComponent *owner)
 
virtual void set_event_name (std::string &name)
 Set the name of the event (name of the ParamSet) and add the corresponding parameter to the set. More...
 
virtual void set_event_name (const char *name)
 
virtual string & get_event_name ()
 Accessor to the LCE's name. More...
 
virtual int get_rank ()
 Accessor to the LCE rank in the life cycle. More...
 
virtual void set_pop_ptr (Metapop *popPtr)
 Accessors for the population pointer. More...
 
virtual Metapopget_pop_ptr ()
 
- Public Member Functions inherited from SimComponent
 SimComponent ()
 
virtual ~SimComponent ()
 
virtual void loadUpdaters (UpdaterServices *loader)
 Loads the parameters and component updater onto the updater manager. More...
 
virtual void set_paramset (ParamSet *paramset)
 Sets the ParamSet member. More...
 
virtual void set_paramsetFromCopy (const ParamSet &PSet)
 Reset the set of parameters from a another set. More...
 
virtual ParamSetget_paramset ()
 ParamSet accessor. More...
 
virtual void add_parameter (Param *param)
 Interface to add a parameter to the set. More...
 
virtual void add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd)
 Interface to add a parameter to the set. More...
 
virtual void add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd, ParamUpdaterBase *updater)
 Interface to add a parameter and its updater to the set. More...
 
virtual Paramget_parameter (std::string name)
 Param getter. More...
 
virtual double get_parameter_value (std::string name)
 Param value getter. More...
 
virtual string get_name ()
 Returnd the name of the ParamSet, i.e. More...
 
virtual bool has_parameter (std::string name)
 Param getter. More...
 

Private Attributes

unsigned int _nSire
 
unsigned int _nDam
 
unsigned int _nOffspring
 
unsigned int _atGeneration
 
bool _doAmongPop
 
bool _doWithinPop
 
bool _doReplace
 
FHPedigreeReader_reader
 
string _pedigree_file
 
map< unsigned long, Individual * > _pedigree_pop
 

Additional Inherited Members

- 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

A class to perform crosses within patches, implements the NC1 mating design.

Constructor & Destructor Documentation

◆ LCE_Cross()

LCE_Cross::LCE_Cross ( )
381  : LifeCycleEvent("cross",""), _nSire(0), _nDam(0), _nOffspring(0),
383 {
385  add_parameter("cross_num_sire", INT, 0, 0, 0, 0, updater);
386  add_parameter("cross_num_dam", INT, 0, 0, 0, 0, updater);
387  add_parameter("cross_num_offspring", INT, 0, 0, 0, 0, updater);
388  add_parameter("cross_at_generation", INT, 1, 0, 0, 0, updater);
389  add_parameter("cross_do_among_pop", BOOL, 0, 0, 0, 0, updater);
390  add_parameter("cross_do_within_pop", BOOL, 0, 0, 0, 0, updater);
391  add_parameter("cross_with_replacement", BOOL, 0, 0, 0, 0, updater);
392 
393  add_parameter("cross_with_pedigree_file", STR, 0, 0, 0, 0, updater);
394 
395 }
unsigned int _nDam
Definition: LCEmisc.h:165
bool _doWithinPop
Definition: LCEmisc.h:168
FHPedigreeReader * _reader
Definition: LCEmisc.h:170
bool _doAmongPop
Definition: LCEmisc.h:168
unsigned int _atGeneration
Definition: LCEmisc.h:167
unsigned int _nSire
Definition: LCEmisc.h:165
bool _doReplace
Definition: LCEmisc.h:168
unsigned int _nOffspring
Definition: LCEmisc.h:166
virtual bool setParameters()
Definition: LCEmisc.cc:399
LifeCycleEvent(const char *name, const char *trait_link)
Cstor.
Definition: lifecycleevent.h:97
Implementation of the ParamUpdaterBase interface.
Definition: param.h:362
virtual void add_parameter(Param *param)
Interface to add a parameter to the set.
Definition: simcomponent.h:111
@ BOOL
Definition: types.h:77
@ STR
Definition: types.h:77
@ INT
Definition: types.h:77

References SimComponent::add_parameter(), BOOL, INT, setParameters(), and STR.

Referenced by clone().

+ Here is the caller graph for this function:

◆ ~LCE_Cross()

virtual LCE_Cross::~LCE_Cross ( )
inlinevirtual
177 { }

Member Function Documentation

◆ addAgeClass()

virtual age_t LCE_Cross::addAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

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

References OFFSPRG.

◆ clone()

virtual LifeCycleEvent* LCE_Cross::clone ( )
inlinevirtual

Implements LifeCycleEvent.

187 {return new LCE_Cross();}
LCE_Cross()
Definition: LCEmisc.cc:381

References LCE_Cross().

◆ create_individual_ancestors()

bool LCE_Cross::create_individual_ancestors ( Individual ind)
575 {
576  Individual *mother = ind->getMother();
577  Individual *father = ind->getFather();
578  unsigned long sire = ind->getFatherID();
579  unsigned long dam = ind->getMotherID();
580 
581  //the individual is set when the mum and dad ptrs are set, exit
582  if(mother && father) return true;
583 
584  //check parents' ID for sampling in the whole pop; choose individuals in first patch
585  if(dam == 0) {
586 
587  if(_popPtr->size(FEM, ADLTx, 0) != 0) {
588 
589  mother = _popPtr->get(FEM, ADLTx, RAND::Uniform( _popPtr->size(FEM, ADLTx, 0) ), 0);
590 
591  } else {
592  mother = _popPtr->makeNewIndividual(0, 0, FEM, 0);
593  mother->create_first_gen();
594  }
595 
596  ind->setMother(mother);
597  ind->setMotherID(mother->getID());
598 
599  } else if( !mother ) {
600 
602  ind->setMother(_pedigree_pop[ dam ]);
603  }
604  }
605 
606  //father
607  if(sire == 0) {
608 
609  if(_popPtr->size(MAL, ADLTx, 0) != 0 ) {
610 
611  father = _popPtr->get(MAL, ADLTx, RAND::Uniform( _popPtr->size(MAL, ADLTx, 0) ), 0);
612 
613  } else {
614  father = _popPtr->makeNewIndividual(0, 0, MAL, 0);
615  father->create_first_gen();
616  }
617 
618  ind->setFather(father);
619  ind->setFatherID(father->getID());
620 
621  } else if(!father) {
622 
624  ind->setFather( _pedigree_pop[ sire ] );
625 
626  }
627 
628  mother = ind->getMother();
629  father = ind->getFather();
630 
631  if(mother && father) {
632  ind->create(true, true); //create with inheritance and mutation
633  }
634 
635  return( mother && father ); //return false when parents are not created
636 }
Individual * makeNewIndividual(Individual *newind, Individual *mother, Individual *father, sex_t sex, unsigned short homepatch)
Creates an individual from existing pointer with new ID.
Definition: indfactory.cc:151
This class contains traits along with other individual information (sex, pedigree,...
Definition: individual.h:48
void setFather(Individual *f)
Definition: individual.h:108
Individual * create()
Creates an individual's genotypes and phenotypes with recombination and mutations.
Definition: individual.h:361
unsigned long getID()
Definition: individual.h:121
void setMother(Individual *m)
Definition: individual.h:109
Individual * getMother()
Definition: individual.h:126
unsigned long getMotherID()
Definition: individual.h:124
void setMotherID(unsigned long value)
Definition: individual.h:107
Individual * getFather()
Definition: individual.h:125
void setFatherID(unsigned long value)
Definition: individual.h:106
unsigned long getFatherID()
Definition: individual.h:123
Individual * create_first_gen()
Creates an individual's genotypes and phenotypes for first generation.
Definition: individual.h:347
map< unsigned long, Individual * > _pedigree_pop
Definition: LCEmisc.h:172
bool create_individual_ancestors(Individual *ind)
Definition: LCEmisc.cc:574
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:80
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together.
Definition: metapop.h:311
Individual * get(sex_t SEX, age_idx AGE, unsigned int at, unsigned int deme)
Returns a pointer to the appropriate individual.
Definition: metapop.h:835
static double Uniform()
Generates a random number from [0.0, 1.0[ uniformly distributed.
Definition: Uniform.h:126
@ FEM
Definition: types.h:36
@ MAL
Definition: types.h:36
@ ADLTx
Definition: types.h:41

References _pedigree_pop, LifeCycleEvent::_popPtr, ADLTx, Individual::create(), Individual::create_first_gen(), FEM, Metapop::get(), Individual::getFather(), Individual::getFatherID(), Individual::getID(), Individual::getMother(), Individual::getMotherID(), IndFactory::makeNewIndividual(), MAL, Individual::setFather(), Individual::setFatherID(), Individual::setMother(), Individual::setMotherID(), Metapop::size(), and RAND::Uniform().

Referenced by generatePedigree().

+ Here is the caller graph for this function:

◆ execute()

void LCE_Cross::execute ( )
virtual

Implements LifeCycleEvent.

453 {
454  Patch* patch;
455  unsigned int nsire;
456  deque<Individual*> males, females;
457 
458  if(_popPtr->getCurrentGeneration() != _atGeneration) return;
459 
460 #ifdef _DEBUG_
461  message("LCE_Cross::execute\n");
462 #endif
463 
464  if(get_parameter("cross_with_pedigree_file")->isSet())
465 
467 
468  else {
469 
470  if(_popPtr->size(OFFSPRG) != 0) {
471  warning("Offspring are still present at time of crossing, flushing\n");
473  }
474 
475  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i ++) {
476 
477  patch = _popPtr->getPatch(i);
478 
479  if(patch->size(MAL, ADLTx) == 0) continue;
480 
481  if(_nSire > patch->size(MAL, ADLTx)) {
482  warning("LCE_Cross:: num_sire greater than actual number of males in patch %i (size = %i), reseting.\n", i+1, patch->size(MAL, ADLTx));
483  nsire = patch->size(MAL, ADLTx);
484  } else
485  nsire = _nSire;
486 
487  males.clear();
488  patch->getCopy(MAL, ADLTx, males);
489 
490  if(_doAmongPop) sampleAmongPop(patch, males, nsire);
491 
492  males.clear();
493  females.clear();
494 
495  if(patch->size(FEM, ADLTx) == 0) continue;
496 
497 
498  if(_doWithinPop) {
499  patch->getCopy(MAL, ADLTx, males);
500  patch->getCopy(FEM, ADLTx, females);
501  sampleWithinPop(patch, males, females, nsire);
502  }
503  }
504  }
505 }
void sampleAmongPop(Patch *patch, deque< Individual * > &males, unsigned int nsire)
Definition: LCEmisc.cc:640
void sampleWithinPop(Patch *patch, deque< Individual * > &males, deque< Individual * > &females, unsigned int nsire)
Definition: LCEmisc.cc:679
void generatePedigree()
Definition: LCEmisc.cc:509
unsigned int getPatchNbr()
Definition: metapop.h:275
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:256
unsigned int getCurrentGeneration()
Definition: metapop.h:295
void flush()
Removes all individual pointers and flush them into the recycling pool.
Definition: metapop.h:848
Second class in the metapopulation design structure, between the Metapop and Individual classes.
Definition: metapop.h:431
void getCopy(sex_t SEX, age_idx AGE, deque< Individual * > &to)
Definition: metapop.h:725
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:497
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:138
void warning(const char *str,...)
Definition: output.cc:57
void message(const char *message,...)
Definition: output.cc:39

References _atGeneration, _doAmongPop, _doWithinPop, _nSire, LifeCycleEvent::_popPtr, ADLTx, FEM, Metapop::flush(), generatePedigree(), SimComponent::get_parameter(), Patch::getCopy(), Metapop::getCurrentGeneration(), Metapop::getPatch(), Metapop::getPatchNbr(), MAL, message(), OFFSPRG, sampleAmongPop(), sampleWithinPop(), Metapop::size(), Patch::size(), and warning().

◆ generatePedigree()

void LCE_Cross::generatePedigree ( )
510 {
511  Individual* ind;;
512 
513 #ifndef USE_MPI
514  //read the pedigree file only once per simulation (but only for non-MPI jobs):
515  if(_popPtr->getCurrentReplicate() == 1)
516 #endif
518 
519 
520  vector< unsigned long * > pedigree = _reader->getPedigree();
521 
522  _pedigree_pop.clear();
523 
524  //read in the individual ID of each record and create individuals
525  for(unsigned int i = 0; i < pedigree.size(); ++i) {
526 
527  if(_pedigree_pop.find(pedigree[i][0]) != _pedigree_pop.end())
528  warning("found duplicated ID %i in pedigree, replacing it with latest record"
529  , pedigree[i][0]);
530  else
531  _pedigree_pop[ pedigree[i][0] ] = _popPtr->getPrototypeClone();
532 
533  ind = _pedigree_pop[ pedigree[i][0] ];
534 
535  ind->init(); //need to allocate traits' memory; warning: sets parents' ID to 0!!!
536  ind->setID( pedigree[i][0] );
537  ind->setFatherID( pedigree[i][1] );
538  ind->setMotherID( pedigree[i][2] );
539 
540  }
541 
542  //create the genetics
543  map< unsigned long, Individual*>::const_iterator REC = _pedigree_pop.begin();
544 
545  while(REC != _pedigree_pop.end()) {
546 
547  //recursively create ancestors of an individual, and the individual by inheritance
548  // adding mutations as well
549  if(!create_individual_ancestors( REC->second ))
550  error("while creating individuals on a pedigree (ID=%i)\n",REC->first);
551 
552  REC++;
553  }
554 
555  //deal with pedigreed population
556  //for now, empty all patches and dump the ped pop in the first patch (offspring fems)
557  _popPtr->flush();
559 
560  Patch* patch = _popPtr->getPatch(0);
561 
562  REC = _pedigree_pop.begin();
563  while(REC != _pedigree_pop.end()) {
564 
565  patch->add(FEM, OFFSx, REC->second);
566 
567  REC++;
568  }
569 
570 }
vector< unsigned long * > & getPedigree()
Definition: LCEmisc.h:210
virtual void FHread(string &filename)
Definition: LCEmisc.cc:727
Individual * getPrototypeClone()
Return an uninitialized copy of the individual prototype.
Definition: indfactory.h:78
Individual * init()
Inits parameters and traits.
Definition: individual.cc:52
void setID(unsigned long value)
Definition: individual.h:103
string _pedigree_file
Definition: LCEmisc.h:171
unsigned int getCurrentReplicate()
Definition: metapop.h:294
void setCurrentAge(age_t age)
Sets the age flag.
Definition: metapop.h:302
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:550
int error(const char *str,...)
Definition: output.cc:78
@ OFFSx
Definition: types.h:41

References _pedigree_file, _pedigree_pop, LifeCycleEvent::_popPtr, _reader, Patch::add(), create_individual_ancestors(), error(), FEM, FHPedigreeReader::FHread(), Metapop::flush(), Metapop::getCurrentReplicate(), Metapop::getPatch(), FHPedigreeReader::getPedigree(), IndFactory::getPrototypeClone(), Individual::init(), OFFSPRG, OFFSx, Metapop::setCurrentAge(), Individual::setFatherID(), Individual::setID(), Individual::setMotherID(), and warning().

Referenced by execute().

+ Here is the caller graph for this function:

◆ loadFileServices()

void LCE_Cross::loadFileServices ( FileServices loader)
virtual

Implements SimComponent.

434 {
435  if( ! get_parameter("cross_with_pedigree_file")->isSet() ) return;
436 
437  if(_reader) delete _reader;
438  _reader = new FHPedigreeReader(this);
439  //set to read mode:
441  //attach to file manager:
442  loader->attach_reader(_reader);
443 
444  _pedigree_file = get_parameter("cross_with_pedigree_file")->getArg();
445 
446  _reader->set(true, false, 1, _atGeneration, 0, "", this);
447 
448 }
virtual void set(bool rpl_per, bool gen_per, int rpl_occ, int gen_occ, int rank, string path, LCE *event)
Definition: filehandler.h:275
A class to read a pedigree from a file.
Definition: LCEmisc.h:202
void set_isInputHandler(bool val)
Definition: filehandler.h:154
virtual void attach_reader(FileHandler *FH)
Attaches the FileHandler to the current list (_readers) of the FileServices.
Definition: fileservices.cc:73
string getArg()
Definition: param.h:137

References _atGeneration, _pedigree_file, _reader, FileServices::attach_reader(), SimComponent::get_parameter(), Param::getArg(), EventFileHandler< LCE >::set(), and FileHandler::set_isInputHandler().

◆ loadStatServices()

virtual void LCE_Cross::loadStatServices ( StatServices loader)
inlinevirtual

Implements SimComponent.

191 {}

◆ removeAgeClass()

virtual age_t LCE_Cross::removeAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

193 {return 0;}

◆ requiredAgeClass()

virtual age_t LCE_Cross::requiredAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

195 {return ADULTS;}
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:53

References ADULTS.

◆ resetParameterFromSource()

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

Implements SimComponent.

192 {return false;}

◆ sampleAmongPop()

void LCE_Cross::sampleAmongPop ( Patch patch,
deque< Individual * > &  males,
unsigned int  nsire 
)
641 {
642  unsigned int at, deme, npatch = _popPtr->getPatchNbr();
643  Individual *sire, *dam;
644  Patch* aimedPatch;
645 
646  for(unsigned int s = 0; s < nsire; ++s) {
647 
648  //sampling parents
649  at = (unsigned int)RAND::Uniform( males.size() );
650 
651  sire = males[at];
652 
653  if( !_doReplace ) males.erase(males.begin() + at);
654 
655  for(unsigned int d = 0; d < _nDam; ++d) {
656  //sample a deme
657  do {
658  deme = (unsigned int)RAND::Uniform(npatch);
659  } while(deme == patch->getID() || patch->size(FEM, ADLTx) == 0);
660 
661  aimedPatch = _popPtr->getPatchPtr(deme);
662  //sample a female
663  dam = aimedPatch->get( FEM, ADLTx, (unsigned int)RAND::Uniform( aimedPatch->size(FEM, ADULTS) ) );
664 
665  if(dam == NULL) {d--; continue;}
666 
667  //mate and breed; ignore sex, put all offs in females' container
668  for(unsigned int k = 0; k < _nOffspring; ++k) {
669 
670  patch->add(FEM, OFFSx, _popPtr->makeOffsprg(dam, sire, FEM, patch->getID()) );
671 
672  }
673  }
674  }
675 }
Individual * makeOffsprg(Individual *mother, Individual *father, sex_t sex, unsigned short homepatch)
Completely creates an individual with inheritance and mutations on all traits.
Definition: indfactory.cc:233
Patch * getPatchPtr(unsigned int patch)
A secure version of the getPatch() method.
Definition: metapop.h:259
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:533
unsigned int getID()
Definition: metapop.h:480

References _doReplace, _nDam, _nOffspring, LifeCycleEvent::_popPtr, Patch::add(), ADLTx, ADULTS, FEM, Patch::get(), Patch::getID(), Metapop::getPatchNbr(), Metapop::getPatchPtr(), IndFactory::makeOffsprg(), OFFSx, Patch::size(), and RAND::Uniform().

Referenced by execute().

+ Here is the caller graph for this function:

◆ sampleWithinPop()

void LCE_Cross::sampleWithinPop ( Patch patch,
deque< Individual * > &  males,
deque< Individual * > &  females,
unsigned int  nsire 
)
680 {
681  unsigned int ndam, at;
682  Individual *sire, *dam;
683 
684  if(!_doReplace && nsire * _nDam > patch->size(FEM,ADLTx)) {
685  ndam = patch->size(FEM,ADLTx)/nsire;
686  warning("LCE_Cross:: total num of dam greater than available females in patch %i, reseting num_dam to %i.\n",patch->getID()+1, ndam);
687  } else
688  ndam = _nDam;
689 
690  if(nsire == 0 || ndam == 0) return;
691 
692  for(unsigned int s = 0; s < nsire; ++s) {
693 
694  //sampling parents
695  at = (unsigned int)RAND::Uniform( males.size() );
696 
697  sire = males[at];
698 
699  if( !_doReplace ) males.erase(males.begin() + at);
700 
701  for(unsigned int d = 0; d < ndam; ++d) {
702 
703  at = (unsigned int)RAND::Uniform( females.size() );
704 
705  dam = females[at];
706 
707  if( !_doReplace ) females.erase(females.begin() + at);
708 
709  //now mate and breed; ignore sex, put all offs in females' container
710  for(unsigned int k = 0; k < _nOffspring; ++k) {
711 
712  patch->add(FEM, OFFSx, _popPtr->makeOffsprg(dam, sire, FEM, patch->getID()) );
713 
714  }
715  }
716  }
717 }

References _doReplace, _nDam, _nOffspring, LifeCycleEvent::_popPtr, Patch::add(), ADLTx, FEM, Patch::getID(), IndFactory::makeOffsprg(), OFFSx, Patch::size(), RAND::Uniform(), and warning().

Referenced by execute().

+ Here is the caller graph for this function:

◆ setParameters()

bool LCE_Cross::setParameters ( )
virtual

Implements SimComponent.

400 {
401  _nSire = (unsigned int)get_parameter_value("cross_num_sire");
402  _nDam = (unsigned int)get_parameter_value("cross_num_dam");
403  _nOffspring = (unsigned int)get_parameter_value("cross_num_offspring");
404  _atGeneration = (unsigned int)get_parameter_value("cross_at_generation");
405 
406  if(get_parameter("cross_do_among_pop")->isSet())
407  _doAmongPop = (unsigned int)get_parameter_value("cross_do_among_pop");
408  else
409  _doAmongPop = 0;
410 
411  if(get_parameter("cross_do_within_pop")->isSet()) {
412  string arg = get_parameter("cross_do_within_pop")->getArg();
413  if (tstring::str2int(arg) == 1) {
414  _doWithinPop = 1;
415  } else if (tstring::str2int(arg) == 0) {
416  _doWithinPop = 0;
417  } else {
418  _doWithinPop = 1;
419  }
420  } else
421  _doWithinPop = true; //by default
422 
423  if(get_parameter("cross_with_replacement")->isSet())
424  _doReplace = (unsigned int)get_parameter_value("cross_with_replacement");
425  else
426  _doReplace = 0;
427 
428  return true;
429 }
bool isSet()
Definition: param.h:139
virtual double get_parameter_value(std::string name)
Param value getter.
Definition: simcomponent.h:142
static int str2int(const string &str)
Converts a string into an integer.
Definition: tstring.h:72

References _atGeneration, _doAmongPop, _doReplace, _doWithinPop, _nDam, _nOffspring, _nSire, SimComponent::get_parameter(), SimComponent::get_parameter_value(), Param::getArg(), Param::isSet(), and tstring::str2int().

Referenced by LCE_Cross().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _atGeneration

unsigned int LCE_Cross::_atGeneration
private

◆ _doAmongPop

bool LCE_Cross::_doAmongPop
private

Referenced by execute(), and setParameters().

◆ _doReplace

bool LCE_Cross::_doReplace
private

◆ _doWithinPop

bool LCE_Cross::_doWithinPop
private

Referenced by execute(), and setParameters().

◆ _nDam

unsigned int LCE_Cross::_nDam
private

◆ _nOffspring

unsigned int LCE_Cross::_nOffspring
private

◆ _nSire

unsigned int LCE_Cross::_nSire
private

Referenced by execute(), and setParameters().

◆ _pedigree_file

string LCE_Cross::_pedigree_file
private

◆ _pedigree_pop

map<unsigned long, Individual* > LCE_Cross::_pedigree_pop
private

◆ _reader

FHPedigreeReader* LCE_Cross::_reader
private

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

Generated for Nemo v2.4.0 by  doxygen 1.9.1 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR