OpenWalnut
1.4.0
|
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. | |
std::string const | getDescription () const |
Returns a description. | |
WDataSetTimeSeries (std::vector< boost::shared_ptr< WDataSetScalar const > > datasets, std::vector< float > times) | |
Construct time series from multiple 3D datasets. | |
virtual | ~WDataSetTimeSeries () |
Destructor. | |
float | getMinTime () const |
Get the first point of time in the time series. | |
float | getMaxTime () const |
Get the last point of time in the time series. | |
bool | isTimeSlice (float time) const |
Check if there exists a predefined dataset at the given point in time, i.e. | |
float | findNearestTimeSlice (float time) const |
Find the nearest time slice for a given time. | |
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. | |
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. | |
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. | |
double | getMinValue () |
Get the smallest value in all datasets. | |
double | getMaxValue () |
Get the largest value in all datasets. | |
Static Public Member Functions | |
static boost::shared_ptr < WPrototyped > | getPrototype () |
Returns a prototype instantiated with the true type of the deriving class. | |
Private Types | |
typedef WDataSetTimeSeries | This |
a conveniance typedef | |
typedef std::pair < boost::shared_ptr < WDataSetScalar const > , float > | TimeSlice |
a time slice | |
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. | |
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. | |
template<typename Data_T > | |
boost::shared_ptr< WValueSetBase > | calcInterpolatedValueSet (float lb, float ub, float time) const |
Interpolate a valueset from two neighboring slices. | |
WDataSetTimeSeries () | |
Standard constructor. | |
Private Attributes | |
std::vector< TimeSlice > | m_dataSets |
the datasets that compose the time series | |
double | m_minValue |
the smallest value | |
double | m_maxValue |
the largest value | |
Static Private Attributes | |
static boost::shared_ptr < WPrototyped > | m_prototype = boost::shared_ptr< WPrototyped >() |
The prototype as singleton. | |
Friends | |
class | WDataSetTimeSeriesTest |
the test is a friend |
A dataset that stores a time series.
Definition at line 51 of file WDataSetTimeSeries.h.
typedef WDataSetTimeSeries WDataSetTimeSeries::This [private] |
a conveniance typedef
Definition at line 57 of file WDataSetTimeSeries.h.
typedef std::pair< boost::shared_ptr< WDataSetScalar const >, float > WDataSetTimeSeries::TimeSlice [private] |
a time slice
Definition at line 60 of file WDataSetTimeSeries.h.
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.
datasets | A list of datasets to add. |
times | A 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().
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.
time | The time. |
name | The name of the new dataset. |
Definition at line 130 of file WDataSetTimeSeries.cpp.
References getDataSetPtrAtTimeSlice(), getLBTimeSlice(), getMaxTime(), getMinTime(), getUBTimeSlice(), wlimits::isNaN(), and m_dataSets.
Referenced by WDataSetTimeSeriesTest::testInterpolatedDataSets().
boost::shared_ptr< WValueSetBase > WDataSetTimeSeries::calcInterpolatedValueSet | ( | float | lb, |
float | ub, | ||
float | time | ||
) | const [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 291 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 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.
time | The time. |
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.
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.
time | The time. |
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.
Definition at line 316 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 239 of file WDataSetTimeSeries.cpp.
References m_maxValue.
float WDataSetTimeSeries::getMinTime | ( | ) | const [inline] |
Get the first point of time in the time series.
Definition at line 311 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 234 of file WDataSetTimeSeries.cpp.
References m_minValue.
std::string const WDataSetTimeSeries::getName | ( | ) | const [virtual] |
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.
Reimplemented from WDataSet.
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.
time | The time. |
Definition at line 218 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 262 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 102 of file WDataSetTimeSeries.cpp.
References m_dataSets.
Referenced by WDataSetTimeSeriesTest::testIsTimeSlice().
friend class WDataSetTimeSeriesTest [friend] |
the test is a friend
Definition at line 54 of file WDataSetTimeSeries.h.
std::vector< TimeSlice > WDataSetTimeSeries::m_dataSets [private] |
the datasets that compose the time series
Definition at line 249 of file WDataSetTimeSeries.h.
Referenced by calcDataSetAtTime(), getDataSetPtrAtTimeSlice(), getLBTimeSlice(), getMaxTime(), getMinTime(), getUBTimeSlice(), isTimeSlice(), WDataSetTimeSeriesTest::testConstruction(), and WDataSetTimeSeries().
double WDataSetTimeSeries::m_maxValue [private] |
the largest value
Definition at line 258 of file WDataSetTimeSeries.h.
Referenced by getMaxValue(), and WDataSetTimeSeries().
double WDataSetTimeSeries::m_minValue [private] |
the smallest value
Definition at line 255 of file WDataSetTimeSeries.h.
Referenced by getMinValue(), and WDataSetTimeSeries().
boost::shared_ptr< WPrototyped > WDataSetTimeSeries::m_prototype = boost::shared_ptr< WPrototyped >() [static, private] |
The prototype as singleton.
Reimplemented from WDataSet.
Definition at line 252 of file WDataSetTimeSeries.h.
Referenced by getPrototype().