OpenWalnut  1.4.0
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:

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< boost::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...
 
boost::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...
 
boost::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 boost::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...
 
boost::shared_ptr< WPropertiesgetProperties () const
 Return a pointer to the properties object of the dataset. More...
 
boost::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 boost::shared_ptr< WPrototypedgetPrototype ()
 Returns a prototype instantiated with the true type of the deriving class. More...
 
- Static Public Member Functions inherited from WDataSet
static boost::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< boost::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 >
boost::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 boost::shared_ptr< WPrototypedm_prototype = boost::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 boost::shared_ptr< WDataSetSPtr
 Shared pointer abbreviation to a instance of this class. More...
 
typedef boost::shared_ptr< const WDataSetConstSPtr
 Shared pointer abbreviation to a const instance of this class. More...
 
- Protected Attributes inherited from WDataSet
boost::shared_ptr< WPropertiesm_properties
 The property object for the dataset. More...
 
boost::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 boost::shared_ptr< WPrototypedm_prototype = boost::shared_ptr< WPrototyped >()
 The prototype as singleton. More...
 

Detailed Description

A dataset that stores a time series.

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

Definition at line 55 of file WDataSetTimeSeries.h.

Member Typedef Documentation

a conveniance typedef

Definition at line 61 of file WDataSetTimeSeries.h.

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

a time slice

Definition at line 64 of file WDataSetTimeSeries.h.

Constructor & Destructor Documentation

WDataSetTimeSeries::WDataSetTimeSeries ( std::vector< boost::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 37 of file WDataSetTimeSeries.cpp.

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

WDataSetTimeSeries::~WDataSetTimeSeries ( )
virtual

Destructor.

Definition at line 78 of file WDataSetTimeSeries.cpp.

WDataSetTimeSeries::WDataSetTimeSeries ( )
private

Standard constructor.

Definition at line 229 of file WDataSetTimeSeries.cpp.

Referenced by getPrototype().

Member Function Documentation

boost::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 130 of file WDataSetTimeSeries.cpp.

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

Referenced by WDataSetTimeSeriesTest::testInterpolatedDataSets().

template<typename Data_T >
boost::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 295 of file WDataSetTimeSeries.h.

References getDataSetPtrAtTimeSlice().

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 108 of file WDataSetTimeSeries.cpp.

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

Referenced by WDataSetTimeSeriesTest::testGetNearestTimeSlice().

boost::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.

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

Definition at line 120 of file WDataSetTimeSeries.cpp.

References m_dataSets.

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

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

Returns a description.

Returns
A description.

Reimplemented from WDataSet.

Definition at line 87 of file WDataSetTimeSeries.cpp.

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 202 of file WDataSetTimeSeries.cpp.

References m_dataSets.

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

float WDataSetTimeSeries::getMaxTime ( ) const
inline

Get the last point of time in the time series.

Returns
The last point of time.

Definition at line 320 of file WDataSetTimeSeries.h.

References m_dataSets.

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

double WDataSetTimeSeries::getMaxValue ( )

Get the largest value in all datasets.

Returns
The largest value.

Definition at line 239 of file WDataSetTimeSeries.cpp.

References m_maxValue.

float WDataSetTimeSeries::getMinTime ( ) const
inline

Get the first point of time in the time series.

Returns
The first point of time.

Definition at line 315 of file WDataSetTimeSeries.h.

References m_dataSets.

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

double WDataSetTimeSeries::getMinValue ( )

Get the smallest value in all datasets.

Returns
The smallest value.

Definition at line 234 of file WDataSetTimeSeries.cpp.

References m_minValue.

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

Returns a name.

Returns
A name.

Reimplemented from WDataSet.

Definition at line 82 of file WDataSetTimeSeries.cpp.

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

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

Returns
the prototype.

Definition at line 92 of file WDataSetTimeSeries.cpp.

References m_prototype, and WDataSetTimeSeries().

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 218 of file WDataSetTimeSeries.cpp.

References m_dataSets.

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

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 266 of file WDataSetTimeSeries.h.

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

Referenced by WDataSetTimeSeriesTest::testInterpolate().

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 102 of file WDataSetTimeSeries.cpp.

References m_dataSets.

Referenced by WDataSetTimeSeriesTest::testIsTimeSlice().

Friends And Related Function Documentation

friend class WDataSetTimeSeriesTest
friend

the test is a friend

Definition at line 58 of file WDataSetTimeSeries.h.

Member Data Documentation

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

the largest value

Definition at line 262 of file WDataSetTimeSeries.h.

Referenced by getMaxValue(), and WDataSetTimeSeries().

double WDataSetTimeSeries::m_minValue
private

the smallest value

Definition at line 259 of file WDataSetTimeSeries.h.

Referenced by getMinValue(), and WDataSetTimeSeries().

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

The prototype as singleton.

Definition at line 256 of file WDataSetTimeSeries.h.

Referenced by getPrototype().


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