VAPOR3 3.9.4
UnstructuredGridLayered.h
Go to the documentation of this file.
1#ifndef _UnstructuredGridLayered_
2#define _UnstructuredGridLayered_
3
4#include <ostream>
5#include <vector>
6#include <memory>
7#include <vapor/common.h>
10
11#ifdef WIN32
12 #pragma warning(disable : 4661 4251) // needed for template class
13#endif
14
15namespace VAPoR {
16
21//
23public:
26 //
27 UnstructuredGridLayered(const DimsType &vertexDims, const DimsType &faceDims, const DimsType &edgeDims, const DimsType &bs, const std::vector<float *> &blks, const int *vertexOnFace,
28 const int *faceOnVertex, const int *faceOnFace,
29 Location location, // node,face, edge
30 size_t maxVertexPerFace, size_t maxFacePerVertex, long nodeOffset, long cellOffset, const UnstructuredGridCoordless &xug, const UnstructuredGridCoordless &yug,
31 const UnstructuredGridCoordless &zug, std::shared_ptr<const QuadTreeRectangleP> qtr);
32
33 UnstructuredGridLayered(const std::vector<size_t> &vertexDims, const std::vector<size_t> &faceDims, const std::vector<size_t> &edgeDims, const std::vector<size_t> &bs,
34 const std::vector<float *> &blks, const int *vertexOnFace, const int *faceOnVertex, const int *faceOnFace,
35 Location location, // node,face, edge
36 size_t maxVertexPerFace, size_t maxFacePerVertex, long nodeOffset, long cellOffset, const UnstructuredGridCoordless &xug, const UnstructuredGridCoordless &yug,
37 const UnstructuredGridCoordless &zug, std::shared_ptr<const QuadTreeRectangleP> qtr);
38
40 virtual ~UnstructuredGridLayered() = default;
41
42 std::shared_ptr<const QuadTreeRectangleP> GetQuadTreeRectangle() const { return (_ug2d.GetQuadTreeRectangle()); }
43
44 virtual DimsType GetCoordDimensions(size_t dim) const override;
45
46 virtual size_t GetGeometryDim() const override;
47
48 static std::string GetClassType() { return ("UnstructuredLayered"); }
49 std::string GetType() const override { return (GetClassType()); }
50
51 virtual void GetBoundingBox(const DimsType &min, const DimsType &max, CoordType &minu, CoordType &maxu) const override;
52
53 bool GetEnclosingRegion(const CoordType &minu, const CoordType &maxu, DimsType &min, DimsType &max) const override;
54
55 virtual void GetUserCoordinates(const DimsType &indices, CoordType &coords) const override;
56
57 bool GetIndicesCell(const CoordType &coords, DimsType &indices) const override;
58
59 bool InsideGrid(const CoordType &coords) const override;
60
61 float GetValueNearestNeighbor(const CoordType &coords) const override;
62
63 float GetValueLinear(const CoordType &coords) const override;
64
66 //
67 // Iterators
68 //
70
72 public:
75
78
79 virtual void next();
80 virtual void next(const long &offset);
81 virtual ConstCoordType &deref() const { return (_coords); }
82 virtual const void * address() const { return this; };
83
84 virtual bool equal(const void *rhs) const
85 {
86 const ConstCoordItrULayered *itrptr = static_cast<const ConstCoordItrULayered *>(rhs);
87
88 return (_itr2D == itrptr->_itr2D && _zCoordItr == itrptr->_zCoordItr);
89 }
90
91 virtual std::unique_ptr<ConstCoordItrAbstract> clone() const { return std::unique_ptr<ConstCoordItrAbstract>(new ConstCoordItrULayered(*this)); };
92
93 private:
94 const UnstructuredGridLayered * _ug;
96 ConstIterator _zCoordItr;
97 CoordType _coords;
98 size_t _nElements2D;
99 size_t _index2D;
100 };
101
102 virtual ConstCoordItr ConstCoordBegin() const override { return ConstCoordItr(std::unique_ptr<ConstCoordItrAbstract>(new ConstCoordItrULayered(this, true))); }
103 virtual ConstCoordItr ConstCoordEnd() const override { return ConstCoordItr(std::unique_ptr<ConstCoordItrAbstract>(new ConstCoordItrULayered(this, false))); }
104
105 VDF_API friend std::ostream &operator<<(std::ostream &o, const UnstructuredGridLayered &sg);
106
107protected:
108 virtual void GetUserExtentsHelper(CoordType &minu, CoordType &maxu) const override;
109
110private:
111 UnstructuredGrid2D _ug2d;
113
114 bool _insideGrid(const CoordType &coords, DimsType &cindices, std::vector<size_t> &nodes2D, std::vector<double> &lambda, float zwgt[2]) const;
115};
116}; // namespace VAPoR
117
118#endif
const CoordType ConstCoordType
Definition: Grid.h:936
class for a 2D unstructured grid.
class for a 2D unstructured grid.
ConstCoordItrULayered(const ConstCoordItrULayered &rhs)
virtual std::unique_ptr< ConstCoordItrAbstract > clone() const
ConstCoordItrULayered(const UnstructuredGridLayered *ug, bool begin)
class for a Layered unstructured grid.
std::string GetType() const override
virtual ~UnstructuredGridLayered()=default
UnstructuredGridLayered(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, const int *vertexOnFace, const int *faceOnVertex, const int *faceOnFace, Location location, size_t maxVertexPerFace, size_t maxFacePerVertex, long nodeOffset, long cellOffset, const UnstructuredGridCoordless &xug, const UnstructuredGridCoordless &yug, const UnstructuredGridCoordless &zug, std::shared_ptr< const QuadTreeRectangleP > qtr)
virtual ConstCoordItr ConstCoordEnd() const override
virtual DimsType GetCoordDimensions(size_t dim) const override
UnstructuredGridLayered(const DimsType &vertexDims, const DimsType &faceDims, const DimsType &edgeDims, const DimsType &bs, const std::vector< float * > &blks, const int *vertexOnFace, const int *faceOnVertex, const int *faceOnFace, Location location, size_t maxVertexPerFace, size_t maxFacePerVertex, long nodeOffset, long cellOffset, const UnstructuredGridCoordless &xug, const UnstructuredGridCoordless &yug, const UnstructuredGridCoordless &zug, std::shared_ptr< const QuadTreeRectangleP > qtr)
virtual void GetBoundingBox(const DimsType &min, const DimsType &max, CoordType &minu, CoordType &maxu) const override
bool InsideGrid(const CoordType &coords) const override
float GetValueLinear(const CoordType &coords) const override
virtual void GetUserCoordinates(const DimsType &indices, CoordType &coords) const override
virtual ConstCoordItr ConstCoordBegin() const override
Return constant grid coordinate iterator.
std::shared_ptr< const QuadTreeRectangleP > GetQuadTreeRectangle() const
virtual size_t GetGeometryDim() const override
float GetValueNearestNeighbor(const CoordType &coords) const override
virtual void GetUserExtentsHelper(CoordType &minu, CoordType &maxu) const override
bool GetIndicesCell(const CoordType &coords, DimsType &indices) const override
bool GetEnclosingRegion(const CoordType &minu, const CoordType &maxu, DimsType &min, DimsType &max) const override
VDF_API friend std::ostream & operator<<(std::ostream &o, const UnstructuredGridLayered &sg)
Abstract base class for a 2D or 3D unstructured grid.
#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