1#ifndef NGEN_REALIZATION_CONFIG_FORMULATION_H
2#define NGEN_REALIZATION_CONFIG_FORMULATION_H
5#include <boost/property_tree/ptree.hpp>
8#include "JSONProperty.hpp"
44 type = tree.get<std::string>(
"name");
45 for (std::pair<std::string, boost::property_tree::ptree> setting : tree.get_child(
"params")) {
52 if(
type==
"bmi_multi"){
53 for(
auto& module : tree.get_child(
"params.modules")){
68 if(
type ==
"bmi_multi"){
69 std::vector<geojson::JSONProperty> tmp;
72 if(n.parameters.count(
"model_params")){
73 n.link_external(feature);
86 if(
parameters.count(
"model_params") < 1 )
return;
89 for (
decltype(
auto) param : attr) {
92 attr.emplace(param.first, param.second);
96 decltype(
auto) param_source = param.second.at(
"source");
97 decltype(
auto) param_source_name = param_source.as_string();
98 if (param_source_name !=
"hydrofabric") {
100 throw std::logic_error(
"ERROR: 'model_params' source `" + param_source_name +
"` not currently supported. Only `hydrofabric` is supported.");
106 decltype(
auto) param_name = param.second.has_key(
"from")
107 ? param.second.at(
"from").as_string()
110 if (feature->has_property(param_name)) {
111 auto catchment_attribute = feature->get_property(param_name);
115 switch (catchment_attribute.get_type()) {
120 std::cerr <<
"WARNING: property type " <<
static_cast<int>(catchment_attribute.get_type()) <<
" not allowed as model parameter. "
121 <<
"Must be one of: Natural (int), Real (double), Boolean, or String" <<
'\n';
@TODO: Convert JSONProperty into a variant of the supported types
Definition JSONProperty.hpp:165
std::map< std::string, JSONProperty > PropertyMap
Shorthand for a mapping between strings and properties.
Definition JSONProperty.hpp:21
std::shared_ptr< FeatureBase > Feature
An easy name for a smart pointer for FeatureBase and its children.
Definition FeatureBase.hpp:34
Definition HY_Features.hpp:12