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

All values for large herbivore forage in a Habitat. More...

#include <habitat_forage.h>

Public Member Functions

 HabitatForage ()
 Constructor with zero values. More...
 
Digestibility get_digestibility () const
 Get digestibility [fractional] for all edible forage types. More...
 
ForageMass get_mass () const
 Get dry matter mass [kgDM/km²] for all edible forage types. More...
 
ForageFraction get_nitrogen_content ()
 Fraction of nitrogen in dry matter [kgN/kgDM]. More...
 
ForageBase get_total () const
 Total forage in the habitat. More...
 
HabitatForagemerge (const HabitatForage &other, const double this_weight, const double other_weight)
 Merge this object with another one by building (weighted) means. More...
 
const ForageBaseoperator[] (const ForageType ft) const
 Reference to forage object by forage type. More...
 
ForageBaseoperator[] (const ForageType ft)
 Reference to forage object by forage type. More...
 
void set_nitrogen_content (const ForageFraction &nitrogen_content)
 Set the nitrogen content [kgN/kgDM] for all forage types. More...
 

Public Attributes

GrassForage grass
 The grass forage in the habitat. More...
 

Private Attributes

ForageBase inedible
 Inedible forage in the habitat. More...
 

Detailed Description

All values for large herbivore forage in a Habitat.

Constructor & Destructor Documentation

◆ HabitatForage()

Fauna::HabitatForage::HabitatForage ( )
inline

Constructor with zero values.

Member Function Documentation

◆ get_digestibility()

Digestibility HabitatForage::get_digestibility ( ) const

Get digestibility [fractional] for all edible forage types.

If mass is zero, digestibility is undefined.

See also
Energy Content of Forage

◆ get_mass()

ForageMass HabitatForage::get_mass ( ) const

Get dry matter mass [kgDM/km²] for all edible forage types.

◆ get_nitrogen_content()

ForageFraction HabitatForage::get_nitrogen_content ( )

Fraction of nitrogen in dry matter [kgN/kgDM].

◆ get_total()

ForageBase HabitatForage::get_total ( ) const

Total forage in the habitat.

Digestibility is weighted average, forage mass is sum. If mass is zero, digestibility is also zero.

◆ merge()

HabitatForage & HabitatForage::merge ( const HabitatForage 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/habitat_forage.h

◆ operator[]() [1/2]

ForageBase & Fauna::HabitatForage::operator[] ( const ForageType  ft)
inline

Reference to forage object by forage type.

Parameters
ftForage type.
Returns
Polymorphic reference to forage class object.
Exceptions
std::logic_errorif ft is not implemented.

◆ operator[]() [2/2]

const ForageBase & Fauna::HabitatForage::operator[] ( const ForageType  ft) const
inline

Reference to forage object by forage type.

Parameters
ftForage type.
Returns
Polymorphic reference to forage class object.
Exceptions
std::logic_errorif ft is not implemented.

◆ set_nitrogen_content()

void HabitatForage::set_nitrogen_content ( const ForageFraction nitrogen_content)

Set the nitrogen content [kgN/kgDM] for all forage types.

Exceptions
std::invalid_argumentIf one value of nitrogen_content equals 1.

Member Data Documentation

◆ grass

GrassForage Fauna::HabitatForage::grass

The grass forage in the habitat.

◆ inedible

ForageBase Fauna::HabitatForage::inedible
private

Inedible forage in the habitat.

This is currently not used, but only here to return something if ForageType::Inedible is passed to the [] operator.


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