37 public Model<Vegetation, VegetationTypes>
88 auto state =
cell->state();
90 auto mass = state.plant_mass;
123 return std::accumulate(
_cm.
cells().begin(),
126 [](
double sum,
const auto&
cell) {
127 return sum + cell->state().plant_mass;
142 template<
class ParentModel>
144 const std::string& name,
166 this->
_log->info(
"'{}' model fully set up.", name);
181 return cell->state().plant_mass; }
typename std::function< CellState(const std::shared_ptr< Cell > &)> RuleFunc
The type of a rule function acting on cells of this cell manager.
Definition cell_manager.hh:84
const CellContainer< Cell > & cells() const
Return const reference to the managed CA cells.
Definition cell_manager.hh:219
Base class interface for Models using the CRT Pattern.
Definition model.hh:112
std::shared_ptr< DataSet > create_cm_dset(const std::string name, const CellManager &cm, const std::size_t compression_level=1, const std::vector< hsize_t > chunksize={})
Create a dataset storing data from a CellManager.
Definition model.hh:849
Monitor _monitor
The monitor.
Definition model.hh:188
typename ModelTypes::DataSet DataSet
Data type that is used for storing data.
Definition model.hh:125
const Config _cfg
Config node belonging to this model instance.
Definition model.hh:158
typename ModelTypes::Config Config
Data type that holds the configuration.
Definition model.hh:116
const std::shared_ptr< spdlog::logger > _log
The (model) logger.
Definition model.hh:164
const std::shared_ptr< RNG > _rng
The RNG shared between models.
Definition model.hh:161
A very simple vegetation model.
Definition Vegetation.hh:38
typename CellManager::RuleFunc RuleFunc
Type of the update rule.
Definition Vegetation.hh:53
double _seeding_rate
The seeding rate.
Definition Vegetation.hh:69
std::normal_distribution< double > _rain_dist
Normal distribution for drawing random rain values.
Definition Vegetation.hh:63
RuleFunc _growth_seeding
Apply logistic growth and seeding.
Definition Vegetation.hh:87
std::shared_ptr< DataSet > _dset_plant_mass
Plant mass dataset.
Definition Vegetation.hh:74
Vegetation(const std::string &name, const ParentModel &parent_model, const DataIO::Config &custom_cfg={})
Construct the Vegetation model.
Definition Vegetation.hh:143
double calc_mean_mass() const
Calculate the mean plant mass.
Definition Vegetation.hh:122
typename Base::Config Config
Type of the config tree.
Definition Vegetation.hh:44
void monitor()
Monitor the current model state; supplies the mean plant mass.
Definition Vegetation.hh:186
void write_data()
Write the cell states (aka plant bio-mass)
Definition Vegetation.hh:176
Model< Vegetation, VegetationTypes > Base
Type of the base class.
Definition Vegetation.hh:41
typename Base::DataSet DataSet
Type of a data set.
Definition Vegetation.hh:47
double _growth_rate
The growth rate (logistic growth model)
Definition Vegetation.hh:66
void perform_step()
Iterate a single step.
Definition Vegetation.hh:170
CellManager _cm
The grid manager.
Definition Vegetation.hh:57
YAML::Node Config
Type of a variadic dictionary-like data structure used throughout Utopia.
Definition types.hh:71
Container select_entities(const Manager &mngr, const DataIO::Config &sel_cfg)
Select entities according to parameters specified in a configuration.
Definition select.hh:213
void apply_rule(Rule &&rule, const ContTarget &cont_target, ContArgs &&... cont_args)
Sequential overload.
Definition apply.hh:133
This is the central file of the HDF5 dataIO module of Utopia and provides a class for writing to,...
This file provides a class for creating and managing groups in a HDF5 file, which then can create oth...
The entity traits struct gathers types to be used for specializing an entity.
Definition entity.hh:49
Wrapper struct for defining model class data types.
Definition model.hh:92
State of a cell in the Vegetation model, consisting only of plant mass.
Definition Vegetation.hh:24
double plant_mass
Definition Vegetation.hh:25