NGen
Loading...
Searching...
No Matches
data_access::DataProvider< DataType, SelectionType > Class Template Referenceabstract

#include <DataProvider.hpp>

+ Inheritance diagram for data_access::DataProvider< DataType, SelectionType >:
+ Collaboration diagram for data_access::DataProvider< DataType, SelectionType >:

Public Types

using data_type = DataType
 This class provides a generic interface to data services.
 
using selection_type = SelectionType
 

Public Member Functions

virtual ~DataProvider ()=default
 
virtual void finalize ()
 Release any resources that should not be held as the run is shutting down.
 
virtual boost::span< const std::string > get_available_variable_names () const =0
 Return the variables that are accessable by this data provider.
 
virtual long get_data_start_time () const =0
 Return the first valid time for which data from the request variable can be requested.
 
virtual long get_data_stop_time () const =0
 Return the last valid time for which data from the requested variable can be requested.
 
virtual long record_duration () const =0
 Return the stride in the time dimension.
 
virtual size_t get_ts_index_for_time (const time_t &epoch_time) const =0
 Get the index of the data time step that contains the given point in time.
 
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_typeget_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.
 
virtual bool is_property_sum_over_time_step (const std::string &name) const
 

Member Typedef Documentation

◆ data_type

template<class DataType , class SelectionType >
using data_access::DataProvider< DataType, SelectionType >::data_type = DataType

This class provides a generic interface to data services.

◆ selection_type

template<class DataType , class SelectionType >
using data_access::DataProvider< DataType, SelectionType >::selection_type = SelectionType

Constructor & Destructor Documentation

◆ ~DataProvider()

template<class DataType , class SelectionType >
virtual data_access::DataProvider< DataType, SelectionType >::~DataProvider ( )
virtualdefault

Member Function Documentation

◆ finalize()

template<class DataType , class SelectionType >
virtual void data_access::DataProvider< DataType, SelectionType >::finalize ( )
inlinevirtual

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

In particular, this should be called before MPI_Finalize()

Reimplemented in data_access::WrappedDataProvider.

◆ get_available_variable_names()

template<class DataType , class SelectionType >
virtual boost::span< const std::string > data_access::DataProvider< DataType, SelectionType >::get_available_variable_names ( ) const
pure virtual

◆ get_data_start_time()

template<class DataType , class SelectionType >
virtual long data_access::DataProvider< DataType, SelectionType >::get_data_start_time ( ) const
pure virtual

◆ get_data_stop_time()

template<class DataType , class SelectionType >
virtual long data_access::DataProvider< DataType, SelectionType >::get_data_stop_time ( ) const
pure virtual

◆ get_ts_index_for_time()

template<class DataType , class SelectionType >
virtual size_t data_access::DataProvider< DataType, SelectionType >::get_ts_index_for_time ( const time_t & epoch_time) const
pure virtual

Get the index of the data 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.

Parameters
epoch_timeThe point in time, as a seconds-based epoch time.
Returns
The index of the forcing time step that contains the given point in time.
Exceptions
std::out_of_rangeIf the given point is not in any time step.

Implemented in CsvPerFeatureForcingProvider, data_access::WrappedDataProvider, NullForcingProvider, realization::Bmi_Module_Formulation, and realization::Bmi_Multi_Formulation.

Referenced by data_access::WrappedDataProvider::get_ts_index_for_time().

◆ get_value()

template<class DataType , class SelectionType >
virtual data_type data_access::DataProvider< DataType, SelectionType >::get_value ( const selection_type & selector,
ReSampleMethod m = SUM )
pure virtual

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.

Parameters
selectorData required to establish what subset of the stored data should be accessed
mHow data is to be resampled if there is a mismatch in data alignment or repeat rate
Returns
The value of the forcing property for the described time period, with units converted if needed.
Exceptions
std::out_of_rangeIf data for the time period is not available.

Referenced by data_access::WrappedDataProvider::get_value(), and realization::Bmi_Module_Formulation::set_model_inputs_prior_to_update().

◆ get_values()

template<class DataType , class SelectionType >
virtual std::vector< data_type > data_access::DataProvider< DataType, SelectionType >::get_values ( const selection_type & selector,
ReSampleMethod m = SUM )
pure virtual

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>

Parameters
output_nameThe name of the forcing property of interest.
init_time_epochThe epoch time (in seconds) of the start of the time period.
duration_secondsThe length of the time period, in seconds.
output_unitsThe expected units of the desired output value.
Returns
std::vector<double> The vector of values of the forcing property for the described time period, with units converted if needed.
Exceptions
std::out_of_rangeIf data for the time period is not available.

Referenced by data_access::WrappedDataProvider::get_values(), and realization::Bmi_Module_Formulation::set_model_inputs_prior_to_update().

◆ is_property_sum_over_time_step()

template<class DataType , class SelectionType >
virtual bool data_access::DataProvider< DataType, SelectionType >::is_property_sum_over_time_step ( const std::string & name) const
inlinevirtual

◆ record_duration()

template<class DataType , class SelectionType >
virtual long data_access::DataProvider< DataType, SelectionType >::record_duration ( ) const
pure virtual

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