OpenWalnut 1.2.5
Public Member Functions | Static Public Member Functions | Static Protected Attributes | Private Attributes
WDataSetScalar Class Reference

This data set type contains scalars as values. More...

#include <WDataSetScalar.h>

Inheritance diagram for WDataSetScalar:

List of all members.

Public Member Functions

 WDataSetScalar (boost::shared_ptr< WValueSetBase > newValueSet, boost::shared_ptr< WGrid > newGrid)
 Constructs an instance out of an appropriate value set and a grid.
 WDataSetScalar ()
 Construct an empty and unusable instance.
virtual ~WDataSetScalar ()
 Destroys this DataSet instance.
virtual WDataSetSingle::SPtr clone (boost::shared_ptr< WValueSetBase > newValueSet) const
 Creates a copy (clone) of this instance but allows to change the valueset.
virtual WDataSetSingle::SPtr clone (boost::shared_ptr< WGrid > newGrid) const
 Creates a copy (clone) of this instance but allows to change the grid.
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.
double getMin () const
 Returns the smallest of the scalars stored in the data set.
boost::shared_ptr< const
WValueSetHistogram
getHistogram (size_t buckets=1000)
 Returns the histogram of this dataset's valueset.
double interpolate (const WPosition &pos, bool *success) const
 Interpolate the value fo the valueset at the given position.
template<typename T >
getValueAt (int x, int y, int z) const
 Get the value stored at a certain grid position of the data set.
double getValueAt (int x, int y, int z) const
 Get the value stored at a certain grid position of the data set.

Static Public Member Functions

static boost::shared_ptr
< WPrototyped
getPrototype ()
 Returns a prototype instantiated with the true type of the deriving class.

Static Protected Attributes

static boost::shared_ptr
< WPrototyped
m_prototype = boost::shared_ptr< WPrototyped >()
 The prototype as singleton.

Private Attributes

std::map< size_t,
boost::shared_ptr
< WValueSetHistogram > > 
m_histograms
 The histograms for later use.
boost::mutex m_histogramLock
 The lock used for securely creating m_histogram on demand.

Detailed Description

This data set type contains scalars as values.

Definition at line 41 of file WDataSetScalar.h.


Constructor & Destructor Documentation

WDataSetScalar::WDataSetScalar ( boost::shared_ptr< WValueSetBase newValueSet,
boost::shared_ptr< WGrid newGrid 
)

Constructs an instance out of an appropriate value set and a grid.

Computes the maximum an minimum values stored as member variables.

Parameters:
newValueSetthe scalar value set to use
newGridthe grid which maps world space to the value set

Definition at line 38 of file WDataSetScalar.cpp.

WDataSetScalar::WDataSetScalar ( )

Construct an empty and unusable instance.

This is needed for the prototype mechanism.

Definition at line 48 of file WDataSetScalar.cpp.

Referenced by clone(), and getPrototype().

WDataSetScalar::~WDataSetScalar ( ) [virtual]

Destroys this DataSet instance.

Definition at line 54 of file WDataSetScalar.cpp.


Member Function Documentation

WDataSetSingle::SPtr WDataSetScalar::clone ( boost::shared_ptr< WValueSetBase newValueSet) const [virtual]

Creates a copy (clone) of this instance but allows to change the valueset.

Unlike copy construction, this is a very useful function if you want to keep the dynamic type of your dataset even if you just have a WDataSetSingle.

Parameters:
newValueSetthe new valueset.
Returns:
the clone

Reimplemented from WDataSetSingle.

Definition at line 58 of file WDataSetScalar.cpp.

References WDataSetSingle::getGrid(), and WDataSetScalar().

WDataSetSingle::SPtr WDataSetScalar::clone ( boost::shared_ptr< WGrid newGrid) const [virtual]

Creates a copy (clone) of this instance but allows to change the grid.

Unlike copy construction, this is a very useful function if you want to keep the dynamic type of your dataset even if you just have a WDataSetSingle.

Parameters:
newGridthe new grid.
Returns:
the clone

Reimplemented from WDataSetSingle.

Definition at line 63 of file WDataSetScalar.cpp.

