Nemo  2.4.2
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 ( )
380  : LifeCycleEvent("cross",""), _nSire(0), _nDam(0), _nOffspring(0),
382 {
384  add_parameter("cross_num_sire", INT, 0, 0, 0, 0, updater);
385  add_parameter("cross_num_dam", INT, 0, 0, 0, 0, updater);
386  add_parameter("cross_num_offspring", INT, 0, 0, 0, 0, updater);
387  add_parameter("cross_at_generation", INT, 1, 0, 0, 0, updater);
388  add_parameter("cross_do_among_pop", BOOL, 0, 0, 0, 0, updater);
389  add_parameter("cross_do_within_pop", BOOL, 0, 0, 0, 0, updater);
390  add_parameter("cross_with_replacement", BOOL, 0, 0, 0, 0, updater);
391 
392  add_parameter("cross_with_pedigree_file", STR, 0, 0, 0, 0, updater);
393 
394 }
unsigned int _nDam
Definition: LCEmisc.h:164
bool _doWithinPop
Definition: LCEmisc.h:167
FHPedigreeReader * _reader
Definition: LCEmisc.h:169
bool _doAmongPop
Definition: LCEmisc.h:167
unsigned int _atGeneration
Definition: LCEmisc.h:166
unsigned int _nSire
Definition: LCEmisc.h:164
bool _doReplace
Definition: LCEmisc.h:167
unsigned int _nOffspring
Definition: LCEmisc.h:165
virtual bool setParameters()
Definition: LCEmisc.cc:398
LifeCycleEvent(const char *name, const char *trait_link)
Cstor.
Definition: lifecycleevent.h:96
Implementation of the ParamUpdaterBase interface.
Definition: param.h:371
virtual void add_parameter(Param *param)
Interface to add a parameter to the set.
Definition: simcomponent.h:110
@ BOOL
Definition: types.h:76
@ STR
Definition: types.h:76
@ INT
Definition: types.h:76

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
176 { }

Member Function Documentation

◆ addAgeClass()

virtual age_t LCE_Cross::addAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

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

References OFFSPRG.

◆ clone()

virtual LifeCycleEvent* LCE_Cross::clone ( )
inlinevirtual

Implements LifeCycleEvent.

186 {return new LCE_Cross();}
LCE_Cross()
Definition: LCEmisc.cc:380

References LCE_Cross().

◆ create_individual_ancestors()

