NGen
Loading...
Searching...
No Matches
config.hpp
1#ifndef NGEN_REALIZATION_CONFIG_H
2#define NGEN_REALIZATION_CONFIG_H
3
4#include <boost/property_tree/ptree.hpp>
5
6#include "formulation.hpp"
7#include "forcing.hpp"
8
9namespace realization{
10 namespace config{
11
16 struct Config{
17
22 Config() = default;
23
29 Config(const boost::property_tree::ptree& tree){
30
31 auto possible_forcing = tree.get_child_optional("forcing");
32
33 if (possible_forcing) {
34 forcing = Forcing(*possible_forcing);
35 }
36 //get first empty key under formulations (corresponds to first json array element)
37 auto possible_formulation_tree = tree.get_child_optional("formulations..");
38 if(possible_formulation_tree){
39 formulation = Formulation(*possible_formulation_tree);
40 }
41 }
42
50 return !(formulation.type.empty() || formulation.parameters.empty());
51 }
52
55 };
56
57
58 }//end namespace config
59}//end namespace realization
60#endif //NGEN_REALIZATION_CONFIG_H
Definition Bmi_C_Formulation.hpp:11
Structure representing the configuration for a general Formulation.
Definition config.hpp:16
bool has_formulation()
Determine if the config has a formulation.
Definition config.hpp:49
Forcing forcing
Definition config.hpp:54
Config()=default
Construct a new Config object.
Formulation formulation
Definition config.hpp:53
Config(const boost::property_tree::ptree &tree)
Construct a new Config object from a property tree.
Definition config.hpp:29
Structure for holding forcing configuration information.
Definition forcing.hpp:15
Definition formulation.hpp:17
geojson::PropertyMap parameters
Definition formulation.hpp:20
std::string type
Definition formulation.hpp:18