Nemo  2.3.46
MPStatHandler Class Reference

A StatHandler for the Metapop SimComponent. More...

#include <MPStatHandler.h>

+ Inheritance diagram for MPStatHandler:
+ Collaboration diagram for MPStatHandler:

Public Member Functions

 MPStatHandler ()
 
virtual ~MPStatHandler ()
 
virtual bool setStatRecorders (std::string &token)
 
void setStatsForDemography (age_t AGE)
 
void setStatsForPop ()
 
void setStatsForPopPerPatch ()
 
void setStatsForMigrants ()
 
void setStatsForMigrantsPerPatch ()
 
void addIndNumPerPatch (sex_t SEX, age_t AGE)
 
void addPatchAge ()
 
Migration
double getMeanEmigrantPerPatch ()
 
double getMeanImigrantPerPatch ()
 
double getMeanMigrantRatio ()
 
double getMeanResidantPerPatch ()
 
double getMeanKolonisersProportion ()
 
double getMeanKolonisersPerPatch ()
 
double getEmigrantInPatch (unsigned int i)
 
double getResidantInPatch (unsigned int i)
 
double getImigrateInPatch (unsigned int i)
 
double getKolonisersInPatch (unsigned int i)
 
Patch extinction
void setObsrvdExtinctionRate ()
 
double getObsrvdExtinctionRate ()
 
double get_isAlive ()
 
double getPatchAge (unsigned int i)
 
double getMeanPatchAge ()
 
Demography
double getAdultSexRatio ()
 
double getOffsprgSexRatio ()
 
double getPatchSize (unsigned int age, unsigned int patch)
 
double getPopulationSize (unsigned int age)
 
double getMeanPatchSize (unsigned int age)
 
double getMeanPatchSizePerSex (unsigned int sex, unsigned int age)
 
double getMeanPatchDensity (age_t AGE)
 
double getMeanPatchDensityVariance (age_t AGE)
 
double getFemNumber (unsigned int i)
 
double getMalNumber (unsigned int i)
 
double getOffFemNumber (unsigned int i)
 
double getOffMalNumber (unsigned int i)
 
double getMeanAssignedFecundity (unsigned int sex)
 
double getMeanMatings (unsigned int sex)
 
double setReproductiveStats (unsigned int sex)
 
double getReproductiveVar ()
 
Kinship
void setKinship ()
 
void setKinClassCounter (Individual *I1, Individual *I2)
 
double getSibProportion (unsigned int i)
 
Pedegree
void setPedegreeCount ()
 
double getPedProportion (unsigned int i)
 
- Public Member Functions inherited from StatHandler< MPStatHandler >
 StatHandler ()
 
virtual ~StatHandler ()
 
virtual void clear ()
 Empties the _recorders list, they are destroyed in StatHandlerBase::reset(). More...
 
virtual StatRecorder
< MPStatHandler > * 
add (std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(MPStatHandler::*getStatNoArg)(void), double(MPStatHandler::*getStatOneArg)(unsigned int), double(MPStatHandler::*getStatTwoArg)(unsigned int, unsigned int), void(MPStatHandler::*setStat)(void))
 Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list. More...
 
- Public Member Functions inherited from StatHandlerBase
 StatHandlerBase ()
 
virtual ~StatHandlerBase ()
 
virtual void reset ()
 Empties the _stats list and calls clear() (defined in the derived class). More...
 
Metapopget_pop_ptr ()
 
void set_service (StatServices *srv)
 
StatServicesget_service ()
 
unsigned int getOccurrence ()
 
unsigned int getNumOccurrences ()
 
unsigned int getCurrentOccurrence ()
 
unsigned int getNbRecorders ()
 
std::list< StatRecBase * > & getStats ()
 
virtual void add (StatRecBase *rec)
 
virtual void init ()
 
virtual void update ()
 This function is left empty as the StatServices calls StatRecorder::setVal directly. More...
 
- Public Member Functions inherited from Handler
virtual ~Handler ()
 

Private Attributes

double meanEmigrant
 
double meanImigrant
 
double meanResidant
 
double meanKolonisers
 
double meanDeadDisp
 
double ObservedExtinctionRate
 
double _sib_prop [5]
 
double _ped_prop [5]
 
double _var_reprod_success
 

Additional Inherited Members

- Protected Types inherited from StatHandler< MPStatHandler >
typedef std::list
< StatRecorder< MPStatHandler >
* >::iterator 
REC_IT
 
- Protected Attributes inherited from StatHandler< MPStatHandler >
std::list< StatRecorder
< MPStatHandler > * > 
_recorders
 The list of stat recorders. More...
 
- Protected Attributes inherited from StatHandlerBase
Metapop_pop
 Link to the current population, set through the link to the StatService. More...
 

Detailed Description

Constructor & Destructor Documentation

MPStatHandler::MPStatHandler ( )
inline
49 { }
virtual MPStatHandler::~MPStatHandler ( )
inlinevirtual
51 {}

Member Function Documentation

void MPStatHandler::addIndNumPerPatch ( sex_t  SEX,
age_t  AGE 
)

References StatHandlerBase::_pop, StatHandler< MPStatHandler >::add(), ADULTS, FEM, getFemNumber(), getMalNumber(), getOffFemNumber(), getOffMalNumber(), Metapop::getPatchNbr(), tstring::int2str(), and OFFSPRG.

Referenced by setStatRecorders(), and setStatsForPopPerPatch().

171 {
172  double (MPStatHandler::* setter) (unsigned int) = 0;
173 
174  if (SEX) {
175 
176  if (AGE == ADULTS) {
177  setter = &MPStatHandler::getFemNumber;
178  } else if (AGE == OFFSPRG) {
180  }
181 
182  } else {
183 
184  if (AGE == ADULTS) {
185  setter = &MPStatHandler::getMalNumber;
186  } else if (AGE == OFFSPRG) {
188  }
189 
190  }
191 
192  string suffix = (AGE == ADULTS ? "adlt.":"off.");
193  string name = (SEX == FEM ? suffix + "fem." : suffix + "mal.");
194  string patch = "p1";
195 
196  add("", name + patch, AGE, 0, 0, 0, setter, 0, 0);
197  for(unsigned int i = 1; i < _pop->getPatchNbr(); i++) {
198  patch = "p" + tstring::int2str(i+1);
199  add("", name + patch, AGE, i, 0, 0, setter, 0, 0);
200  }
201 }
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
double getMalNumber(unsigned int i)
Definition: stats_demo.cc:565
double getOffMalNumber(unsigned int i)
Definition: stats_demo.cc:563
unsigned int getPatchNbr()
Definition: metapop.h:270
A StatHandler for the Metapop SimComponent.
Definition: MPStatHandler.h:40
double getFemNumber(unsigned int i)
Definition: stats_demo.cc:564
static string int2str(const int i)
Writes an integer value into a string.
Definition: tstring.h:95
virtual StatRecorder< MPStatHandler > * add(std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(MPStatHandler::*getStatNoArg)(void), double(MPStatHandler::*getStatOneArg)(unsigned int), double(MPStatHandler::*getStatTwoArg)(unsigned int, unsigned int), void(MPStatHandler::*setStat)(void))
Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.
Definition: stathandler.h:144
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
Definition: types.h:37
double getOffFemNumber(unsigned int i)
Definition: stats_demo.cc:562
void MPStatHandler::addPatchAge ( )

