libpspm
Cohort< Ind > Class Template Reference

#include <cohort.h>

Inheritance diagram for Cohort< Ind >:
[legend]
Collaboration diagram for Cohort< Ind >:
[legend]

Public Member Functions

 Cohort ()
 
 Cohort (const Ind &_ind)
 
void print_xu (std::ostream &out=std::cout)
 
void print (std::ostream &out=std::cout)
 
void set_size (double _x)
 
void preCompute (double x, double t, void *_env)
 
double growthRate (double x, double t, void *_env)
 
double mortalityRate (double x, double t, void *_env)
 
double birthRate (double x, double t, void *_env)
 

Public Attributes

double x = -999
 
double u = -999
 
int id = 0
 
double birth_time = 0
 
bool remove = false
 
bool need_precompute = true
 

Static Public Attributes

static int np
 
static int ng
 
static int nm
 
static int nf
 

Detailed Description

template<class Ind>
class Cohort< Ind >

Definition at line 7 of file cohort.h.

Constructor & Destructor Documentation

◆ Cohort() [1/2]

template<class Ind>
Cohort< Ind >::Cohort ( )
inline

Definition at line 22 of file cohort.h.

22  : Ind() {
23  }

◆ Cohort() [2/2]

template<class Ind>
Cohort< Ind >::Cohort ( const Ind &  _ind)
inline

Definition at line 26 of file cohort.h.

26  : Ind(_ind){
27  }

Member Function Documentation

◆ birthRate()

template<class Ind>
double Cohort< Ind >::birthRate ( double  x,
double  t,
void *  _env 
)
inline

Definition at line 68 of file cohort.h.

68  {
69  ++nf;
70  if (need_precompute) preCompute(x,t,_env);
71  //std::cout << x << " cohort birthRate: "; print(); std::cout << "\n";
72  return Ind::birthRate(x,t,_env);
73  }
double x
Definition: cohort.h:11
bool need_precompute
Definition: cohort.h:18
static int nf
Definition: cohort.h:9
void preCompute(double x, double t, void *_env)
Definition: cohort.h:47
Here is the caller graph for this function:

◆ growthRate()

template<class Ind>
double Cohort< Ind >::growthRate ( double  x,
double  t,
void *  _env 
)
inline

Definition at line 54 of file cohort.h.

54  {
55  ++ng;
56  if (need_precompute) preCompute(x,t,_env);
57  //std::cout << "cohort growthRate(): "; print(); std::cout << "\n";
58  return Ind::growthRate(x,t,_env);
59  }
double x
Definition: cohort.h:11
bool need_precompute
Definition: cohort.h:18
void preCompute(double x, double t, void *_env)
Definition: cohort.h:47
static int ng
Definition: cohort.h:9
Here is the caller graph for this function:

◆ mortalityRate()

template<class Ind>
double Cohort< Ind >::mortalityRate ( double  x,
double  t,
void *  _env 
)
inline

Definition at line 61 of file cohort.h.

61  {
62  ++nm;
63  if (need_precompute) preCompute(x,t,_env);
64  //std::cout << "cohort mortRate(): "; print(); std::cout << "\n";
65  return Ind::mortalityRate(x,t,_env);
66  }
static int nm
Definition: cohort.h:9
double x
Definition: cohort.h:11
bool need_precompute
Definition: cohort.h:18
void preCompute(double x, double t, void *_env)
Definition: cohort.h:47
Here is the caller graph for this function:

◆ preCompute()

template<class Ind>
void Cohort< Ind >::preCompute ( double  x,
double  t,
void *  _env 
)
inline

Definition at line 47 of file cohort.h.

47  {
48  ++np;
49  //std::cout << "cohort precompute: "; print(); std::cout << "\n";
50  Ind::preCompute(x,t,_env);
51  need_precompute = false; // Once precompute is called, no need to further precompute until necessary
52  }
static int np
Definition: cohort.h:9
double x
Definition: cohort.h:11
bool need_precompute
Definition: cohort.h:18
Here is the caller graph for this function:

◆ print()

template<class Ind>
void Cohort< Ind >::print ( std::ostream &  out = std::cout)
inline

Definition at line 33 of file cohort.h.

33  {
34  print_xu(out);
35  Ind::print(out);
36  }
void print_xu(std::ostream &out=std::cout)
Definition: cohort.h:29

◆ print_xu()

template<class Ind>
void Cohort< Ind >::print_xu ( std::ostream &  out = std::cout)
inline

Definition at line 29 of file cohort.h.

29  {
30  out << birth_time << "\t" << x << "\t" << u << "\t";
31  }
double x
Definition: cohort.h:11
double birth_time
Definition: cohort.h:15
double u
Definition: cohort.h:12
Here is the caller graph for this function:

◆ set_size()

template<class Ind>
void Cohort< Ind >::set_size ( double  _x)
inline

Definition at line 38 of file cohort.h.

38  {
39  x = _x;
40  need_precompute = true; // when size is updated, next rate calc will need precompute
41  Ind::set_size(x);
42  }
double x
Definition: cohort.h:11
bool need_precompute
Definition: cohort.h:18
Here is the caller graph for this function:

Member Data Documentation

◆ birth_time

template<class Ind>
double Cohort< Ind >::birth_time = 0

Definition at line 15 of file cohort.h.

◆ id

template<class Ind>
int Cohort< Ind >::id = 0

Definition at line 13 of file cohort.h.

◆ need_precompute

template<class Ind>
bool Cohort< Ind >::need_precompute = true

Definition at line 18 of file cohort.h.

◆ nf

template<class Ind>
int Cohort< Ind >::nf
static

Definition at line 9 of file cohort.h.

◆ ng

template<class Ind>
int Cohort< Ind >::ng
static

Definition at line 9 of file cohort.h.

◆ nm

template<class Ind>
int Cohort< Ind >::nm
static

Definition at line 9 of file cohort.h.

◆ np

template<class Ind>
int Cohort< Ind >::np
static

Definition at line 9 of file cohort.h.

◆ remove

template<class Ind>
bool Cohort< Ind >::remove = false

Definition at line 16 of file cohort.h.

◆ u

template<class Ind>
double Cohort< Ind >::u = -999

Definition at line 12 of file cohort.h.

◆ x

template<class Ind>
double Cohort< Ind >::x = -999

Definition at line 11 of file cohort.h.


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