|
NGen
|
A formulation that answers a fixed depth. More...
Inheritance diagram for Depth_Formulation:
Collaboration diagram for Depth_Formulation:Public Types | |
| typedef long | time_step_t |
Public Member Functions | |||||||||||||||||
| Depth_Formulation (double depth_m) | |||||||||||||||||
| std::string | get_formulation_type () const override | ||||||||||||||||
| void | create_formulation (boost::property_tree::ptree &, geojson::PropertyMap *) override | ||||||||||||||||
| See Identity. | |||||||||||||||||
| void | create_formulation (geojson::PropertyMap) override | ||||||||||||||||
| See Identity. | |||||||||||||||||
| void | check_mass_balance (const int &, const int &, const std::string &) const override | ||||||||||||||||
| See Identity. | |||||||||||||||||
| void | checkpoint_state (const int &, const int &, const std::string &) const override | ||||||||||||||||
| Invoke the state-save side of the ngen BMI Serialization Protocol. | |||||||||||||||||
| void | update (time_step_t, time_step_t) override | ||||||||||||||||
| Advance the backing model formulation through the given time step. | |||||||||||||||||
| double | get_response (time_step_t, time_step_t) override | ||||||||||||||||
| Execute the backing model formulation for the given time step, where it is of the specified size, and return the response output. | |||||||||||||||||
| std::vector< utils::OutputField > | get_output_fields () const override | ||||||||||||||||
| Get this formulation's output fields – name plus metadata (units, ...) – in the same order as the values returned by get_output_values_for_timestep. | |||||||||||||||||
| std::vector< double > | get_output_values_for_timestep (int) override | ||||||||||||||||
| Get the output values for the given time step, positionally aligned with get_output_fields. | |||||||||||||||||
Identity | |||||||||||||||||
Three roles, not three independent names. A formulation has a subject, a locator, and an identity made of the two:
Subject and locator diverge only when one formulation composes another. The composer builds each module's locator from its own locator and that module's index within it, so a multi on A domain layer has no hydrofabric feature, but the layer is still what its model belongs to, so it stands as the subject. | |||||||||||||||||
| std::string | get_id () const | ||||||||||||||||
| See Identity. | |||||||||||||||||
| void | finalize () | ||||||||||||||||
| Release resources of the given forcing provider. | |||||||||||||||||
| const std::string & | get_feature_id () const | ||||||||||||||||
| The feature whose data this model reads and produces; see Identity. | |||||||||||||||||
| void | set_feature_id (const std::string &feature_id) | ||||||||||||||||
| Associate this formulation with a feature other than the one it is named for. | |||||||||||||||||
Protected Member Functions | |
| const std::vector< std::string > & | get_required_parameters () const override |
| geojson::PropertyMap | interpret_parameters (boost::property_tree::ptree &config, geojson::PropertyMap *global=nullptr) |
| void | validate_parameters (geojson::PropertyMap options) |
Protected Attributes | |
| std::string | id |
| This formulation's locator; see get_id. | |
| std::shared_ptr< data_access::GenericDataProvider > | forcing |
Private Attributes | |
| double | depth |
| std::string | feature_id |
| This formulation's subject; see get_feature_id. | |
A formulation that answers a fixed depth.
Formulation::get_response requests meters of its model, so a stub standing in for one answers in meters too. Everything else here is the interface, not the subject.
|
inherited |
|
inlineexplicit |
|
inlineoverridevirtual |
See Identity.
Implements realization::Formulation.
|
inlineoverridevirtual |
Invoke the state-save side of the ngen BMI Serialization Protocol.
Called from the per-timestep driver (see core/Layer.cpp) alongside check_mass_balance. Implementations build a protocol Context from the arguments and the formulation's own compound identity, then forward to the NgenBmiProtocols container. Non-BMI formulations may implement as a no-op; unconfigured save protocols short-circuit inside run() so the cost is just the virtual dispatch.
Implements realization::Formulation.
|
inlineoverridevirtual |
See Identity.
Implements realization::Formulation.
|
inlineoverridevirtual |
See Identity.
Implements realization::Formulation.
|
inherited |
Release resources of the given forcing provider.
References realization::Formulation::forcing.
|
inlineinherited |
The feature whose data this model reads and produces; see Identity.
References realization::Formulation::feature_id.
Referenced by realization::Bmi_Module_Formulation::get_output_values_for_timestep(), realization::Bmi_Multi_Formulation::get_output_values_for_timestep(), realization::Bmi_Module_Formulation::get_response(), realization::Bmi_Multi_Formulation::get_response(), realization::Bmi_Multi_Formulation::init_nested_module(), and realization::Bmi_Module_Formulation::perform_set().
|
inlineoverridevirtual |
Implements realization::Formulation.
|
inlineinherited |
See Identity.
References realization::Formulation::id.
Referenced by realization::Bmi_Multi_Formulation::create_multi_formulation().
|
inlineoverridevirtual |
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.
Implements realization::Formulation.
|
inlineoverridevirtual |
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.
| timestep | The time step for which values are desired. |
timestep, one per output column. Implements realization::Formulation.
|
inlineoverrideprotectedvirtual |
Implements realization::Formulation.
|
inlineoverridevirtual |
Execute the backing model formulation for the given time step, where it is of the specified size, and return the response output.
Advances the model as update does, and additionally reduces its state to one value. Callers that only need the model stepped should use update instead. This function should be implemented and used when a single-value representation of the model's state is required.
Any inputs and additional parameters must be made available as instance members.
The response is a depth, in meters. Implementations are responsible for converting it: the BMI ones ask their model for "m" and convert from whatever it declares in GetVarUnits. HY_CatchmentRealization takes that for granted when it records the response as a depth, and HY_CatchmentArea multiplies it by an area in m^2.
Types should clearly document anything further about their particular response.
| t_index | The index of the time step for which to run model calculations. |
| t_delta | The duration, in seconds, of the time step for which to run model calculations. |
Implements realization::Formulation.
References depth.
|
protectedinherited |
|
inlineinherited |
Associate this formulation with a feature other than the one it is named for.
For a formulation composing others: a nested module's id names its position within the composition, so the composing formulation gives it the feature they share.
References realization::Formulation::feature_id.
|
inlineoverridevirtual |
Advance the backing model formulation through the given time step.
| t_index | The index of the time step to run. |
| t_delta | The duration, in seconds, of that time step. |
Implements realization::Formulation.
|
protectedinherited |
References realization::Formulation::get_formulation_type(), and realization::Formulation::get_required_parameters().
Referenced by realization::Bmi_Multi_Formulation::create_multi_formulation(), realization::Bmi_Module_Formulation::inner_create_formulation(), and realization::Formulation::interpret_parameters().
|
private |
Referenced by get_response().
|
privateinherited |
This formulation's subject; see get_feature_id.
Referenced by realization::Formulation::get_feature_id(), and realization::Formulation::set_feature_id().
|
protectedinherited |
Referenced by realization::Bmi_Multi_Formulation::create_multi_formulation(), realization::Bmi_Module_Formulation::determine_model_time_offset(), realization::Formulation::finalize(), realization::Bmi_Module_Formulation::get_provider_for_input_var(), realization::Bmi_Multi_Formulation::get_variable_time_begin(), realization::Bmi_Multi_Formulation::get_variable_time_end(), and realization::Bmi_Module_Formulation::inner_create_formulation().
|
protectedinherited |
This formulation's locator; see get_id.
Referenced by realization::Formulation::get_id().