bool LCE_Cross::create_individual_ancestors ( Individual ind)
574 {
575  Individual *mother = ind->getMother();
576  Individual *father = ind->getFather();
577  unsigned long sire = ind->getFatherID();
578  unsigned long dam = ind->getMotherID();
579 
580  //the individual is set when the mum and dad ptrs are set, exit
581  if(mother && father) return true;
582 
583  //check parents' ID for sampling in the whole pop; choose individuals in first patch
584  if(dam == 0) {
585 
586  if(_popPtr->size(FEM, ADLTx, 0) != 0) {
587 
588  mother = _popPtr->get(FEM, ADLTx, RAND::Uniform( _popPtr->size(FEM, ADLTx, 0) ), 0);
589 
590  } else {
591  mother = _popPtr->makeNewIndividual(0, 0, FEM, 0);
592  mother->create_first_gen();
593  }
594 
595  ind->setMother(mother);
596  ind->setMotherID(mother->getID());
597 
598  } else if( !mother ) {
599 
601  ind->setMother(_pedigree_pop[ dam ]);
602  }
603  }
604 
605  //father
606  if(sire == 0) {
607 
608  if(_popPtr->size(MAL, ADLTx, 0) != 0 ) {
609 
610  father = _popPtr->get(MAL, ADLTx, RAND::Uniform( _popPtr->size(MAL, ADLTx, 0) ), 0);
611 
612  } else {
613  father = _popPtr->makeNewIndividual(0, 0, MAL, 0);
614  father->create_first_gen();
615  }
616 
617  ind->setFather(father);
618  ind->setFatherID(father->getID());
619 
620  } else if(!father) {
621 
623  ind->setFather( _pedigree_pop[ sire ] );
624 
625  }
626 
627  mother = ind->getMother();
628  father = ind->getFather();
629 
630  if(mother && father) {
631  ind->create(true, true); //create with inheritance and mutation
632  }
633 
634  return( mother && father ); //return false when parents are not created
635 }
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:150
This class contains traits along with other individual information (sex, pedigree,...
Definition: individual.h:47
void setFather(Individual *f)
Definition: individual.h:107
Individual * create()
Creates an individual's genotypes and phenotypes with recombination and mutations.
Definition: individual.h:360
unsigned long getID()
Definition: individual.h:120
void setMother(Individual *m)
Definition: individual.h:108
Individual * getMother()
Definition: individual.h:125
unsigned long getMotherID()
Definition: individual.h:123
void setMotherID(unsigned long value)
Definition: individual.h:106
Individual * getFather()
Definition: individual.h:124
void setFatherID(unsigned long value)
Definition: individual.h:105
unsigned long getFatherID()
Definition: individual.h:122
Individual * create_first_gen()
Creates an individual's genotypes and phenotypes for first generation.
Definition: individual.h:346
map< unsigned long, Individual * > _pedigree_pop
Definition: LCEmisc.h:171
bool create_individual_ancestors(Individual *ind)
Definition: LCEmisc.cc:573
Metapop * _popPtr
The ptr to the current Metapop.
Definition: lifecycleevent.h:79
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together.
Definition: metapop.h:310
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:125
@ FEM
Definition: types.h:35
@ MAL
Definition: types.h:35
@ ADLTx
Definition: types.h:40

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.

452 {
453  Patch* patch;
454  unsigned int nsire;
455  deque<Individual*> males, females;
456 
457  if(_popPtr->getCurrentGeneration() != _atGeneration) return;
458 
459 #ifdef _DEBUG_
460  message("LCE_Cross::execute\n");
461 #endif
462 
463  if(get_parameter("cross_with_pedigree_file")->isSet())
464 
466 
467  else {
468 
469  if(_popPtr->size(OFFSPRG) != 0) {
470  warning("Offspring are still present at time of crossing, flushing\n");
472  }
473 
474  for(unsigned int i = 0; i < _popPtr->getPatchNbr(); i ++) {
475 
476  patch = _popPtr->getPatch(i);
477 
478  if(patch->size(MAL, ADLTx) == 0) continue;
479 
480  if(_nSire > patch->size(MAL, ADLTx)) {
481  warning("LCE_Cross:: num_sire greater than actual number of males in patch %i (size = %i), reseting.\n", i+1, patch->size(MAL, ADLTx));
482  nsire = patch->size(MAL, ADLTx);
483  } else
484  nsire = _nSire;
485 
486  males.clear();
487  patch->getCopy(MAL, ADLTx, males);
488 
489  if(_doAmongPop) sampleAmongPop(patch, males, nsire);
490 
491  males.clear();
492  females.clear();
493 
494  if(patch->size(FEM, ADLTx) == 0) continue;
495 
496 
497  if(_doWithinPop) {
498  patch->getCopy(MAL, ADLTx, males);
499  patch->getCopy(FEM, ADLTx, females);
500  sampleWithinPop(patch, males, females, nsire);
501  }
502  }
503  }
504 }
void sampleAmongPop(Patch *patch, deque< Individual * > &males, unsigned int nsire)
Definition: LCEmisc.cc:639
void sampleWithinPop(Patch *patch, deque< Individual * > &males, deque< Individual * > &females, unsigned int nsire)
Definition: LCEmisc.cc:678
void generatePedigree()
Definition: LCEmisc.cc:508
unsigned int getPatchNbr()
Definition: metapop.h:274
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:255
unsigned int getCurrentGeneration()
Definition: metapop.h:294
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:430
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:496
virtual Param * get_parameter(std::string name)
Param getter.
Definition: simcomponent.h:137
void warning(const char *str,...)
Definition: output.cc:56
void message(const char *message,...)
Definition: output.cc:38

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

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.

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

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.

190 {}

◆ removeAgeClass()

virtual age_t LCE_Cross::removeAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

192 {return 0;}

◆ requiredAgeClass()

virtual age_t LCE_Cross::requiredAgeClass ( )
inlinevirtual

Implements LifeCycleEvent.

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

References ADULTS.

◆ resetParameterFromSource()

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

Implements SimComponent.

191 {return false;}

◆ sampleAmongPop()

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

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

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.

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

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.2 by  doxygen 1.9.1

Catalogued on GSR