212 void setPopulation (
unsigned int currentReplicate,
unsigned int replicates);
261 fatal(
"Metapop::getPatchPtr()::_vPatch overflow (id=%i nb=%i)\n", patch,
_vPatch.size());
263 if (
_vPatch[patch] == NULL)
fatal(
"Metapop::getPatchPtr()::NULL ptr\n");
329 unsigned int size (
age_idx IDX,
unsigned int deme);
368 age_idx to_age,
unsigned int to_deme,
unsigned int at);
468 Patch*
init (
unsigned int nbfem,
unsigned int nbmal,
unsigned int id);
506 unsigned int mask = 1, s = 0;
508 if( (mask & AGE) != 0) s +=
_sizes[SEX][i];
519 {
return _sizes[SEX][AGE]; }
579 _sizes[SEX][AGE] = new_size;
589 if(
_sizes[SEX][AGE] == 0) {
590 error(
"Patch::remove:: container already empty!!");
593 unsigned int last =
_sizes[SEX][AGE] - 1;
630 for(
unsigned int i = 0; i <
_sizes[SEX][from]; ++i)
647 unsigned int to_size =
_sizes[SEX][to];
662 _containers[SEX][from].assign(temp.begin(), temp.begin()+to_size);
688 for (
unsigned int i = 0; i <
_sizes[SEX][AGE]; ++i) {
705 unsigned int mask = 1;
708 if( (mask & AGE) != 0) {
727 for (
unsigned int i = 0; i <
_sizes[SEX][AGE]; ++i) {
734 for (
unsigned int i = 0; i <
_sizes[from_sex][from_age]; ++i)
735 to_patch->
add(to_sex, to_age,
_containers[from_sex][from_age][i] );
740 for (
unsigned int i = 0; i <
_sizes[SEX][AGE]; ++i)
741 patch->
add(SEX, AGE,
get(SEX, AGE, i) );
811 for(
unsigned int i = 0; i <
_patchNbr; i++)
818 return _vPatch[deme]->size(SEX, IDX);
824 for(
unsigned int i = 0; i <
_vPatch.size(); i++)
832 return (patch!=0? patch->
size(SEX, AGE) : 0);
839 age_idx to_age,
unsigned int to_deme,
unsigned int at)
841 _vPatch[to_deme]->add( SEX, to_age,
get(SEX, from_age, at, from_deme));
843 _vPatch[from_deme]->remove(SEX, from_age, at);
878 for (
unsigned int k = i; k <
_vPatch.size() -1; k++) {
892 for (
unsigned int i = 0; i < num; i++)
A class to load a whole population from a binary data file.
Definition: binarydataloader.h:40
Metapop * extractPop(string &filename, unsigned int generation, SimBuilder *sim, Metapop *popPtr)
Definition: binarydataloader.cc:162
A class to store any kind of data in a char buffer before unloading it in a binary data file.
Definition: binarystoragebuffer.h:43
Interface to handle file input/output for any SimComponent.
Definition: filehandler.h:52
A class to manage the files associated with each components of the simulation.
Definition: fileservices.h:51
Factory of Individual, stores the individual prototype and the trait prototypes, manages the individu...
Definition: indfactory.h:42
void recycle(Individual *ind)
Put an individual in the recycling pool.
Definition: indfactory.h:61
This class contains traits along with other individual information (sex, pedigree,...
Definition: individual.h:48
Base class of the Life Cycle Events, declares the LCE interface.
Definition: lifecycleevent.h:72
Definition: metapop.h:775
virtual ~MPFileHandler()
Definition: metapop.h:782
virtual void FHwrite()
Definition: metapop.cc:1259
void setOption(int size)
Definition: metapop.h:784
void createAndPrintSample(age_idx AGE, Patch *patch, ofstream &FH)
Definition: metapop.cc:1324
MPFileHandler()
Definition: metapop.h:780
virtual void FHread(string &filename)
Definition: metapop.h:787
void printNoSample(sex_t SEX, age_idx AGE, Patch *patch, ofstream &FH)
Definition: metapop.cc:1308
int _patch_sample_size
Definition: metapop.h:777
Definition: MPImanager.h:47
A StatHandler for the Metapop SimComponent.
Definition: MPStatHandler.h:39
Second class in the metapopulation design structure, between the Metapop and Individual classes.
Definition: metapop.h:431
Patch * init(unsigned int nbfem, unsigned int nbmal, unsigned int id)
Definition: patch.cc:37
void setID(unsigned int i)
Definition: metapop.h:471
double getDensity(age_idx age)
Definition: metapop.h:489
unsigned int get_K()
Definition: metapop.h:481
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:587
void getCopy(sex_t SEX, age_idx AGE, deque< Individual * > &to)
Definition: metapop.h:725
unsigned int _KMal
Definition: metapop.h:437
void show_up()
Definition: patch.cc:133
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:497
unsigned int _sizes[2][3]
Containers size counters, sex X age.
Definition: metapop.h:445
void set_isExtinct(bool status)
Definition: metapop.h:475
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:533
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:550
unsigned short nbEmigrant
Definition: metapop.h:453
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:560
unsigned int _age
age since last extinction.
Definition: metapop.h:441
void clear()
Definition: metapop.h:676
unsigned int _capacities[2][3]
Total size of the containers, amount of allocated memory.
Definition: metapop.h:447
void setNewGeneration(age_t AGE, Metapop *pop)
Fills the patch containers corresponding to the age flags passed, for both sexes.
Definition: patch.cc:79
Patch()
Definition: metapop.h:457
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:703
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:518
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:610
void set_KMal(unsigned int k)
Definition: metapop.h:474
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:686
void flush(age_idx AGE, Metapop *pop)
Definition: metapop.h:695
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:504
unsigned int getID()
Definition: metapop.h:480
void set_age(unsigned int a)
Definition: metapop.h:476
void reset_containers()
Definition: patch.cc:65
unsigned short nbPhilopat
Definition: metapop.h:453
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:542
deque< Individual * > _containers[2][3]
Individuals containers, sex X age.
Definition: metapop.h:449
void copy2patch(sex_t from_sex, sex_t to_sex, age_idx from_age, age_idx to_age, Patch *to_patch)
Definition: metapop.h:732
~Patch()
Definition: patch.cc:119
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:623
void set_KFem(unsigned int k)
Definition: metapop.h:473
unsigned int _KFem
Sex specific carrying capacity.
Definition: metapop.h:437
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:573
void copy2patch(Patch *patch)
Definition: metapop.h:750
void set_K(unsigned int k)
Definition: metapop.h:472
void copy2patch(age_idx AGE, Patch *patch)
Definition: metapop.h:744
unsigned int get_K(sex_t SEX)
Definition: metapop.h:482
unsigned int _nb_age_class
Number of age classes present.
Definition: metapop.h:443
bool _isExtinct
Extinction flag.
Definition: metapop.h:439
unsigned int get_KFem()
Definition: metapop.h:483
unsigned int get_KMal()
Definition: metapop.h:484
void reset_counters()
Definition: patch.cc:55
unsigned short nbImigrant
Definition: metapop.h:453
void copy2patch(sex_t SEX, age_idx AGE, Patch *patch)
Definition: metapop.h:738
void clear(sex_t SEX, age_idx AGE)
Sets the size of the appropriate container to zero.
Definition: metapop.h:675
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:644
unsigned int _ID
Patch ID is equal to its position in the metapop patch array.
Definition: metapop.h:433
unsigned int size(age_idx AGE)
Returns the size of the container for the appropriate age class for both sexes.
Definition: metapop.h:524
short nbKolonisers
Definition: metapop.h:454
unsigned int get_age()
Definition: metapop.h:486
bool get_isExtinct()
Definition: metapop.h:485
bool isEmpty()
Definition: metapop.h:487
unsigned int _K
Carrying capacity for males and females.
Definition: metapop.h:435
unsigned int getAdultsNumber()
Definition: metapop.h:488
void flush(Metapop *pop)
Removes all individual pointers of all sex and age classes and flush them into the recycling pool.
Definition: metapop.h:717
Provides methods to build the user's selected set of life cycle events and traits from the parameters...
Definition: basicsimulation.h:167
Interface to all basic components of a simulation (traits, life cycle events, pop,...
Definition: simcomponent.h:44
The Service class used to manage the StatHandler objects.
Definition: statservices.h:49
virtual void attach(Handler *H)
attach the StatHandler to the current list (_statHandlers) of the StatServices
Definition: statservices.cc:176
Provides an interface to binary data saving and uploading.
Definition: simcomponent.h:161
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) const
Accessor to element at row i and column j.
Definition: tmatrix.h:192
void fatal(const char *str,...)
Definition: output.cc:99
int error(const char *str,...)
Definition: output.cc:78
#define ALL
All ages age class flag.
Definition: types.h:55
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:35
@ FEM
Definition: types.h:36
@ MAL
Definition: types.h:36
unsigned int age_t
Age class flags.
Definition: types.h:45
age_idx
Array index of the age classes in the patch sizes and containers arrays.
Definition: types.h:40
@ ADLTx
Definition: types.h:41