OpenWalnut
1.5.0dev
|
A dataset that stores a time series. More...
#include <WDataSetTimeSeries.h>
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< WDataSetVector > | isVectorDataSet () |
Checks if this dataset is a vector dataset. More... | |
virtual osg::ref_ptr< WDataTexture3D > | getTexture () const |
Returns the texture- representation of the dataset. More... | |
std::shared_ptr< WProperties > | getProperties () const |
Return a pointer to the properties object of the dataset. More... | |
std::shared_ptr< WProperties > | getInformationProperties () 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< WPrototyped > | getPrototype () |
Returns a prototype instantiated with the true type of the deriving class. More... | |
Static Public Member Functions inherited from WDataSet | |
static std::shared_ptr< WPrototyped > | getPrototype () |
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< WValueSetBase > | calcInterpolatedValueSet (float lb, float ub, float time) const |
Interpolate a valueset from two neighboring slices. More... | |
WDataSetTimeSeries () | |
Standard constructor. More... | |
Private Attributes | |
std::vector< TimeSlice > | m_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< WPrototyped > | m_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< WDataSet > | SPtr |
Shared pointer abbreviation to a instance of this class. More... | |
typedef std::shared_ptr< const WDataSet > | ConstSPtr |
Shared pointer abbreviation to a const instance of this class. More... | |
Protected Attributes inherited from WDataSet | |
std::shared_ptr< WProperties > | m_properties |
The property object for the dataset. More... | |
std::shared_ptr< WProperties > | m_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< WPrototyped > | m_prototype = std::shared_ptr< WPrototyped >() |
The prototype as singleton. More... | |
A dataset that stores a time series.
Definition at line 49 of file WDataSetTimeSeries.h.
|
private |
a conveniance typedef
Definition at line 55 of file WDataSetTimeSeries.h.
|
private |
a time slice
Definition at line 58 of file WDataSetTimeSeries.h.
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.
datasets | A list of datasets to add. |
times | A list of times for the datasets. |
Definition at line 38 of file WDataSetTimeSeries.cpp.
References wlimits::isNaN(), m_dataSets, m_maxValue, and m_minValue.
|
virtual |
Destructor.
Definition at line 79 of file WDataSetTimeSeries.cpp.
|
private |
Standard constructor.
Definition at line 230 of file WDataSetTimeSeries.cpp.
Referenced by getPrototype().
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.
time | The time. |
name | The name of the new dataset. |
Definition at line 131 of file WDataSetTimeSeries.cpp.
References getDataSetPtrAtTimeSlice(), getLBTimeSlice(), getMaxTime(), getMinTime(), getUBTimeSlice(), wlimits::isNaN(), and m_dataSets.
Referenced by WDataSetTimeSeriesTest::testInterpolatedDataSets().
|
private |
Interpolate a valueset from two neighboring slices.
lb | Time of one slice. |
ub | Time of the other slice. |
time | The actual time of the interpolated slice. |
Definition at line 289 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.
time | The time. |
Definition at line 109 of file WDataSetTimeSeries.cpp.
References getLBTimeSlice(), getMaxTime(), getUBTimeSlice(), and wlimits::isNaN().
Referenced by WDataSetTimeSeriesTest::testGetNearestTimeSlice().
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.
time | The time. |
Definition at line 121 of file WDataSetTimeSeries.cpp.
References m_dataSets.
Referenced by calcDataSetAtTime(), calcInterpolatedValueSet(), interpolate(), and WDataSetTimeSeriesTest::testGetDataSetPtrAtTimeSlice().
|
virtual |
Returns a description.
Reimplemented from WDataSet.
Definition at line 88 of file WDataSetTimeSeries.cpp.
|
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.
time | The time. |
Definition at line 203 of file WDataSetTimeSeries.cpp.
References m_dataSets.
Referenced by calcDataSetAtTime(), findNearestTimeSlice(), interpolate(), and WDataSetTimeSeriesTest::testLBTime().
|
inline |
Get the last point of time in the time series.
Definition at line 314 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.
Definition at line 240 of file WDataSetTimeSeries.cpp.
References m_maxValue.
|
inline |
Get the first point of time in the time series.
Definition at line 309 of file WDataSetTimeSeries.h.
References m_dataSets.
Referenced by calcDataSetAtTime(), interpolate(), and WDataSetTimeSeriesTest::testTimeMinMax().
double WDataSetTimeSeries::getMinValue | ( | ) |
Get the smallest value in all datasets.
Definition at line 235 of file WDataSetTimeSeries.cpp.
References m_minValue.
|
virtual |
Returns a name.
Reimplemented from WDataSet.
Definition at line 83 of file WDataSetTimeSeries.cpp.
|
static |
Returns a prototype instantiated with the true type of the deriving class.
Definition at line 93 of file WDataSetTimeSeries.cpp.
References m_prototype, and WDataSetTimeSeries().
|
private |
Find the smallest time slice position that is larger than time, or return inf, if there is no such time slice.
time | The time. |
Definition at line 219 of file WDataSetTimeSeries.cpp.
References m_dataSets.
Referenced by calcDataSetAtTime(), findNearestTimeSlice(), interpolate(), and WDataSetTimeSeriesTest::testUBTime().
Data_T WDataSetTimeSeries::interpolate | ( | WVector3d const & | pos, |
float | time, | ||
bool * | success | ||
) | const |
Interpolate a value for a single point in space and time.
pos | The spatial location. | |
time | The temporal location. | |
[out] | success | A flag indicating if the position was in the dataset. |
Definition at line 260 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.
time | The point in time to test. |
Definition at line 103 of file WDataSetTimeSeries.cpp.
References m_dataSets.
Referenced by WDataSetTimeSeriesTest::testIsTimeSlice().
|
friend |
the test is a friend
Definition at line 52 of file WDataSetTimeSeries.h.
|
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().
|
private |
the largest value
Definition at line 256 of file WDataSetTimeSeries.h.
Referenced by getMaxValue(), and WDataSetTimeSeries().
|
private |
the smallest value
Definition at line 253 of file WDataSetTimeSeries.h.
Referenced by getMinValue(), and WDataSetTimeSeries().
|
staticprivate |
The prototype as singleton.
Definition at line 250 of file WDataSetTimeSeries.h.
Referenced by getPrototype().