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");
330 unsigned int size (
age_idx IDX,
unsigned int deme);
369 age_idx to_age,
unsigned int to_deme,
unsigned int at);
469 Patch*
init (
unsigned int nbfem,
unsigned int nbmal,
unsigned int id);
507 unsigned int mask = 1, s = 0;
509 if( (mask & AGE) != 0) s +=
_sizes[SEX][i];
520 {
return _sizes[SEX][AGE]; }
580 _sizes[SEX][AGE] = new_size;
590 if(
_sizes[SEX][AGE] == 0) {
591 error(
"Patch::remove:: container already empty!!");
594 unsigned int last =
_sizes[SEX][AGE] - 1;
631 for(
unsigned int i = 0; i <
_sizes[SEX][from]; ++i)
661 _containers[SEX][from].assign(temp.begin(), temp.end());
687 for (
unsigned int i = 0; i <
_sizes[SEX][AGE]; ++i) {
704 unsigned int mask = 1;
707 if( (mask & AGE) != 0) {
726 for (
unsigned int i = 0; i <
_sizes[SEX][AGE]; ++i) {
733 for (
unsigned int i = 0; i <
_sizes[from_sex][from_age]; ++i)
734 to_patch->
add(to_sex, to_age,
_containers[from_sex][from_age][i] );
739 for (
unsigned int i = 0; i <
_sizes[SEX][AGE]; ++i)
740 patch->
add(SEX, AGE,
get(SEX, AGE, i) );
810 for(
unsigned int i = 0; i <
_patchNbr; i++)
817 return _vPatch[deme]->size(SEX, IDX);
823 for(
unsigned int i = 0; i <
_vPatch.size(); i++)
831 return (patch!=0? patch->
size(SEX, AGE) : 0);
838 age_idx to_age,
unsigned int to_deme,
unsigned int at)
840 _vPatch[to_deme]->add( SEX, to_age,
get(SEX, from_age, at, from_deme));
842 _vPatch[from_deme]->remove(SEX, from_age, at);
877 for (
unsigned int k = i; k <
_vPatch.size() -1; k++) {
891 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:774
virtual ~MPFileHandler()
Definition: metapop.h:781
virtual void FHwrite()
Definition: metapop.cc:1260
void setOption(int size)
Definition: metapop.h:783
void createAndPrintSample(age_idx AGE, Patch *patch, ofstream &FH)
Definition: metapop.cc:1325
MPFileHandler()
Definition: metapop.h:779
virtual void FHread(string &filename)
Definition: metapop.h:786
void printNoSample(sex_t SEX, age_idx AGE, Patch *patch, ofstream &FH)
Definition: metapop.cc:1309
int _patch_sample_size
Definition: metapop.h:776
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:432
Patch * init(unsigned int nbfem, unsigned int nbmal, unsigned int id)
Definition: patch.cc:38
void setID(unsigned int i)
Definition: metapop.h:472
double getDensity(age_idx age)
Definition: metapop.h:490
unsigned int get_K()
Definition: metapop.h:482
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:588
void getCopy(sex_t SEX, age_idx AGE, deque< Individual * > &to)
Definition: metapop.h:724
unsigned int _KMal
Definition: metapop.h:438
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:498
unsigned int _sizes[2][3]
Containers size counters, sex X age.
Definition: metapop.h:446
void set_isExtinct(bool status)
Definition: metapop.h:476
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
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
unsigned short nbEmigrant
Definition: metapop.h:454
void assign(sex_t SEX, age_idx AGE, size_t n)
Assigns a new container of given size for the sex and age class passed, sets all values to NULL.
Definition: metapop.h:561
unsigned int _age
age since last extinction.
Definition: metapop.h:442
void clear()
Definition: metapop.h:675
unsigned int _capacities[2][3]
Total size of the containers, amount of allocated memory.
Definition: metapop.h:448
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:458
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:702
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:519
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:611
void set_KMal(unsigned int k)
Definition: metapop.h:475
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:685
void flush(age_idx AGE, Metapop *pop)
Definition: metapop.h:694
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:505
unsigned int getID()
Definition: metapop.h:481
void set_age(unsigned int a)
Definition: metapop.h:477
void reset_containers()
Definition: patch.cc:66
unsigned short nbPhilopat
Definition: metapop.h:454
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:543
deque< Individual * > _containers[2][3]
Individuals containers, sex X age.
Definition: metapop.h:450
void copy2patch(sex_t from_sex, sex_t to_sex, age_idx from_age, age_idx to_age, Patch *to_patch)
Definition: metapop.h:731
~Patch()
Definition: patch.cc:120
void move(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:624
void set_KFem(unsigned int k)
Definition: metapop.h:474
unsigned int _KFem
Sex specific carrying capacity.
Definition: metapop.h:438
void resize(sex_t SEX, age_idx AGE, size_t new_size)
Reserves a certain range of values that are assigned to 0 in a given container.
Definition: metapop.h:574
void copy2patch(Patch *patch)
Definition: metapop.h:749
void set_K(unsigned int k)
Definition: metapop.h:473
void copy2patch(age_idx AGE, Patch *patch)
Definition: metapop.h:743
unsigned int get_K(sex_t SEX)
Definition: metapop.h:483
unsigned int _nb_age_class
Number of age classes present.
Definition: metapop.h:444
bool _isExtinct
Extinction flag.
Definition: metapop.h:440
unsigned int get_KFem()
Definition: metapop.h:484
unsigned int get_KMal()
Definition: metapop.h:485
void reset_counters()
Definition: patch.cc:56
unsigned short nbImigrant
Definition: metapop.h:454
void copy2patch(sex_t SEX, age_idx AGE, Patch *patch)
Definition: metapop.h:737
void clear(sex_t SEX, age_idx AGE)
Sets the size of the appropriate container to zero.
Definition: metapop.h:674
void swap_new(sex_t SEX, age_idx from, age_idx to)
Swaps elements between two containers, 'from' age-class container and the 'to' age-class container of...
Definition: metapop.h:645
unsigned int _ID
Patch ID is equal to its position in the metapop patch array.
Definition: metapop.h:434
unsigned int size(age_idx AGE)
Returns the size of the container for the appropriate age class for both sexes.
Definition: metapop.h:525
short nbKolonisers
Definition: metapop.h:455
unsigned int get_age()
Definition: metapop.h:487
bool get_isExtinct()
Definition: metapop.h:486
bool isEmpty()
Definition: metapop.h:488
unsigned int _K
Carrying capacity for males and females.
Definition: metapop.h:436
unsigned int getAdultsNumber()
Definition: metapop.h:489
void flush(Metapop *pop)
Removes all individual pointers of all sex and age classes and flush them into the recycling pool.
Definition: metapop.h:716
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:50
void copy(const TMatrix &mat)
Copy a matrix.
Definition: tmatrix.h:78
double get(unsigned int i, unsigned int j) const
Accessor to element at row i and column j.
Definition: tmatrix.h:193
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