NGen
Loading...
Searching...
No Matches
realization::Formulation_Manager Class Reference

#include <Formulation_Manager.hpp>

+ Collaboration diagram for realization::Formulation_Manager:

Public Member Functions

 Formulation_Manager (std::stringstream &data)
 
 Formulation_Manager (const std::string &file_path)
 
 Formulation_Manager (boost::property_tree::ptree &loaded_tree)
 
 ~Formulation_Manager ()=default
 
void read (geojson::GeoJSON fabric, utils::StreamHandler output_stream)
 
void add_formulation (std::shared_ptr< Catchment_Formulation > formulation)
 
std::shared_ptr< Catchment_Formulationget_formulation (std::string id) const
 
std::shared_ptr< Catchment_Formulationget_domain_formulation (long id) const
 
bool has_domain_formulation (int id) const
 
bool contains (std::string identifier) const
 
int get_size ()
 
bool is_empty ()
 
std::map< std::string, std::shared_ptr< Catchment_Formulation > >::const_iterator begin () const
 
std::map< std::string, std::shared_ptr< Catchment_Formulation > >::const_iterator end () const
 
bool get_using_routing ()
 
std::string get_t_route_config_file_with_path ()
 
void finalize ()
 Release any resources that should not be held as the run is shutting down.
 
std::string get_output_root () const
 Get the formatted output root: check the existence of the output_root directory defined in realization.
 
ngen::LayerDataStorageget_layer_metadata ()
 return the layer storage used for formulations
 

Public Attributes

std::shared_ptr< Simulation_TimeSimulation_Time_Object
 

Protected Member Functions

std::shared_ptr< Catchment_Formulationconstruct_formulation_from_config (simulation_time_params &simulation_time_config, std::string identifier, const realization::config::Config &catchment_formulation, utils::StreamHandler output_stream)
 
std::shared_ptr< Catchment_Formulationconstruct_missing_formulation (geojson::Feature &feature, utils::StreamHandler output_stream, simulation_time_params &simulation_time_config)
 
forcing_params get_forcing_params (const geojson::PropertyMap &forcing_prop_map, std::string identifier, simulation_time_params &simulation_time_config)
 
void parse_external_model_params (boost::property_tree::ptree &model_params, const geojson::Feature catchment_feature)
 Parse a model_params property tree and replace external parameters with values from a catchment's properties.
 
void parse_external_model_params (geojson::PropertyMap &model_params, const geojson::Feature catchment_feature)
 Parse a model_params property map and replace external parameters with values from a catchment's properties.
 

Protected Attributes

boost::property_tree::ptree tree
 
realization::config::Config global_config
 
std::map< std::string, std::shared_ptr< Catchment_Formulation > > formulations
 
std::map< int, std::shared_ptr< Catchment_Formulation > > domain_formulations
 
std::shared_ptr< routing_paramsrouting_config
 
bool using_routing = false
 
ngen::LayerDataStorage layer_storage
 

Constructor & Destructor Documentation

◆ Formulation_Manager() [1/3]

realization::Formulation_Manager::Formulation_Manager ( std::stringstream & data)
inline

References tree.

◆ Formulation_Manager() [2/3]

realization::Formulation_Manager::Formulation_Manager ( const std::string & file_path)
inline

References tree.

◆ Formulation_Manager() [3/3]

realization::Formulation_Manager::Formulation_Manager ( boost::property_tree::ptree & loaded_tree)
inline

References tree.

◆ ~Formulation_Manager()

realization::Formulation_Manager::~Formulation_Manager ( )
default

Member Function Documentation

◆ add_formulation()

void realization::Formulation_Manager::add_formulation ( std::shared_ptr< Catchment_Formulation > formulation)
inline

References formulations.

Referenced by read().

◆ begin()

std::map< std::string, std::shared_ptr< Catchment_Formulation > >::const_iterator realization::Formulation_Manager::begin ( ) const
inline

References formulations.

◆ construct_formulation_from_config()

◆ construct_missing_formulation()

◆ contains()

bool realization::Formulation_Manager::contains ( std::string identifier) const
inline

References formulations.

Referenced by read().

◆ end()

std::map< std::string, std::shared_ptr< Catchment_Formulation > >::const_iterator realization::Formulation_Manager::end ( ) const
inline

References formulations.

◆ finalize()

