OpenWalnut  1.5.0dev
Public Types | 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:
+ Collaboration diagram for WDataSetScalar:

Public Types

typedef std::shared_ptr< WDataSetScalarSPtr
 shared_ptr abbreviation More...
 
typedef std::shared_ptr< const WDataSetScalarConstSPtr
 const shared_ptr abbreviation More...
 
- Public Types inherited from WDataSetSingle
typedef std::shared_ptr< WDataSetSingleSPtr
 Convenience typedef for a std::shared_ptr. More...
 
typedef std::shared_ptr< const WDataSetSingleConstSPtr
 Convenience typedef for a std::shared_ptr; const. More...
 
- Public Types inherited from WDataSet
typedef std::shared_ptr< WDataSetSPtr
 Shared pointer abbreviation to a instance of this class. More...
 
typedef std::shared_ptr< const WDataSetConstSPtr
 Shared pointer abbreviation to a const instance of this class. More...
 

Public Member Functions

 WDataSetScalar (std::shared_ptr< WValueSetBase > newValueSet, std::shared_ptr< WGrid > newGrid)
 Constructs an instance out of an appropriate value set and a grid. More...
 
 WDataSetScalar ()
 Construct an empty and unusable instance. More...
 
virtual ~WDataSetScalar ()
 Destroys this DataSet instance. More...
 
virtual WDataSetSingle::SPtr clone (std::shared_ptr< WValueSetBase > newValueSet, std::shared_ptr< WGrid > newGrid) const
 Creates a copy (clone) of this instance but allows one to change the valueset. More...
 
virtual WDataSetSingle::SPtr clone (std::shared_ptr< WValueSetBase > newValueSet) const
 Creates a copy (clone) of this instance but allows one to change the valueset. More...
 
virtual WDataSetSingle::SPtr clone (std::shared_ptr< WGrid > newGrid) const
 Creates a copy (clone) of this instance but allows one to change the grid. More...
 
virtual WDataSetSingle::SPtr clone () const
 Creates a copy (clone) of this instance. More...
 
double getMax () const
 Returns the largest of the scalars stored in the data set. More...
 
double getMin () const
 Returns the smallest of the scalars stored in the data set. More...
 
virtual const std::string getName () const
 Gets the name of this prototype. More...
 
virtual const std::string getDescription () const
 Gets the description for this prototype. More...
 
std::shared_ptr< const WValueSetHistogramgetHistogram (size_t buckets=1000)
 Returns the histogram of this dataset's valueset. More...
 
double interpolate (const WPosition &pos, bool *success) const
 Interpolate the value for the valueset at the given position. More...
 
template<typename T >
getValueAt (int x, int y, int z) const
 Get the value stored at a certain grid position of the data set. More...
 
double getValueAt (int x, int y, int z) const
 Get the value stored at a certain grid position of the data set. More...
 
double getValueAt (size_t id) const
 Get the value stored at a certain grid position of the data set. More...
 
double getSingleRawValue (size_t id) const
 Get the raw scalar value stored at id-th position of the raw array of the value set. More...
 
- Public Member Functions inherited from WDataSetSingle
 WDataSetSingle (std::shared_ptr< WValueSetBase > newValueSet, std::shared_ptr< WGrid > newGrid)
 Constructs an instance out of a value set and a grid. More...
 
 WDataSetSingle ()
 Construct an empty and unusable instance. More...
 
virtual ~WDataSetSingle ()
 Destroys this DataSet instance. More...
 
std::shared_ptr< WValueSetBasegetValueSet () const
 
std::shared_ptr< WGridgetGrid () const
 
template<typename T >
OW_API_DEPRECATEDgetValueAt (size_t id)
 Get the scalar value stored at id-th position of the array of the value set. More...
 
double OW_API_DEPRECATED getValueAt (size_t id) const
 Get the scalar value stored at id-th position of the array of the value set. More...
 
double getSingleRawValue (size_t id) const
 Get the raw scalar value stored at id-th position of the raw array of the value set. More...
 
virtual bool isTexture () const
 Determines whether this dataset can be used as a texture. More...
 
virtual osg::ref_ptr< WDataTexture3DgetTexture () const
 Returns the texture representation of the dataset. More...
 
- Public Member Functions inherited from WDataSet
 WDataSet ()
 This constructor should be used if a dataSet does not stem from a file. More...
 
