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

Helper class of World to create various megafauna components. More...

#include <world_constructor.h>

Public Member Functions

 WorldConstructor (const std::shared_ptr< const Parameters > params, const HftList &hftlist)
 Constructor: only set member variables. More...
 
PopulationListcreate_populations (const unsigned int habitat_ctr_in_agg_unit) const
 Instantiate populations for all HFTs in one Habitat. More...
 
DistributeForagecreate_distribute_forage () const
 Create new DistributeForage object according to parameters. More...
 
const HftListget_hftlist () const
 Get herbivore functional types. More...
 
const Parametersget_params () const
 Get global parameters. More...
 

Private Attributes

const std::shared_ptr< const Parametersparams
 
const HftListhftlist
 

Detailed Description

Helper class of World to create various megafauna components.

We separate World and WorldConstructor into two classes because the framework class World should be as slim as possible because it is exposed in the library interface. Moreover, World cannot be easily unit-tested since it is constructed with an external instruction file.

Constructor & Destructor Documentation

◆ WorldConstructor()

WorldConstructor::WorldConstructor ( const std::shared_ptr< const Parameters params,
const HftList hftlist 
)

Constructor: only set member variables.

Member Function Documentation

◆ create_distribute_forage()

DistributeForage * WorldConstructor::create_distribute_forage ( ) const

Create new DistributeForage object according to parameters.

◆ create_populations()

PopulationList * WorldConstructor::create_populations ( const unsigned int  habitat_ctr_in_agg_unit) const

Instantiate populations for all HFTs in one Habitat.

Parameters
habitat_ctr_in_agg_unitHabitat counter in aggregation unit. The habitat index (starting with 0) in the current aggregation unit (e.g. grid cell). If Parameters::one_hft_per_habitat == true, the counter indicates which HFT is to be created: A value of 0 will create one population with the first HFT in hftlist; 1 will create the second, 3 the third. Suppose there are 3 HFTs in the list, a value of 3 will create the first HFT again; 4 the second, and so forth.
Exceptions
std::logic_errorif Parameters::herbivore_type is not implemented
Returns
Pointer to new object

◆ get_hftlist()

const HftList & Fauna::WorldConstructor::get_hftlist ( ) const
inline

Get herbivore functional types.

◆ get_params()

const Parameters & Fauna::WorldConstructor::get_params ( ) const
inline

Get global parameters.

Member Data Documentation

◆ hftlist

const HftList& Fauna::WorldConstructor::hftlist
private

◆ params

const std::shared_ptr<const Parameters> Fauna::WorldConstructor::params
private

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