Modular Megafauna Model 1.1.5
A physiological, dynamic herbivore simulator in C++.
Loading...
Searching...
No Matches
forage_base.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_FORAGE_BASE_H
12#define FAUNA_FORAGE_BASE_H
13
14#include <stdexcept>
15
16namespace Fauna {
17
20 private:
22
23 public:
26
28
29 double get_digestibility() const { return digestibility; }
30
32 double get_mass() const { return dry_matter_mass; }
33
35 double get_nitrogen_mass() const { return nitrogen_mass; }
36
39 void set_digestibility(const double d) {
40 if (d < 0.0 || d > 1.0)
41 throw std::invalid_argument(
42 "Fauna::ForageBase::set_digestibility(): "
43 "Digestibility out of range.");
44 digestibility = d;
45 }
46
51 void set_mass(const double dm);
52
57 void set_nitrogen_mass(const double n_mass);
58
59 protected:
61
74 ForageBase& merge_base(const ForageBase& other, const double this_weight,
75 const double other_weight);
76};
77} // namespace Fauna
78#endif // FAUNA_FORAGE_BASE_H
Base class for herbivore forage in a habitat.
Definition: forage_base.h:19
double get_digestibility() const
Fractional digestibility of the biomass for ruminants.
Definition: forage_base.h:29
double dry_matter_mass
Definition: forage_base.h:21
void set_mass(const double dm)
Dry matter forage biomass over the whole area [kgDM/km²].
Definition: forage_base.cpp:38
double get_nitrogen_mass() const
Nitrogen mass per area [kgN/km²].
Definition: forage_base.h:35
void set_digestibility(const double d)
Fractional digestibility of the biomass for ruminants.
Definition: forage_base.h:39
double get_mass() const
Dry matter forage biomass over the whole area [kgDM/km²].
Definition: forage_base.h:32
void set_nitrogen_mass(const double n_mass)
Nitrogen mass per area [kgN/km²].
Definition: forage_base.cpp:51
ForageBase()
Constructor with zero values.
Definition: forage_base.h:25
ForageBase & merge_base(const ForageBase &other, const double this_weight, const double other_weight)
Merge this object with another one by building (weighted) means.
Definition: forage_base.cpp:17
double nitrogen_mass
Definition: forage_base.h:21
double digestibility
Definition: forage_base.h:21
Definition: average.h:16