virtual ~WDataSet ()
 Since WDataSet is a base class and thus should be polymorphic we add virtual destructor. More...
 
void setFilename (const std::string filename)
 Set the name of the file that this data set stems from. More...
 
std::string getFilename () const
 Get the name of the file that this data set stems from. More...
 
OW_API_DEPRECATED void setFileName (const std::string filename)
 Set the name of the file that this data set stems from. More...
 
OW_API_DEPRECATED std::string getFileName () const
 Get the name of the file that this data set stems from. More...
 
virtual std::shared_ptr< WDataSetVectorisVectorDataSet ()
 Checks if this dataset is a vector dataset. More...
 
std::shared_ptr< WPropertiesgetProperties () const
 Return a pointer to the properties object of the dataset. More...
 
std::shared_ptr< WPropertiesgetInformationProperties () const
 Return a pointer to the information properties object of the dataset. More...
 
- Public Member Functions inherited from WTransferable
 WTransferable ()
 Default constructor. More...
 
virtual ~WTransferable ()
 Destructor. More...
 
- Public Member Functions inherited from WPrototyped
 WPrototyped ()
 Default constructor. More...
 
virtual ~WPrototyped ()
 Destructor. More...
 
template<typename T >
bool isA ()
 Checks whether the actual prototype has the specified runtime type. More...
 

Static Public Member Functions

static std::shared_ptr< WPrototypedgetPrototype ()
 Returns a prototype instantiated with the true type of the deriving class. More...
 
- Static Public Member Functions inherited from WDataSetSingle
static std::shared_ptr< WPrototypedgetPrototype ()
 Returns a prototype instantiated with the true type of the deriving class. More...
 
- Static Public Member Functions inherited from WDataSet
static std::shared_ptr< WPrototypedgetPrototype ()
 Returns a prototype instantiated with the true type of the deriving class. More...
 

Static Protected Attributes

static std::shared_ptr< WPrototypedm_prototype = std::shared_ptr< WPrototyped >()
 The prototype as singleton. More...
 
- Static Protected Attributes inherited from WDataSetSingle
static std::shared_ptr< WPrototypedm_prototype = std::shared_ptr< WPrototyped >()
 The prototype as singleton. More...
 
- Static Protected Attributes inherited from WDataSet
static std::shared_ptr< WPrototypedm_prototype = std::shared_ptr< WPrototyped >()
 The prototype as singleton. More...
 

Private Attributes

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

Additional Inherited Members

- Protected Attributes inherited from WDataSetSingle
std::shared_ptr< WGridm_grid
 Stores the reference of the WGrid of this DataSetSingle instance. More...
 
std::shared_ptr< WValueSetBasem_valueSet
 Stores the reference of the WValueSet of this DataSetSingle instance. More...
 
- Protected Attributes inherited from WDataSet
std::shared_ptr< WPropertiesm_properties
 The property object for the dataset. More...
 
std::shared_ptr< WPropertiesm_infoProperties
 The property object for the dataset containing only props whose purpose is "PV_PURPOSE_INFORMNATION". More...
 

Detailed Description

This data set type contains scalars as values.

Definition at line 42 of file WDataSetScalar.h.

Member Typedef Documentation

◆ ConstSPtr

typedef std::shared_ptr< const WDataSetScalar > WDataSetScalar::ConstSPtr

const shared_ptr abbreviation

Definition at line 53 of file WDataSetScalar.h.

◆ SPtr

typedef std::shared_ptr< WDataSetScalar > WDataSetScalar::SPtr

shared_ptr abbreviation

Definition at line 48 of file WDataSetScalar.h.

Constructor & Destructor Documentation

◆ WDataSetScalar() [1/2]

