1#ifndef UTOPIA_MODELS_ENVIRONMENT_ENVSTATEFUNCCOLLECTION_HH
2#define UTOPIA_MODELS_ENVIRONMENT_ENVSTATEFUNCCOLLECTION_HH
7namespace StateFunctionCollection {
19 class EnvStateFunc =
typename EnvModel::EnvStateFunc>
23 const std::string& param_name,
76 class EnvStateFunc =
typename EnvModel::EnvStateFunc>
78 const std::string& param_name,
97 std::poisson_distribution<>
dist(
mean);
128 throw std::invalid_argument(
"No method implemented to resolve "
129 "noise distribution '" +
distribution +
"'! Valid options: "
130 "normal, poisson, uniform_int, uniform_real.");
150 class EnvStateFunc =
typename EnvModel::EnvStateFunc>
152 const std::string& param_name,
168 const double pos = (
env_state.position[1] / extent[1]);
200 class EnvStateFunc =
typename EnvModel::EnvStateFunc>
202 const std::string& param_name,
213 throw std::invalid_argument(
"The list of 'latitudes' and"
214 " 'values_north_south' don't match in size. Sizes were "
215 + std::to_string(
latitudes.size()) +
" and "
217 ". Values_north_south must have one element more that"
259 class EnvStateFunc =
typename EnvModel::EnvStateFunc>
261 const std::string& param_name,
268 if (cfg.IsScalar()) {
271 value = cfg.as<
double>();
273 else if (cfg.IsMap()) {
278 throw std::invalid_argument(
"The configuration for environment "
279 "function 'uniform' must be a scalar or a mapping!");
283 [param_name, mode, value]
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
std::pair< EnvStateFunc, Update > esf_uniform(const EnvModel &, const std::string ¶m_name, const Config &cfg)
Creates a rule function for spatially uniform parameter values.
Definition env_state_func_collection.hh:260
ValMode extract_val_mode(const DataIO::Config &cfg, const std::string &context)
Given a configuration node, extract the value mode.
Definition tools.hh:19
std::pair< EnvStateFunc, Update > esf_noise(const EnvModel &model, const std::string ¶m_name, const Config &cfg)
Creates a rule function for noisy parameter values.
Definition env_state_func_collection.hh:77
std::pair< EnvStateFunc, Update > esf_steps(const EnvModel &, const std::string ¶m_name, const Config &cfg)
Creates a rule function for spatial steps in the parameter values.
Definition env_state_func_collection.hh:201
std::pair< EnvStateFunc, Update > esf_slope(const EnvModel &, const std::string ¶m_name, const Config &cfg, const Extent &extent)
Creates a rule function for spatially linearly parameter values.
Definition env_state_func_collection.hh:151
ValMode
Value calculation mode.
Definition tools.hh:10
@ Set
Set a value, discarding the current state.
@ Add
Add the new value to the existing value.
@ sync
Synchronous update.
EnvStateFunc build_rng_env_state_func(EnvModel &model, DistType &&dist, const std::string ¶m_name, const ValMode &mode)
Create a rule function that uses a random number distribution.
Definition env_state_func_collection.hh:21
DataIO::Config Config
Configuration node type alias.
Definition env_state_func_collection.hh:10
Definition env_param_func_collection.hh:8
unsigned int DistType
Type for distancens, i.e. intermediately long unsigned integers.
Definition types.hh:37