|
Modular Megafauna Model 1.1.5
A physiological, dynamic herbivore simulator in C++.
|
Abstract class of a homogenous spatial unit populated by herbivores. More...
#include <habitat.h>
Public Member Functions | |
| virtual | ~Habitat () |
| Virtual Destructor. More... | |
| virtual const char * | get_aggregation_unit () const =0 |
| A string identifier for the group of habitats whose output is aggregated. More... | |
| virtual HabitatForage | get_available_forage () const =0 |
| Get dry-matter biomass [kgDM/km²] that is available to herbivores to eat. More... | |
| virtual HabitatEnvironment | get_environment () const =0 |
| Get today’s abiotic environmental variables in the habitat. More... | |
| virtual void | init_day (const int today) |
| Update at the start of the day. More... | |
| bool | is_dead () const |
| Whether kill() has been called on this object. More... | |
| void | kill () |
| Mark the object as dead and to be deleted. More... | |
| virtual void | remove_eaten_forage (const ForageMass &eaten_forage) |
| Remove forage eaten by herbivores. More... | |
| int | get_day () const |
| The current day as set by init_day(). More... | |
| const Output::HabitatData & | get_todays_output () const |
| The current output data (read-only). More... | |
Protected Member Functions | |
| Output::HabitatData & | get_todays_output () |
| Class-internal read/write access to current output data. More... | |
Private Attributes | |
| Output::HabitatData | current_output |
| int | day_of_year |
| bool | killed = false |
Abstract class of a homogenous spatial unit populated by herbivores.
|
inlinevirtual |
Virtual Destructor.
Destructor must be virtual in an interface.
|
pure virtual |
A string identifier for the group of habitats whose output is aggregated.
Suppose the vegetation model works in longitude/latitude grid cells and has three habitats in each grid cell. Output shall be aggregated per grid cell. Then all habitats in each set of three have the same (unique!) aggregation unit sting identifier. This could be for instance "10.0/54.0" for a grid cell at 10° E and 54° N. It’s completely up to the vegetation model to define a convention for the aggregation unit identifiers.
You should avoid leading or trailing whitespaces and take care that you don’t include a character that is used as a field separator in the output table. Also, the string should not be empty.
The output of this function should not change within the lifetime of one class instance: One Habitat object shall not change into another aggregation unit.
Implemented in Fauna::Demo::SimpleHabitat.
|
pure virtual |
Get dry-matter biomass [kgDM/km²] that is available to herbivores to eat.
| std::logic_error | If this object is dead. |
Implemented in Fauna::Demo::SimpleHabitat.
|
inline |
The current day as set by init_day().
|
pure virtual |
Get today’s abiotic environmental variables in the habitat.
| std::logic_error | If this object is dead. |
Implemented in Fauna::Demo::SimpleHabitat.
|
inlineprotected |
Class-internal read/write access to current output data.
|
inline |
The current output data (read-only).
|
virtual |
Update at the start of the day.
Call this once every day from the framework. When overwriting this in derived classes, make sure to call this parent function first.
| today | Day of the year (0 ≙ Jan 1st). |
| std::invalid_argument | If not 0<=today<=364. |
| std::logic_error | If this object is dead. |
Reimplemented in Fauna::Demo::SimpleHabitat.
|
inline |
Whether kill() has been called on this object.
|
inline |
Mark the object as dead and to be deleted.
Call this when the corresponding vegetation unit is invalid.
|
inlinevirtual |
Remove forage eaten by herbivores.
The base class implements only adding the eaten forage to the output. Any derived class should call this (the parent‘s) function and do forage removal afterwards.
| eaten_forage | Dry matter leaf forage [kgDM/km²], must not exceed available forage. |
| std::logic_error | If eaten_forage exceeds available forage (to be implemented in derived classes). |
| std::logic_error | If this object is dead. |
Reimplemented in Fauna::Demo::SimpleHabitat.
|
private |
|
private |
|
private |