References StatHandlerBase::_pop, StatHandler< MPStatHandler >::add(), ALL, getMeanPatchAge(), getObsrvdExtinctionRate(), getPatchAge(), Metapop::getPatchNbr(), and setObsrvdExtinctionRate().

Referenced by setStatsForPopPerPatch().

204 {
205 
206  std::ostringstream name, sub_name;
207 
208  add("Patch 1 age","age.patch1",ALL,0,0,0,&MPStatHandler::getPatchAge,0,0);
209  for(unsigned int i = 1; i < _pop->getPatchNbr(); i++) {
210  name<<"Patch "<<i+1<<" age";
211  sub_name<<"age.patch"<<i+1;
212  add(name.str(),sub_name.str(),ALL,i,0,0,&MPStatHandler::getPatchAge,0,0);
213  name.str("");
214  sub_name.str("");
215  }
216 
217  add("Mean patch age","patch.avg.age",ALL,0,0,&MPStatHandler::getMeanPatchAge,0,0,0);
218  add("Extinction rate","extrate",ALL,0,0,&MPStatHandler::getObsrvdExtinctionRate,0,0,
220 }
double getPatchAge(unsigned int i)
Definition: stats_demo.cc:172
unsigned int getPatchNbr()
Definition: metapop.h:270
void setObsrvdExtinctionRate()
Definition: stats_demo.cc:162
virtual StatRecorder< MPStatHandler > * add(std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(MPStatHandler::*getStatNoArg)(void), double(MPStatHandler::*getStatOneArg)(unsigned int), double(MPStatHandler::*getStatTwoArg)(unsigned int, unsigned int), void(MPStatHandler::*setStat)(void))
Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.
Definition: stathandler.h:144
#define ALL
All ages age class flag.
Definition: types.h:56
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
double getObsrvdExtinctionRate()
Definition: MPStatHandler.h:78
double getMeanPatchAge()
Definition: stats_demo.cc:178
double MPStatHandler::get_isAlive ( )
double MPStatHandler::getAdultSexRatio ( )

References ADULTS, FEM, and MAL.

Referenced by setStatRecorders(), and setStatsForPop().

557 {return (_pop->size(MAL, ADULTS) != 0 ? (double)_pop->size(FEM, ADULTS)/_pop->size(MAL, ADULTS) : 0);}
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
Definition: types.h:37
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
Definition: types.h:37
double MPStatHandler::getEmigrantInPatch ( unsigned int  i)

References Patch::nbEmigrant.

Referenced by setStatsForMigrantsPerPatch().

129 {
130  Patch* patch = _pop->getPatch(i);
131  return (patch != 0 ? patch->nbEmigrant : 0);
132 }
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned short nbEmigrant
Definition: metapop.h:444
double MPStatHandler::getFemNumber ( unsigned int  i)

References ADULTS, and FEM.

Referenced by addIndNumPerPatch().

564 {return _pop->size(FEM, ADULTS, i);}
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
Definition: types.h:37
double MPStatHandler::getImigrateInPatch ( unsigned int  i)

References Patch::nbImigrant, and Patch::nbPhilopat.

Referenced by setStatsForMigrantsPerPatch().

141 {
142  Patch* patch = _pop->getPatch(i);
143  return (patch != 0 ? (double)patch->nbImigrant/(double)(patch->nbImigrant + patch->nbPhilopat)
144  : nanf("NULL"));
145 }
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned short nbImigrant
Definition: metapop.h:444
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned short nbPhilopat
Definition: metapop.h:444
double MPStatHandler::getKolonisersInPatch ( unsigned int  i)

References Patch::nbKolonisers.

Referenced by setStatsForMigrantsPerPatch().

149 {
150  Patch* patch = _pop->getPatch(i);
151  int colon = (patch != 0 ? patch->nbKolonisers : 0);
152  return (colon != -1 ? colon : nanf("NULL"));
153 }
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
short nbKolonisers
Definition: metapop.h:445
double MPStatHandler::getMalNumber ( unsigned int  i)

References ADULTS, and MAL.

Referenced by addIndNumPerPatch().

565 {return _pop->size(MAL, ADULTS, i);}
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
Definition: types.h:37
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
double MPStatHandler::getMeanAssignedFecundity ( unsigned int  sex)

References ADLTx, FEM, Patch::get(), Individual::getFecundity(), MAL, and Patch::size().

268 {
269  double mean = 0, sum = 0;
270  unsigned int nbpatch = 0;
271  Patch* crnt_patch;
272 
273  if((bool)sex) {
274  for(unsigned int i = 0; i < _pop->getPatchNbr(); ++i) {
275  crnt_patch = _pop->getPatch(i);
276  if(crnt_patch->size(FEM, ADLTx) != 0) {
277  nbpatch++;
278  sum = 0;
279  for(unsigned int j = 0; j < crnt_patch->size(FEM, ADLTx);++j)
280  sum += crnt_patch->get(FEM, ADLTx, j)->getFecundity();
281  mean += sum/crnt_patch->size(FEM, ADLTx);
282  }
283  }
284  } else {
285  for(unsigned int i = 0; i < _pop->getPatchNbr(); ++i) {
286  crnt_patch = _pop->getPatch(i);
287  if(crnt_patch->size(MAL, ADLTx) != 0) {
288  nbpatch++;
289  sum = 0;
290  for(unsigned int j = 0; j < crnt_patch->size(MAL, ADLTx);++j)
291  sum += crnt_patch->get(MAL, ADLTx, j)->getFecundity();
292  mean += sum/crnt_patch->size(MAL, ADLTx);
293  }
294  }
295  }
296  return (nbpatch != 0 ? mean/nbpatch : nanf("NULL"));
297 }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
Definition: types.h:42
Definition: types.h:37
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:523
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
double getFecundity()
Definition: individual.h:133
Definition: types.h:37
double MPStatHandler::getMeanEmigrantPerPatch ( )

Referenced by setStatsForMigrants().

44 {
45  unsigned int meanM = 0;
46 
47  for(unsigned int i = 0; i < _pop->getPatchNbr(); i++)
48  meanM += _pop->getPatch(i)->nbEmigrant;
49  meanEmigrant = (double)meanM/_pop->getPatchNbr();
50  return meanEmigrant;
51 }
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
double meanEmigrant
Definition: MPStatHandler.h:42
unsigned short nbEmigrant
Definition: metapop.h:444
double MPStatHandler::getMeanImigrantPerPatch ( )

References Patch::get_isExtinct(), and Patch::nbImigrant.

Referenced by setStatsForMigrants().

56 {
57  double meanM = 0,nbpatch = 0;
58  Patch* current_patch;
59  for(unsigned int i = 0; i < _pop->getPatchNbr(); i++) {
60  current_patch = _pop->getPatch(i);
61  if(!current_patch->get_isExtinct()){
62  meanM += current_patch->nbImigrant;
63  nbpatch++;
64  }
65  }
66  meanImigrant = (nbpatch != 0 ? meanM/nbpatch : nanf("NULL"));
67  return meanImigrant;
68 }
double meanImigrant
Definition: MPStatHandler.h:42
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned short nbImigrant
Definition: metapop.h:444
bool get_isExtinct()
Definition: metapop.h:475
unsigned int getPatchNbr()
Definition: metapop.h:270
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
double MPStatHandler::getMeanKolonisersPerPatch ( )

References Patch::nbKolonisers.

Referenced by setStatsForMigrants().

114 {
115  double mean = 0,nbpatch = 0;
116  Patch* current_patch;
117  for(unsigned int i = 0; i < _pop->getPatchNbr(); i++){
118  current_patch = _pop->getPatch(i);
119  if(current_patch->nbKolonisers >= 0) {
120  mean += current_patch->nbKolonisers;
121  nbpatch++;
122  }
123  }
124  meanKolonisers = (nbpatch != 0 ? mean/nbpatch : nanf("NULL"));
125  return meanKolonisers;
126 }
double meanKolonisers
Definition: MPStatHandler.h:42
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
short nbKolonisers
Definition: metapop.h:445
double MPStatHandler::getMeanKolonisersProportion ( )

References Patch::get_K(), and Patch::nbKolonisers.

Referenced by setStatsForMigrants().

97 {
98  double nbpatch = 0, mean = 0;
99  Patch* current_patch;
100  for(unsigned int i = 0; i < _pop->getPatchNbr(); i++){
101  current_patch = _pop->getPatch(i);
102  if(current_patch->nbKolonisers >= 0) {
103  mean += fmin((double)current_patch->nbKolonisers / current_patch->get_K(), 1.0);
104  nbpatch++;
105  }
106  }
107 
108  return (nbpatch != 0 ? mean/nbpatch : nanf("NULL"));
109 }
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
unsigned int get_K()
Definition: metapop.h:470
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
short nbKolonisers
Definition: metapop.h:445
double MPStatHandler::getMeanMatings ( unsigned int  sex)

References ADLTx, FEM, Patch::get(), Individual::getTotMatings(), MAL, and Patch::size().

Referenced by setStatRecorders().

302 {
303  double mean = 0, sum = 0;
304  unsigned int nbpatch = 0;
305  Patch* crnt_patch;
306 
307  if((bool)sex) {
308  for(unsigned int i = 0; i < _pop->getPatchNbr(); ++i) {
309  crnt_patch = _pop->getPatch(i);
310  if(crnt_patch->size(FEM, ADLTx) != 0) {
311  nbpatch++;
312  sum = 0;
313  for(unsigned int j = 0; j < crnt_patch->size(FEM, ADLTx);++j)
314  sum += crnt_patch->get(FEM, ADLTx, j)->getTotMatings();
315  mean += sum/crnt_patch->size(FEM, ADLTx);
316  }
317  }
318  } else {
319  for(unsigned int i = 0; i < _pop->getPatchNbr(); ++i) {
320  crnt_patch = _pop->getPatch(i);
321  if(crnt_patch->size(MAL, ADLTx) != 0) {
322  nbpatch++;
323  sum = 0;
324  for(unsigned int j = 0; j < crnt_patch->size(MAL, ADLTx);++j)
325  sum += crnt_patch->get(MAL, ADLTx, j)->getTotMatings();
326  mean += sum/crnt_patch->size(MAL, ADLTx);
327  }
328  }
329  }
330  return (nbpatch != 0 ? mean/nbpatch : nanf("NULL"));
331 }
unsigned int getTotMatings()
Gives the total number of matings of an individual.
Definition: individual.h:152
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
Definition: types.h:42
Definition: types.h:37
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:523
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
Definition: types.h:37
double MPStatHandler::getMeanMigrantRatio ( )

Referenced by setStatsForMigrants().

73 {
75 }
double meanImigrant
Definition: MPStatHandler.h:42
double meanResidant
Definition: MPStatHandler.h:42
double MPStatHandler::getMeanPatchAge ( )

Referenced by addPatchAge().

179 {
180  int mean = 0;
181  for(unsigned int i = 0; i < _pop->getPatchNbr(); ++i)
182  mean += _pop->getPatch(i)->get_age();
183  return mean/_pop->getPatchNbr();
184 }
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
unsigned int get_age()
Definition: metapop.h:476
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
double MPStatHandler::getMeanPatchDensity ( age_t  AGE)

References ADLTx, ADULTS, and OFFSx.

Referenced by setStatsForDemography().

223 {
224  double mean = 0;
225  unsigned int nb_patch = 0;
226  age_idx age = (AGE == ADULTS ? ADLTx : OFFSx);
227 
228  for(unsigned int i = 0; i < _pop->getPatchNbr(); i++) {
229  nb_patch += (_pop->size(AGE, i) != 0);
230  mean += _pop->getPatch(i)->getDensity(age);
231  }
232 
233  return (nb_patch != 0 ? mean/nb_patch : nanf("NULL"));
234 }
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
age_idx
Array index of the age classes in the patch sizes and containers arrays.
Definition: types.h:41
double getDensity(age_idx age)
Definition: metapop.h:479
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
Definition: types.h:42
Definition: types.h:42
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
double MPStatHandler::getMeanPatchDensityVariance ( age_t  AGE)

References ADLTx, ADULTS, and OFFSx.

Referenced by setStatsForDemography().

239 {
240  unsigned int i,nb_patch;
241  vector<double> stat;
242  double var = 0, mean = 0, val;
243  age_idx age = (AGE == ADULTS ? ADLTx : OFFSx);
244 
245  for(i = 0; i < _pop->getPatchNbr(); i++) {
246  if(_pop->size(AGE,i) != 0){
247  val = _pop->getPatch(i)->getDensity(age);
248  stat.push_back(val);
249  mean += val;
250  }
251  }
252  nb_patch = stat.size();
253  mean = (nb_patch != 0 ? mean/nb_patch : 0);
254 
255  for(i = 0; i < nb_patch; i++)
256  var += pow((stat[i]-mean),2);
257 
258  return (nb_patch != 0 ? var/nb_patch : nanf("NULL"));
259 }
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
age_idx
Array index of the age classes in the patch sizes and containers arrays.
Definition: types.h:41
double getDensity(age_idx age)
Definition: metapop.h:479
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
Definition: types.h:42
Definition: types.h:42
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
double MPStatHandler::getMeanPatchSize ( unsigned int  age)
193 {
194  double mean = 0;
195  unsigned int nb_patch = 0;
196 
197  for(unsigned int i = 0; i < _pop->getPatchNbr(); i++) {
198  nb_patch += (_pop->size(age_t(age),i) != 0);
199  mean += _pop->size(age_t(age),i);
200  }
201 
202  return (nb_patch != 0 ? mean/nb_patch : nanf("NULL"));
203 }
unsigned int age_t
Age class flags.
Definition: types.h:46
unsigned int getPatchNbr()
Definition: metapop.h:270
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
double MPStatHandler::getMeanPatchSizePerSex ( unsigned int  sex,
unsigned int  age 
)

Referenced by setStatsForDemography().

208 {
209  double mean = 0;
210  unsigned int nb_patch = 0;
211 
212  for(unsigned int i = 0; i < _pop->getPatchNbr(); i++) {
213  nb_patch += (_pop->size(sex_t(sex),age_t(age),i) != 0);
214  mean += _pop->size(sex_t(sex),age_t(age),i);
215  }
216 
217  return (nb_patch != 0 ? mean/nb_patch : nanf("NULL"));
218 }
unsigned int age_t
Age class flags.
Definition: types.h:46
unsigned int getPatchNbr()
Definition: metapop.h:270
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:36
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
double MPStatHandler::getMeanResidantPerPatch ( )

References Patch::get_isExtinct(), and Patch::nbPhilopat.

Referenced by setStatsForMigrants().

80 {
81  double meanR = 0,nbpatch = 0;
82  Patch* current_patch;
83  for(unsigned int i = 0; i < _pop->getPatchNbr(); i++){
84  current_patch = _pop->getPatch(i);
85  if(!current_patch->get_isExtinct()){
86  meanR += current_patch->nbPhilopat;
87  nbpatch++;
88  }
89  }
90  meanResidant = (nbpatch != 0 ? meanR/nbpatch : nanf("NULL"));
91  return meanResidant;
92 }
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
bool get_isExtinct()
Definition: metapop.h:475
unsigned int getPatchNbr()
Definition: metapop.h:270
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
double meanResidant
Definition: MPStatHandler.h:42
unsigned short nbPhilopat
Definition: metapop.h:444
double MPStatHandler::getObsrvdExtinctionRate ( )
inline

References ObservedExtinctionRate.

Referenced by addPatchAge(), setStatRecorders(), and setStatsForPop().

78 {return ObservedExtinctionRate;}
double ObservedExtinctionRate
Definition: MPStatHandler.h:43
double MPStatHandler::getOffFemNumber ( unsigned int  i)

References FEM, and OFFSPRG.

Referenced by addIndNumPerPatch().

562 {return _pop->size(FEM, OFFSPRG,i);}
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
Definition: types.h:37
double MPStatHandler::getOffMalNumber ( unsigned int  i)

References MAL, and OFFSPRG.

Referenced by addIndNumPerPatch().

563 {return _pop->size(MAL, OFFSPRG,i);}
Definition: types.h:37
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
double MPStatHandler::getOffsprgSexRatio ( )

References FEM, MAL, and OFFSPRG.

Referenced by setStatRecorders(), and setStatsForPop().

556 {return (_pop->size(MAL, OFFSPRG)!= 0 ? (double)_pop->size(FEM, OFFSPRG)/_pop->size(MAL, OFFSPRG) : 0);}
Definition: types.h:37
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
Definition: types.h:37
double MPStatHandler::getPatchAge ( unsigned int  i)

References Patch::get_age().

Referenced by addPatchAge().

173 {
174  Patch* patch = _pop->getPatch(i);
175  return (patch != 0 ? patch->get_age() : 0);
176 }
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int get_age()
Definition: metapop.h:476
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
double MPStatHandler::getPatchSize ( unsigned int  age,
unsigned int  patch 
)
559 {return _pop->size(age_t(age), patch);}
unsigned int age_t
Age class flags.
Definition: types.h:46
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
double MPStatHandler::getPedProportion ( unsigned int  i)
inline

Referenced by setStatRecorders().

112 {return _ped_prop[i];}
double _ped_prop[5]
Definition: MPStatHandler.h:44
double MPStatHandler::getPopulationSize ( unsigned int  age)

Referenced by setStatsForDemography().

560 {return _pop->size(age_t(age));}
unsigned int age_t
Age class flags.
Definition: types.h:46
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
double MPStatHandler::getReproductiveVar ( )
inline

References _var_reprod_success.

Referenced by setStatRecorders().

101 {return _var_reprod_success;}
double _var_reprod_success
Definition: MPStatHandler.h:45
double MPStatHandler::getResidantInPatch ( unsigned int  i)

References Patch::nbPhilopat.

Referenced by setStatsForMigrantsPerPatch().

135 {
136  Patch* patch = _pop->getPatch(i);
137  return (patch != 0 ? patch->nbPhilopat : 0);
138 }
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned short nbPhilopat
Definition: metapop.h:444
double MPStatHandler::getSibProportion ( unsigned int  i)
inline

Referenced by setStatRecorders().

107 {return _sib_prop[i];}
double _sib_prop[5]
Definition: MPStatHandler.h:44
void MPStatHandler::setKinClassCounter ( Individual I1,
Individual I2 
)

References Individual::getFatherID(), and Individual::getMotherID().

497 {
498  //non sibs
499  if((I1->getMotherID() != I2->getMotherID()) && (I1->getFatherID() != I2->getFatherID()))
500  _sib_prop[0]++;
501 
502  //maternal half sibs
503  else if((I1->getMotherID() == I2->getMotherID()) && (I1->getFatherID() != I2->getFatherID()))
504  _sib_prop[1]++;
505 
506  //paternal half sibs
507  else if((I1->getMotherID() != I2->getMotherID()) && (I1->getFatherID() == I2->getFatherID()))
508  _sib_prop[2]++;
509 
510  //full sibs
511  else if((I1->getMotherID() == I2->getMotherID()) && (I1->getFatherID() == I2->getFatherID()))
512  _sib_prop[3]++;
513 }
unsigned long getMotherID()
Definition: individual.h:125
double _sib_prop[5]
Definition: MPStatHandler.h:44
unsigned long getFatherID()
Definition: individual.h:124
void MPStatHandler::setKinship ( )

References FEM, Patch::get(), Individual::getIsSelfed(), MAL, OFFSPRG, OFFSx, and Patch::size().

Referenced by setStatRecorders().

408 {
409  unsigned int i,j,k;
410  unsigned int patchNbr = this->_pop->getPatchNbr(), Msize=0, Fsize=0;
411  Patch* current_patch;
412  Individual *I1,*I2;
413 
414  //counters initialization
415  for(i = 0; i < 5; ++i) _sib_prop[i] = 0.0;
416 
417  for( i = 0; i < patchNbr; ++i) {
418 
419  current_patch = _pop->getPatch(i);
420 
421  //male-male
422  if ( (Msize = current_patch->size(MAL, OFFSx)) != 0) {
423 
424  for(j = 0; j < Msize -1; ++j) {
425 
426  I1 = current_patch->get(MAL, OFFSx, j);
427 
428  for(k = j+1; k < Msize; ++k) {
429 
430  I2 = current_patch->get(MAL, OFFSx, k);
431 
432  setKinClassCounter(I1, I2);
433 
434  } //end for k < size
435 
436  //selfed offspring counter:
437  if(I1->getIsSelfed()) _sib_prop[4]++;
438 
439  } //end for j < size-1
440 
441  //don't forget the last one!
442  if(current_patch->get(MAL, OFFSx, Msize -1)->getIsSelfed()) _sib_prop[4]++;
443 
444  }//endif
445 
446  //female-female
447  if ( (Fsize = current_patch->size(FEM, OFFSx)) != 0) {
448 
449  for(j = 0; j < Fsize -1; ++j) {
450 
451  I1 = current_patch->get(FEM, OFFSx, j);
452 
453  for(k = j+1; k < Fsize; ++k) {
454 
455  I2 = current_patch->get(FEM, OFFSx, k);
456 
457  setKinClassCounter(I1, I2);
458 
459  } //end for k < size
460 
461  //selfed offspring counter:
462  if(I1->getIsSelfed()) _sib_prop[4]++;
463 
464  } //end for j < size-1
465 
466  //don't forget the last one!
467  if(current_patch->get(FEM, OFFSx, Fsize -1)->getIsSelfed()) _sib_prop[4]++;
468 
469  }//endif
470 
471  //male-female
472  for(j = 0; j < Msize; ++j) {
473 
474  I1 = current_patch->get(MAL, OFFSx, j);
475 
476  for(k = 0; k < Fsize; ++k) {
477 
478  I2 = current_patch->get(FEM, OFFSx, k);
479 
480  setKinClassCounter(I1, I2);
481  } //end for k
482  } //end for j
483 
484  } //end for i < patchNbr
485 
486  //total number of pairwise comparisons:
487  double tot = _sib_prop[0] + _sib_prop[1] + _sib_prop[2] + _sib_prop[3];
488 
489  for(i = 0 ; i < 4; ++i) _sib_prop[i] /= tot;
490 
491  _sib_prop[4] /= _pop->size(OFFSPRG);
492 }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
double _sib_prop[5]
Definition: MPStatHandler.h:44
unsigned int getPatchNbr()
Definition: metapop.h:270
bool getIsSelfed()
Definition: individual.h:131
Definition: types.h:37
Definition: types.h:42
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:523
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
This class contains traits along with other individual information (sex, pedigree, etc. ).
Definition: individual.h:49
Definition: types.h:37
void setKinClassCounter(Individual *I1, Individual *I2)
Definition: stats_demo.cc:496
void MPStatHandler::setObsrvdExtinctionRate ( )

Referenced by addPatchAge(), setStatRecorders(), and setStatsForPop().

163 {
165 
166  for(unsigned int i = 0; i < _pop->getPatchNbr(); ++i)
168 
170 }
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
bool isEmpty()
Definition: metapop.h:477
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
double ObservedExtinctionRate
Definition: MPStatHandler.h:43
void MPStatHandler::setPedegreeCount ( )

References FEM, Patch::get(), Individual::getPedigreeClass(), MAL, OFFSx, and Patch::size().

Referenced by setStatRecorders().

519 {
520 
521  unsigned int i,j;
522  unsigned int patchNbr = _pop->getPatchNbr();
523  Patch* patch;
524 
525  //counters initialization
526  for(i = 0; i < 5; ++i) _ped_prop[i] = 0.0;
527 
528  for(i = 0; i < patchNbr; ++i) {
529 
530  patch = _pop->getPatch(i);
531 
532  //males
533  for(j = 0; j < patch->size(MAL, OFFSx); ++j) {
534 
535  _ped_prop[ patch->get(MAL, OFFSx, j)->getPedigreeClass() ]++;
536 
537  }
538 
539  //females
540  for(j = 0; j < patch->size(FEM, OFFSx); ++j) {
541 
542  _ped_prop[ patch->get(FEM, OFFSx, j)->getPedigreeClass() ]++;
543 
544  }
545 
546 
547  } //end for i < patchNbr
548 
549  //total:
550  double tot = _ped_prop[0] + _ped_prop[1] + _ped_prop[2] + _ped_prop[3] + _ped_prop[4];
551 
552  for(i = 0 ; i < 5; ++i) _ped_prop[i] /= tot;
553 
554 }
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
unsigned int getPedigreeClass()
Returns the pedigree class of the individual, as set during offspring creation.
Definition: individual.h:179
Definition: types.h:37
Definition: types.h:42
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:523
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
double _ped_prop[5]
Definition: MPStatHandler.h:44
Definition: types.h:37
double MPStatHandler::setReproductiveStats ( unsigned int  sex)

References ADLTx, ADULTS, FEM, Patch::get(), Individual::getTotRealizedFecundity(), MAL, and Patch::size().

Referenced by setStatRecorders().

336 {
337  double var = 0, mean = 0;
338  unsigned int tot_size = _pop->size( (sex_t)sex, ADULTS ), v = 0;
339  double *stat;
340  Patch *crnt_patch;
341 
342  if(tot_size == 0) {
343  _var_reprod_success = nanf("NULL");
344  return nanf("NULL");
345  }
346 
347  stat = new double [tot_size];
348 
349  //females
350  if((bool)sex) {
351 
352  for(unsigned int i = 0; i < _pop->getPatchNbr(); ++i) {
353  crnt_patch = _pop->getPatch(i);
354  for(unsigned int j = 0, size = crnt_patch->size(FEM, ADLTx);
355  j < size;
356  ++j)
357  {
358  stat[v] = crnt_patch->get(FEM, ADLTx, j)->getTotRealizedFecundity();
359  mean += stat[v];
360  v++;
361  }
362  }
363 
364  mean /= tot_size;
365 
366  for(unsigned int i = 0; i < tot_size; ++i)
367  var += pow( (stat[i] - mean), 2);
368 
369  var /= tot_size;
370  //males
371  } else {
372 
373  for(unsigned int i = 0; i < _pop->getPatchNbr(); ++i) {
374  crnt_patch = _pop->getPatch(i);
375  for(unsigned int j = 0, size = crnt_patch->size(MAL, ADLTx);
376  j < size;
377  ++j)
378  {
379  stat[v] = crnt_patch->get(MAL, ADLTx, j)->getTotRealizedFecundity();
380  mean += stat[v];
381  v++;
382  }
383  }
384 
385  mean /= tot_size;
386 
387  for(unsigned int i = 0; i < tot_size; ++i)
388  var += pow( (stat[i] - mean), 2);
389 
390  var /= tot_size;
391 
392  }
393 
394  _var_reprod_success = var;
395 
396  delete [] stat;
397 
398  return mean;
399 }
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
unsigned int getTotRealizedFecundity()
Gives the total number of surviving offspring for all categories of mating.
Definition: individual.h:176
unsigned int size(age_t AGE)
Returns the size of the container of the appropriate age class(es) for both sexes.
Definition: metapop.h:487
Second class in the metapopulation design structure, between the Metapop and Individual classes...
Definition: metapop.h:421
Patch * getPatch(unsigned int i)
Patch accessor, return the ith+1 patch in the metapop.
Definition: metapop.h:251
unsigned int getPatchNbr()
Definition: metapop.h:270
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:36
Definition: types.h:42
double _var_reprod_success
Definition: MPStatHandler.h:45
Definition: types.h:37
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:523
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
unsigned int size()
Get the total number of individuals present in the population, all sex and age classes together...
Definition: metapop.h:302
Definition: types.h:37
bool MPStatHandler::setStatRecorders ( std::string &  token)
virtual

Implements StatHandlerBase.

References StatHandler< MPStatHandler >::add(), addIndNumPerPatch(), ADULTS, ALL, FEM, getAdultSexRatio(), getMeanMatings(), getObsrvdExtinctionRate(), getOffsprgSexRatio(), getPedProportion(), getReproductiveVar(), getSibProportion(), MAL, message(), OFFSPRG, setKinship(), setObsrvdExtinctionRate(), setPedegreeCount(), setReproductiveStats(), setStatsForDemography(), setStatsForMigrants(), setStatsForMigrantsPerPatch(), setStatsForPop(), and setStatsForPopPerPatch().

43 {
44 #ifdef _DEBUG_
45  message("-MPStatHandler::setStatRecorders ");
46 #endif
47 
48  if(token.compare("extrate") == 0) {
49 
50  add("Extinction rate","extrate",ALL,0,0,&MPStatHandler::getObsrvdExtinctionRate,0,0,
52 
53  } else if(token.compare("pop") == 0) {
54 
56 
57  } else if(token.compare("pop.patch") == 0) {
58 
60 
61  } else if(token.compare("off.fem.patch") == 0) {
62 
64 
65  } else if(token.compare("off.mal.patch") == 0) {
66 
68 
69  } else if(token.compare("adlt.fem.patch") == 0) {
70 
72 
73  } else if(token.compare("adlt.mal.patch") == 0) {
74 
76 
77  } else if(token.compare("adlt.sexratio") == 0) {
78 
79  add("Adults sex ratio","adlt.sexratio",ADULTS,0,0,&MPStatHandler::getAdultSexRatio,0,0,0);
80 
81  } else if(token.compare("off.sexratio") == 0) {
82 
83  add("Offspring Sex Ratio","off.sexratio",OFFSPRG,0,0,&MPStatHandler::getOffsprgSexRatio,0,0,0);
84 
85  } else if(token.compare("migrants") == 0) {
86 
88 
89  } else if(token.compare("migrants.patch") == 0) {
90 
92 
93  } else if(token.compare("demography") == 0) {
94 
97 
98  } else if(token.compare("off.demography") == 0) {
99 
101 
102  } else if(token.compare("adlt.demography") == 0) {
103 
105 
106  } else if(token.compare("fecundity") == 0) {
107 
108  add("Females assigned fecundity","adlt.femfec",ADULTS,1,0,0,&MPStatHandler::getMeanMatings,0,0);
109  add("Females realized fecundity","adlt.femrealfec",ADULTS,1,0,0,&MPStatHandler::setReproductiveStats,0,0);
110  add("Females reproductive var ","adlt.femvarfec",ADULTS,0,0,&MPStatHandler::getReproductiveVar,0,0,0);
111  add("Males realized fecundity ","adlt.malrealfec",ADULTS,0,0,0,&MPStatHandler::setReproductiveStats,0,0);
112  add("Males reproductive var ","adlt.malvarfec",ADULTS,0,0,&MPStatHandler::getReproductiveVar,0,0,0);
113 
114  } else if(token.compare("kinship") == 0) {
115 
116  add("Proportion of full-sib offspring","off.fsib",OFFSPRG,3,0,0,&MPStatHandler::getSibProportion,0,&MPStatHandler::setKinship);
117  add("Proportion of paternal half-sib ","off.phsib",OFFSPRG,2,0,0,&MPStatHandler::getSibProportion,0,0);
118  add("Proportion of maternal half-sib ","off.mhsib",OFFSPRG,1,0,0, &MPStatHandler::getSibProportion,0,0);
119  add("Proportion of non-sib offspring ","off.nsib",OFFSPRG,0,0,0,&MPStatHandler::getSibProportion,0,0);
120  add("Proportion of selfed offspring ","off.self",OFFSPRG,4,0,0,&MPStatHandler::getSibProportion,0,0);
121 
122  } else if(token == "pedigree") {
123 
124  add("Proportion of other deme mated","ped.outb",OFFSPRG,0,0,0,&MPStatHandler::getPedProportion,0,&MPStatHandler::setPedegreeCount);
125  add("Proportion of same deme mated ","ped.outw",OFFSPRG,1,0,0,&MPStatHandler::getPedProportion,0,0);
126  add("Proportion of half-sib mated ","ped.hsib",OFFSPRG,2,0,0, &MPStatHandler::getPedProportion,0,0);
127  add("Proportion of full-sib mated ","ped.fsib",OFFSPRG,3,0,0,&MPStatHandler::getPedProportion,0,0);
128  add("Proportion of selfed mated ","ped.self",OFFSPRG,4,0,0,&MPStatHandler::getPedProportion,0,0);
129 
130  } else
131  return false;
132 
133  return true;
134 }
void message(const char *message,...)
Definition: output.cc:40
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
void setStatsForPop()
Definition: MPStatHandler.cc:136
void setKinship()
Definition: stats_demo.cc:407
void setStatsForPopPerPatch()
Definition: MPStatHandler.cc:161
double setReproductiveStats(unsigned int sex)
Definition: stats_demo.cc:335
double getMeanMatings(unsigned int sex)
Definition: stats_demo.cc:301
void setObsrvdExtinctionRate()
Definition: stats_demo.cc:162
double getOffsprgSexRatio()
Definition: stats_demo.cc:556
virtual StatRecorder< MPStatHandler > * add(std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(MPStatHandler::*getStatNoArg)(void), double(MPStatHandler::*getStatOneArg)(unsigned int), double(MPStatHandler::*getStatTwoArg)(unsigned int, unsigned int), void(MPStatHandler::*setStat)(void))
Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.
Definition: stathandler.h:144
void setStatsForMigrants()
Definition: MPStatHandler.cc:223
void setPedegreeCount()
Definition: stats_demo.cc:518
#define ALL
All ages age class flag.
Definition: types.h:56
Definition: types.h:37
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
double getObsrvdExtinctionRate()
Definition: MPStatHandler.h:78
double getPedProportion(unsigned int i)
Definition: MPStatHandler.h:112
double getSibProportion(unsigned int i)
Definition: MPStatHandler.h:107
void addIndNumPerPatch(sex_t SEX, age_t AGE)
Definition: MPStatHandler.cc:170
Definition: types.h:37
void setStatsForMigrantsPerPatch()
Definition: MPStatHandler.cc:233
double getReproductiveVar()
Definition: MPStatHandler.h:101
void setStatsForDemography(age_t AGE)
Definition: MPStatHandler.cc:148
double getAdultSexRatio()
Definition: stats_demo.cc:557
void MPStatHandler::setStatsForDemography ( age_t  AGE)

References StatHandler< MPStatHandler >::add(), ADULTS, FEM, getMeanPatchDensity(), getMeanPatchDensityVariance(), getMeanPatchSizePerSex(), getPopulationSize(), and MAL.

Referenced by setStatRecorders(), and setStatsForPop().

149 {
150  string suffix = (AGE == ADULTS ? "adlt.":"off.");
151  string name = (AGE == ADULTS ? "Adults ":"Offspring ");
152 
153  add(name + "number", suffix + "nbr", AGE, AGE, 0, 0, &MPStatHandler::getPopulationSize,0,0);
154  add(name + "fem nbr", suffix + "nbfem", AGE, FEM, AGE, 0, 0, &MPStatHandler::getMeanPatchSizePerSex,0);
155  add(name + "mal nbr", suffix + "nbmal", AGE, MAL, AGE, 0, 0, &MPStatHandler::getMeanPatchSizePerSex,0);
156  add(name + "density", suffix + "density", AGE, AGE, 0, 0, &MPStatHandler::getMeanPatchDensity,0,0);
157  add(name + "density var", suffix + "dvar", AGE, AGE, 0, 0, &MPStatHandler::getMeanPatchDensityVariance,0,0);
158 
159 }
double getPopulationSize(unsigned int age)
Definition: stats_demo.cc:560
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
double getMeanPatchDensityVariance(age_t AGE)
Definition: stats_demo.cc:238
virtual StatRecorder< MPStatHandler > * add(std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(MPStatHandler::*getStatNoArg)(void), double(MPStatHandler::*getStatOneArg)(unsigned int), double(MPStatHandler::*getStatTwoArg)(unsigned int, unsigned int), void(MPStatHandler::*setStat)(void))
Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.
Definition: stathandler.h:144
Definition: types.h:37
double getMeanPatchSizePerSex(unsigned int sex, unsigned int age)
Definition: stats_demo.cc:207
double getMeanPatchDensity(age_t AGE)
Definition: stats_demo.cc:222
Definition: types.h:37
void MPStatHandler::setStatsForMigrants ( )

References StatHandler< MPStatHandler >::add(), ALL, getMeanEmigrantPerPatch(), getMeanImigrantPerPatch(), getMeanKolonisersPerPatch(), getMeanKolonisersProportion(), getMeanMigrantRatio(), and getMeanResidantPerPatch().

Referenced by setStatRecorders().

224 {
225  add("Emigrant nbr","emigrants",ALL,0,0,&MPStatHandler::getMeanEmigrantPerPatch,0,0,0);
226  add("Imigrant nbr","imigrants",ALL,0,0,&MPStatHandler::getMeanImigrantPerPatch,0,0,0);
227  add("Residant nbr","residents",ALL,0,0,&MPStatHandler::getMeanResidantPerPatch,0,0,0);
228  add("Imigration rate","imigrate",ALL,0,0,&MPStatHandler::getMeanMigrantRatio,0,0,0);
229  add("Coloniser nbr","colonisers",ALL,0,0,&MPStatHandler::getMeanKolonisersPerPatch,0,0,0);
230  add("Colonisation rate","colonrate",ALL,0,0,&MPStatHandler::getMeanKolonisersProportion,0,0,0);
231 }
double getMeanEmigrantPerPatch()
Definition: stats_demo.cc:43
double getMeanMigrantRatio()
Definition: stats_demo.cc:72
double getMeanKolonisersPerPatch()
Definition: stats_demo.cc:113
double getMeanResidantPerPatch()
Definition: stats_demo.cc:79
double getMeanKolonisersProportion()
Definition: stats_demo.cc:96
virtual StatRecorder< MPStatHandler > * add(std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(MPStatHandler::*getStatNoArg)(void), double(MPStatHandler::*getStatOneArg)(unsigned int), double(MPStatHandler::*getStatTwoArg)(unsigned int, unsigned int), void(MPStatHandler::*setStat)(void))
Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.
Definition: stathandler.h:144
#define ALL
All ages age class flag.
Definition: types.h:56
double getMeanImigrantPerPatch()
Definition: stats_demo.cc:55
void MPStatHandler::setStatsForMigrantsPerPatch ( )

References StatHandlerBase::_pop, StatHandler< MPStatHandler >::add(), ALL, getEmigrantInPatch(), getImigrateInPatch(), getKolonisersInPatch(), Metapop::getPatchNbr(), and getResidantInPatch().

Referenced by setStatRecorders().

234 { std::ostringstream name, sub_name;
235 
236  add("Emigrants patch 1","emigr.p1", ALL,0,0,0,&MPStatHandler::getEmigrantInPatch,0,0);
237  for(unsigned int i = 1; i < _pop->getPatchNbr(); i++) {
238  name<<"Emigrants patch "<<i+1;
239  sub_name<<"emigr.p"<<i+1;
240  add(name.str(),sub_name.str(),ALL,i,0,0,&MPStatHandler::getEmigrantInPatch,0,0);
241  name.str("");
242  sub_name.str("");
243  }
244 
245  add("Residants patch 1","resid.p1", ALL,0,0,0,&MPStatHandler::getResidantInPatch,0,0);
246  for(unsigned int i = 1; i < _pop->getPatchNbr(); i++) {
247  name<<"Residants patch "<<i+1;
248  sub_name<<"resid.p"<<i+1;
249  add(name.str(),sub_name.str(),ALL,i,0,0,&MPStatHandler::getResidantInPatch,0,0);
250  name.str("");
251  sub_name.str("");
252  }
253 
254  add("Imig. rate patch 1","imrate.p1", ALL,0,0,0,&MPStatHandler::getImigrateInPatch,0,0);
255  for(unsigned int i = 1; i < _pop->getPatchNbr(); i++) {
256  name<<"Imig. rate patch "<<i+1;
257  sub_name<<"imrate.p"<<i+1;
258  add(name.str(),sub_name.str(),ALL,i,0,0,&MPStatHandler::getImigrateInPatch,0,0);
259  name.str("");
260  sub_name.str("");
261  }
262 
263  add("Colons patch 1","colo.p1", ALL,0,0,0,&MPStatHandler::getKolonisersInPatch,0,0);
264  for(unsigned int i = 1; i < _pop->getPatchNbr(); i++) {
265  name<<"Colons patch "<<i+1;
266  sub_name<<"colo.p"<<i+1;
267  add(name.str(),sub_name.str(),ALL,i,0,0,&MPStatHandler::getKolonisersInPatch,0,0);
268  name.str("");
269  sub_name.str("");
270  }
271 }
double getKolonisersInPatch(unsigned int i)
Definition: stats_demo.cc:148
double getEmigrantInPatch(unsigned int i)
Definition: stats_demo.cc:128
unsigned int getPatchNbr()
Definition: metapop.h:270
virtual StatRecorder< MPStatHandler > * add(std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(MPStatHandler::*getStatNoArg)(void), double(MPStatHandler::*getStatOneArg)(unsigned int), double(MPStatHandler::*getStatTwoArg)(unsigned int, unsigned int), void(MPStatHandler::*setStat)(void))
Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.
Definition: stathandler.h:144
#define ALL
All ages age class flag.
Definition: types.h:56
Metapop * _pop
Link to the current population, set through the link to the StatService.
Definition: stathandler.h:61
double getImigrateInPatch(unsigned int i)
Definition: stats_demo.cc:140
double getResidantInPatch(unsigned int i)
Definition: stats_demo.cc:134
void MPStatHandler::setStatsForPop ( )

References StatHandler< MPStatHandler >::add(), ADULTS, ALL, getAdultSexRatio(), getObsrvdExtinctionRate(), getOffsprgSexRatio(), OFFSPRG, setObsrvdExtinctionRate(), and setStatsForDemography().

Referenced by setStatRecorders().

137 {
139  add("Offspring Sex Ratio","off.sexratio",OFFSPRG,0,0,&MPStatHandler::getOffsprgSexRatio,0,0,0);
140 
142  add("Adults sex ratio","adlt.sexratio",ADULTS,0,0,&MPStatHandler::getAdultSexRatio,0,0,0);
143 
144  add("Extinction rate","extrate",ALL,0,0,&MPStatHandler::getObsrvdExtinctionRate,0,0,
146 }
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
void setObsrvdExtinctionRate()
Definition: stats_demo.cc:162
double getOffsprgSexRatio()
Definition: stats_demo.cc:556
virtual StatRecorder< MPStatHandler > * add(std::string Title, std::string Name, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(MPStatHandler::*getStatNoArg)(void), double(MPStatHandler::*getStatOneArg)(unsigned int), double(MPStatHandler::*getStatTwoArg)(unsigned int, unsigned int), void(MPStatHandler::*setStat)(void))
Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.
Definition: stathandler.h:144
#define ALL
All ages age class flag.
Definition: types.h:56
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
double getObsrvdExtinctionRate()
Definition: MPStatHandler.h:78
void setStatsForDemography(age_t AGE)
Definition: MPStatHandler.cc:148
double getAdultSexRatio()
Definition: stats_demo.cc:557
void MPStatHandler::setStatsForPopPerPatch ( )

References addIndNumPerPatch(), addPatchAge(), ADULTS, FEM, MAL, and OFFSPRG.

Referenced by setStatRecorders().

162 {
167  addPatchAge();
168 }
#define ADULTS
Adults age class flag (breeders).
Definition: types.h:54
void addPatchAge()
Definition: MPStatHandler.cc:203
Definition: types.h:37
#define OFFSPRG
Offspring age class flag.
Definition: types.h:50
void addIndNumPerPatch(sex_t SEX, age_t AGE)
Definition: MPStatHandler.cc:170
Definition: types.h:37

Member Data Documentation

double MPStatHandler::_ped_prop[5]
private
double MPStatHandler::_sib_prop[5]
private
double MPStatHandler::_var_reprod_success
private

Referenced by getReproductiveVar().

double MPStatHandler::meanDeadDisp
private
double MPStatHandler::meanEmigrant
private
double MPStatHandler::meanImigrant
private
double MPStatHandler::meanKolonisers
private
double MPStatHandler::meanResidant
private
double MPStatHandler::ObservedExtinctionRate
private

Referenced by getObsrvdExtinctionRate().


The documentation for this class was generated from the following files:

Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR