OpenWalnut  1.5.0dev
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
WDataSetTimeSeries Class Reference

A dataset that stores a time series. More...

#include <WDataSetTimeSeries.h>

+ Inheritance diagram for WDataSetTimeSeries:
+ Collaboration diagram for WDataSetTimeSeries:

Classes

class  TimeSliceCompare
 A compare functor for time slices. More...
 

Public Member Functions

std::string const getName () const
 Returns a name. More...
 
std::string const getDescription () const
 Returns a description. More...
 
 WDataSetTimeSeries (std::vector< std::shared_ptr< WDataSetScalar const > > datasets, std::vector< float > times)
 Construct time series from multiple 3D datasets. More...
 
virtual ~WDataSetTimeSeries ()
 Destructor. More...
 
float getMinTime () const
 Get the first point of time in the time series. More...
 
float getMaxTime () const
 Get the last point of time in the time series. More...
 
bool isTimeSlice (float time) const
 Check if there exists a predefined dataset at the given point in time, i.e. More...
 
float findNearestTimeSlice (float time) const
 Find the nearest time slice for a given time. More...
 
std::shared_ptr< WDataSetScalar const > getDataSetPtrAtTimeSlice (float time) const
 Get a pointer to the dataset at a given time or a NULL-pointer, if there was no dataset given for that point in time. More...
 
std::shared_ptr< WDataSetScalar const > calcDataSetAtTime (float time, std::string const &name) const
 Calculates a new dataset with values interpolated between the two nearest time slices. More...
 
template<typename Data_T >
Data_T interpolate (WVector3d const &pos, float time, bool *success) const
 Interpolate a value for a single point in space and time. More...
 
double getMinValue ()
 Get the smallest value in all datasets. More...
 
double getMaxValue ()
 Get the largest value in all datasets. More...
 
- Public Member Functions inherited from WDataSet
 WDataSet ()
 This constructor should be used if a dataSet does not stem from a file. More...
 
virtual ~WDataSet ()
 Since WDataSet is a base class and thus should be polymorphic we add virtual destructor. More...
 
void setFilename (const std::string filename)
 Set the name of the file that this data set stems from. More...
 
std::string getFilename () const
 Get the name of the file that this data set stems from. More...
 
OW_API_DEPRECATED void setFileName (const std::string filename)
 Set the name of the file that this data set stems from. More...
 
OW_API_DEPRECATED std::string getFileName () const
 Get the name of the file that this data set stems from. More...
 
virtual bool isTexture () const
 Determines whether this dataset can be used as a texture. More...
 
virtual std::shared_ptr< WDataSetVectorisVectorDataSet ()
 Checks if this dataset is a vector dataset. More...
 
virtual osg::ref_ptr< WDataTexture3DgetTexture () const
 Returns the texture- representation of the dataset. More...
 
std::shared_ptr< WPropertiesgetProperties () const
 Return a pointer to the properties object of the dataset. More...
 
std::shared_ptr< WPropertiesgetInformationProperties () const
 Return a pointer to the information properties object of the dataset. More...
 
- Public Member Functions inherited from WTransferable
 WTransferable ()
 Default constructor. More...
 
virtual ~WTransferable ()
 Destructor. More...
 
- Public Member Functions inherited from WPrototyped
 WPrototyped ()
 Default constructor. More...
 
virtual ~WPrototyped ()
 Destructor. More...
 
template<typename T >
bool isA ()
 Checks whether the actual prototype has the specified runtime type. More...
 

Static Public Member Functions

static std::shared_ptr< WPrototypedgetPrototype ()
 Returns a prototype instantiated with the true type of the deriving class. More...
 
- Static Public Member Functions inherited from WDataSet
static std::shared_ptr< WPrototypedgetPrototype ()
 Returns a prototype instantiated with the true type of the deriving class. More...
 

Private Types

typedef WDataSetTimeSeries This
 a conveniance typedef More...
 
typedef std::pair< std::shared_ptr< WDataSetScalar const >, float > TimeSlice
 a time slice More...
 

