OpenWalnut  1.2.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Static Protected Attributes | Private Attributes | List of all members
WDataSetScalar Class Reference

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

#include <WDataSetScalar.h>

+ Inheritance diagram for WDataSetScalar:

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.
- Public Member Functions inherited from WDataSetSingle
 WDataSetSingle (boost::shared_ptr< WValueSetBase > newValueSet, boost::shared_ptr< WGrid > newGrid)
 Constructs an instance out of a value set and a grid.
 WDataSetSingle ()
 Construct an empty and unusable instance.
virtual ~WDataSetSingle ()
 Destroys this DataSet instance.
boost::shared_ptr< WValueSetBasegetValueSet () const
boost::shared_ptr< WGridgetGrid () const
template<typename T >
getValueAt (size_t id)
 Get the value stored at position of the value set.
double getValueAt (size_t id) const
 Get the value stored at position of the value set.
virtual bool isTexture () const
 Determines whether this dataset can be used as a texture.
virtual osg::ref_ptr
< WDataTexture3D
getTexture () const
 Returns the texture representation of the dataset.
virtual const std::string getName () const
 Gets the name of this prototype.
virtual const std::string getDescription () const
 Gets the description for this prototype.
- Public Member Functions inherited from WDataSet
 WDataSet ()
 This constructor should be used if a dataSet does not stem from a file.
virtual ~WDataSet ()
 Since WDataSet is a base class and thus should be polymorphic we add virtual destructor.
void setFileName (const std::string fileName)
 Set the name of the file that this data set stems from.
std::string getFileName () const
 Get the name of the file that this data set stems from.
virtual boost::shared_ptr
< WDataSetVector
isVectorDataSet ()
 Checks if this dataset is a vector dataset.
boost::shared_ptr< WPropertiesgetProperties () const
 Return a pointer to the properties object of the dataset.
boost::shared_ptr< WPropertiesgetInformationProperties () const
 Return a pointer to the information properties object of the dataset.
- Public Member Functions inherited from WTransferable
 WTransferable ()
 Default constructor.
virtual ~WTransferable ()
 Destructor.
- Public Member Functions inherited from WPrototyped
 WPrototyped ()
 Default constructor.
virtual ~WPrototyped ()
 Destructor.
template<typename T >
bool isA ()
 Checks whether the actual prototype has the specified runtime type.

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.
- Static Protected Attributes inherited from WDataSetSingle
static boost::shared_ptr
< WPrototyped
m_prototype = boost::shared_ptr< WPrototyped >()
 The prototype as singleton.
- Static Protected Attributes inherited from WDataSet
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.

Additional Inherited Members

- Public Types inherited from WDataSetSingle
typedef boost::shared_ptr
< WDataSetSingle
SPtr
 Convenience typedef for a boost::shared_ptr.
typedef boost::shared_ptr
< const WDataSetSingle
ConstSPtr
 Convenience typedef for a boost::shared_ptr; const.
- Protected Attributes inherited from WDataSetSingle
boost::shared_ptr< WGridm_grid
 Stores the reference of the WGrid of this DataSetSingle instance.
boost::shared_ptr< WValueSetBasem_valueSet
 Stores the reference of the WValueSet of this DataSetSingle instance.

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().

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::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.
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 >()
staticprotected

The prototype as singleton.

Definition at line 165 of file WDataSetScalar.h.

Referenced by getPrototype().


The documentation for this class was generated from the following files: