211 for(
unsigned int i = 0; i < 5; i++) {
265 {
for(
unsigned int i = 0; i <
_trait_nb; i++)
Traits[i]->set_value(); }
278 fatal(
"Individual::Trying to access a trait not present in the traits table (at %i, size %i)\n",T,
_trait_nb);
289 fatal(
"Individual::adding a trait to the wrong position (at %i, size %i)!\n",pos,
_trait_nb);
325 {
if(!(mother && father))
326 fatal(
"Individual::create::received null pointer!!!\n");
349 for(
unsigned int i = 0; i <
_trait_nb; i++) {
350 Traits[i]->init_sequence();
354 static unsigned long ID = std::numeric_limits< unsigned long >::max();
384 if(!(mother && father))
385 fatal(
"Individual::create::received null parents pointer!!!\n");
388 for(
unsigned int i = 0; i <
_trait_nb; i++) {
403 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:43
This class contains traits along with other individual information (sex, pedigree,...
Definition: individual.h:48
unsigned long _motherID
Parents ID tags.
Definition: individual.h:57
void inheritTrait(IDX T, Individual *mother, Individual *father)
Calls the inheritance procedure of a particular trait.
Definition: individual.h:308
void setFather(Individual *f)
Definition: individual.h:108
double getFecWithHomePatchMate()
Returns the proportion of succesfull local matings (i.e.
Definition: individual.h:228
void retrieve_data(BinaryStorageBuffer *reader)
Definition: individual.cc:116
Individual * init()
Inits parameters and traits.
Definition: individual.cc:52
unsigned int _trait_nb
Number of traits in the table.
Definition: individual.h:77
void createTrait(IDX i, Individual *mother, Individual *father)
Sets a particular trait's genotype and phenotype values from the two parents.
Definition: individual.h:324
unsigned long _fatherID
Definition: individual.h:57
void Aging()
Definition: individual.h:105
unsigned int getTotMatings()
Gives the total number of matings of an individual.
Definition: individual.h:151
double getFecWithOtherPatchMate()
Returns the proportion of successfull remote matings.
Definition: individual.h:236
void setCurrentID(unsigned long value)
Definition: individual.h:112
~Individual()
Definition: individual.h:90
void * setTrait(IDX T, void *value)
Sets the phenotype/value of a trait to a particular value.
Definition: individual.h:255
Individual * _mother
Parents pointers.
Definition: individual.h:59
void setID(unsigned long value)
Definition: individual.h:103
Individual * create()
Creates an individual's genotypes and phenotypes with recombination and mutations.
Definition: individual.h:361
void recombine(unsigned long ID)
Definition: individual.h:411
Individual()
Definition: individual.cc:40
static unsigned long currentID
The ID counter, reset at the beginning of each simulation.
Definition: individual.h:82
void setTraitValue(IDX T)
Calls the value setting procedure of a particular trait.
Definition: individual.h:260
sex_t _sex
Sex tag.
Definition: individual.h:55
unsigned long getID()
Definition: individual.h:121
void mutateTrait(IDX T)
Calls the mutation procedure of a particular trait.
Definition: individual.h:316
void reset_counters()
Resets the mating and fecundity counters.
Definition: individual.h:209
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:127
unsigned int getTotRealizedFecundity()
Gives the total number of surviving offspring for all categories of mating.
Definition: individual.h:175
unsigned short getMatings(unsigned int cat)
Gives the number of matings that individual had with mates from a given pedigree class.
Definition: individual.h:141
unsigned char _pedigreeClass
Pedigree class of the individual.
Definition: individual.h:69
unsigned int getTraitNumber()
Accessor to the size of the traits table.
Definition: individual.h:246
void mutate()
Calls the mutation procedure of all the traits present in the individual.
Definition: individual.h:408
unsigned short _realizedFecundity[5]
Number of surviving offspring from the different mating categories (see matings).
Definition: individual.h:75
void setPedigreeClass(Individual *mother, Individual *father)
Definition: individual.h:114
void setMother(Individual *m)
Definition: individual.h:109
unsigned short getAge()
Definition: individual.h:122
void clearTraits()
Clears the traits container.
Definition: individual.h:299
unsigned short _home
Natal Patch tag.
Definition: individual.h:61
double _fecundity
Assigned fecundity.
Definition: individual.h:71
TTrait * getTrait(IDX T)
Trait accessor.
Definition: individual.h:276
Individual * getMother()
Definition: individual.h:126
void * getTraitValue(IDX T)
Accessor to the value (phenotype) of a particular trait.
Definition: individual.h:270
void reset()
Resets parameters and traits values.
Definition: individual.cc:78
unsigned short _age
Age.
Definition: individual.h:53
void addTrait(TTrait *theTrait, IDX pos)
Adds a trait to the table.
Definition: individual.h:287
Individual * create(Individual *mother, Individual *father)
Creates an individual, inherit, mutate and set all its trait's values.
Definition: individual.h:382
double getFecundity()
Definition: individual.h:132
void store_data(BinaryStorageBuffer *saver)
Definition: individual.cc:101
double setFecundity(double value)
Sets the fecundity to the value given and returns it.
Definition: individual.h:206
void inherit(Individual *mother, Individual *father)
Calls the inheritance procedure of all the traits present in the individual.
Definition: individual.h:400
void setIsSelfed(bool s)
Definition: individual.h:113
void setHome(unsigned short value)
Definition: individual.h:110
unsigned long getMotherID()
Definition: individual.h:124
int IDX
Definition: individual.h:84
void show_up()
Write some info to stdout.
Definition: individual.cc:131
std::deque< TTrait * > Traits
The traits table.
Definition: individual.h:87
Individual * clone()
Cloning procedure, clones all the traits present in the individual.
Definition: individual.cc:149
void setMotherID(unsigned long value)
Definition: individual.h:107
Individual * getFather()
Definition: individual.h:125
void removeTrait(IDX T)
Removes a trait from the table.
Definition: individual.h:295
void setSex(sex_t sex)
Definition: individual.h:111
unsigned short getRealizedFecundity(unsigned int cat)
Gives the number of surviving offspring for a given pedigree class of mating.
Definition: individual.h:163
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:338
sex_t getSex()
Definition: individual.h:128
void DidHaveABaby(unsigned int category)
Increments the mating and realized fecundity counters according to the pedigree class of the offsprin...
Definition: individual.h:224
void setTraitValue()
Calls the value setting procedure of all traits present in an individual.
Definition: individual.h:264
unsigned int getLocalRealizedFecundity()
Gives the total number of surviving offspring when mating occures with mates of the same patch.
Definition: individual.h:169
unsigned short _matings[5]
Mating counter.
Definition: individual.h:73
unsigned long _id
ID tag, unique for one simulation.
Definition: individual.h:51
void setFatherID(unsigned long value)
Definition: individual.h:106
void setAge(unsigned short value)
Definition: individual.h:104
Individual * _father
Definition: individual.h:59
void setPedigreeClass(unsigned char ped)
Definition: individual.h:115
bool operator==(const Individual &i)
Only checks for traits equivalence.
Definition: individual.cc:204
bool isFemale()
Definition: individual.h:129
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:178
unsigned long getFatherID()
Definition: individual.h:123
unsigned long getcurrentID()
Definition: individual.h:131
std::deque< TTrait * > & getTraits()
Accessot to the traits table itself.
Definition: individual.h:250
bool getIsSelfed()
Definition: individual.h:130
Individual * create(bool do_inherit, bool do_mutate)
Creates an individual's genotypes and phenotypes with optional recombination or mutations.
Definition: individual.h:371
unsigned short getLocalMatings()
Gives the number of times an individual mated with an individual from the same patch.
Definition: individual.h:146
Individual * create_first_gen()
Creates an individual's genotypes and phenotypes for first generation.
Definition: individual.h:347
void addMating(unsigned int category)
Increments the mating counter according to the pedigree class of the offspring.
Definition: individual.h:218
static void recombine(unsigned long indID)
Definition: ttrait_with_map.cc:592
Interface for all trait types, declares all basic trait operations.
Definition: ttrait.h:45
virtual void * getValue() const =0
Genotype to phenotype mapper.
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 inherit(const TTrait *mother, const TTrait *father)=0
Inheritance procedure, creates a new trait from mother's and father's traits.
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...
void fatal(const char *str,...)
Definition: output.cc:99
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:35
@ FEM
Definition: types.h:36