Private Member Functions

float getLBTimeSlice (float time) const
 Find the largest time slice position that is smaller than or equal to time, or return -inf, if there is no such time slice. More...
 
float getUBTimeSlice (float time) const
 Find the smallest time slice position that is larger than time, or return inf, if there is no such time slice. More...
 
template<typename Data_T >
std::shared_ptr< WValueSetBasecalcInterpolatedValueSet (float lb, float ub, float time) const
 Interpolate a valueset from two neighboring slices. More...
 
 WDataSetTimeSeries ()
 Standard constructor. More...
 

Private Attributes

std::vector< TimeSlicem_dataSets
 the datasets that compose the time series More...
 
double m_minValue
 the smallest value More...
 
double m_maxValue
 the largest value More...
 

Static Private Attributes

static std::shared_ptr< WPrototypedm_prototype = std::shared_ptr< WPrototyped >()
 The prototype as singleton. More...
 

Friends

class WDataSetTimeSeriesTest
 the test is a friend More...
 

Additional Inherited Members

- Public Types inherited from WDataSet
typedef std::shared_ptr< WDataSetSPtr
 Shared pointer abbreviation to a instance of this class. More...
 
typedef std::shared_ptr< const WDataSetConstSPtr
 Shared pointer abbreviation to a const instance of this class. More...
 
- Protected Attributes inherited from WDataSet
std::shared_ptr< WPropertiesm_properties
 The property object for the dataset. More...
 
std::shared_ptr< WPropertiesm_infoProperties
 The property object for the dataset containing only props whose purpose is "PV_PURPOSE_INFORMNATION". More...
 
- Static Protected Attributes inherited from WDataSet
static std::shared_ptr< WPrototypedm_prototype = std::shared_ptr< WPrototyped >()
 The prototype as singleton. More...
 

Detailed Description

A dataset that stores a time series.

Note
Only works for scalar datasets at the moment!
this is only a temporary solution

Definition at line 49 of file WDataSetTimeSeries.h.

Member Typedef Documentation

◆ This

a conveniance typedef

Definition at line 55 of file WDataSetTimeSeries.h.

◆ TimeSlice

typedef std::pair< std::shared_ptr< WDataSetScalar const >, float > WDataSetTimeSeries::TimeSlice
private

a time slice

Definition at line 58 of file WDataSetTimeSeries.h.

Constructor & Destructor Documentation

◆ WDataSetTimeSeries() [1/2]

WDataSetTimeSeries::WDataSetTimeSeries ( std::vector< std::shared_ptr< WDataSetScalar const > >  datasets,
std::vector< float >  times 
)

Construct time series from multiple 3D datasets.

They do not have to be sorted by time.

Parameters
datasetsA list of datasets to add.
timesA list of times for the datasets.

Definition at line 38 of file WDataSetTimeSeries.cpp.

References wlimits::isNaN(), m_dataSets, m_maxValue, and m_minValue.

+ Here is the call graph for this function:

◆ ~WDataSetTimeSeries()

WDataSetTimeSeries::~WDataSetTimeSeries ( )
virtual

Destructor.

Definition at line 79 of file WDataSetTimeSeries.cpp.

◆ WDataSetTimeSeries() [2/2]

WDataSetTimeSeries::WDataSetTimeSeries ( )
private

Standard constructor.

Definition at line 230 of file WDataSetTimeSeries.cpp.

Referenced by getPrototype().

+ Here is the caller graph for this function:

Member Function Documentation

◆ calcDataSetAtTime()

std::shared_ptr< WDataSetScalar const > WDataSetTimeSeries::calcDataSetAtTime ( float  time,
std::string const &  name 
) const

Calculates a new dataset with values interpolated between the two nearest time slices.

if the time is not in the interval [getMinTime(),getMaxTime()], a NULL-pointer will be returned.

Parameters
timeThe time.
nameThe name of the new dataset.
Returns
A new interpolated dataset.

Definition at line 131 of file WDataSetTimeSeries.cpp.

