NGen
Loading...
Searching...
No Matches
realization::Catchment_Formulation Class Referenceabstract

#include <Catchment_Formulation.hpp>

+ Inheritance diagram for realization::Catchment_Formulation:
+ Collaboration diagram for realization::Catchment_Formulation:

Public Types

typedef long time_step_t
 

Public Member Functions

 Catchment_Formulation (std::string id, std::shared_ptr< data_access::GenericDataProvider > forcing, utils::StreamHandler output_stream)
 
 Catchment_Formulation (std::string id)
 
virtual std::string get_output_header_line (std::string delimiter=DEFAULT_FORMULATION_OUTPUT_DELIMITER) const
 Get a header line appropriate for a file made up of entries from this type's implementation of get_output_line_for_timestep.
 
virtual std::string get_output_line_for_timestep (int timestep, std::string delimiter=DEFAULT_FORMULATION_OUTPUT_DELIMITER)=0
 Get a formatted line of output values for the given time step as a delimited string.
 
virtual double get_response (time_step_t t_index, time_step_t t_delta) override=0
 Execute the backing model formulation for the given time step, where it is of the specified size, and return the response output.
 
const std::vector< std::string > & get_required_parameters () const override=0
 
void create_formulation (boost::property_tree::ptree &config, geojson::PropertyMap *global=nullptr) override=0
 
void create_formulation (geojson::PropertyMap properties) override=0
 
virtual ~Catchment_Formulation ()
 
void finalize ()
 Release resources of the given forcing provider.
 
virtual std::string get_formulation_type () const =0
 
std::string get_id () const
 
void set_output_stream (std::string file_path)
 
void write_output (std::string out)
 

Static Public Member Functions

static void config_pattern_substitution (geojson::PropertyMap &properties, const std::string &key, const std::string &pattern, const std::string &replacement)
 Perform in-place substitution on the given config property item, if the item and the pattern are present.
 

Protected Member Functions

std::string get_catchment_id () const override
 
void set_catchment_id (std::string cat_id) override
 
geojson::PropertyMap interpret_parameters (boost::property_tree::ptree &config, geojson::PropertyMap *global=nullptr)
 
void validate_parameters (geojson::PropertyMap options)
 

Protected Attributes

std::shared_ptr< data_access::GenericDataProviderforcing
 
std::string id
 
polygon_t bounds
 
utils::StreamHandler output
 
std::shared_ptr< HY_Catchmentrealized_catchment
 
unsigned long id_number
 

Private Attributes

std::string cat_id
 

Member Typedef Documentation

◆ time_step_t

Constructor & Destructor Documentation

◆ Catchment_Formulation() [1/2]

realization::Catchment_Formulation::Catchment_Formulation ( std::string id,
std::shared_ptr< data_access::GenericDataProvider > forcing,
utils::StreamHandler output_stream )
inline

References set_catchment_id().

◆ Catchment_Formulation() [2/2]

realization::Catchment_Formulation::Catchment_Formulation ( std::string id)
inline

References set_catchment_id().

◆ ~Catchment_Formulation()

virtual realization::Catchment_Formulation::~Catchment_Formulation ( )
inlinevirtual

Member Function Documentation

◆ config_pattern_substitution()

static void realization::Catchment_Formulation::config_pattern_substitution ( geojson::PropertyMap & properties,
const std::string & key,
const std::string & pattern,
const std::string & replacement )
inlinestatic

Perform in-place substitution on the given config property item, if the item and the pattern are present.

Any and all instances of the substring pattern are replaced by replacement, if key maps to a present string-type property value.

Parameters
propertiesA reference to the properties config object to be altered.
keyThe key for the configuration property to potentially adjust.
patternThe pattern substring to search for that, when present, should be replaced.
replacementThe replacement substring to potentially insert.

References geojson::String.

Referenced by realization::Formulation_Manager::construct_missing_formulation(), and realization::Bmi_Multi_Formulation::init_nested_module().

◆ create_formulation() [1/2]

void realization::Catchment_Formulation::create_formulation ( boost::property_tree::ptree & config,
geojson::PropertyMap * global = nullptr )
overridepure virtual

◆ create_formulation() [2/2]

void realization::Catchment_Formulation::create_formulation ( geojson::PropertyMap properties)
overridepure virtual

◆ finalize()

void realization::Catchment_Formulation::finalize ( )
inline

Release resources of the given forcing provider.

References forcing.

◆ get_catchment_id()

◆ get_formulation_type()

◆ get_id()

std::string realization::Formulation::get_id ( ) const
inlineinherited

◆ get_output_header_line()

virtual std::string realization::Catchment_Formulation::get_output_header_line ( std::string delimiter = DEFAULT_FORMULATION_OUTPUT_DELIMITER) const
inlinevirtual

Get a header line appropriate for a file made up of entries from this type's implementation of get_output_line_for_timestep.

Note that like the output generating function, this line does not include anything for time step.

A default implementation is provided for inheritors of this type, which includes only "Total Discharge."

Returns
An appropriate header line for this type.

Reimplemented in realization::Bmi_Formulation.

Referenced by ngen::DomainLayer::DomainLayer().

◆ get_output_line_for_timestep()

virtual std::string realization::Catchment_Formulation::get_output_line_for_timestep ( int timestep,
std::string delimiter = DEFAULT_FORMULATION_OUTPUT_DELIMITER )
pure virtual

Get a formatted line of output values for the given time step as a delimited string.

This method is useful for preparing calculated data in a representation useful for output files, such as CSV files.

The resulting string will contain calculated values for applicable output variables for the particular formulation, as determined for the given time step. However, the string will not contain any representation of the time step itself.

An empty string is returned if the time step value is not in the range of valid time steps for which there are calculated values for all variables.

Parameters
timestepThe time step for which data is desired.
delimiterThe value delimiter for the string.
Returns
A delimited string with all the output variable values for the given time step.

Implemented in realization::Bmi_Module_Formulation, and realization::Bmi_Multi_Formulation.

Referenced by ngen::DomainLayer::update_models().

◆ get_required_parameters()

const std::vector< std::string > & realization::Catchment_Formulation::get_required_parameters ( ) const
overridepure virtual

◆ get_response()

virtual double realization::Catchment_Formulation::get_response ( time_step_t t_index,
time_step_t t_delta )
overridepure virtual

Execute the backing model formulation for the given time step, where it is of the specified size, and return the response output.

Any inputs and additional parameters must be made available as instance members.

Types should clearly document the details of their particular response output.

Parameters
t_indexThe index of the time step for which to run model calculations.
t_deltaThe duration, in seconds, of the time step for which to run model calculations.
Returns
The response output of the model for this time step.

Implements HY_CatchmentRealization.

Implemented in realization::Bmi_Module_Formulation, and realization::Bmi_Multi_Formulation.

Referenced by ngen::DomainLayer::update_models().

◆ interpret_parameters()

geojson::PropertyMap realization::Formulation::interpret_parameters ( boost::property_tree::ptree & config,
geojson::PropertyMap * global = nullptr )
inlineprotectedinherited

◆ set_catchment_id()

void realization::Catchment_Formulation::set_catchment_id ( std::string cat_id)
inlineoverrideprotectedvirtual

◆ set_output_stream()

void HY_CatchmentArea::set_output_stream ( std::string file_path)
inlineinherited

◆ validate_parameters()

◆ write_output()

void HY_CatchmentArea::write_output ( std::string out)
inlineinherited

Member Data Documentation

◆ bounds

polygon_t HY_CatchmentArea::bounds
protectedinherited

◆ cat_id

std::string realization::Catchment_Formulation::cat_id
private

◆ forcing

◆ id

std::string realization::Formulation::id
protectedinherited

◆ id_number

unsigned long HY_CatchmentRealization::id_number
protectedinherited

◆ output

◆ realized_catchment

std::shared_ptr<HY_Catchment> HY_CatchmentRealization::realized_catchment
protectedinherited

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