VAPOR3 3.9.4
SphericalGrid.h
Go to the documentation of this file.
1#ifndef _SphericalGrid_
2#define _SphericalGrid_
3#include <vector>
4#include <vapor/common.h>
5#include "RegularGrid.h"
6#ifdef _WINDOWS
7 #pragma warning(disable : 4251 4100)
8#endif
9
10namespace VAPoR {
11
28//
30public:
68 SphericalGrid(const size_t bs[3], const size_t min[3], const size_t max[3], const double extents[6], const size_t permutation[3], const bool periodic[3], float **blks);
69
82 SphericalGrid(const size_t bs[3], const size_t min[3], const size_t max[3], const double extents[6], const size_t permutation[3], const bool periodic[3], float **blks, float missing_value);
83
86 float GetValue(double x, double y, double z) const;
87
91 //
92 virtual void GetUserExtents(double extents[6]) const
93 {
94 for (int i = 0; i < 6; i++) extents[i] = _extentsC[i];
95 };
96
99 virtual void GetBoundingBox(const size_t min[3], const size_t max[3], double extents[6]) const;
100
103 int GetUserCoordinates(size_t i, size_t j, size_t k, double *x, double *y, double *z) const;
104
107 void GetIJKIndex(double x, double y, double z, size_t *i, size_t *j, size_t *k) const;
108
111 void GetIJKIndexFloor(double x, double y, double z, size_t *i, size_t *j, size_t *k) const;
112
124 bool InsideGrid(double x, double y, double z) const;
125
126 // phi is in range -180 to 180, theta is in range -180/2 to 180/2
127 //
128 static inline void CartToSph(double x, double y, double z, double *phi, double *theta, double *r);
129
130 static inline void SphToCart(double phi, double theta, double r, double *x, double *y, double *z);
131
132private:
133 double _extentsC[6]; // extents in Cartesian coordinates, ordered x,y,z
134 std::vector<long> _permutation; // permutation vector for coordinate ordering
135
136 void _GetUserExtents(double extents[6]) const;
137
138 void _permute(const std::vector<long> &permutation, double result[3], double x, double y, double z) const;
139};
140}; // namespace VAPoR
141#endif
This class implements a 2D or 3D regular grid.
Definition: RegularGrid.h:25
This class implements a 2D or 3D spherical grid.
Definition: SphericalGrid.h:29
static void CartToSph(double x, double y, double z, double *phi, double *theta, double *r)
virtual void GetBoundingBox(const size_t min[3], const size_t max[3], double extents[6]) const
virtual void GetUserExtents(double extents[6]) const
Definition: SphericalGrid.h:92
int GetUserCoordinates(size_t i, size_t j, size_t k, double *x, double *y, double *z) const
SphericalGrid(const size_t bs[3], const size_t min[3], const size_t max[3], const double extents[6], const size_t permutation[3], const bool periodic[3], float **blks)
float GetValue(double x, double y, double z) const
static void SphToCart(double phi, double theta, double r, double *x, double *y, double *z)
void GetIJKIndex(double x, double y, double z, size_t *i, size_t *j, size_t *k) const
SphericalGrid(const size_t bs[3], const size_t min[3], const size_t max[3], const double extents[6], const size_t permutation[3], const bool periodic[3], float **blks, float missing_value)
bool InsideGrid(double x, double y, double z) const
void GetIJKIndexFloor(double x, double y, double z, size_t *i, size_t *j, size_t *k) const
#define VDF_API
Definition: common.h:73