References getDataSetPtrAtTimeSlice(), getLBTimeSlice(), getMaxTime(), getMinTime(), getUBTimeSlice(), wlimits::isNaN(), and m_dataSets.

Referenced by WDataSetTimeSeriesTest::testInterpolatedDataSets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calcInterpolatedValueSet()

template<typename Data_T >
std::shared_ptr< WValueSetBase > WDataSetTimeSeries::calcInterpolatedValueSet ( float  lb,
float  ub,
float  time 
) const
private

Interpolate a valueset from two neighboring slices.

Parameters
lbTime of one slice.
ubTime of the other slice.
timeThe actual time of the interpolated slice.
Returns
A valueset with linearly interpolated values.

Definition at line 289 of file WDataSetTimeSeries.h.

References getDataSetPtrAtTimeSlice().

+ Here is the call graph for this function:

◆ findNearestTimeSlice()

float WDataSetTimeSeries::findNearestTimeSlice ( float  time) const

Find the nearest time slice for a given time.

If there are two nearest time slices, the smaller one will be returned.

Parameters
timeThe time.
Returns
The nearest time slice.

Definition at line 109 of file WDataSetTimeSeries.cpp.

References getLBTimeSlice(), getMaxTime(), getUBTimeSlice(), and wlimits::isNaN().

Referenced by WDataSetTimeSeriesTest::testGetNearestTimeSlice().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDataSetPtrAtTimeSlice()

std::shared_ptr< WDataSetScalar const > WDataSetTimeSeries::getDataSetPtrAtTimeSlice ( float  time) const

Get a pointer to the dataset at a given time or a NULL-pointer, if there was no dataset given for that point in time.

Note
You need to provide the exact time.
Parameters
timeThe time.
Returns
A pointer to the appropriate dataset or a NULL-pointer.

Definition at line 121 of file WDataSetTimeSeries.cpp.

References m_dataSets.

Referenced by calcDataSetAtTime(), calcInterpolatedValueSet(), interpolate(), and WDataSetTimeSeriesTest::testGetDataSetPtrAtTimeSlice().

+ Here is the caller graph for this function:

◆ getDescription()

std::string const WDataSetTimeSeries::getDescription ( ) const
virtual

Returns a description.

Returns
A description.

Reimplemented from WDataSet.

Definition at line 88 of file WDataSetTimeSeries.cpp.

◆ getLBTimeSlice()

float WDataSetTimeSeries::getLBTimeSlice ( float  time) const
private

Find the largest time slice position that is smaller than or equal to time, or return -inf, if there is no such time slice.

Parameters
timeThe time.
Returns
The largest time slice that is smaller than or equal to time or -inf.

Definition at line 203 of file WDataSetTimeSeries.cpp.

References m_dataSets.

Referenced by calcDataSetAtTime(), findNearestTimeSlice(), interpolate(), and WDataSetTimeSeriesTest::testLBTime().

+ Here is the caller graph for this function:

◆ getMaxTime()

float WDataSetTimeSeries::getMaxTime ( ) const
inline

Get the last point of time in the time series.

Returns
The last point of time.

Definition at line 314 of file WDataSetTimeSeries.h.

References m_dataSets.

Referenced by calcDataSetAtTime(), findNearestTimeSlice(), interpolate(), and WDataSetTimeSeriesTest::testTimeMinMax().

+ Here is the caller graph for this function:

◆ getMaxValue()

double WDataSetTimeSeries::getMaxValue ( )

Get the largest value in all datasets.

Returns
The largest value.

Definition at line 240 of file WDataSetTimeSeries.cpp.

References m_maxValue.

◆ getMinTime()

float WDataSetTimeSeries::getMinTime ( ) const
inline

Get the first point of time in the time series.

Returns
The first point of time.

Definition at line 309 of file WDataSetTimeSeries.h.

References m_dataSets.

Referenced by calcDataSetAtTime(), interpolate(), and WDataSetTimeSeriesTest::testTimeMinMax().

+ Here is the caller graph for this function:

