Modular Megafauna Model 1.1.5
A physiological, dynamic herbivore simulator in C++.
Loading...
Searching...
No Matches
habitat.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2020 W. Traylor <wolfgang.traylor@senckenberg.de>
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
11#ifndef FAUNA_HABITAT_H
12#define FAUNA_HABITAT_H
13
14#include <cassert>
15#include <list>
16#include <memory>
18
19namespace Fauna {
20// Forward Declarations
21struct HabitatEnvironment;
22
24
29class Habitat {
30 public:
32
33 virtual ~Habitat() {}
34
36
52 virtual const char* get_aggregation_unit() const = 0;
53
55
59
61
65
67
75 virtual void init_day(const int today);
76
78 bool is_dead() const { return killed; }
79
81
84 void kill() { killed = true; }
85
87
106 virtual void remove_eaten_forage(const ForageMass& eaten_forage) {
107 get_todays_output().eaten_forage += eaten_forage;
108 }
109
111
112 int get_day() const { return day_of_year; }
113
116 return current_output;
117 }
118
119 protected:
122
123 private:
126 bool killed = false;
127};
128
130typedef std::list<const Habitat*> HabitatList;
131} // namespace Fauna
132#endif // FAUNA_HABITAT_H
All values for large herbivore forage in a Habitat.
Definition: habitat_forage.h:21
Abstract class of a homogenous spatial unit populated by herbivores.
Definition: habitat.h:29
bool killed
Definition: habitat.h:126
Output::HabitatData current_output
Definition: habitat.h:124
virtual HabitatEnvironment get_environment() const =0
Get today’s abiotic environmental variables in the habitat.
virtual void init_day(const int today)
Update at the start of the day.
Definition: habitat.cpp:16
virtual const char * get_aggregation_unit() const =0
A string identifier for the group of habitats whose output is aggregated.
int get_day() const
The current day as set by init_day().
Definition: habitat.h:112
const Output::HabitatData & get_todays_output() const
The current output data (read-only).
Definition: habitat.h:115
Output::HabitatData & get_todays_output()
Class-internal read/write access to current output data.
Definition: habitat.h:121
bool is_dead() const
Whether kill() has been called on this object.
Definition: habitat.h:78
int day_of_year
Definition: habitat.h:125
virtual HabitatForage get_available_forage() const =0
Get dry-matter biomass [kgDM/km²] that is available to herbivores to eat.
virtual void remove_eaten_forage(const ForageMass &eaten_forage)
Remove forage eaten by herbivores.
Definition: habitat.h:106
void kill()
Mark the object as dead and to be deleted.
Definition: habitat.h:84
virtual ~Habitat()
Virtual Destructor.
Definition: habitat.h:33
Output data of a habitat.
Definition: average.h:16
std::list< const Habitat * > HabitatList
A list of Habitat pointers.
Definition: habitat.h:130
Variables describing the habitat that are not forage ⇒ abiotic environment.
Definition: environment.h:16
Habitat output data for one time unit.
Definition: habitat_data.h:23
Fauna::ForageMass eaten_forage
Forage mass [kgDM/km²/day] eaten by herbivores.
Definition: habitat_data.h:32