Nemo  2.4.0b
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 ( )
382  : LifeCycleEvent("cross",""), _nSire(0), _nDam(0), _nOffspring(0),
384 {
386  add_parameter("cross_num_sire", INT, 0, 0, 0, 0, updater);
387  add_parameter("cross_num_dam", INT, 0, 0, 0, 0, updater);
388  add_parameter("cross_num_offspring", INT, 0, 0, 0, 0, updater);
389  add_parameter("cross_at_generation", INT, 1, 0, 0, 0, updater);
390  add_parameter("cross_do_among_pop", BOOL, 0, 0, 0, 0, updater);
391  add_parameter("cross_do_within_pop", BOOL, 0, 0, 0, 0, updater);
392  add_parameter("cross_with_replacement", BOOL, 0, 0, 0, 0, updater);
393 
394  add_parameter("cross_with_pedigree_file", STR, 0, 0, 0, 0, updater);
395 
396 }
unsigned int _nDam
Definition: LCEmisc.h:166
bool _doWithinPop
Definition: LCEmisc.h:169
FHPedigreeReader * _reader
Definition: LCEmisc.h:171
bool _doAmongPop
Definition: LCEmisc.h:169
unsigned int _atGeneration
Definition: LCEmisc.h:168
unsigned int _nSire
Definition: LCEmisc.h:166
bool _doReplace
Definition: LCEmisc.h:169
unsigned int _nOffspring
Definition: LCEmisc.h:167
virtual bool setParameters()
Definition: LCEmisc.cc:400
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
@ BOOL
Definition: types.h:78
@ STR
Definition: types.h:78
@ INT
Definition: types.h:78

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

Referenced by clone().

◆ ~LCE_Cross()

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

Member Function Documentation

◆ addAgeClass()

virtual age_t LCE_Cross::addAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

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

References OFFSPRG.

◆ clone()

virtual LifeCycleEvent* LCE_Cross::clone ( )
inlinevirtual

Implements LifeCycleEvent.

188 {return new LCE_Cross();}
LCE_Cross()
Definition: LCEmisc.cc:382

References LCE_Cross().

◆ create_individual_ancestors()

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

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

◆ execute()

void LCE_Cross::execute ( )
virtual

Implements LifeCycleEvent.

454 {
455  Patch* patch;
456  unsigned int nsire;
457  deque<Individual*> males, females;
458 
459  if(_popPtr->getCurrentGeneration() != _atGeneration) return;
460 
461 #ifdef _DEBUG_
462  message("LCE_Cross::execute\n");
463 #endif
464 
465  if(get_parameter("cross_with_pedigree_file")->isSet())
466 
468 
469  else {
470 
471  if(_popPtr->size(OFFSPRG) != 0) {
472  warning("Offspring are still present at time of crossing, flushing\n");
474  }
475 
476  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i ++) {
477 
478  patch = _popPtr->getPatch(i);
479 
480  if(patch->size(MAL, ADLTx) == 0) continue;
481 
482  if(_nSire > patch->size(MAL, ADLTx)) {
483  warning("LCE_Cross:: num_sire greater than actual number of males in patch %i (size = %i), reseting.\n", i+1, patch->size(MAL, ADLTx));
484  nsire = patch->size(MAL, ADLTx);
485  } else
486  nsire = _nSire;
487 
488  males.clear();
489  patch->getCopy(MAL, ADLTx, males);
490 
491  if(_doAmongPop) sampleAmongPop(patch, males, nsire);
492 
493  males.clear();
494  females.clear();
495 
496  if(patch->size(FEM, ADLTx) == 0) continue;
497 
498 
499  if(_doWithinPop) {
500  patch->getCopy(MAL, ADLTx, males);
501  patch->getCopy(FEM, ADLTx, females);
502  sampleWithinPop(patch, males, females, nsire);
503  }
504  }
505  }
506 }
void sampleAmongPop(Patch *patch, deque< Individual * > &males, unsigned int nsire)
Definition: LCEmisc.cc:641
void sampleWithinPop(Patch *patch, deque< Individual * > &males, deque< Individual * > &females, unsigned int nsire)
Definition: LCEmisc.cc:680
void generatePedigree()
Definition: LCEmisc.cc:510
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
unsigned int getCurrentGeneration()
Definition: metapop.h:296
void flush()
Removes all individual pointers and flush them into the recycling pool.
Definition: metapop.h:847
Second class in the metapopulation design structure, between the Metapop and Individual classes.
Definition: metapop.h:432
void getCopy(sex_t SEX, age_idx AGE, deque< Individual * > &to)
Definition: metapop.h:724
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
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:139
void warning(const char *str,...)
Definition: output.cc:58
void message(const char *message,...)
Definition: output.cc:40

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

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

◆ loadFileServices()

void LCE_Cross::loadFileServices ( FileServices loader)
virtual

Implements SimComponent.

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

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.

192 {}

◆ removeAgeClass()

virtual age_t LCE_Cross::removeAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

194 {return 0;}

◆ requiredAgeClass()

virtual age_t LCE_Cross::requiredAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

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

References ADULTS.

◆ resetParameterFromSource()

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

Implements SimComponent.

193 {return false;}

◆ sampleAmongPop()

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

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

◆ sampleWithinPop()

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

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

Referenced by execute().

◆ setParameters()

bool LCE_Cross::setParameters ( )
virtual

Implements SimComponent.

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

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

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

Locations of visitors to this page
Catalogued on GSR