WDataSetScalar::WDataSetScalar ( std::shared_ptr< WValueSetBase newValueSet,
std::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() [2/2]

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

+ Here is the caller graph for this function:

◆ ~WDataSetScalar()

WDataSetScalar::~WDataSetScalar ( )
virtual

Destroys this DataSet instance.

Definition at line 54 of file WDataSetScalar.cpp.

Member Function Documentation

◆ clone() [1/4]

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 73 of file WDataSetScalar.cpp.

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

+ Here is the call graph for this function:

◆ clone() [2/4]

WDataSetSingle::SPtr WDataSetScalar::clone ( std::shared_ptr< WGrid newGrid) const
virtual

Creates a copy (clone) of this instance but allows one 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 68 of file WDataSetScalar.cpp.

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

+ Here is the call graph for this function:

◆ clone() [3/4]

WDataSetSingle::SPtr WDataSetScalar::clone ( std::shared_ptr< WValueSetBase newValueSet) const
virtual

Creates a copy (clone) of this instance but allows one 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 63 of file WDataSetScalar.cpp.

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

+ Here is the call graph for this function:

◆ clone() [4/4]

WDataSetSingle::SPtr WDataSetScalar::clone ( std::shared_ptr< WValueSetBase newValueSet,
std::shared_ptr< WGrid newGrid 
) const
virtual

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

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

Parameters
newValueSetthe new valueset.
newGridthe new grid.
Returns
the clone

Reimplemented from WDataSetSingle.

Definition at line 58 of file WDataSetScalar.cpp.

References WDataSetScalar().

+ Here is the call graph for this function:

◆ getDescription()

std::string const WDataSetScalar::getDescription ( ) const
virtual

Gets the description for this prototype.

Returns
the description

Reimplemented from WDataSetSingle.

Definition at line 83 of file WDataSetScalar.cpp.

◆ getHistogram()

std::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 174 of file WDataSetScalar.cpp.

References m_histogramLock, m_histograms, and WDataSetSingle::m_valueSet.

◆ getMax()

double WDataSetScalar::getMax ( ) const

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

Returns
maximum value in dataset

Definition at line 88 of file WDataSetScalar.cpp.

References WDataSetSingle::m_valueSet.

◆ getMin()

double WDataSetScalar::getMin ( ) const

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

Returns
minimum value in dataset

Definition at line 93 of file WDataSetScalar.cpp.

References WDataSetSingle::m_valueSet.

◆ getName()

std::string const WDataSetScalar::getName ( ) const
virtual

Gets the name of this prototype.

Returns
the name.

Reimplemented from WDataSetSingle.

Definition at line 78 of file WDataSetScalar.cpp.

◆ getPrototype()

std::shared_ptr< WPrototyped > WDataSetScalar::getPrototype ( )
static

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

Returns
the prototype.

Definition at line 98 of file WDataSetScalar.cpp.

References m_prototype, and WDataSetScalar().

+ Here is the call graph for this function:

◆ getSingleRawValue()

T WDataSetSingle::getSingleRawValue

Get the raw scalar value stored at id-th position of the raw array of the value set.

This is the value at the id-th grid position only for scalar data sets.

Parameters
idThe id of the raw value to be obtained
Returns
Scalar value for that given id

Definition at line 164 of file WDataSetSingle.cpp.

◆ getValueAt() [1/3]

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 220 of file WDataSetScalar.h.

References WDataSetSingle::m_grid, and WDataSetSingle::m_valueSet.

◆ getValueAt() [2/3]

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.

Definition at line 161 of file WDataSetScalar.cpp.

References WDataSetSingle::getSingleRawValue(), and WDataSetSingle::m_grid.

+ Here is the call graph for this function:

◆ getValueAt() [3/3]

double WDataSetScalar::getValueAt ( size_t  id) const

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

Parameters
id
Returns
the double the grid position with the given tuple.

Definition at line 169 of file WDataSetScalar.cpp.

References WDataSetSingle::getSingleRawValue().

+ Here is the call graph for this function:

◆ interpolate()

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

Interpolate the value for the valueset at the given position.

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

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

Definition at line 108 of file WDataSetScalar.cpp.

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

Referenced by WDataSetTimeSeries::interpolate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_histogramLock

boost::mutex WDataSetScalar::m_histogramLock
private

The lock used for securely creating m_histogram on demand.

Definition at line 217 of file WDataSetScalar.h.

Referenced by getHistogram().

◆ m_histograms

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

The histograms for later use.

Each histogram for a requested bucket count gets cached.

Definition at line 212 of file WDataSetScalar.h.

Referenced by getHistogram().

◆ m_prototype

std::shared_ptr< WPrototyped > WDataSetScalar::m_prototype = std::shared_ptr< WPrototyped >()
staticprotected

The prototype as singleton.

Definition at line 206 of file WDataSetScalar.h.

Referenced by getPrototype().


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