25 #ifndef WDATASETSCALAR_H
26 #define WDATASETSCALAR_H
32 #include <boost/thread.hpp>
34 #include "WDataSetSingle.h"
35 #include "datastructures/WValueSetHistogram.h"
48 typedef std::shared_ptr< WDataSetScalar >
SPtr;
53 typedef std::shared_ptr< const WDataSetScalar >
ConstSPtr;
63 std::shared_ptr< WGrid > newGrid );
84 virtual WDataSetSingle::SPtr clone( std::shared_ptr< WValueSetBase > newValueSet, std::shared_ptr< WGrid > newGrid )
const;
133 virtual const std::string
getName()
const;
151 std::shared_ptr< const WValueSetHistogram >
getHistogram(
size_t buckets = 1000 );
173 template<
typename T > T
getValueAt(
int x,
int y,
int z )
const;
183 double getValueAt(
int x,
int y,
int z )
const;
212 std::map< size_t, std::shared_ptr< WValueSetHistogram > >
m_histograms;
222 std::shared_ptr< WValueSet< T > > vs = std::dynamic_pointer_cast< WValueSet< T > >(
m_valueSet );
223 std::shared_ptr< WGridRegular3D > grid = std::dynamic_pointer_cast< WGridRegular3D >(
m_grid );
225 size_t id = x + y * grid->getNbCoordsX() + z * grid->getNbCoordsX() * grid->getNbCoordsY();
227 T v = vs->getScalar(
id );
This data set type contains scalars as values.
virtual ~WDataSetScalar()
Destroys this DataSet instance.
static std::shared_ptr< WPrototyped > m_prototype
The prototype as singleton.
std::shared_ptr< const WDataSetScalar > ConstSPtr
const shared_ptr abbreviation
double getMin() const
Returns the smallest of the scalars stored in the data set.
double interpolate(const WPosition &pos, bool *success) const
Interpolate the value for the valueset at the given position.
static std::shared_ptr< WPrototyped > getPrototype()
Returns a prototype instantiated with the true type of the deriving class.
T getValueAt(int x, int y, int z) const
Get the value stored at a certain grid position of the data set.
std::shared_ptr< WDataSetScalar > SPtr
shared_ptr abbreviation
std::map< size_t, std::shared_ptr< WValueSetHistogram > > m_histograms
The histograms for later use.
virtual const std::string getName() const
Gets the name of this prototype.
std::shared_ptr< const WValueSetHistogram > getHistogram(size_t buckets=1000)
Returns the histogram of this dataset's valueset.
virtual WDataSetSingle::SPtr clone() const
Creates a copy (clone) of this instance.
double getMax() const
Returns the largest of the scalars stored in the data set.
boost::mutex m_histogramLock
The lock used for securely creating m_histogram on demand.
virtual const std::string getDescription() const
Gets the description for this prototype.
WDataSetScalar()
Construct an empty and unusable instance.
A data set consisting of a set of values based on a grid.
std::shared_ptr< WGrid > m_grid
Stores the reference of the WGrid of this DataSetSingle instance.
double getSingleRawValue(size_t id) const
Get the raw scalar value stored at id-th position of the raw array of the value set.
std::shared_ptr< WValueSetBase > m_valueSet
Stores the reference of the WValueSet of this DataSetSingle instance.
std::shared_ptr< WDataSetSingle > SPtr
Convenience typedef for a std::shared_ptr.
This only is a 3d double vector.