View on GitHub

Vistle

Distributed Data-parallel Scientific Visualization in VR

rectilineargrid.h
Go to the documentation of this file.
1//-------------------------------------------------------------------------
2// RECTILINEAR GRID CLASS H
3// *
4// * Rectilinear Grid Container Object
5//-------------------------------------------------------------------------
6#ifndef RECTILINEAR_GRID_H
7#define RECTILINEAR_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 RECTILINEARGRID
20//-------------------------------------------------------------------------
23
24public:
25 typedef Object Base;
26
27 // constructor
28 RectilinearGrid(const Index numDivX, const Index numDivY, const Index numDivZ, const Meta &meta = Meta());
29
30 std::set<Object::const_ptr> referencedObjects() const override;
31
32 // get functions for metadata
33 Index getNumDivisions(int c) override { return d()->coords[c]->size(); }
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 c, 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 shm<Scalar>::array &coords(int c) { return *d()->coords[c]; }
45 const Scalar *coords(int c) const { return m_coords[c]; }
46
47 // GridInterface
48 Index getNumVertices() override;
49 Index getNumVertices() const override;
50 std::pair<Vector, Vector> getBounds() const override;
51 Normals::const_ptr normals() const override;
52 void setNormals(Normals::const_ptr normals);
53 std::pair<Vector, Vector> cellBounds(Index elem) const override;
54 Index findCell(const Vector &point, Index hint = InvalidIndex, int flags = NoFlags) const override;
55 bool inside(Index elem, const Vector &point) const override;
56 Interpolator getInterpolator(Index elem, const Vector &point, DataBase::Mapping mapping = DataBase::Vertex,
57 InterpolationMode mode = Linear) const override;
58 Scalar exitDistance(Index elem, const Vector &point, const Vector &dir) const override;
59 Vector getVertex(Index v) const override;
60
61 void copyAttributes(Object::const_ptr src, bool replace = true) override;
62
63private:
64 // mutable pointers to ShmVectors
65 mutable Index m_numDivisions[3];
66 mutable const Scalar *m_coords[3];
67 mutable Index m_ghostLayers[3][2];
68 mutable Index m_size = 0;
69
70 // data object
72
74 Index indexOffset[3]; //< global index offset
75 ShmVector<Scalar> coords[3]; //< coordinates of divisions in x, y, and z
76 Index ghostLayers[3][2]; //< number of ghost cell layers in each x, y, z directions
77
78 Data(const Index numDivX, const Index numDivY, const Index numDivZ, const std::string &name,
79 const Meta &meta = Meta());
80 ~Data();
81 static Data *create(const Index numDivX = 0, const Index numDivY = 0, const Index numDivZ = 0,
82 const Meta &meta = Meta());
83
85};
86
87} // namespace vistle
88#endif /* RECTILINEAR_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: rectilineargrid.h:21
const Scalar * coords(int c) const
Definition: rectilineargrid.h:45
shm< Scalar >::array & coords(int c)
Definition: rectilineargrid.h:44
Object Base
Definition: rectilineargrid.h:25
Index getNumDivisions(int c) const override
Definition: rectilineargrid.h:34
Index getNumDivisions(int c) override
Definition: rectilineargrid.h:33
Normals::const_ptr normals() const override
Index getGlobalIndexOffset(int c) const override
Definition: rectilineargrid.h:37
Definition: structuredgridbase.h:20
Definition: shm_reference.h:15
Definition: shm_array.h:19
Definition: shm_obj_ref.h:15
#define V_COREEXPORT
Definition: export.h:9
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