1
//---------------------------------------------------------------------------
3
// Project: OpenWalnut ( http://www.openwalnut.org )
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
8
// This file is part of OpenWalnut.
10
// OpenWalnut is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
15
// OpenWalnut is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
23
//---------------------------------------------------------------------------
25
#ifndef WDATASETVECTOR_H
26
#define WDATASETVECTOR_H
28
#include "WDataSetSingle.h"
32
* This data set type contains vectors as values.
33
* \ingroup dataHandler
35
class WDataSetVector : public WDataSetSingle // NOLINT
39
* shared_ptr abbreviation
41
typedef boost::shared_ptr< WDataSetVector > SPtr;
44
* const shared_ptr abbreviation
46
typedef boost::shared_ptr< const WDataSetVector > ConstSPtr;
49
* Constructs an instance out of an appropriate value set and a grid.
51
* \param newValueSet the vector value set to use
52
* \param newGrid the grid which maps world space to the value set
54
WDataSetVector( boost::shared_ptr< WValueSetBase > newValueSet,
55
boost::shared_ptr< WGrid > newGrid );
58
* Construct an empty and unusable instance. This is needed for the prototype mechanism.
63
* Destroys this DataSet instance
65
virtual ~WDataSetVector();
68
* 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
69
* want to keep the dynamic type of your dataset even if you just have a WDataSetSingle.
71
* \param newValueSet the new valueset.
75
virtual WDataSetSingle::SPtr clone( boost::shared_ptr< WValueSetBase > newValueSet ) const;
78
* 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
79
* want to keep the dynamic type of your dataset even if you just have a WDataSetSingle.
81
* \param newGrid the new grid.
85
virtual WDataSetSingle::SPtr clone( boost::shared_ptr< WGrid > newGrid ) const;
88
* Creates a copy (clone) of this instance. Unlike copy construction, this is a very useful function if you
89
* want to keep the dynamic type of your dataset even if you just have a WDataSetSingle.
93
virtual WDataSetSingle::SPtr clone() const;
96
* Returns a prototype instantiated with the true type of the deriving class.
98
* \return the prototype.
100
static boost::shared_ptr< WPrototyped > getPrototype();
103
* Interpolates the vector field at the given position
105
* \param pos position to interpolate
106
* \param success if the position was inside the grid
108
* \return Vector beeing the interpolate.
110
WVector3d interpolate( const WPosition &pos, bool *success ) const;
113
* Interpolates the very same way as \ref interpolate but it assures that all vecs are aligned to point into the same
114
* half-space. This is useful for eigenvector fields, where -v, and v both are eigenvectors.
116
* \param pos Position to interpolate a vector for
117
* \param success return parameter which is true if pos was inside of the grid, false otherwise.
119
* \return The resulting interpolated vector.
121
WVector3d eigenVectorInterpolate( const WPosition &pos, bool *success ) const;
124
* Get the vector on the given position in value set.
125
* \note currently only implmented for WVector3d
127
* \param index the position where to get the vector from
131
WVector3d getVectorAt( size_t index ) const;
134
* Determines whether this dataset can be used as a texture.
136
* \return true if usable as texture.
138
virtual bool isTexture() const;
141
* Overwrites the isVectorDataSet check.
143
* \return Non empty reference to the dataset if it is a vector dataset, empty if not.
145
boost::shared_ptr< WDataSetVector > isVectorDataSet();
149
* The prototype as singleton.
151
static boost::shared_ptr< WPrototyped > m_prototype;
156
inline boost::shared_ptr< WDataSetVector > WDataSetVector::isVectorDataSet()
158
return boost::shared_static_cast< WDataSetVector >( shared_from_this() );
161
#endif // WDATASETVECTOR_H