NGen
|
Simple implementation that basically wraps another instance. More...
#include <WrappedDataProvider.hpp>
Public Types | |
using | data_type = DataType |
This class provides a generic interface to data services. | |
using | selection_type = SelectionType |
Public Member Functions | |
WrappedDataProvider (GenericDataProvider *provider) | |
Primary constructor for instances. | |
WrappedDataProvider (WrappedDataProvider &provider_to_copy) | |
Copy constructor. | |
WrappedDataProvider (WrappedDataProvider &&provider_to_move) | |
Move constructor. | |
void | finalize () override |
Release any resources that should not be held as the run is shutting down. | |
boost::span< const std::string > | get_available_variable_names () const override |
Get the available variable names object. | |
long | get_data_start_time () const override |
Get the inclusive beginning of the period of time over which this instance can provide data for this forcing. | |
long | get_data_stop_time () const override |
Get the exclusive ending of the period of time over which this instance can provide data for this forcing. | |
long | record_duration () const override |
Return the stride in the time dimension. | |
size_t | get_ts_index_for_time (const time_t &epoch_time) const override |
Get the index of the forcing time step that contains the given point in time. | |
double | get_value (const CatchmentAggrDataSelector &selector, ReSampleMethod m) override |
Get the value of a forcing property for an arbitrary time period, converting units if needed. | |
std::vector< double > | get_values (const CatchmentAggrDataSelector &selector, ReSampleMethod m) override |
bool | is_property_sum_over_time_step (const std::string &name) const override |
Get whether a property's per-time-step values are each an aggregate sum over the entire time step. | |
virtual data_type | get_value (const selection_type &selector, ReSampleMethod m=SUM)=0 |
Get the value of a forcing property for an arbitrary time period, converting units if needed. | |
virtual std::vector< data_type > | get_values (const selection_type &selector, ReSampleMethod m=SUM)=0 |
Get the values of a forcing property for an arbitrary time period, converting units if needed. | |
Protected Attributes | |
GenericDataProvider * | wrapped_provider |
Simple implementation that basically wraps another instance.
The primary purpose is to support self-referencing as a forcing provider (e.g., for ET) without introducing any circular references in smart pointers.
Instances of this type must be used carefully, as they do not contain any mechanisms for making sure they actually point to a valid backing object.
|
inherited |
This class provides a generic interface to data services.
|
inherited |
|
inlineexplicit |
Primary constructor for instances.
provider | Simple pointer to some existing ForcingProvider object for this new instance to wrap. |
|
inline |
Copy constructor.
provider_to_copy |
|
inline |
Move constructor.
provider_to_move |
|
inlineoverridevirtual |
Release any resources that should not be held as the run is shutting down.
In particular, this should be called before MPI_Finalize()
Reimplemented from data_access::DataProvider< DataType, SelectionType >.
|
inlineoverridevirtual |
Get the available variable names object.
Implements data_access::DataProvider< DataType, SelectionType >.
References data_access::DataProvider< DataType, SelectionType >::get_available_variable_names(), and wrapped_provider.
|
inlineoverridevirtual |
Get the inclusive beginning of the period of time over which this instance can provide data for this forcing.
Implements data_access::DataProvider< DataType, SelectionType >.
References data_access::DataProvider< DataType, SelectionType >::get_data_start_time(), and wrapped_provider.
|
inlineoverridevirtual |
Get the exclusive ending of the period of time over which this instance can provide data for this forcing.
Implements data_access::DataProvider< DataType, SelectionType >.
References data_access::DataProvider< DataType, SelectionType >::get_data_stop_time(), and wrapped_provider.
|
inlineoverridevirtual |
Get the index of the forcing time step that contains the given point in time.
An std::out_of_range exception should be thrown if the time is not in any time step.
epoch_time | The point in time, as a seconds-based epoch time. |
std::out_of_range | If the given point is not in any time step. |
Implements data_access::DataProvider< DataType, SelectionType >.
References data_access::DataProvider< DataType, SelectionType >::get_ts_index_for_time(), and wrapped_provider.
|
pure virtualinherited |
Get the value of a forcing property for an arbitrary time period, converting units if needed.
An std::out_of_range exception should be thrown if the data for the time period is not available.
selector | Data required to establish what subset of the stored data should be accessed |
m | How data is to be resampled if there is a mismatch in data alignment or repeat rate |
std::out_of_range | If data for the time period is not available. |
Referenced by get_value(), and realization::Bmi_Module_Formulation::set_model_inputs_prior_to_update().
|
inlineoverride |
Get the value of a forcing property for an arbitrary time period, converting units if needed.
An std::out_of_range exception should be thrown if the data for the time period is not available.
output_name | The name of the forcing property of interest. |
init_time_epoch | The epoch time (in seconds) of the start of the time period. |
duration_seconds | The length of the time period, in seconds. |
output_units | The expected units of the desired output value. |
std::out_of_range | If data for the time period is not available. |
References data_access::DataProvider< DataType, SelectionType >::get_value(), and wrapped_provider.
|
pure virtualinherited |
Get the values of a forcing property for an arbitrary time period, converting units if needed.
An std::out_of_range exception should be thrown if the data for the time period is not available.
If a provider doesn't implement this function, then by default, get_values will be a simple proxy to get_value with the result wrapped in a std::vector<double>
output_name | The name of the forcing property of interest. |
init_time_epoch | The epoch time (in seconds) of the start of the time period. |
duration_seconds | The length of the time period, in seconds. |
output_units | The expected units of the desired output value. |
std::out_of_range | If data for the time period is not available. |
Referenced by get_values(), and realization::Bmi_Module_Formulation::set_model_inputs_prior_to_update().
|
inlineoverride |
|
inlineoverridevirtual |
Get whether a property's per-time-step values are each an aggregate sum over the entire time step.
Certain properties, like rain fall, are aggregated sums over an entire time step. Others, such as pressure, are not such sums and instead something else like an instantaneous reading or an average value.
It may be the case that forcing data is needed for some discretization different than the forcing time step. This aspect must be known in such cases to perform the appropriate value interpolation.
name | The name of the forcing property for which the current value is desired. |
Reimplemented from data_access::DataProvider< DataType, SelectionType >.
References data_access::DataProvider< DataType, SelectionType >::is_property_sum_over_time_step(), and wrapped_provider.
|
inlineoverridevirtual |
Return the stride in the time dimension.
Implements data_access::DataProvider< DataType, SelectionType >.
References data_access::DataProvider< DataType, SelectionType >::record_duration(), and wrapped_provider.
|
protected |
Referenced by data_access::DeferredWrappedProvider::DeferredWrappedProvider(), get_available_variable_names(), get_data_start_time(), get_data_stop_time(), get_ts_index_for_time(), get_value(), get_values(), is_property_sum_over_time_step(), data_access::DeferredWrappedProvider::isWrappedProviderSet(), record_duration(), and data_access::DeferredWrappedProvider::setWrappedProvider().