~noskcaj/ubuntu/saucy/openwalnut/liberation

« back to all changes in this revision

Viewing changes to .pc/boost153/src/core/dataHandler/WDataSetVector.h

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2013-05-24 03:12:03 UTC
  • Revision ID: package-import@ubuntu.com-20130524031203-l5g1lzm1vd83fupi
Tags: 1.3.1+hg5849-1ubuntu1
Cherrypick boost1.53 pointer cast fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//---------------------------------------------------------------------------
 
2
//
 
3
// Project: OpenWalnut ( http://www.openwalnut.org )
 
4
//
 
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
 
6
// For more information see http://www.openwalnut.org/copying
 
7
//
 
8
// This file is part of OpenWalnut.
 
9
//
 
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.
 
14
//
 
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.
 
19
//
 
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/>.
 
22
//
 
23
//---------------------------------------------------------------------------
 
24
 
 
25
#ifndef WDATASETVECTOR_H
 
26
#define WDATASETVECTOR_H
 
27
 
 
28
#include "WDataSetSingle.h"
 
29
 
 
30
 
 
31
/**
 
32
 * This data set type contains vectors as values.
 
33
 * \ingroup dataHandler
 
34
 */
 
35
class WDataSetVector : public WDataSetSingle // NOLINT
 
36
{
 
37
public:
 
38
    /**
 
39
     * shared_ptr abbreviation
 
40
     */
 
41
    typedef boost::shared_ptr< WDataSetVector > SPtr;
 
42
 
 
43
    /**
 
44
     * const shared_ptr abbreviation
 
45
     */
 
46
    typedef boost::shared_ptr< const WDataSetVector > ConstSPtr;
 
47
 
 
48
    /**
 
49
     * Constructs an instance out of an appropriate value set and a grid.
 
50
     *
 
51
     * \param newValueSet the vector value set to use
 
52
     * \param newGrid the grid which maps world space to the value set
 
53
     */
 
54
    WDataSetVector( boost::shared_ptr< WValueSetBase > newValueSet,
 
55
                    boost::shared_ptr< WGrid > newGrid );
 
56
 
 
57
    /**
 
58
     * Construct an empty and unusable instance. This is needed for the prototype mechanism.
 
59
     */
 
60
    WDataSetVector();
 
61
 
 
62
    /**
 
63
     * Destroys this DataSet instance
 
64
     */
 
65
    virtual ~WDataSetVector();
 
66
 
 
67
    /**
 
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.
 
70
     *
 
71
     * \param newValueSet the new valueset.
 
72
     *
 
73
     * \return the clone
 
74
     */
 
75
    virtual WDataSetSingle::SPtr clone( boost::shared_ptr< WValueSetBase > newValueSet ) const;
 
76
 
 
77
    /**
 
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.
 
80
     *
 
81
     * \param newGrid the new grid.
 
82
     *
 
83
     * \return the clone
 
84
     */
 
85
    virtual WDataSetSingle::SPtr clone( boost::shared_ptr< WGrid > newGrid ) const;
 
86
 
 
87
    /**
 
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.
 
90
     *
 
91
     * \return the clone
 
92
     */
 
93
    virtual WDataSetSingle::SPtr clone() const;
 
94
 
 
95
    /**
 
96
     * Returns a prototype instantiated with the true type of the deriving class.
 
97
     *
 
98
     * \return the prototype.
 
99
     */
 
100
    static boost::shared_ptr< WPrototyped > getPrototype();
 
101
 
 
102
    /**
 
103
     * Interpolates the vector field at the given position
 
104
     *
 
105
     * \param pos position to interpolate
 
106
     * \param success if the position was inside the grid
 
107
     *
 
108
     * \return Vector beeing the interpolate.
 
109
     */
 
110
    WVector3d interpolate( const WPosition &pos, bool *success ) const;
 
111
 
 
112
    /**
 
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.
 
115
     *
 
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.
 
118
     *
 
119
     * \return The resulting interpolated vector.
 
120
     */
 
121
    WVector3d eigenVectorInterpolate( const WPosition &pos, bool *success ) const;
 
122
 
 
123
    /**
 
124
     * Get the vector on the given position in value set.
 
125
     * \note currently only implmented for WVector3d
 
126
     *
 
127
     * \param index the position where to get the vector from
 
128
     *
 
129
     * \return the vector
 
130
     */
 
131
    WVector3d getVectorAt( size_t index ) const;
 
132
 
 
133
    /**
 
134
     * Determines whether this dataset can be used as a texture.
 
135
     *
 
136
     * \return true if usable as texture.
 
137
     */
 
138
    virtual bool isTexture() const;
 
139
 
 
140
    /**
 
141
     * Overwrites the isVectorDataSet check.
 
142
     *
 
143
     * \return Non empty reference to the dataset if it is a vector dataset, empty if not.
 
144
     */
 
145
    boost::shared_ptr< WDataSetVector > isVectorDataSet();
 
146
 
 
147
protected:
 
148
    /**
 
149
     * The prototype as singleton.
 
150
     */
 
151
    static boost::shared_ptr< WPrototyped > m_prototype;
 
152
 
 
153
private:
 
154
};
 
155
 
 
156
inline boost::shared_ptr< WDataSetVector > WDataSetVector::isVectorDataSet()
 
157
{
 
158
    return boost::shared_static_cast< WDataSetVector >( shared_from_this() );
 
159
}
 
160
 
 
161
#endif  // WDATASETVECTOR_H