◆ getMinValue()

double WDataSetTimeSeries::getMinValue ( )

Get the smallest value in all datasets.

Returns
The smallest value.

Definition at line 235 of file WDataSetTimeSeries.cpp.

References m_minValue.

◆ getName()

std::string const WDataSetTimeSeries::getName ( ) const
virtual

Returns a name.

Returns
A name.

Reimplemented from WDataSet.

Definition at line 83 of file WDataSetTimeSeries.cpp.

◆ getPrototype()

std::shared_ptr< WPrototyped > WDataSetTimeSeries::getPrototype ( )
static

Returns a prototype instantiated with the true type of the deriving class.

Returns
the prototype.

Definition at line 93 of file WDataSetTimeSeries.cpp.

References m_prototype, and WDataSetTimeSeries().

+ Here is the call graph for this function:

◆ getUBTimeSlice()

float WDataSetTimeSeries::getUBTimeSlice ( float  time) const
private

Find the smallest time slice position that is larger than time, or return inf, if there is no such time slice.

Parameters
timeThe time.
Returns
The largest time slice that is smaller than time or inf.

Definition at line 219 of file WDataSetTimeSeries.cpp.

References m_dataSets.

Referenced by calcDataSetAtTime(), findNearestTimeSlice(), interpolate(), and WDataSetTimeSeriesTest::testUBTime().

+ Here is the caller graph for this function:

◆ interpolate()

template<typename Data_T >
Data_T WDataSetTimeSeries::interpolate ( WVector3d const &  pos,
float  time,
bool *  success 
) const

Interpolate a value for a single point in space and time.

Parameters
posThe spatial location.
timeThe temporal location.
[out]successA flag indicating if the position was in the dataset.
Returns
The value at the given location.

Definition at line 260 of file WDataSetTimeSeries.h.

References getDataSetPtrAtTimeSlice(), getLBTimeSlice(), getMaxTime(), getMinTime(), getUBTimeSlice(), WDataSetScalar::interpolate(), and wlimits::isNaN().

Referenced by WDataSetTimeSeriesTest::testInterpolate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isTimeSlice()

bool WDataSetTimeSeries::isTimeSlice ( float  time) const

Check if there exists a predefined dataset at the given point in time, i.e.

no interpolation has to be done to access data at that point in time.

If the time is not in the represented interval [getMinTime(),getMaxTime()], it will return false.

Parameters
timeThe point in time to test.
Returns
true, iff the time is one of those that were given in the constructor.

Definition at line 103 of file WDataSetTimeSeries.cpp.

References m_dataSets.

Referenced by WDataSetTimeSeriesTest::testIsTimeSlice().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ WDataSetTimeSeriesTest

friend class WDataSetTimeSeriesTest
friend

the test is a friend

Definition at line 52 of file WDataSetTimeSeries.h.

Member Data Documentation

◆ m_dataSets

std::vector< TimeSlice > WDataSetTimeSeries::m_dataSets
private

the datasets that compose the time series

Definition at line 247 of file WDataSetTimeSeries.h.

Referenced by calcDataSetAtTime(), getDataSetPtrAtTimeSlice(), getLBTimeSlice(), getMaxTime(), getMinTime(), getUBTimeSlice(), isTimeSlice(), and WDataSetTimeSeries().

◆ m_maxValue

double WDataSetTimeSeries::m_maxValue
private

the largest value

Definition at line 256 of file WDataSetTimeSeries.h.

Referenced by getMaxValue(), and WDataSetTimeSeries().

◆ m_minValue

double WDataSetTimeSeries::m_minValue
private

the smallest value

Definition at line 253 of file WDataSetTimeSeries.h.

Referenced by getMinValue(), and WDataSetTimeSeries().

◆ m_prototype

std::shared_ptr< WPrototyped > WDataSetTimeSeries::m_prototype = std::shared_ptr< WPrototyped >()
staticprivate

The prototype as singleton.

Definition at line 250 of file WDataSetTimeSeries.h.

Referenced by getPrototype().


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