Modular Megafauna Model 1.1.5
A physiological, dynamic herbivore simulator in C++.
Loading...
Searching...
No Matches
herbivore_cohort.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_HERBIVORE_COHORT_H
12#define FAUNA_HERBIVORE_COHORT_H
13
14#include "herbivore_base.h"
15
16namespace Fauna {
17
19
26 public:
27 // -------- HerbivoreInterface ----------
28 virtual double get_ind_per_km2() const { return ind_per_km2; }
30 virtual bool is_dead() const;
31 virtual void kill() { ind_per_km2 = 0.0; }
32
33 public:
35
48 HerbivoreCohort(const int age_days, const double body_condition,
49 std::shared_ptr<const Hft> hft, const Sex sex,
50 const double ind_per_km2,
52
54
64 HerbivoreCohort(std::shared_ptr<const Hft> hft, const Sex sex,
65 const double ind_per_km2,
67
69
76 bool is_same_age(const HerbivoreCohort& other) const {
77 return (this->get_age_days() / 365 == other.get_age_days() / 365);
78 }
79
81
96 void merge(HerbivoreCohort& other);
97
98 protected:
99 // -------- HerbivoreBase ---------------
100 virtual void apply_mortality(const double mortality);
101
102 private:
104};
105
106} // namespace Fauna
107#endif // FAUNA_HERBIVORE_COHORT_H
Abstract base class for herbivores.
Definition: herbivore_base.h:31
int get_age_days() const
Current age in days.
Definition: herbivore_base.h:49
const Sex sex
Definition: herbivore_base.h:279
int age_days
Definition: herbivore_base.h:285
const std::shared_ptr< const Hft > hft
Definition: herbivore_base.h:278
const ForageEnergyContent forage_gross_energy
Definition: herbivore_base.h:281
A herbivore cohort (age-class)
Definition: herbivore_cohort.h:25
void merge(HerbivoreCohort &other)
Merge another cohort into this one.
Definition: herbivore_cohort.cpp:55
virtual void kill()
Mark this herbivore as dead (see is_dead()).
Definition: herbivore_cohort.h:31
bool is_same_age(const HerbivoreCohort &other) const
Check if this and the other cohort are of the same age.
Definition: herbivore_cohort.h:76
double ind_per_km2
Definition: herbivore_cohort.h:103
virtual double get_ind_per_km2() const
Individuals per km²
Definition: herbivore_cohort.h:28
virtual bool is_dead() const
A cohort is dead if its density is zero.
Definition: herbivore_cohort.cpp:53
virtual void apply_mortality(const double mortality)
Apply a fractional mortality.
Definition: herbivore_cohort.cpp:40
A versatile base class to derive herbivores from.
Definition: average.h:16
Sex
The sex of a herbivore.
Definition: herbivore_base.h:25