Modular Megafauna Model 1.1.5
A physiological, dynamic herbivore simulator in C++.
Loading...
Searching...
No Matches
Fauna::HerbivoreInterface Struct Referenceabstract

Interface for any herbivore implementation in the model. More...

#include <herbivore_interface.h>

Inheritance diagram for Fauna::HerbivoreInterface:
Fauna::HerbivoreBase Fauna::HerbivoreCohort

Public Member Functions

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::HerbivoreDataget_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...
 

Detailed Description

Interface for any herbivore implementation in the model.

Derived classes will define the model mechanics. Each herbivore class has a corresponding implementation of PopulationInterface which creates and manages the herbivores.

See also
How to add a new herbivore class
PopulationInterface
The Herbivore

Constructor & Destructor Documentation

◆ ~HerbivoreInterface()

virtual Fauna::HerbivoreInterface::~HerbivoreInterface ( )
virtualdefault

Virtual destructor, which will be called by derived classes.

Member Function Documentation

◆ eat()

virtual void Fauna::HerbivoreInterface::eat ( const ForageMass kg_per_km2,
const Digestibility digestibility,
const ForageMass N_kg_per_km2 = ForageMass(0) 
)
pure virtual

Feed the herbivore dry matter forage.

Parameters
kg_per_km2Dry matter forage mass [kgDM/km²].
N_kg_per_km2Nitrogen in the forage [kgN/km²].
digestibilityProportional forage digestibility.
Exceptions
std::logic_errorIf forage exceeds intake constraints of maximal foraging and digestion.
std::logic_errorIf this herbivore is dead or has no individuals.
std::invalid_argumentIf N_kg_per_km2 is larger than kg_per_km2 for a forage type. The nitrogen mass is only a fraction of dry matter, and there cannot be more then 100% nitrogen in the forage.

Implemented in Fauna::HerbivoreBase.

◆ get_bodymass()

virtual double Fauna::HerbivoreInterface::get_bodymass ( ) const
pure virtual

Body mass of one individual [kg/ind].

Implemented in Fauna::HerbivoreBase.

◆ get_forage_demands()

virtual ForageMass Fauna::HerbivoreInterface::get_forage_demands ( const HabitatForage available_forage)
pure virtual

Get the forage the herbivore would like to eat today.

Call this after simulate_day().

Note
This may be called multiple times a day in order to allow switching to another forage type!
Parameters
available_forageAvailable forage in the habitat [kgDM/km²].
Returns
Dry matter forage per m² that the herbivore would eat without any food competition [kgDM/km²].

Implemented in Fauna::HerbivoreBase.

◆ get_ind_per_km2()

virtual double Fauna::HerbivoreInterface::get_ind_per_km2 ( ) const
pure virtual

Individuals per km²

Implemented in Fauna::HerbivoreCohort.

◆ get_kg_per_km2()

virtual double Fauna::HerbivoreInterface::get_kg_per_km2 ( ) const
pure virtual

Get herbivore biomass density [kg/km²].

Implemented in Fauna::HerbivoreBase.

◆ get_output_group()

virtual std::string Fauna::HerbivoreInterface::get_output_group ( ) const
pure virtual

The name of the HFT for aggregating output.

Technically, this can be a generic identifier to aggregate output of herbivores. However, herbivores used to be aggregated only by HFT, and so this is assumed to be the HFT name until the output framework is made more flexible.

Implemented in Fauna::HerbivoreBase.

◆ get_todays_output()

virtual const Output::HerbivoreData & Fauna::HerbivoreInterface::get_todays_output ( ) const
pure virtual

Read current output.

Implemented in Fauna::HerbivoreBase.

◆ is_dead()

virtual bool Fauna::HerbivoreInterface::is_dead ( ) const
pure virtual

Whether the herbivore object is dead.

Implemented in Fauna::HerbivoreCohort.

◆ kill()

virtual void Fauna::HerbivoreInterface::kill ( )
pure virtual

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.

Implemented in Fauna::HerbivoreCohort.

◆ simulate_day()

virtual void Fauna::HerbivoreInterface::simulate_day ( const int  day,
const HabitatEnvironment environment,
double &  offspring 
)
pure virtual

Simulate daily events.

Call this before get_forage_demands().

Parameters
[in]dayCurrent day of year, 0=Jan. 1st.
[in]environmentCurrent environmental conditions in the habitat.
[out]offspringNumber of newborn today [ind/km²].
Exceptions
std::invalid_argumentIf day not in [0,364].
std::logic_errorIf this herbivore is dead.

Implemented in Fauna::HerbivoreBase.


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