References WDataSetSingle::getValueSet(), and WDataSetScalar().

WDataSetSingle::SPtr WDataSetScalar::clone ( ) const [virtual]

Creates a copy (clone) of this instance.

Unlike copy construction, this is a very useful function if you want to keep the dynamic type of your dataset even if you just have a WDataSetSingle.

Returns:
the clone

Reimplemented from WDataSetSingle.

Definition at line 68 of file WDataSetScalar.cpp.

References WDataSetSingle::getGrid(), WDataSetSingle::getValueSet(), and WDataSetScalar().

boost::shared_ptr< const WValueSetHistogram > WDataSetScalar::getHistogram ( size_t  buckets = 1000)

Returns the histogram of this dataset's valueset.

If it does not exist yet, it will be created and cached. It does NOT make use of the WValueSetHistogram down scaling feature even though the number of buckets might be lower than the default as the down scaling might introduce errors. To use down-scaling, grab the default histogram and call WValueSetHistogram( getHistogram(), buckets ) manually.

Parameters:
bucketsthe number of buckets inside the histogram.
Returns:
the histogram.

Definition at line 155 of file WDataSetScalar.cpp.

References m_histogramLock, m_histograms, and WDataSetSingle::m_valueSet.

double WDataSetScalar::getMax ( ) const

Returns the largest of the scalars stored in the data set.

Returns:
maximum value in dataset

Definition at line 73 of file WDataSetScalar.cpp.

References WDataSetSingle::m_valueSet.

double WDataSetScalar::getMin ( ) const

Returns the smallest of the scalars stored in the data set.

Returns:
minimum value in dataset

Definition at line 78 of file WDataSetScalar.cpp.

References WDataSetSingle::m_valueSet.

boost::shared_ptr< WPrototyped > WDataSetScalar::getPrototype ( ) [static]

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

Returns:
the prototype.

Reimplemented from WDataSetSingle.

Definition at line 83 of file WDataSetScalar.cpp.

References m_prototype, and WDataSetScalar().

double WDataSetScalar::getValueAt ( int  x,
int  y,
int  z 
) const

Get the value stored at a certain grid position of the data set.

Parameters:
xindex in x direction
yindex in y direction
zindex in z direction
Returns:
the double the grid position with the given index tuple.
template<typename T >
T WDataSetScalar::getValueAt ( int  x,
int  y,
int  z 
) const

Get the value stored at a certain grid position of the data set.

Parameters:
xindex in x direction
yindex in y direction
zindex in z direction
Returns:
the value at the grid position with the given index tuple.

Definition at line 147 of file WDataSetScalar.cpp.

References WGridRegular3D::getNbCoordsX(), and WDataSetSingle::m_grid.

Referenced by interpolate().

double WDataSetScalar::interpolate ( const WPosition pos,
bool *  success 
) const

Interpolate the value fo the valueset at the given position.

If interpolation fails, the success parameter will be false and the value returned zero.

Parameters:
posThe position for wich we would like to get a value.
successindicates whether the interpolation was successful
Returns:
Scalar value for that given position

Definition at line 93 of file WDataSetScalar.cpp.

References getValueAt(), WDataSetSingle::m_grid, and WDataSetSingle::m_valueSet.

Referenced by WDataSetTimeSeries::interpolate(), and WDataSetScalarTest::testInterpolate().


Member Data Documentation

boost::mutex WDataSetScalar::m_histogramLock [private]

The lock used for securely creating m_histogram on demand.

Definition at line 177 of file WDataSetScalar.h.

Referenced by getHistogram().

std::map< size_t, boost::shared_ptr< WValueSetHistogram > > WDataSetScalar::m_histograms [private]

The histograms for later use.

Each histogram for a requested bucket count gets cached.

Definition at line 172 of file WDataSetScalar.h.

Referenced by getHistogram().

boost::shared_ptr< WPrototyped > WDataSetScalar::m_prototype = boost::shared_ptr< WPrototyped >() [static, protected]

The prototype as singleton.

Reimplemented from WDataSetSingle.

Definition at line 165 of file WDataSetScalar.h.

Referenced by getPrototype().


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends