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::vector< utils::OutputFieldget_output_fields () const =0
 Get this formulation's output fields – name plus metadata (units, ...) – in the same order as the values returned by get_output_values_for_timestep.
 
virtual std::vector< double > get_output_values_for_timestep (int timestep)=0
 Get the output values for the given time step, positionally aligned with get_output_fields.
 
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 ()=default
 
void finalize ()
 Release resources of the given forcing provider.
 
virtual std::string get_formulation_type () const =0
 
std::string get_id () const
 
virtual void check_mass_balance (const int &iteration, const int &total_steps, const std::string &timestamp) const =0
 

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

const 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 )

References set_catchment_id().

◆ Catchment_Formulation() [2/2]

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

References set_catchment_id().

◆ ~Catchment_Formulation()

virtual realization::Catchment_Formulation::~Catchment_Formulation ( )
virtualdefault

Member Function Documentation

◆ check_mass_balance()

virtual void realization::Formulation::check_mass_balance ( const int & iteration,
const int & total_steps,
const std::string & timestamp ) const
pure virtualinherited

◆ config_pattern_substitution()

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

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_formulation_from_config(), 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 ( )

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_fields()

virtual std::vector< utils::OutputField > realization::Catchment_Formulation::get_output_fields ( ) const
pure virtual

Get this formulation's output fields – name plus metadata (units, ...) – in the same order as the values returned by get_output_values_for_timestep.

The name is the output header field (configured, or defaulting to the output variable name); the units come from the same source that produces each value. So each field is positionally aligned with, and describes, the corresponding value.

Returns
The ordered output fields.

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

◆ get_output_values_for_timestep()

virtual std::vector< double > realization::Catchment_Formulation::get_output_values_for_timestep ( int timestep)
pure virtual

Get the output values for the given time step, positionally aligned with get_output_fields.

Values are returned as raw doubles, with no formatting or precision applied by the formulation.

Parameters
timestepThe time step for which values are desired.
Returns
The output values for timestep, one per output column.

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 )
protectedinherited

◆ set_catchment_id()

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

◆ validate_parameters()

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

utils::StreamHandler HY_CatchmentArea::output
protectedinherited

◆ realized_catchment

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

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