212 for(
unsigned int i = 0; i < 5; i++) {
266 {
for(
unsigned int i = 0; i <
_trait_nb; i++)
Traits[i]->set_value(); }
279 fatal(
"Individual::Trying to access a trait not present in the traits table (at %i, size %i)\n",T,
_trait_nb);
290 fatal(
"Individual::adding a trait to the wrong position (at %i, size %i)!\n",pos,
_trait_nb);
326 {
if(!(mother && father))
327 fatal(
"Individual::create::received null pointer!!!\n");
350 for(
unsigned int i = 0; i <
_trait_nb; i++) {
351 Traits[i]->init_sequence();
355 static unsigned long ID = std::numeric_limits< unsigned long >::max();
385 if(!(mother && father))
386 fatal(
"Individual::create::received null parents pointer!!!\n");
389 for(
unsigned int i = 0; i <
_trait_nb; i++) {
404 for(
unsigned int i = 0; i <
_trait_nb; i++)
A class to store any kind of data in a char buffer before unloading it in a binary data file.
Definition: binarystoragebuffer.h:44
This class contains traits along with other individual information (sex, pedigree,...
Definition: individual.h:49
unsigned long _motherID
Parents ID tags.
Definition: individual.h:58
void inheritTrait(IDX T, Individual *mother, Individual *father)
Calls the inheritance procedure of a particular trait.
Definition: individual.h:309
void setFather(Individual *f)
Definition: individual.h:109
double getFecWithHomePatchMate()
Returns the proportion of succesfull local matings (i.e.
Definition: individual.h:229
void retrieve_data(BinaryStorageBuffer *reader)
Definition: individual.cc:117
Individual * init()
Inits parameters and traits.
Definition: individual.cc:53
unsigned int _trait_nb
Number of traits in the table.
Definition: individual.h:78
void createTrait(IDX i, Individual *mother, Individual *father)
Sets a particular trait's genotype and phenotype values from the two parents.
Definition: individual.h:325
unsigned long _fatherID
Definition: individual.h:58
void Aging()
Definition: individual.h:106
unsigned int getTotMatings()
Gives the total number of matings of an individual.
Definition: individual.h:152
double getFecWithOtherPatchMate()
Returns the proportion of successfull remote matings.
Definition: individual.h:237
void setCurrentID(unsigned long value)
Definition: individual.h:113
~Individual()
Definition: individual.h:91
Individual * _mother
Parents pointers.
Definition: individual.h:60
void setID(unsigned long value)
Definition: individual.h:104
Individual * getFather()
Definition: individual.h:126
void recombine(unsigned long ID)
Definition: individual.h:412
Individual()
Definition: individual.cc:41
static unsigned long currentID
The ID counter, reset at the beginning of each simulation.
Definition: individual.h:83
void setTraitValue(IDX T)
Calls the value setting procedure of a particular trait.
Definition: individual.h:261
sex_t _sex
Sex tag.
Definition: individual.h:56
unsigned long getID()
Definition: individual.h:122
void mutateTrait(IDX T)
Calls the mutation procedure of a particular trait.
Definition: individual.h:317
void reset_counters()
Resets the mating and fecundity counters.
Definition: individual.h:210
Individual & operator=(const Individual &i)
Assignment, make a deep copy of the parameter values and traits.
Definition: individual.cc:161
unsigned short getHome()
Definition: individual.h:128
unsigned int getTotRealizedFecundity()
Gives the total number of surviving offspring for all categories of mating.
Definition: individual.h:176
Individual * getMother()
Definition: individual.h:127
unsigned short getMatings(unsigned int cat)
Gives the number of matings that individual had with mates from a given pedigree class.
Definition: individual.h:142
unsigned char _pedigreeClass
Pedigree class of the individual.
Definition: individual.h:70
unsigned int getTraitNumber()
Accessor to the size of the traits table.
Definition: individual.h:247
std::deque< TTrait * > & getTraits()
Accessot to the traits table itself.
Definition: individual.h:251
void mutate()
Calls the mutation procedure of all the traits present in the individual.
Definition: individual.h:409
unsigned short _realizedFecundity[5]
Number of surviving offspring from the different mating categories (see matings).
Definition: individual.h:76
void setPedigreeClass(Individual *mother, Individual *father)
Definition: individual.h:115
void setMother(Individual *m)
Definition: individual.h:110
Individual * create(bool do_inherit, bool do_mutate)
Creates an individual's genotypes and phenotypes with optional recombination or mutations.
Definition: individual.h:372
unsigned short getAge()
Definition: individual.h:123
void clearTraits()
Clears the traits container.
Definition: individual.h:300
unsigned short _home
Natal Patch tag.
Definition: individual.h:62
double _fecundity
Assigned fecundity.
Definition: individual.h:72
void reset()
Resets parameters and traits values.
Definition: individual.cc:79
unsigned short _age
Age.
Definition: individual.h:54
void addTrait(TTrait *theTrait, IDX pos)
Adds a trait to the table.
Definition: individual.h:288
TTrait * getTrait(IDX T)
Trait accessor.
Definition: individual.h:277
double getFecundity()
Definition: individual.h:133
Individual * create()
Creates an individual's genotypes and phenotypes with recombination and mutations.
Definition: individual.h:362
Individual * createTrait(IDX i, bool do_inherit, bool do_mutate)
Creates an individual's genotypes and phenotypes with optional recombination or mutations on one trai...
Definition: individual.h:339
void store_data(BinaryStorageBuffer *saver)
Definition: individual.cc:102
double setFecundity(double value)
Sets the fecundity to the value given and returns it.
Definition: individual.h:207
void inherit(Individual *mother, Individual *father)
Calls the inheritance procedure of all the traits present in the individual.
Definition: individual.h:401
void setIsSelfed(bool s)
Definition: individual.h:114
void setHome(unsigned short value)
Definition: individual.h:111
unsigned long getMotherID()
Definition: individual.h:125
int IDX
Definition: individual.h:85
void * setTrait(IDX T, void *value)
Sets the phenotype/value of a trait to a particular value.
Definition: individual.h:256
void show_up()
Write some info to stdout.
Definition: individual.cc:132
std::deque< TTrait * > Traits
The traits table.
Definition: individual.h:88
Individual * clone()
Cloning procedure, clones all the traits present in the individual.
Definition: individual.cc:149
void * getTraitValue(IDX T)
Accessor to the value (phenotype) of a particular trait.
Definition: individual.h:271
void setMotherID(unsigned long value)
Definition: individual.h:108
void removeTrait(IDX T)
Removes a trait from the table.
Definition: individual.h:296
void setSex(sex_t sex)
Definition: individual.h:112
unsigned short getRealizedFecundity(unsigned int cat)
Gives the number of surviving offspring for a given pedigree class of mating.
Definition: individual.h:164
sex_t getSex()
Definition: individual.h:129
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_first_gen()
Creates an individual's genotypes and phenotypes for first generation.
Definition: individual.h:348
void setTraitValue()
Calls the value setting procedure of all traits present in an individual.
Definition: individual.h:265
unsigned int getLocalRealizedFecundity()
Gives the total number of surviving offspring when mating occures with mates of the same patch.
Definition: individual.h:170
unsigned short _matings[5]
Mating counter.
Definition: individual.h:74
unsigned long _id
ID tag, unique for one simulation.
Definition: individual.h:52
void setFatherID(unsigned long value)
Definition: individual.h:107
void setAge(unsigned short value)
Definition: individual.h:105
Individual * _father
Definition: individual.h:60
Individual * create(Individual *mother, Individual *father)
Creates an individual, inherit, mutate and set all its trait's values.
Definition: individual.h:383
void setPedigreeClass(unsigned char ped)
Definition: individual.h:116
bool operator==(const Individual &i)
Only checks for traits equivalence.
Definition: individual.cc:204
bool isFemale()
Definition: individual.h:130
bool operator!=(const Individual &i)
Definition: individual.cc:222
unsigned int getPedigreeClass()
Returns the pedigree class of the individual, as set during offspring creation.
Definition: individual.h:179
unsigned long getFatherID()
Definition: individual.h:124
unsigned long getcurrentID()
Definition: individual.h:132
bool getIsSelfed()
Definition: individual.h:131
unsigned short getLocalMatings()
Gives the number of times an individual mated with an individual from the same patch.
Definition: individual.h:147
void addMating(unsigned int category)
Increments the mating counter according to the pedigree class of the offspring.
Definition: individual.h:219
static void recombine(unsigned long indID)
Definition: ttrait_with_map.cc:591
Interface for all trait types, declares all basic trait operations.
Definition: ttrait.h:46
virtual void * set_trait(void *value)=0
Called to set the phenotypic to a particular value or to give context-dependant value(s) to the trait...
virtual void inherit(TTrait *mother, TTrait *father)=0
Inheritance procedure, creates a new trait from mother's and father's traits.
virtual void mutate()=0
Mutation procedure, perform mutations on the genes sequence.
virtual void set_value()=0
Tells the trait to set its phenotype from genotype, should be used instead of getValue().
virtual void * getValue() const =0
Genotype to phenotype mapper.
void fatal(const char *str,...)
Definition: output.cc:96
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:36
@ FEM
Definition: types.h:37