Modular Megafauna Model 1.1.5
A physiological, dynamic herbivore simulator in C++.
Loading...
Searching...
No Matches
cohort_population.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_COHORT_POPULATION_H
12#define FAUNA_COHORT_POPULATION_H
13
14#include <list>
17
18namespace Fauna {
19
20// Forward Declarations
21enum class Sex;
22
25 public: // ------ PopulationInterface -------
27 virtual void create_offspring(const double ind_per_km2);
28
35 virtual void establish();
36
37 virtual const Hft& get_hft() const { return create_cohort.get_hft(); }
38 virtual ConstHerbivoreVector get_list() const;
39 virtual HerbivoreVector get_list();
40 virtual void kill_nonviable();
41 virtual void purge_of_dead();
42
43 public:
45
51
52 private:
53 typedef std::list<HerbivoreCohort> List;
54
56
64 void create_offspring_by_sex(const Sex sex, double ind_per_km2);
65
67
74 List::iterator find_cohort(const int age_years, const Sex sex);
75
79};
80} // namespace Fauna
81#endif // FAUNA_COHORT_POPULATION_H
A population of HerbivoreCohort objects.
Definition: cohort_population.h:24
virtual void create_offspring(const double ind_per_km2)
Give birth to new herbivores.
Definition: cohort_population.cpp:35
virtual ConstHerbivoreVector get_list() const
Get pointers to the herbivores (including dead ones).
Definition: cohort_population.cpp:90
const CreateHerbivoreCohort create_cohort
Definition: cohort_population.h:76
virtual void kill_nonviable()
Mark those herbivores as dead that are not viable.
Definition: cohort_population.cpp:112
virtual const Hft & get_hft() const
Definition: cohort_population.h:37
List list
Offspring accumulated until above minimum threshold [ind/km²].
Definition: cohort_population.h:78
List::iterator find_cohort(const int age_years, const Sex sex)
Find a cohort in the list.
Definition: cohort_population.cpp:81
virtual void establish()
Create a set of new herbivores to establish a population.
Definition: cohort_population.cpp:47
virtual void purge_of_dead()
Delete all dead herbivores.
Definition: cohort_population.cpp:120
void create_offspring_by_sex(const Sex sex, double ind_per_km2)
Add newborn animals to the population either males or females.
Definition: cohort_population.cpp:20
std::list< HerbivoreCohort > List
Definition: cohort_population.h:53
Function class constructing HerbivoreCohort objects.
Definition: create_herbivore_cohort.h:20
const Hft & get_hft() const
The herbivore functional type.
Definition: create_herbivore_common.cpp:41
One herbivore functional type (i.e. one species).
Definition: hft.h:310
Construct new herbivore cohort objects.
Definition: average.h:16
Sex
The sex of a herbivore.
Definition: herbivore_base.h:25
std::vector< HerbivoreInterface * > HerbivoreVector
A list of herbivore interface pointers.
Definition: herbivore_vector.h:20
std::vector< const HerbivoreInterface * > ConstHerbivoreVector
A list of read-only herbivore interface pointers.
Definition: herbivore_vector.h:23
Abstract class for any population of herbivores.
A container of herbivore objects.
Definition: population_interface.h:29