VAPOR3 3.9.4
ArbitrarilyOrientedRegularGrid.h
Go to the documentation of this file.
1#pragma once
2
3#include <ostream>
4#include <vector>
5#include <vapor/common.h>
6#include <vapor/RegularGrid.h>
7#include <glm/glm.hpp>
8
9// clang-format off
10
16 size_t sideSize;
17 std::vector<double> origin;
18 std::vector<double> normal;
21};
22
23namespace VAPoR {
24
40
42public:
44 const VAPoR::Grid* grid3d,
46 const DimsType& dims
47 );
48
51
52 static std::string GetClassType() { return ("ArbitrarilyOrientedRegular"); }
53 std::string GetType() const override { return (GetClassType()); }
54
56 //
57 virtual void GetUserCoordinates(const DimsType &indices, CoordType &coords) const override;
58
59 // Deleted fuctions that use CoordType
60 virtual void GetUserCoordinates (size_t i, size_t j, size_t k, double &x, double &y, double &z) = delete;
61 virtual void GetUserExtents (CoordType &minu, CoordType &maxu) = delete;
62 virtual void GetBoundingBox (const DimsType &min, const DimsType &max, CoordType &minu, CoordType &maxu) = delete;
63 virtual bool GetEnclosingRegion (const CoordType &minu, const CoordType &maxu, DimsType &min, DimsType &max) = delete;
64 virtual bool GetIndicesCell (const CoordType &coords, DimsType &indices) = delete;
65 virtual bool InsideGrid (const CoordType &coords) = delete;
66 virtual void ClampCoord (const CoordType &coords, CoordType &cCoords) = delete;
67
68 static glm::vec3 GetNormalFromRotations(const std::vector<double> &rotations);
69 static std::pair<float, float> GetOffsetRange(const planeDescription &pd);
70
71private:
72 std::vector<glm::tvec2<double, glm::highp>> _rectangle2D;
73 size_t _sideSize;
74 glm::tvec3<double, glm::highp> _normal, _origin, _axis1, _axis2;
75 float* _myBlks;
76
77 void _makeEmptyGrid();
78
79 void _populateData(
80 const VAPoR::Grid *grid,
81 const planeDescription& description
82 );
83
84 void _getMinimumAreaRectangle(
85 const std::vector<glm::tvec3<double, glm::highp>>& vertices
86 );
87
88 void _findIntercepts(
89 const VAPoR::CoordType& boxMin,
90 const VAPoR::CoordType& boxMax,
91 std::vector<glm::tvec3<double, glm::highp>> &vertices
92 );
93
94 glm::tvec3<double, glm::highp> _getOrthogonal(
95 const glm::tvec3<double, glm::highp>& u
96 );
97
98 void _rotate();
99};
100}; // namespace VAPoR
101
102// clang-format on
virtual bool InsideGrid(const CoordType &coords)=delete
virtual void GetUserCoordinates(size_t i, size_t j, size_t k, double &x, double &y, double &z)=delete
virtual void GetUserExtents(CoordType &minu, CoordType &maxu)=delete
static std::pair< float, float > GetOffsetRange(const planeDescription &pd)
virtual void ClampCoord(const CoordType &coords, CoordType &cCoords)=delete
virtual bool GetEnclosingRegion(const CoordType &minu, const CoordType &maxu, DimsType &min, DimsType &max)=delete
virtual bool GetIndicesCell(const CoordType &coords, DimsType &indices)=delete
static glm::vec3 GetNormalFromRotations(const std::vector< double > &rotations)
virtual void GetUserCoordinates(const DimsType &indices, CoordType &coords) const override
ArbitrarilyOrientedRegularGrid(const VAPoR::Grid *grid3d, planeDescription &pd, const DimsType &dims)
virtual void GetBoundingBox(const DimsType &min, const DimsType &max, CoordType &minu, CoordType &maxu)=delete
Abstract base class for a 2D or 3D structured or unstructured grid.
Definition: Grid.h:56
This class implements a 2D or 3D regular grid.
Definition: RegularGrid.h:25
#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
std::vector< double > origin
std::vector< double > normal