Modular Megafauna Model 1.1.5
A physiological, dynamic herbivore simulator in C++.
Loading...
Searching...
No Matches
Fauna::GrassForage Class Reference

Grass forage in a habitat. More...

#include <grass_forage.h>

Inheritance diagram for Fauna::GrassForage:
Fauna::ForageBase

Public Member Functions

 GrassForage ()
 Constructor with zero values. More...
 
double get_sward_density () const
 Dry matter forage in the area covered by grass [kgDM/km²]. More...
 
double get_fpc () const
 Fraction of habitat covered by grass [fractional]. More...
 
GrassForagemerge (const GrassForage &other, const double this_weight, const double other_weight)
 Merge this object with another one by building (weighted) means. More...
 
void set_fpc (const double f)
 Fraction of habitat covered by grass [fractional]. More...
 
- Public Member Functions inherited from Fauna::ForageBase
 ForageBase ()
 Constructor with zero values. More...
 
double get_digestibility () const
 Fractional digestibility of the biomass for ruminants. More...
 
double get_mass () const
 Dry matter forage biomass over the whole area [kgDM/km²]. More...
 
double get_nitrogen_mass () const
 Nitrogen mass per area [kgN/km²]. More...
 
void set_digestibility (const double d)
 Fractional digestibility of the biomass for ruminants. More...
 
void set_mass (const double dm)
 Dry matter forage biomass over the whole area [kgDM/km²]. More...
 
void set_nitrogen_mass (const double n_mass)
 Nitrogen mass per area [kgN/km²]. More...
 

Private Attributes

double fpc
 

Static Private Attributes

static constexpr double MAX_SWARD_DENSITY = 2e7
 Maximum imaginable real-world sward density [kgDM/km²]. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Fauna::ForageBase
ForageBasemerge_base (const ForageBase &other, const double this_weight, const double other_weight)
 Merge this object with another one by building (weighted) means. More...
 

Detailed Description

Grass forage in a habitat.

Constructor & Destructor Documentation

◆ GrassForage()

Fauna::GrassForage::GrassForage ( )
inline

Constructor with zero values.

Member Function Documentation

◆ get_fpc()

double Fauna::GrassForage::get_fpc ( ) const
inline

Fraction of habitat covered by grass [fractional].

Grass-covered area as a fraction of the habitat. (FPC = “foliar projective cover” might not be the ideal term, but you can interprect the acronym also as “Fraction of Patch Covered [by grass]”.)

Exceptions
std::logic_errorIf the values of mass and FPC don’t fit together: If mass is zero, FPC must also be zero, and if mass is non-zero, FPC must not be zero. (Call set_mass() and set_fpc() with correct values before calling get_fpc().)

◆ get_sward_density()

double Fauna::GrassForage::get_sward_density ( ) const
inline

Dry matter forage in the area covered by grass [kgDM/km²].

Note that this is always greater or equal than get_mass()

Exceptions
std::logic_errorIf the result is greater than MAX_SWARD_DENSITY. In this case, the fpc value set by the vegetation model is probably unreasonably low.

◆ merge()

GrassForage & GrassForage::merge ( const GrassForage other,
const double  this_weight,
const double  other_weight 
)

Merge this object with another one by building (weighted) means.

Parameters
otherOther object to merge into this one.
this_weightWeight of this object’s values.
other_weightWeight of the other object’s values.
Returns
This object.
Exceptions
std::invalid_argumentThe same as average().
See also
.\ifile/home/docs/checkouts/readthedocs.org/user_builds/modular-megafauna-model/checkouts/latest/include/Fauna/grass_forage.h

◆ set_fpc()

void Fauna::GrassForage::set_fpc ( const double  f)
inline

Fraction of habitat covered by grass [fractional].

Note
Call get_mass() before this function to avoid any illogical state (see exceptions in get_fpc()).
Exceptions
std::invalid_argumentIf not 0.0<=f<=1.0.
std::logic_errorIf f==0.0 && get_mass()==0.0 or f==0.0 && get_mass()>0.0.

Member Data Documentation

◆ fpc

double Fauna::GrassForage::fpc
private

◆ MAX_SWARD_DENSITY

constexpr double Fauna::GrassForage::MAX_SWARD_DENSITY = 2e7
staticconstexprprivate

Maximum imaginable real-world sward density [kgDM/km²].


The documentation for this class was generated from the following files: