1#ifndef NGEN_REALIZATION_CONFIG_LAYER_H
2#define NGEN_REALIZATION_CONFIG_LAYER_H
4#include <boost/property_tree/ptree.hpp>
6#include "LayerData.hpp"
31 std::vector<std::string> missing_keys;
32 auto name = tree.get_optional<std::string>(
"name");
33 if(!name) missing_keys.push_back(
"name");
34 auto unit = tree.get<std::string>(
"time_step_units",
"s");
36 auto id = tree.get_optional<
int>(
"id");
37 if(!
id) missing_keys.push_back(
"id");
39 auto ts = tree.get_optional<
double>(
"time_step");
41 auto tmp = tree.get_optional<std::string>(
"domain");
43 if(missing_keys.empty()){
44 descriptor = {*name, unit, *id, *ts};
47 std::string message =
"ERROR: Layer cannot be created; the following parameters are missing or invalid: ";
49 for (
const auto& missing : missing_keys) {
56 throw std::runtime_error(message);
76 return formulation.has_formulation();
Definition Bmi_C_Formulation.hpp:11
A simple structure to hold meta data related to a computational layer.
Definition LayerData.hpp:18
Structure representing the configuration for a general Formulation.
Definition config.hpp:16
Layer configuration information.
Definition layer.hpp:16
Layer()
Construct a new default surface layer.
Definition layer.hpp:23
ngen::LayerDescription descriptor
Definition layer.hpp:93
const std::string & get_domain()
Get the domain description.
Definition layer.hpp:84
Layer(const boost::property_tree::ptree &tree)
Construct a new Layer from a property tree.
Definition layer.hpp:30
const ngen::LayerDescription & get_descriptor()
Get the descriptor associated with this layer configuration.
Definition layer.hpp:65
Config formulation
The formulation configuration associated with the layer.
Definition layer.hpp:90
bool has_formulation()
Determines if the layer has a valid configured formulation.
Definition layer.hpp:75
std::string domain
Definition layer.hpp:92