void realization::Formulation_Manager::finalize ( )
inline

Release any resources that should not be held as the run is shutting down.

In particular, this should be called before MPI_Finalize()

References domain_formulations, and formulations.

◆ get_domain_formulation()

std::shared_ptr< Catchment_Formulation > realization::Formulation_Manager::get_domain_formulation ( long id) const
inline

References domain_formulations.

◆ get_forcing_params()

forcing_params realization::Formulation_Manager::get_forcing_params ( const geojson::PropertyMap & forcing_prop_map,
std::string identifier,
simulation_time_params & simulation_time_config )
inlineprotected

◆ get_formulation()

std::shared_ptr< Catchment_Formulation > realization::Formulation_Manager::get_formulation ( std::string id) const
inline

References formulations.

◆ get_layer_metadata()

ngen::LayerDataStorage & realization::Formulation_Manager::get_layer_metadata ( )
inline

return the layer storage used for formulations

Returns
a reference to the LayerStorageObject

References layer_storage.

◆ get_output_root()

std::string realization::Formulation_Manager::get_output_root ( ) const
inline

Get the formatted output root: check the existence of the output_root directory defined in realization.

If true, return the directory name. Otherwise, try to create the directory or throw an error on failure.

// Example config:
// ...
// "output_root": "/path/to/dir/"
// ...
const auto manager = Formulation_Manger(CONFIG);
manager.get_output_root();
//> "/path/to/dir/"
Returns
std::string of the output root directory

References tree.

Referenced by read().

◆ get_size()

int realization::Formulation_Manager::get_size ( )
inline
Returns
The number of elements within the collection

References formulations.

◆ get_t_route_config_file_with_path()

std::string realization::Formulation_Manager::get_t_route_config_file_with_path ( )
inline
Returns
routing t_route_config_file_with_path

References routing_config, and routing_params::t_route_config_file_with_path.

◆ get_using_routing()

bool realization::Formulation_Manager::get_using_routing ( )
inline
Returns
Whether or not using routing

References using_routing.

◆ has_domain_formulation()

bool realization::Formulation_Manager::has_domain_formulation ( int id) const
inline

References domain_formulations.

◆ is_empty()

bool realization::Formulation_Manager::is_empty ( )
inline
Returns
Whether or not the collection is empty

References formulations.

◆ parse_external_model_params() [1/2]

void realization::Formulation_Manager::parse_external_model_params ( boost::property_tree::ptree & model_params,
const geojson::Feature catchment_feature )
inlineprotected

Parse a model_params property tree and replace external parameters with values from a catchment's properties.

Parameters
model_paramsProperty tree with root key "model_params"
catchment_featureAssociated catchment feature

References geojson::Boolean, geojson::List, geojson::Natural, geojson::Object, geojson::Real, and geojson::String.

◆ parse_external_model_params() [2/2]

void realization::Formulation_Manager::parse_external_model_params ( geojson::PropertyMap & model_params,
const geojson::Feature catchment_feature )
inlineprotected

Parse a model_params property map and replace external parameters with values from a catchment's properties.

Parameters
model_paramsProperty map with root key "model_params"
catchment_featureAssociated catchment feature

References geojson::Boolean, geojson::List, geojson::Natural, geojson::Object, geojson::Real, and geojson::String.

◆ read()

Member Data Documentation

◆ domain_formulations

std::map<int, std::shared_ptr<Catchment_Formulation> > realization::Formulation_Manager::domain_formulations
protected

◆ formulations

std::map<std::string, std::shared_ptr<Catchment_Formulation> > realization::Formulation_Manager::formulations
protected

◆ global_config

realization::config::Config realization::Formulation_Manager::global_config
protected

◆ layer_storage

ngen::LayerDataStorage realization::Formulation_Manager::layer_storage
protected

Referenced by get_layer_metadata(), and read().

◆ routing_config

std::shared_ptr<routing_params> realization::Formulation_Manager::routing_config
protected

◆ Simulation_Time_Object

std::shared_ptr<Simulation_Time> realization::Formulation_Manager::Simulation_Time_Object

Referenced by read().

◆ tree

boost::property_tree::ptree realization::Formulation_Manager::tree
protected

◆ using_routing

bool realization::Formulation_Manager::using_routing = false
protected

Referenced by get_using_routing(), and read().


The documentation for this class was generated from the following file: