VAPoR
0.1
|
#include <RegularGrid.h>
Classes | |
class | ConstIterator |
class | Iterator |
Public Member Functions | |
RegularGrid (const size_t bs[3], const size_t min[3], const size_t max[3], const double extents[6], const bool periodic[3], float **blks) | |
RegularGrid (const size_t bs[3], const size_t min[3], const size_t max[3], const double extents[6], const bool periodic[3], float **blks, float missing_value) | |
virtual | ~RegularGrid () |
float & | AccessIJK (size_t i, size_t j, size_t k) const |
virtual float | GetValue (double x, double y, double z) const |
virtual void | GetUserExtents (double extents[6]) const |
virtual void | GetBoundingBox (const size_t min[3], const size_t max[3], double extents[6]) const |
virtual void | GetBoundingBox (const std::vector< size_t > &min, const std::vector< size_t > &max, std::vector< double > &minu, std::vector< double > &maxu) const |
virtual void | GetEnclosingRegion (const double minu[3], const double maxu[3], size_t min[3], size_t max[3]) const |
virtual void | GetIJKMinMax (size_t min[3], size_t max[3]) const |
virtual void | GetIJKOrigin (size_t min[3]) const |
void | GetDimensions (size_t dims[3]) const |
float | GetMissingValue () const |
void | SetMissingValue (float missing_value) |
bool | HasMissingData () const |
virtual int | GetInterpolationOrder () const |
virtual void | SetInterpolationOrder (int order) |
virtual int | GetUserCoordinates (size_t i, size_t j, size_t k, double *x, double *y, double *z) const |
void | getBilinearWeights (double x, double y, double z, double &iwgt, double &jwgt) const |
double | bilinearElevation (size_t i0, size_t i1, size_t j0, size_t j1, size_t k0, double iwgt, double jwgt) const |
double | bilinearInterpolation (size_t i0, size_t i1, size_t j0, size_t j1, size_t k0, double iwgt, double jwgt) const |
double | quadraticInterpolation (double x, double y, double z) const |
double | verticalLinearInterpolation (double x, double y, double z) const |
virtual void | GetIJKIndex (double x, double y, double z, size_t *i, size_t *j, size_t *k) const |
virtual void | GetIJKIndexFloor (double x, double y, double z, size_t *i, size_t *j, size_t *k) const |
virtual void | GetRange (float range[2]) const |
virtual int | Reshape (const size_t min[3], const size_t max[3], const bool periodic[3]) |
virtual bool | InsideGrid (double x, double y, double z) const |
virtual void | HasPeriodic (bool *idim, bool *jdim, bool *kdim) const |
virtual void | SetPeriodic (const bool periodic[3]) |
void | GetBlockSize (size_t bs[3]) const |
virtual void | GetMinCellExtents (double *x, double *y, double *z) const |
virtual int | GetRank () |
virtual double | _interpolateVaryingCoord (size_t, size_t, size_t, double, double, double) const |
float ** | GetBlks () const |
size_t | GetNumBlks () const |
float | Next () |
void | ResetItr () |
Iterator | begin () |
Iterator | end () |
ConstIterator | begin () const |
ConstIterator | end () const |
Protected Member Functions | |
float & | _AccessIJK (float **blks, size_t i, size_t j, size_t k) const |
void | _ClampCoord (double &x, double &y, double &z) const |
void | _SetExtents (const double extents[6]) |
Protected Attributes | |
size_t | _min [3] |
size_t | _max [3] |
Friends | |
VDF_API friend std::ostream & | operator<< (std::ostream &o, const RegularGrid &rg) |
Definition at line 36 of file RegularGrid.h.
VAPoR::RegularGrid::RegularGrid | ( | const size_t | bs[3], |
const size_t | min[3], | ||
const size_t | max[3], | ||
const double | extents[6], | ||
const bool | periodic[3], | ||
float ** | blks | ||
) |
Construct a regular grid sampling a 3D or 2D scalar function
The sampled function is represented as a 2D or 3D array, decomposed into smaller blocks. The dimensions of the array are not constrained to coincide with block boundaries.
If blks
is NULL a dataless RegularGrid object is returned. Data can not be retrieved from a dataless RegularGrid. However, coordinate access methods may still be invoked.
[in] | bs | A three-element vector specifying the dimensions of each block storing the sampled scalar function. |
[in] | min | A three-element vector specifying the ijk index of the first point in the grid. The first grid point need not coincide with block boundaries. I.e. the indecies need not be (0,0,0): the first grid point is not required to be the first element of the array. |
[in] | max | A three-element vector specifying the ijk index of the last point in the grid |
[in] | extents | A six-element vector specifying the user coordinates of the first (first three elements) and last (last three elements) of the grid points indicated by min and max , respectively. These two points define the extents of the smallest axis-aligned bounding box that completely encloses the grid. |
[in] | periodic | A three-element boolean vector indicating which i,j,k indecies, respectively, are periodic |
[in] | blks | An array of blocks containing the sampled function. The dimensions of each block is given by bs . The number of blocks is given by the product of the terms: |
over i = 0..2.
A shallow copy of the blocks is made by the constructor
VAPoR::RegularGrid::RegularGrid | ( | const size_t | bs[3], |
const size_t | min[3], | ||
const size_t | max[3], | ||
const double | extents[6], | ||
const bool | periodic[3], | ||
float ** | blks, | ||
float | missing_value | ||
) |
Construct a regular grid sampling a 3D or 2D scalar function that contains missing values.
This constructor adds a parameter, missing_value
, that specifies the value of missing values in the sampled function. When reconstructing the function at arbitrary coordinates special consideration is given to grid points with missing values that are used in the reconstruction.
|
virtual |
|
protected |
|
protected |
|
inlinevirtual |
Definition at line 562 of file RegularGrid.h.
|
protected |
float& VAPoR::RegularGrid::AccessIJK | ( | size_t | i, |
size_t | j, | ||
size_t | k | ||
) | const |
Set or Get the data value at the indicated grid point
This method provides read or write access to the scalar data value defined at the grid point indicated by index(i,j,k). The range of valid indecies is between zero and dim - 1, where dim is the dimesion of the grid returned by GetDimensions()
If any of the indecies i
, j
, or k
are outside of the valid range the results are undefined
[in] | i | index of grid point along fastest varying dimension |
[in] | j | index of grid point along second fastest varying dimension |
[in] | k | index of grid point along third fastest varying dimension |
|
inline |
Definition at line 612 of file RegularGrid.h.
|
inline |
Definition at line 646 of file RegularGrid.h.
double VAPoR::RegularGrid::bilinearElevation | ( | size_t | i0, |
size_t | i1, | ||
size_t | j0, | ||
size_t | j1, | ||
size_t | k0, | ||
double | iwgt, | ||
double | jwgt | ||
) | const |
double bilinearElevation(double x, double y, size_t k, double *iwgt, double *jwgt) const; Return the bilinearly interpolated elevation of a point given in user coordinates.
This function applies the bilinear interpolation method to derive a the elevation from x and y axis weights of a point in user coordinates.
[in] | i | index of bottom left cell corner |
[in] | i | index of top right cell corner |
[in] | j | index of bottom left cell corner |
[in] | j | index of top right cell corner |
[in] | k | index of the level to interpolate upon |
[in] | the | i-axis weight for bilinear interpolation |
[in] | the | j-axis weight for bilinear interpolation |
[out] | a | bilinearly calculated elevation value |
double VAPoR::RegularGrid::bilinearInterpolation | ( | size_t | i0, |
size_t | i1, | ||
size_t | j0, | ||
size_t | j1, | ||
size_t | k0, | ||
double | iwgt, | ||
double | jwgt | ||
) | const |
double bilinearInterpolation(double x, double y, size_t k, double *iwgt, double *jwgt) const; Return the bilinearly interpolated value of the currently opened variable of a point given in user coordinates.
This function applies the bilinear interpolation method to derive a variable value from x and y axis weights of a point in user coordinates.
[in] | i | index of bottom left cell corner |
[in] | i | index of top right cell corner |
[in] | j | index of bottom left cell corner |
[in] | j | index of top right cell corner |
[in] | k | index of the level to interpolate upon |
[in] | the | i-axis weight for bilinear interpolation |
[in] | the | j-axis weight for bilinear interpolation |
[out] | a | bilinearly calculated value of the currently open variable |
|
inline |
Definition at line 613 of file RegularGrid.h.
|
inline |
Definition at line 647 of file RegularGrid.h.
void VAPoR::RegularGrid::getBilinearWeights | ( | double | x, |
double | y, | ||
double | z, | ||
double & | iwgt, | ||
double & | jwgt | ||
) | const |
void getBilinearWeights(double x, double y, size_t k, double *iwgt, double *jwgt) const; Return the bilinear interpolation weights of a point given in user coordinates. These weights apply to the x (iwgt) and y (jwgt) axes.
This function applies the bilinear interpolation method to derive a the x and y axis weights of a point in user coordinates.
[in] | x | coordinate of grid point along fastest varying dimension |
[in] | y | coordinate of grid point along second fastest varying dimension |
[out] | a | bilinearly calculated weight for the x axis |
[out] | a | bilinearly calculated weight for the y axis |
|
inline |
Return the internal data structure containing a copy of the blocks passed in by the constructor
Definition at line 569 of file RegularGrid.h.
|
inline |
Definition at line 532 of file RegularGrid.h.
|
virtual |
Return the extents of the axis-aligned bounding box enclosign a region
This method returns min and max extents, in user coordinates, of the smallest axis-aligned box enclosing the region defined by the corner grid points, min
and max
.
min
is greater than the coresponding coordinate of max
.[out] | extents | A six-element array, the first three values will contain the minimum coordinate, and the last three values the maximum coordinate |
Reimplemented in VAPoR::SphericalGrid, VAPoR::StretchedGrid, and VAPoR::LayeredGrid.
|
virtual |
void VAPoR::RegularGrid::GetDimensions | ( | size_t | dims[3] | ) | const |
Return the ijk dimensions of grid
Returns the number of grid points defined along each axis of the grid
[out] | dims | A three element array containing the grid dimensions |
|
virtual |
Get voxel coordinates of grid containing a region
Calculates the starting and ending IJK voxel coordinates of the smallest grid completely containing the rectangular region defined by the user coordinates minu
and maxu
If rectangluar region defined by minu
and maxu
can not be contained the minimum and maximum IJK coordinates are returned in min
and max
, respectively
[in] | minu | User coordinates of minimum coorner |
[in] | maxu | User coordinates of maximum coorner |
[out] | min | Integer coordinates of minimum coorner |
[out] | max | Integer coordinates of maximum coorner |
Reimplemented in VAPoR::SphericalGrid, VAPoR::StretchedGrid, and VAPoR::LayeredGrid.
|
virtual |
Return the closest grid point to the specified user coordinates
This method returns the ijk index of the grid point closest to the specified user coordinates based on Euclidean distance. If any of the input coordinates correspond to periodic dimensions the the coordinate(s) are first re-mapped to lie inside the grid extents as returned by GetUserExtents()
[in] | x | coordinate along fastest varying dimension |
[in] | y | coordinate along second fastest varying dimension |
[in] | z | coordinate along third fastest varying dimension |
[out] | i | index of grid point along fastest varying dimension |
[out] | j | index of grid point along second fastest varying dimension |
[out] | k | index of grid point along third fastest varying dimension |
Reimplemented in VAPoR::SphericalGrid, VAPoR::StretchedGrid, and VAPoR::LayeredGrid.
|
virtual |
Return the corner grid point of the cell containing the specified user coordinates
This method returns the smallest ijk index of the grid point of associated with the cell containing the specified user coordinates. If any of the input coordinates correspond to periodic dimensions the the coordinate(s) are first re-mapped to lie inside the grid extents as returned by GetUserExtents()
If the specified coordinates lie outside of the grid (are not contained by any cell) the lowest valued ijk index of the grid points defining the boundary cell closest to the point are returned.
[in] | x | coordinate along fastest varying dimension |
[in] | y | coordinate along second fastest varying dimension |
[in] | z | coordinate along third fastest varying dimension |
[out] | i | index of grid point along fastest varying dimension |
[out] | j | index of grid point along second fastest varying dimension |
[out] | k | index of grid point along third fastest varying dimension |
Reimplemented in VAPoR::SphericalGrid, VAPoR::StretchedGrid, and VAPoR::LayeredGrid.
|
inlinevirtual |
Return the min and max valid IJK index
This method returns the minimum and maximum valid IJK index
[out] | min[3] | Minimum valid IJK index |
[out] | max[3] | Maximum valid IJK index |
Definition at line 219 of file RegularGrid.h.
|
inlinevirtual |
Return the origin of the grid in global IJK coordinates
This method returns the value of the min
parameter passed to the constructor
[out] | min[3] | Minimum IJK coordinates in global grid coordinates |
Definition at line 231 of file RegularGrid.h.
|
inlinevirtual |
Return the interpolation order to be used during function reconstruction
This method returns the order of the interpolation method that will be used when reconstructing the sampled scalar function
Definition at line 279 of file RegularGrid.h.
|
inlinevirtual |
Return the minimum grid spacing between all grid points
This method returns the minimum distance, in user coordinates, between adjacent grid points for all cells in the grid.
[out] | x | Minimum distance between grid points along X axis |
[out] | y | Minimum distance between grid points along Y axis |
[out] | z | Minimum distance between grid points along Z axis |
Reimplemented in VAPoR::LayeredGrid, and VAPoR::StretchedGrid.
Definition at line 547 of file RegularGrid.h.
|
inline |
Return the value of the missing_value parameter
The missing value is a special value intended to indicate that the value of the sampled or reconstructed function is unknown at a particular point.
Definition at line 249 of file RegularGrid.h.
|
inline |
Return the number of blocks that were passed in to the constructor
Definition at line 573 of file RegularGrid.h.
|
virtual |
Return the min and max data value
This method returns the values of grid points with min and max values, respectively.
[out] | range[2] | A two-element array containing the mininum and maximum values, in that order |
|
inlinevirtual |
Return the rank of the grid
This method returns the number of dimensions, between 1 and 3, that do not have a length of 1
Definition at line 556 of file RegularGrid.h.
|
virtual |
Return the user coordinates of a grid point
This method returns the user coordinates of the grid point specified by index(i,j,k)
[in] | i | index of grid point along fastest varying dimension |
[in] | j | index of grid point along second fastest varying dimension |
[in] | k | index of grid point along third fastest varying dimension |
[out] | x | coordinate of grid point along fastest varying dimension |
[out] | y | coordinate of grid point along second fastest varying dimension |
[out] | z | coordinate of grid point along third fastest varying dimension |
status | A negative int is returned if index(i,j,k) is out out of bounds |
Reimplemented in VAPoR::SphericalGrid, VAPoR::StretchedGrid, and VAPoR::LayeredGrid.
|
virtual |
Return the extents of the user coordinate system
This method returns min and max extents of the user coordinate system defined on the grid. The minimum extent is the coordinate of the grid point with index(0,0,0). The maximum extent is the coordinate of the grid point with index(nx-1, ny-1, nz-1), where nx, ny, and nz are the I, J, K dimensions, respectively.
[out] | extents | A six-element array, the first three values will contain the minimum coordinate, and the last three values the maximum coordinate |
Reimplemented in VAPoR::SphericalGrid, VAPoR::StretchedGrid, and VAPoR::LayeredGrid.
|
virtual |
Get the reconstructed value of the sampled scalar function
This method reconstructs the scalar field at an arbitrary point in space. If the point's coordinates are outside of the grid's coordinate extents as returned by GetUserExtents(), and the grid is not periodic along the out-of-bounds axis, the value returned will be the missing_value.
If the value of any of the grid point samples used in the reconstruction is the missing_value then the result returned is the missing_value.
The reconstruction method used is determined by interpolation order returned by GetInterpolationOrder()
[in] | x | coordinate along fastest varying dimension |
[in] | y | coordinate along second fastest varying dimension |
[in] | z | coordinate along third fastest varying dimension |
Reimplemented in VAPoR::StretchedGrid, VAPoR::SphericalGrid, and VAPoR::LayeredGrid.
|
inline |
Return missing data flag
This method returns true iff the class instance was created with the constructor specifying missing_value
parameter or if the SetMissingValue() method has been called. This does not imply that grid points exist with missing data, only that the class was constructed with the missing data version of the constructor.
Definition at line 270 of file RegularGrid.h.
|
inlinevirtual |
Check for periodic boundaries
This method returns a boolean for each dimension indicating whether the data along that dimension has periodic boundaries.
[out] | idim | periodicity of fastest varying dimension |
[out] | jdim | periodicity of second fastest varying dimension |
[out] | kdim | periodicity of third fastest varying dimension |
Definition at line 514 of file RegularGrid.h.
|
virtual |
Return true if the specified point lies inside the grid
This method can be used to determine if a point expressed in user coordinates reside inside or outside the grid
[in] | x | coordinate along fastest varying dimension |
[in] | y | coordinate along second fastest varying dimension |
[in] | z | coordinate along third fastest varying dimension |
bool | True if point is inside the grid |
Reimplemented in VAPoR::SphericalGrid, and VAPoR::LayeredGrid.
float VAPoR::RegularGrid::Next | ( | ) |
double VAPoR::RegularGrid::quadraticInterpolation | ( | double | x, |
double | y, | ||
double | z | ||
) | const |
Return the interpolated value of a point in user coordinates. This only interpolates in the vertical (z) direction. Return the quadratically interpolated value of a point in user coordinates.
This function applies the quadratic interpolation method to derive a the value of a variable in user coordinates from its neighboring points in ijk space. Linear interpolation is applied at the boundaries of the domain.
[in] | x | coordinate of grid point along fastest varying dimension |
[in] | y | coordinate of grid point along second fastest varying dimension |
[in] | z | coordinate of grid point along third fastest varying dimension |
[out] | a | quadratically interpolated value of a point in user coordinates |
void VAPoR::RegularGrid::ResetItr | ( | ) |
|
virtual |
Change the voxel exents specified by the constructor
This method permits the grid to be reshaped under the constraints that: 1) the number of blocks does not change, and 2) the grid can only get smaller, not larger. I.e. min
can only increase and max
can only decrease.
[in] | min | A three-element vector specifying the ijk index of the first point in the grid. The first grid point need not coincide with block boundaries. I.e. the indecies need not be (0,0,0): the first grid point is not required to be the first element of the array |
[in] | max | A three-element vector specifying the ijk index of the last point in the grid. |
[in] | periodic | A three-element boolean vector indicating which i,j,k indecies, respectively, are periodic |
Reimplemented in VAPoR::SphericalGrid, VAPoR::StretchedGrid, and VAPoR::LayeredGrid.
|
virtual |
Set the interpolation order to be used during function reconstruction
This method sets the order of the interpolation method that will be used when reconstructing the sampled scalar function. Valid values of order
are 0 and 1, corresponding to nearest-neighbor and linear interpolation, respectively. If order
is invalid it will be silently set to 1. The default interpolation order is 1
[in] | order | interpolation order |
|
inline |
Set the missing value indicator
This method sets the value of the missing value indicator. The method does not the value of any grid point locations.
Definition at line 258 of file RegularGrid.h.
|
inlinevirtual |
Set periodic boundaries
This method changes the periodicity of boundaries set by the class constructor
[in] | periodic | A three-element boolean vector indicating which i,j,k indecies, respectively, are periodic |
Reimplemented in VAPoR::LayeredGrid.
Definition at line 526 of file RegularGrid.h.
double VAPoR::RegularGrid::verticalLinearInterpolation | ( | double | x, |
double | y, | ||
double | z | ||
) | const |
Return the linearly interpolated value of a point in user coordinates. This only interpolates in the vertical (z) direction.
[in] | x | coordinate of grid point along fastest varying dimension |
[in] | y | coordinate of grid point along second fastest varying dimension |
[in] | z | coordinate of grid point along third fastest varying dimension |
[out] | a | linearly interpolated value of a point in user coordinates. |
|
friend |
|
protected |
Definition at line 663 of file RegularGrid.h.
|
protected |
Definition at line 662 of file RegularGrid.h.