View on GitHub

Vistle

Distributed Data-parallel Scientific Visualization in VR

unstr.h
Go to the documentation of this file.
1#ifndef UNSTRUCTUREDGRID_H
2#define UNSTRUCTUREDGRID_H
3
4
5#include "shm.h"
6#include "indexed.h"
7#include "grid.h"
8#include "celltypes.h"
9#include <vistle/util/enum.h>
10
11namespace vistle {
12
13class V_COREEXPORT UnstructuredGrid: public Indexed, virtual public GridInterface {
15
16public:
17 typedef Indexed Base;
18 enum Type {
22
24
38 };
39
40 static const Index MaxNumVertices = 4;
41 static const Index MaxNumFaces = 6;
42
43 static const int Dimensionality[NUM_TYPES];
44 static const int NumVertices[NUM_TYPES];
45 static const int NumFaces[NUM_TYPES];
46 static const unsigned FaceSizes[NUM_TYPES][MaxNumFaces];
47 static const unsigned FaceVertices[NUM_TYPES][MaxNumFaces][MaxNumVertices];
48
49 UnstructuredGrid(const Index numElements, const Index numCorners, const Index numVertices,
50 const Meta &meta = Meta());
51
52 void resetElements() override;
53
54 shm<Byte>::array &tl() { return *d()->tl; }
55 const Byte *tl() const { return m_tl; }
56
57 bool isConvex(Index elem) const;
58 bool isGhostCell(Index elem) const override;
59 std::pair<Vector, Vector> cellBounds(Index elem) const override;
60 Index findCell(const Vector &point, Index hint = InvalidIndex, int flags = NoFlags) const override;
61 bool insideConvex(Index elem, const Vector &point) const;
62 bool inside(Index elem, const Vector &point) const override;
63 Index checkConvexity(); //< return number of non-convex cells
64 Scalar exitDistance(Index elem, const Vector &point, const Vector &dir) const override;
65
66 Interpolator getInterpolator(Index elem, const Vector &point, Mapping mapping = Vertex,
67 InterpolationMode mode = Linear) const override;
68 std::pair<Vector, Vector> elementBounds(Index elem) const override;
69 std::vector<Index> cellVertices(Index elem) const override;
70 Scalar cellDiameter(Index elem) const override;
71 Vector cellCenter(Index elem) const override;
72 std::vector<Index> getNeighborElements(Index elem) const override;
73 Index cellNumFaces(Index elem) const override;
74
75private:
76 mutable const Byte *m_tl;
77
80
81 Data(const Index numElements = 0, const Index numCorners = 0, const Index numVertices = 0,
82 const std::string &name = "", const Meta &meta = Meta());
83 static Data *create(const Index numElements = 0, const Index numCorners = 0, const Index numVertices = 0,
84 const Meta &meta = Meta());
85
87};
88
89} // namespace vistle
90#endif
Definition: grid.h:14
Definition: indexed.h:14
Definition: objectmeta.h:16
Type
Definition: object.h:84
Definition: unstr.h:13
Indexed Base
Definition: unstr.h:17
shm< Byte >::array & tl()
Definition: unstr.h:54
const Byte * tl() const
Definition: unstr.h:55
Definition: shm_reference.h:15
Definition: shm_array.h:19
#define V_COREEXPORT
Definition: export.h:9
@ NUM_TYPES
Definition: celltypes.h:32
@ NONE
Definition: celltypes.h:19
@ TRIANGLE
Definition: celltypes.h:21
@ POLYHEDRON
Definition: celltypes.h:31
@ BAR
Definition: celltypes.h:20
@ HEXAHEDRON
Definition: celltypes.h:26
@ VPOLYHEDRON
Definition: celltypes.h:27
@ PRISM
Definition: celltypes.h:25
@ PYRAMID
Definition: celltypes.h:24
@ TETRAHEDRON
Definition: celltypes.h:23
@ CONVEX_BIT
Definition: celltypes.h:15
@ TYPE_MASK
Definition: celltypes.h:16
@ CPOLYHEDRON
Definition: celltypes.h:30
@ QUAD
Definition: celltypes.h:22
@ POLYGON
Definition: celltypes.h:28
@ POINT
Definition: celltypes.h:29
@ GHOST_BIT
Definition: celltypes.h:14
Definition: allobjects.cpp:30
unsigned char Byte
Definition: scalar.h:9
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