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