VAPOR3 3.9.4
UnstructuredGrid.h
Go to the documentation of this file.
1#ifndef _UnstructuredGrid_
2#define _UnstructuredGrid_
3
4#include <ostream>
5#include <vector>
6#include <memory>
7#include <vapor/common.h>
8#include <vapor/Grid.h>
9
10#ifdef WIN32
11 #pragma warning(disable : 4661 4251) // needed for template class
12#endif
13
14namespace VAPoR {
15
42//
44public:
45 enum Location { NODE, CELL, EDGE };
46
116 //
117 UnstructuredGrid(const DimsType &vertexDims, const DimsType &faceDims, const DimsType &edgeDims, const DimsType &bs, const std::vector<float *> &blks, size_t topology_dimension,
118 const int *vertexOnFace, const int *faceOnVertex, const int *faceOnFace,
119 Location location, // node,face, edge
120 size_t maxVertexPerFace, size_t maxFacePerVertex, long nodeOffset, long cellOffset
121
122 );
123 UnstructuredGrid(const std::vector<size_t> &vertexDims, const std::vector<size_t> &faceDims, const std::vector<size_t> &edgeDims, const std::vector<size_t> &bs, const std::vector<float *> &blks,
124 size_t topology_dimension, const int *vertexOnFace, const int *faceOnVertex, const int *faceOnFace,
125 Location location, // node,face, edge
126 size_t maxVertexPerFace, size_t maxFacePerVertex, long nodeOffset, long cellOffset
127
128 );
129
130 UnstructuredGrid() = default;
131 virtual ~UnstructuredGrid() = default;
132
133 static std::string GetClassType() { return ("Unstructured"); }
134 std::string GetType() const override { return (GetClassType()); }
135
136 bool GetCellNodes(const DimsType &cindices, std::vector<DimsType> &nodes) const override;
137
140 virtual bool GetCellNeighbors(const DimsType &cindices, std::vector<DimsType> &cells) const override;
141
144 virtual bool GetNodeCells(const DimsType &indices, std::vector<DimsType> &cells) const override;
145
146 size_t GetMaxVertexPerFace() const override { return (_maxVertexPerFace); };
147
148 size_t GetMaxVertexPerCell() const override { return ((GetTopologyDim() == 3) ? 2 * GetMaxVertexPerFace() : GetMaxVertexPerFace()); };
149
152 const VAPoR::DimsType &GetNodeDimensions() const override;
153 const size_t GetNumNodeDimensions() const override;
154
157 const DimsType &GetCellDimensions() const override { return (_faceDims); }
158
159 virtual const size_t GetNumCellDimensions() const override { return (_nDims); }
160
163 const DimsType &GetEdgeDimensions() const { return (_edgeDims); }
164
169 size_t GetMissingID() const { return (_missingID); }
170 void SetMissingID(size_t v) { _missingID = v; }
171
176 size_t GetBoundaryID() const { return (_boundaryID); }
177 void SetBoundaryID(size_t v) { _boundaryID = v; }
178
179 virtual void ClampCoord(const CoordType &coords, CoordType &cCoords) const override { cCoords = coords; }
180
182 //
183 virtual void ClampCoord(const double coords[3], double cCoords[3]) const override { Grid::ClampCoord(coords, cCoords); }
184
185 // A no-op for unstructured grids. Needs to be set in the constuctor :-(
186 //
187 virtual void SetNodeOffset(long offset) override {}
188 virtual void SetCellOffset(long offset) override {}
189
191 //
192 // Iterators
193 //
195
196 VDF_API friend std::ostream &operator<<(std::ostream &o, const UnstructuredGrid &sg);
197
198protected:
199 const int *_vertexOnFace;
200 const int *_faceOnVertex;
201 const int *_faceOnFace;
205
206private:
207 DimsType _vertexDims;
208 DimsType _faceDims;
209 DimsType _edgeDims;
210 size_t _nDims;
211 int _missingID;
212 int _boundaryID;
213
214 void _unstructuredGrid(const DimsType &vertexDims, const DimsType &faceDims, const DimsType &edgeDims, const DimsType &bs, const std::vector<float *> &blks, size_t topology_dimension,
215 const int *vertexOnFace, const int *faceOnVertex, const int *faceOnFace,
216 Location location, // node,face, edge
217 size_t maxVertexPerFace, size_t maxFacePerVertex, long nodeOffset, long cellOffset
218
219 );
220};
221}; // namespace VAPoR
222
223#endif
Abstract base class for a 2D or 3D structured or unstructured grid.
Definition: Grid.h:56
Abstract base class for a 2D or 3D unstructured grid.
virtual ~UnstructuredGrid()=default
virtual void ClampCoord(const CoordType &coords, CoordType &cCoords) const override
UnstructuredGrid(const std::vector< size_t > &vertexDims, const std::vector< size_t > &faceDims, const std::vector< size_t > &edgeDims, const std::vector< size_t > &bs, const std::vector< float * > &blks, size_t topology_dimension, const int *vertexOnFace, const int *faceOnVertex, const int *faceOnFace, Location location, size_t maxVertexPerFace, size_t maxFacePerVertex, long nodeOffset, long cellOffset)
std::string GetType() const override
virtual void SetNodeOffset(long offset) override
const size_t GetNumNodeDimensions() const override
bool GetCellNodes(const DimsType &cindices, std::vector< DimsType > &nodes) const override
VDF_API friend std::ostream & operator<<(std::ostream &o, const UnstructuredGrid &sg)
void SetBoundaryID(size_t v)
size_t GetMaxVertexPerFace() const override
const DimsType & GetCellDimensions() const override
size_t GetMaxVertexPerCell() const override
static std::string GetClassType()
virtual bool GetCellNeighbors(const DimsType &cindices, std::vector< DimsType > &cells) const override
virtual void ClampCoord(const double coords[3], double cCoords[3]) const override
const VAPoR::DimsType & GetNodeDimensions() const override
const DimsType & GetEdgeDimensions() const
virtual void SetCellOffset(long offset) override
virtual bool GetNodeCells(const DimsType &indices, std::vector< DimsType > &cells) const override
UnstructuredGrid(const DimsType &vertexDims, const DimsType &faceDims, const DimsType &edgeDims, const DimsType &bs, const std::vector< float * > &blks, size_t topology_dimension, const int *vertexOnFace, const int *faceOnVertex, const int *faceOnFace, Location location, size_t maxVertexPerFace, size_t maxFacePerVertex, long nodeOffset, long cellOffset)
size_t GetBoundaryID() const
virtual const size_t GetNumCellDimensions() const override
#define VDF_API
Definition: common.h:73
std::array< double, 3 > CoordType
Type for specifying floating point coordinates.
Definition: Grid.h:23
std::array< size_t, 3 > DimsType
Type for specifying integer indices.
Definition: Grid.h:26