NGen
Loading...
Searching...
No Matches
Formulation.hpp
1#ifndef FORMULATION_H
2#define FORMULATION_H
3
4#include <memory>
5#include <string>
6#include <map>
7#include <exception>
8#include <vector>
9
10#include "JSONProperty.hpp"
11
12#include <boost/property_tree/ptree.hpp>
13#include <boost/algorithm/string.hpp>
14
15namespace realization {
16
18 public:
19 typedef long time_step_t;
20
21 Formulation(std::string id) : id(id) {}
22
23 virtual ~Formulation(){};
24
25 virtual std::string get_formulation_type() const = 0;
26
27 // TODO: to truly make this properly generalized (beyond catchments, and to some degree even in that
28 // context) a more complex type for the entirety of the response/output is needed, perhaps with independent
29 // access functions
30
31 // TODO: a reference to the actual time of the initial time step is needed
32
33 // TODO: a reference to the last calculated time step is needed
34
35 // TODO: a mapping of previously calculated time steps to the size/delta of each is needed (unless we
36 // introduce a way to enforce immutable time step delta values for an object)
37
38 // TODO: a convenience method for getting the actual time of calculated time steps (at least the last)
39
40 std::string get_id() const {
41 return this->id;
42 }
43
44 virtual void create_formulation(boost::property_tree::ptree &config, geojson::PropertyMap *global = nullptr) = 0;
45 virtual void create_formulation(geojson::PropertyMap properties) = 0;
46
47 virtual void check_mass_balance(const int& iteration, const int& total_steps, const std::string& timestamp) const = 0;
48 protected:
49
50 virtual const std::vector<std::string>& get_required_parameters() const = 0;
51 geojson::PropertyMap interpret_parameters(boost::property_tree::ptree &config, geojson::PropertyMap *global = nullptr);
53
54 std::string id;
55 };
56
57}
58#endif // FORMULATION_H
Definition Formulation.hpp:17
std::string get_id() const
Definition Formulation.hpp:40
virtual std::string get_formulation_type() const =0
virtual ~Formulation()
Definition Formulation.hpp:23
virtual void create_formulation(geojson::PropertyMap properties)=0
Formulation(std::string id)
Definition Formulation.hpp:21
void validate_parameters(geojson::PropertyMap options)
Definition Formulation.cpp:24
virtual void create_formulation(boost::property_tree::ptree &config, geojson::PropertyMap *global=nullptr)=0
geojson::PropertyMap interpret_parameters(boost::property_tree::ptree &config, geojson::PropertyMap *global=nullptr)
Definition Formulation.cpp:4
std::string id
Definition Formulation.hpp:54
virtual void check_mass_balance(const int &iteration, const int &total_steps, const std::string &timestamp) const =0
virtual const std::vector< std::string > & get_required_parameters() const =0
long time_step_t
Definition Formulation.hpp:19
std::map< std::string, JSONProperty > PropertyMap
Shorthand for a mapping between strings and properties.
Definition JSONProperty.hpp:21
Definition HY_Features.hpp:12