213 void setPopulation (
unsigned int currentReplicate,
unsigned int replicates);
262 fatal(
"Metapop::getPatchPtr()::_vPatch overflow (id=%i nb=%i)\n", patch,
_vPatch.size());
264 if (
_vPatch[patch] == NULL)
fatal(
"Metapop::getPatchPtr()::NULL ptr\n");
328 unsigned int size (
age_idx IDX,
unsigned int deme);
367 age_idx to_age,
unsigned int to_deme,
unsigned int at);
465 Patch*
init (
unsigned int nbfem,
unsigned int nbmal,
unsigned int id);
505 unsigned int mask = 1, s = 0;
507 if( (mask & AGE) != 0) s +=
_sizes[SEX][i];
518 {
return _sizes[SEX][AGE]; }
575 if(
_sizes[SEX][AGE] == 0) {
576 error(
"Patch::remove:: container already empty!!");
579 unsigned int last =
_sizes[SEX][AGE] - 1;
616 for(
unsigned int i = 0; i <
_sizes[SEX][from]; ++i)
645 for (
unsigned int i = 0; i <
_sizes[SEX][AGE]; ++i) {
662 unsigned int mask = 1;
665 if( (mask & AGE) != 0) {
684 for (
unsigned int i = 0; i <
_sizes[SEX][AGE]; ++i) {
691 for (
unsigned int i = 0; i <
_sizes[from_sex][from_age]; ++i)
692 to_patch->
add(to_sex, to_age,
_containers[from_sex][from_age][i] );
697 for (
unsigned int i = 0; i <
_sizes[SEX][AGE]; ++i)
698 patch->
add(SEX, AGE,
get(SEX, AGE, i) );
768 for(
unsigned int i = 0; i <
_patchNbr; i++)
775 return _vPatch[deme]->size(SEX, IDX);
781 for(
unsigned int i = 0; i <
_vPatch.size(); i++)
789 return (patch!=0? patch->
size(SEX, AGE) : 0);
796 age_idx to_age,
unsigned int to_deme,
unsigned int at)
798 _vPatch[to_deme]->add( SEX, to_age,
get(SEX, from_age, at, from_deme));
800 _vPatch[from_deme]->remove(SEX, from_age, at);
835 for (
unsigned int k = i; k <
_vPatch.size() -1; k++) {
849 for (
unsigned int i = 0; i < num; i++)
A class to load a whole population from a binary data file.
Definition: binarydataloader.h:41
Metapop * extractPop(string &filename, unsigned int generation, SimBuilder *sim, Metapop *popPtr)
Definition: binarydataloader.cc:163
A class to store any kind of data in a char buffer before unloading it in a binary data file.
Definition: binarystoragebuffer.h:44
Interface to handle file input/output for any SimComponent.
Definition: filehandler.h:53
A class to manage the files associated with each components of the simulation.
Definition: fileservices.h:52
Factory of Individual, stores the individual prototype and the trait prototypes, manages the individu...
Definition: indfactory.h:43
void recycle(Individual *ind)
Put an individual in the recycling pool.
Definition: indfactory.h:62
This class contains traits along with other individual information (sex, pedigree,...
Definition: individual.h:49
Base class of the Life Cycle Events, declares the LCE interface.
Definition: lifecycleevent.h:73
Definition: metapop.h:732
virtual ~MPFileHandler()
Definition: metapop.h:739
virtual void FHwrite()
Definition: metapop.cc:1260
void setOption(int size)
Definition: metapop.h:741
void createAndPrintSample(age_idx AGE, Patch *patch, ofstream &FH)
Definition: metapop.cc:1325
MPFileHandler()
Definition: metapop.h:737
virtual void FHread(string &filename)
Definition: metapop.h:744
void printNoSample(sex_t SEX, age_idx AGE, Patch *patch, ofstream &FH)
Definition: metapop.cc:1309
int _patch_sample_size
Definition: metapop.h:734
Definition: MPImanager.h:48
A StatHandler for the Metapop SimComponent.
Definition: MPStatHandler.h:40
Second class in the metapopulation design structure, between the Metapop and Individual classes.
Definition: metapop.h:430
Patch * init(unsigned int nbfem, unsigned int nbmal, unsigned int id)
Definition: patch.cc:38
void setID(unsigned int i)
Definition: metapop.h:468
double getDensity(age_idx age)
Definition: metapop.h:488
unsigned int get_K()
Definition: metapop.h:479
void getCopy(sex_t SEX, age_idx AGE, deque< Individual * > &to)
Definition: metapop.h:682
unsigned int _KMal
Definition: metapop.h:436
void show_up()
Definition: patch.cc:134
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
unsigned int _sizes[2][3]
Containers size counters, sex X age.
Definition: metapop.h:444
void set_isExtinct(bool status)
Definition: metapop.h:472
void assign(sex_t SEX, age_idx AGE, unsigned int n)
Assigns a new container of given size for the sex and age class passed, sets all values to NULL.
Definition: metapop.h:561
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
unsigned short nbEmigrant
Definition: metapop.h:452
unsigned int _age
age since last extinction.
Definition: metapop.h:440
Individual * remove(sex_t SEX, age_idx AGE, unsigned int at)
Removes the individual sitting at the given index in the appropriate container.
Definition: metapop.h:573
void clear()
Definition: metapop.h:633
unsigned int _capacities[2][3]
Total size of the containers, amount of allocated memory.
Definition: metapop.h:446
void setNewGeneration(age_t AGE, Metapop *pop)
Fills the patch containers corresponding to the age flags passed, for both sexes.
Definition: patch.cc:80
Patch()
Definition: metapop.h:456
void flush(age_t AGE, Metapop *pop)
Removes all individual pointers of the appropriate sex and age class and flush them into the recyclin...
Definition: metapop.h:660
unsigned int size(sex_t SEX, age_idx AGE)
Returns the size of the container for the appropriate sex and age class.
Definition: metapop.h:517
void move(sex_t SEX, age_idx from, age_idx to, unsigned int at)
Moves an individual from an age class to an other one.
Definition: metapop.h:596
void set_KMal(unsigned int k)
Definition: metapop.h:471
void flush(sex_t SEX, age_idx AGE, Metapop *pop)
Removes all individual pointers of the appropriate sex and age class and flush them into the recyclin...
Definition: metapop.h:643
void flush(age_idx AGE, Metapop *pop)
Definition: metapop.h:652
unsigned int size(sex_t SEX, age_t AGE)
Returns the size of the container for the appropriate sex and age classes present in the age flag.
Definition: metapop.h:503
unsigned int getID()
Definition: metapop.h:478
void set_age(unsigned int a)
Definition: metapop.h:473
void reset_containers()
Definition: patch.cc:66
unsigned short nbPhilopat
Definition: metapop.h:452
void set(sex_t SEX, age_idx AGE, unsigned int at, Individual *ind)
Modifies the appropriate container with value of the pointer given.
Definition: metapop.h:541
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
deque< Individual * > _containers[2][3]
Individuals containers, sex X age.
Definition: metapop.h:448
void copy2patch(sex_t from_sex, sex_t to_sex, age_idx from_age, age_idx to_age, Patch *to_patch)
Definition: metapop.h:689
~Patch()
Definition: patch.cc:120
void set_KFem(unsigned int k)
Definition: metapop.h:470
unsigned int _KFem
Sex specific carrying capacity.
Definition: metapop.h:436
void copy2patch(Patch *patch)
Definition: metapop.h:707
void set_K(unsigned int k)
Definition: metapop.h:469
void copy2patch(age_idx AGE, Patch *patch)
Definition: metapop.h:701
unsigned int get_K(sex_t SEX)
Definition: metapop.h:480
unsigned int _nb_age_class
Number of age classes present.
Definition: metapop.h:442
bool _isExtinct
Extinction flag.
Definition: metapop.h:438
unsigned int get_KFem()
Definition: metapop.h:481
unsigned int get_KMal()
Definition: metapop.h:482
void reset_counters()
Definition: patch.cc:56
unsigned short nbImigrant
Definition: metapop.h:452
void copy2patch(sex_t SEX, age_idx AGE, Patch *patch)
Definition: metapop.h:695
void clear(sex_t SEX, age_idx AGE)
Sets the size of the appropriate container to zero.
Definition: metapop.h:632
unsigned int _ID
Patch ID is equal to its position in the metapop patch array.
Definition: metapop.h:432
void swap(sex_t SEX, age_idx from, age_idx to)
Copies all elements in the 'from' age-class container to the 'to' age-class container of the same sex...
Definition: metapop.h:609
unsigned int size(age_idx AGE)
Returns the size of the container for the appropriate age class for both sexes.
Definition: metapop.h:523
short nbKolonisers
Definition: metapop.h:453
unsigned int get_age()
Definition: metapop.h:485
bool get_isExtinct()
Definition: metapop.h:484
bool isEmpty()
Definition: metapop.h:486
unsigned int _K
Carrying capacity for males and females.
Definition: metapop.h:434
unsigned int getAdultsNumber()
Definition: metapop.h:487
void flush(Metapop *pop)
Removes all individual pointers of all sex and age classes and flush them into the recycling pool.
Definition: metapop.h:674
Provides methods to build the user's selected set of life cycle events and traits from the parameters...
Definition: basicsimulation.h:168
Interface to all basic components of a simulation (traits, life cycle events, pop,...
Definition: simcomponent.h:45
The Service class used to manage the StatHandler objects.
Definition: statservices.h:50
virtual void attach(Handler *H)
attach the StatHandler to the current list (_statHandlers) of the StatServices
Definition: statservices.cc:177
Provides an interface to binary data saving and uploading.
Definition: simcomponent.h:162
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
void copy(const TMatrix &mat)
Copy a matrix.
Definition: tmatrix.h:77
double get(unsigned int i, unsigned int j)
Accessor to element at row i and column j.
Definition: tmatrix.h:147
void fatal(const char *str,...)
Definition: output.cc:96
int error(const char *str,...)
Definition: output.cc:77
#define ALL
All ages age class flag.
Definition: types.h:56
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:36
@ FEM
Definition: types.h:37
@ MAL
Definition: types.h:37
unsigned int age_t
Age class flags.
Definition: types.h:46
age_idx
Array index of the age classes in the patch sizes and containers arrays.
Definition: types.h:41
@ ADLTx
Definition: types.h:42