|
Modular Megafauna Model 1.1.5
A physiological, dynamic herbivore simulator in C++.
|
A herbivore cohort (age-class) More...
#include <herbivore_cohort.h>
Public Member Functions | |
| virtual double | get_ind_per_km2 () const |
| Individuals per km² More... | |
| virtual bool | is_dead () const |
| A cohort is dead if its density is zero. More... | |
| virtual void | kill () |
| Mark this herbivore as dead (see is_dead()). More... | |
| HerbivoreCohort (const int age_days, const double body_condition, std::shared_ptr< const Hft > hft, const Sex sex, const double ind_per_km2, const ForageEnergyContent &forage_gross_energy) | |
| Establishment constructor. More... | |
| HerbivoreCohort (std::shared_ptr< const Hft > hft, const Sex sex, const double ind_per_km2, const ForageEnergyContent &forage_gross_energy) | |
| Birth constructor. More... | |
| bool | is_same_age (const HerbivoreCohort &other) const |
| Check if this and the other cohort are of the same age. More... | |
| void | merge (HerbivoreCohort &other) |
| Merge another cohort into this one. More... | |
Public Member Functions inherited from Fauna::HerbivoreBase | |
| virtual void | eat (const ForageMass &kg_per_km2, const Digestibility &digestibility, const ForageMass &N_kg_per_km2) |
| Feed the herbivore dry matter forage. More... | |
| virtual ForageMass | get_forage_demands (const HabitatForage &available_forage) |
| Get the forage the herbivore would like to eat today. More... | |
| virtual std::string | get_output_group () const |
| The name of the HFT for aggregating output. More... | |
| virtual double | get_kg_per_km2 () const |
| Get herbivore biomass density [kg/km²]. More... | |
| virtual const Output::HerbivoreData & | get_todays_output () const |
| Read current output. More... | |
| virtual void | simulate_day (const int day, const HabitatEnvironment &environment, double &offspring) |
| Simulate daily events. More... | |
| int | get_age_days () const |
| Current age in days. More... | |
| double | get_age_years () const |
| Current age in years. More... | |
| double | get_bodyfat () const |
| Proportional body fat in empty body (fat mass/empty body mass). More... | |
| virtual double | get_bodymass () const |
| Current live weight, including fat, ingesta, blood, etc. [kg/ind]. More... | |
| double | get_bodymass_adult () const |
| Body mass at physical maturity [kg/ind]. More... | |
| double | get_conductance () const |
| Get full-body conductance [W/°C/ind]. More... | |
| double | get_fatmass () const |
| Current fat mass (pure lipids) [kg/ind]. More... | |
| const Hft & | get_hft () const |
| The herbivore functional type (HFT). More... | |
| double | get_max_fatmass () const |
| Physiological maximum of fat mass [kg/ind]. More... | |
| double | get_structural_mass () const |
| Current mass of body tissue without fat, ingesta, blood, etc. [kg/ind]. More... | |
| int | get_today () const |
| Current day of the year, as set in simulate_day(). More... | |
| Sex | get_sex () const |
| The sex of the herbivore. More... | |
Public Member Functions inherited from Fauna::HerbivoreInterface | |
| virtual | ~HerbivoreInterface ()=default |
| Virtual destructor, which will be called by derived classes. More... | |
| virtual void | eat (const ForageMass &kg_per_km2, const Digestibility &digestibility, const ForageMass &N_kg_per_km2=ForageMass(0))=0 |
| Feed the herbivore dry matter forage. More... | |
| virtual double | get_bodymass () const =0 |
| Body mass of one individual [kg/ind]. More... | |
| virtual ForageMass | get_forage_demands (const HabitatForage &available_forage)=0 |
| Get the forage the herbivore would like to eat today. More... | |
| virtual std::string | get_output_group () const =0 |
| The name of the HFT for aggregating output. More... | |
| virtual double | get_ind_per_km2 () const =0 |
| Individuals per km² More... | |
| virtual double | get_kg_per_km2 () const =0 |
| Get herbivore biomass density [kg/km²]. More... | |
| virtual const Output::HerbivoreData & | get_todays_output () const =0 |
| Read current output. More... | |
| virtual bool | is_dead () const =0 |
| Whether the herbivore object is dead. More... | |
| virtual void | kill ()=0 |
| Mark this herbivore as dead (see is_dead()). More... | |
| virtual void | simulate_day (const int day, const HabitatEnvironment &environment, double &offspring)=0 |
| Simulate daily events. More... | |
Protected Member Functions | |
| virtual void | apply_mortality (const double mortality) |
| Apply a fractional mortality. More... | |
Protected Member Functions inherited from Fauna::HerbivoreBase | |
| HerbivoreBase (const int age_days, const double body_condition, std::shared_ptr< const Hft > hft, const Sex sex, const ForageEnergyContent &forage_gross_energy) | |
| Establishment constructor. More... | |
| HerbivoreBase (std::shared_ptr< const Hft > hft, const Sex sex, const ForageEnergyContent &forage_gross_energy) | |
| Birth constructor. More... | |
| virtual | ~HerbivoreBase ()=default |
| Virtual destructor, which will be called by derived classes. More... | |
| virtual void | apply_mortality (const double mortality)=0 |
| Apply a fractional mortality. More... | |
| FatmassEnergyBudget & | get_energy_budget () |
| The herbivore’s energy budget object. More... | |
| const FatmassEnergyBudget & | get_energy_budget () const |
| The herbivore’s energy budget object. More... | |
| const HabitatEnvironment & | get_environment () const |
| Current abiotic conditions in the habitat. More... | |
| Output::HerbivoreData & | get_todays_output () |
| Class-internal read/write access to current output. More... | |
| bool | constant_members_match (const HerbivoreBase &other) const |
| Check whether the constant member variables match those of another object. More... | |
Private Attributes | |
| double | ind_per_km2 |
A herbivore cohort (age-class)
Any state variables describe mean values across all individuals. All individuals have the same age.
| HerbivoreCohort::HerbivoreCohort | ( | const int | age_days, |
| const double | body_condition, | ||
| std::shared_ptr< const Hft > | hft, | ||
| const Sex | sex, | ||
| const double | ind_per_km2, | ||
| const ForageEnergyContent & | forage_gross_energy | ||
| ) |
Establishment constructor.
| age_days | age in days |
| body_condition | Initial fat reserve as fraction of physiological maximum [kg/kg]. |
| hft | Herbivore functional type. |
| sex | The sex of the herbivore. |
| forage_gross_energy | The (constant) gross energy content for the forage types [MJ/kgDM]. See: Parameters::forage_gross_energy |
| std::invalid_argument | if any parameter is invalid |
| ind_per_km2 | Initial individual density [ind/km²]. Can be 0.0, but must not be negative. |
| HerbivoreCohort::HerbivoreCohort | ( | std::shared_ptr< const Hft > | hft, |
| const Sex | sex, | ||
| const double | ind_per_km2, | ||
| const ForageEnergyContent & | forage_gross_energy | ||
| ) |
Birth constructor.
| hft | Herbivore functional type. |
| sex | The sex of the herbivore. |
| forage_gross_energy | The (constant) gross energy content for the forage types [MJ/kgDM]. See: Parameters::forage_gross_energy |
| std::invalid_argument | if any parameter is invalid |
| ind_per_km2 | Initial individual density [ind/km²]. Can be 0.0, but must not be negative. |
|
protectedvirtual |
Apply a fractional mortality.
| mortality | Fraction of individual density/count that is dying. |
| std::invalid_argument | if not 0.0≤mortality≤1.0 |
Implements Fauna::HerbivoreBase.
|
inlinevirtual |
Individuals per km²
Implements Fauna::HerbivoreInterface.
|
virtual |
A cohort is dead if its density is zero.
Implements Fauna::HerbivoreInterface.
|
inline |
Check if this and the other cohort are of the same age.
Two cohorts are considered coeval if they are in the same year of life:
0<=age_days<365365<=age_days<730
|
inlinevirtual |
Mark this herbivore as dead (see is_dead()).
This function is needed in order to take nitrogen back from “dead” herbivores before removing them from memory.
Implements Fauna::HerbivoreInterface.
| void HerbivoreCohort::merge | ( | HerbivoreCohort & | other | ) |
Merge another cohort into this one.
All state variables are averaged between the two cohorts by the weight of population density. The age in days (HerbivoreBase::age_days) will not be changed, which effectively means that the other (merged) cohort will lose the information about its precise age (in days).
| other | The other cohort that is merged into this. The density of other will be reduced. |
| std::invalid_argument | If fraction not in [0,1]. |
| std::logic_error | If the other cohort is not compatible: different age, different HFT, different gross energy, or different sex. See HerbivoreBase::constant_members_match() |
|
private |