25 #ifndef WDATASETTIMESERIES_H
26 #define WDATASETTIMESERIES_H
33 #include <boost/enable_shared_from_this.hpp>
34 #include <boost/shared_ptr.hpp>
36 #include "../common/WLimits.h"
37 #include "../common/WProperties.h"
38 #include "../common/WTransferable.h"
39 #include "WDataSetScalar.h"
40 #include "WExportDataHandler.h"
60 typedef std::pair< boost::shared_ptr< WDataSetScalar const >,
float >
TimeSlice;
68 std::string
const getName()
const;
90 WDataSetTimeSeries( std::vector< boost::shared_ptr< WDataSetScalar const > > datasets, std::vector< float > times );
102 inline float getMinTime()
const;
109 inline float getMaxTime()
const;
121 bool isTimeSlice(
float time )
const;
130 float findNearestTimeSlice(
float time )
const;
141 boost::shared_ptr< WDataSetScalar const > getDataSetPtrAtTimeSlice(
float time )
const;
152 boost::shared_ptr< WDataSetScalar const > calcDataSetAtTime(
float time, std::string
const& name )
const;
162 template<
typename Data_T >
163 Data_T interpolate(
WVector3d const& pos,
float time,
bool* success )
const;
170 double getMinValue();
177 double getMaxValue();
187 float getLBTimeSlice(
float time )
const;
196 float getUBTimeSlice(
float time )
const;
206 template<
typename Data_T >
207 boost::shared_ptr< WValueSetBase > calcInterpolatedValueSet(
float lb,
float ub,
float time )
const;
236 bool operator() (
float const& t0,
TimeSlice const& t1 );
245 bool operator() (
TimeSlice const& t0,
float const& t1 );
261 template<
typename Data_T >
264 static const float inf = std::numeric_limits< float >::infinity();
265 WAssert( success,
"" );
271 throw WException( std::string(
"The provided time is not in the interval of this time series." ) );
275 if( lb == time || ub == time )
280 WAssert( lb != -inf && ub != inf,
"" );
283 WAssert( f && g,
"" );
284 float ml = ( ub - time ) / ( ub - lb );
285 float mu = ( time - lb ) / ( ub - lb );
290 template<
typename Data_T >
293 static const float inf = std::numeric_limits< float >::infinity();
294 WAssert( lb != -inf && ub != inf,
"" );
297 WAssert( f && g,
"" );
298 boost::shared_ptr< WValueSet< Data_T > > vf = boost::shared_dynamic_cast<
WValueSet< Data_T > >( f->getValueSet() );
299 boost::shared_ptr< WValueSet< Data_T > > vg = boost::shared_dynamic_cast<
WValueSet< Data_T > >( g->getValueSet() );
300 WAssert( vf && vg,
"" );
301 boost::shared_ptr< std::vector< Data_T > > values = boost::shared_ptr< std::vector< Data_T > >(
new std::vector< Data_T >( vf->size() ) );
302 float ml = ( ub - time ) / ( ub - lb );
303 float mu = ( time - lb ) / ( ub - lb );
304 for( std::size_t k = 0; k < values->size(); ++k )
306 ( *values )[ k ] = ml * vf->getScalar( k ) + mu * vg->getScalar( k );
321 #endif // WDATASETTIMESERIES_H