View on GitHub

Vistle

Distributed Data-parallel Scientific Visualization in VR

uniformgrid.h
Go to the documentation of this file.
1//-------------------------------------------------------------------------
2// UNIFORM GRID CLASS H
3// *
4// * Uniform Grid Container Object
5//-------------------------------------------------------------------------
6#ifndef UNIFORM_GRID_H
7#define UNIFORM_GRID_H
8
9#include "scalar.h"
10#include "shm.h"
11#include "shmvector.h"
12#include "structuredgridbase.h"
13#include "normals.h"
14#include "export.h"
15
16namespace vistle {
17
18//-------------------------------------------------------------------------
19// DECLARATION OF UNIFORMGRID
20//-------------------------------------------------------------------------
23
24public:
25 typedef Object Base;
26
27 // constructor
28 UniformGrid(Index xdim, Index ydim, Index zdim, const Meta &meta = Meta());
29
30 std::set<Object::const_ptr> referencedObjects() const override;
31
32 // get/set functions
33 Index getNumDivisions(int c) override { return d()->numDivisions[c]; }
34 Index getNumDivisions(int c) const override { return m_numDivisions[c]; }
35 Index getNumGhostLayers(unsigned dim, GhostLayerPosition pos) override;
36 Index getNumGhostLayers(unsigned dim, GhostLayerPosition pos) const override;
37 Index getGlobalIndexOffset(int c) const override { return d()->indexOffset[c]; }
38 void setGlobalIndexOffset(int d, Index offset) override;
39
40 // virtual set functions
41 void setNumGhostLayers(unsigned dim, GhostLayerPosition pos, unsigned value) override;
42
43 // get/set functions for shared memory members
44 Scalar *min() { return d()->min; }
45 Scalar *max() { return d()->max; }
46 const Scalar *min() const { return m_min; }
47 const Scalar *max() const { return m_max; }
48
49 // GeometryInterface
50 std::pair<Vector, Vector> getBounds() const override;
51 Normals::const_ptr normals() const override;
52 void setNormals(Normals::const_ptr normals);
53
54 // GridInterface
55 Index getNumVertices() override;
56 Index getNumVertices() const override;
57 std::pair<Vector, Vector> cellBounds(Index elem) const override;
58 Index findCell(const Vector &point, Index hint = InvalidIndex, int flags = NoFlags) const override;
59 bool inside(Index elem, const Vector &point) const override;
60 Interpolator getInterpolator(Index elem, const Vector &point, DataBase::Mapping mapping = DataBase::Vertex,
61 InterpolationMode mode = Linear) const override;
62 Scalar exitDistance(Index elem, const Vector &point, const Vector &dir) const override;
63 Vector getVertex(Index v) const override;
64
65 void copyAttributes(Object::const_ptr src, bool replace = true) override;
66
67private:
68 // mutable pointers to ShmVectors
69 mutable Index m_size;
70 mutable Index m_numDivisions[3];
71 mutable Scalar m_min[3];
72 mutable Scalar m_max[3];
73 mutable Scalar m_dist[3];
74 mutable Index m_ghostLayers[3][2];
75
76 // data object
78
80 // each of the following variables represents a coordinate (by index, in order x, y, z)
81 Index indexOffset[3]; //< global index offset
82 Index numDivisions[3]; //< number of divisions on each axis (1 more than number of cells)
83 Scalar min[3]; //< coordinates of minimum grid point
84 Scalar max[3]; //< coordinates of maximum grid point
85 Index ghostLayers[3][2]; //< number of ghost cell layers in each x, y, z directions
86
87 Data(const std::string &name, Index xdim, Index ydim, Index zdim, const Meta &meta = Meta());
88 ~Data();
89 static Data *create(Index xdim = 0, Index ydim = 0, Index zdim = 0, const Meta &meta = Meta());
90
92};
93
94
95//ARCHIVE_ASSUME_ABSTRACT(UniformGrid)
96
97} // namespace vistle
98#endif /* UNIFORM_GRID_H */
return at least those elements sharing faces with elem, but might also contain those just sharing ver...
Definition: grid.h:33
Definition: objectmeta.h:16
Definition: object.h:58
std::shared_ptr< const Object > const_ptr
Definition: object.h:68
Definition: structuredgridbase.h:20
Definition: uniformgrid.h:21
Index getGlobalIndexOffset(int c) const override
Definition: uniformgrid.h:37
Scalar * max()
Definition: uniformgrid.h:45
const Scalar * min() const
Definition: uniformgrid.h:46
Index getNumDivisions(int c) override
Definition: uniformgrid.h:33
Object Base
Definition: uniformgrid.h:25
Index getNumDivisions(int c) const override
Definition: uniformgrid.h:34
Scalar * min()
Definition: uniformgrid.h:44
const Scalar * max() const
Definition: uniformgrid.h:47
Normals::const_ptr normals() const override
Definition: shm_obj_ref.h:15
#define V_COREEXPORT
Definition: export.h:9
static T min(T a, T b)
Definition: messages.cpp:28
Definition: allobjects.cpp:30
Vector3 Vector
Definition: vector.h:36
const Index InvalidIndex
Definition: index.h:17
float Scalar
Definition: scalar.h:14
uint32_t Index
Definition: index.h:13
#define V_DATA_BEGIN(ObjType)
Definition: object.h:474
#define V_DATA_END(ObjType)
Definition: object.h:481
#define V_OBJECT(ObjType)
declare a new Object type
Definition: object.h:381
Definition: object.h:233