VAPoR
0.1
|
This class manages an Adaptive Mesh Refinement grid. More...
#include <AMRData.h>
Public Member Functions | |
AMRData (const AMRTree *tree, const size_t cell_dim[3], const size_t bmin[3], const size_t bmax[3], int reflevel=-1) | |
AMRData (const AMRTree *tree, const size_t cell_dim[3], int reflevel=-1) | |
AMRData (const AMRTree *tree) | |
AMRData (const AMRTree *tree, const size_t cell_dim[3], const int paramesh_gids[][15], const float paramesh_bboxs[][3][2], const float paramesh_unk[], int total_blocks, int reflevel=-1) | |
virtual | ~AMRData () |
int | SetRegion (const size_t min[3], const size_t max[3], int reflevel) |
void | GetRegion (const size_t **min, const size_t **max, int *reflevel) const |
void | Update () |
int | WriteNCDF (const string &path, int reflevel=-1) |
int | ReadNCDF (const string &path, const size_t bmin[3], const size_t bmax[3], int reflevel=-1) |
int | ReadNCDF (const string &path, int reflevel=-1) |
float * | GetBlock (AMRTree::cid_t cellid) const |
int | ReGrid (const size_t bmin[3], const size_t bmax[3], int reflevel, float *grid, const size_t dim[3]) const |
const float * | GetDataRange () const |
const AMRTree * | GetTree () const |
void | GetBounds (size_t bmin[3], size_t bmax[3]) const |
Public Member Functions inherited from VetsUtil::MyBase | |
MyBase () | |
const string & | getClassName () const |
Static Public Member Functions | |
static int | ReadAttributesNCDF (const string &path, size_t cell_dim[3], size_t bmin[3], size_t bmax[3], float data_range[2], int &reflevel, size_t &num_nodes) |
Static Public Member Functions inherited from VetsUtil::MyBase | |
static void | SetErrMsg (const char *format,...) |
Record a formatted error message. More... | |
static void | SetErrMsg (int errcode, const char *format,...) |
Record a formatted error message and an error code. More... | |
static const char * | GetErrMsg () |
static void | SetErrCode (int err_code) |
Record an error code. More... | |
static int | GetErrCode () |
Retrieve the current error code. More... | |
static void | SetErrMsgCB (ErrMsgCB_T cb) |
static ErrMsgCB_T | GetErrMsgCB () |
static void | SetErrMsgFilePtr (FILE *fp) |
static const FILE * | SetErrMsgFilePtr () |
static void | SetDiagMsg (const char *format,...) |
Record a formatted diagnostic message. More... | |
static const char * | GetDiagMsg () |
static void | SetDiagMsgCB (DiagMsgCB_T cb) |
static DiagMsgCB_T | GetDiagMsgCB () |
static void | SetDiagMsgFilePtr (FILE *fp) |
static bool | EnableErrMsg (bool enable) |
Additional Inherited Members | |
Public Types inherited from VetsUtil::MyBase | |
typedef void(* | ErrMsgCB_T) (const char *msg, int err_code) |
typedef void(* | DiagMsgCB_T) (const char *msg) |
Static Public Attributes inherited from VetsUtil::MyBase | |
static char * | ErrMsg |
static int | ErrCode |
static int | ErrMsgSize |
static FILE * | ErrMsgFilePtr |
static ErrMsgCB_T | ErrMsgCB |
static char * | DiagMsg |
static int | DiagMsgSize |
static FILE * | DiagMsgFilePtr |
static DiagMsgCB_T | DiagMsgCB |
static bool | Enabled |
Protected Member Functions inherited from VetsUtil::MyBase | |
void | SetClassName (const string &name) |
This class manages an Adaptive Mesh Refinement grid.
This class manages block-structured Adaptive Mesh Refinement grids. The AMR grid is composed of a Cartesian base grid of cells (blocks) that are recursively refined into octants. The representation of the tree data structure is managed by a AMRTree object.
This class is derived from the MyBase base class. Hence all of the methods make use of MyBase's error reporting capability - the success of any method (including constructors) can (and should) be tested with the GetErrCode() method. If non-zero, an error message can be retrieved with GetErrMsg().
VAPoR::AMRData::AMRData | ( | const AMRTree * | tree, |
const size_t | cell_dim[3], | ||
const size_t | bmin[3], | ||
const size_t | bmax[3], | ||
int | reflevel = -1 |
||
) |
Constructor for the AMRData class.
Construct block structured AMR grid data object. The
tree | parameter defines the octree hierarchy for the grid. The AMR grid defined by this object may be a subdomain of the tree pointed to by tree . The bmin and bmax parameters may be used to restrict the spatial domain to a subset of base blocks. Similarly, the reflevel parameter may be used to restrict the refinement level | |
[in] | tree | A pointer to an initialized AMRTree |
[in] | cell_dim | A three-element array specifying the topological dimensions, in voxels, of all blocks in the grid |
[in] | bmin | A three-element array specifying the coordinates, in base blocks, of the minimum extents of the subgrid. The default is (0,0,0). |
[in] | bmax | A three-element array specifying the coordinates, in base blocks, of the maximum extents of the subgrid. The default is is AMRTree::GetBaseDim()[i] - 1 |
[in] | reflevel | The maximum refinement level of the grid. If a negative value is specified, the refinement level of the tree pointed to by the tree parameter is used. |
VAPoR::AMRData::AMRData | ( | const AMRTree * | tree, |
const size_t | cell_dim[3], | ||
int | reflevel = -1 |
||
) |
Constructor for the AMRData class.
Construct block structured AMR grid data object. The
tree | parameter defines the octree hierarchy for the grid. The AMR grid defined by this object may be a subdomain of the tree pointed to by tree . The bmin and bmax parameters may be used to restrict the spatial domain to a subset of base blocks. Similarly, the reflevel parameter may be used to restrict the refinement level | |
[in] | tree | A pointer to an initialized AMRTree |
[in] | cell_dim | A three-element array specifying the topological dimensions, in voxels, of all blocks in the grid |
[in] | bmin | A three-element array specifying the coordinates, in base blocks, of the minimum extents of the subgrid. The default is (0,0,0). |
[in] | bmax | A three-element array specifying the coordinates, in base blocks, of the maximum extents of the subgrid. The default is is AMRTree::GetBaseDim()[i] - 1 |
[in] | reflevel | The maximum refinement level of the grid. If a negative value is specified, the refinement level of the tree pointed to by the tree parameter is used. |
VAPoR::AMRData::AMRData | ( | const AMRTree * | tree | ) |
Constructor for the AMRData class.
Construct block structured AMR grid data object. The
tree | parameter defines the octree hierarchy for the grid. The AMR grid defined by this object may be a subdomain of the tree pointed to by tree . The bmin and bmax parameters may be used to restrict the spatial domain to a subset of base blocks. Similarly, the reflevel parameter may be used to restrict the refinement level | |
[in] | tree | A pointer to an initialized AMRTree |
[in] | cell_dim | A three-element array specifying the topological dimensions, in voxels, of all blocks in the grid |
[in] | bmin | A three-element array specifying the coordinates, in base blocks, of the minimum extents of the subgrid. The default is (0,0,0). |
[in] | bmax | A three-element array specifying the coordinates, in base blocks, of the maximum extents of the subgrid. The default is is AMRTree::GetBaseDim()[i] - 1 |
[in] | reflevel | The maximum refinement level of the grid. If a negative value is specified, the refinement level of the tree pointed to by the tree parameter is used. |
VAPoR::AMRData::AMRData | ( | const AMRTree * | tree, |
const size_t | cell_dim[3], | ||
const int | paramesh_gids[][15], | ||
const float | paramesh_bboxs[][3][2], | ||
const float | paramesh_unk[], | ||
int | total_blocks, | ||
int | reflevel = -1 |
||
) |
Constructor an AMRData object from a Paramesh (FLASH) AMR data set.
Construct block structured AMR grid data object using a Paramesh (FLASH) AMR data set to populate the grid's data elements. The reflevel
parameter may be used to restrict the refinement level
[in] | tree | A pointer to an initialized AMRTree |
[in] | cell_dim | A three-element array specifying the topological dimensions, in voxels, of all blocks in the grid |
[in] | paramesh_gids | A paramesh global identifier array |
[in] | paramesh_bboxs | An array of Paramesh bounding boxes |
[in] | paramesh_unk | A paramesh dependent data array |
[in] | paramesh_total_blocks | Total number of nodes (both leaf and |
[in] | reflevel | The maximum refinement level of the grid. If a negative value is specified, the refinement level of the tree pointed to by the tree parameter is used. |
float* VAPoR::AMRData::GetBlock | ( | AMRTree::cid_t | cellid | ) | const |
Get a block of data from the AMR grid
This method returns a pointer to the block of field data associated with the cell id indicated by the cellid
parameter
[in] | cellid | The cell identifier of the block to be returned. |
data | A pointer to a block of field values |
|
inline |
|
inline |
Return the data range for the grid
The method returns the minimum and maximum data values, respectively, for the current AMR grid.
[out] | range | Min and Max data values, respectively |
status | A negative integer is returned on failure, otherwise the method has succeeded. |
void VAPoR::AMRData::GetRegion | ( | const size_t ** | min, |
const size_t ** | max, | ||
int * | reflevel | ||
) | const |
Retrieve the current defined region of interest
This method returns the parameters defining the AMR data objects region of interest
|
static |
Read AMRData attributes from a netCDF file
This static method can be used to return attribute data from a netCDF file generated by WriteNCDF().
[in] | path | String containing path to input file |
[out] | cell_dim | Three element array containing the the dimensions of each cell in the AMR data structure |
[out] | bmin | Minimum bounds of AMR mesh in block coordinates |
[out] | bmax | Maximum bounds of AMR mesh in block coordinates |
[out] | data_range | Minimum and maximum values of floating point data stored in the mesh. |
[out] | num_nodes | Total number of nodes (blocks) in AMR mesh |
status | A negative int is returned on failure. |
int VAPoR::AMRData::ReadNCDF | ( | const string & | path, |
const size_t | bmin[3], | ||
const size_t | bmax[3], | ||
int | reflevel = -1 |
||
) |
Read an AMR data object from a file
Read an ARM data object from a file. The subregion of the data read is determined by the objects currently defined extents and the refinement level specified by the reflevel
parameter
[in] | path | Path name of the file to be read |
[in] | reflevel | The maximum refinement level to write. If negative, the maximum current refinement level defined by the object is read |
[in] | bmin | Minimum bounds of data subregion expressed in block coordinates. The default is the minimum bounds the object was constructed with. |
[in] | bmax | Maximum bounds of data subregion expressed in block coordinates. The default is the maximum bounds the object was constructed with. |
int VAPoR::AMRData::ReadNCDF | ( | const string & | path, |
int | reflevel = -1 |
||
) |
Read an AMR data object from a file
Read an ARM data object from a file. The subregion of the data read is determined by the objects currently defined extents and the refinement level specified by the reflevel
parameter
[in] | path | Path name of the file to be read |
[in] | reflevel | The maximum refinement level to write. If negative, the maximum current refinement level defined by the object is read |
[in] | bmin | Minimum bounds of data subregion expressed in block coordinates. The default is the minimum bounds the object was constructed with. |
[in] | bmax | Maximum bounds of data subregion expressed in block coordinates. The default is the maximum bounds the object was constructed with. |
int VAPoR::AMRData::ReGrid | ( | const size_t | bmin[3], |
const size_t | bmax[3], | ||
int | reflevel, | ||
float * | grid, | ||
const size_t | dim[3] | ||
) | const |
Resample an AMR grid to a Cartesian grid
This method permits the resampling of the AMR grid represented by this object to a regular, Cartesian grid. The refinemenlevel
parameter indicates the refinement level of the AMR grid to use in the resampling. AMR blocks, intersecting the domain of interest that are coarser than the indicated refinement level, are interpolated to match the desired refinement level. The default interpolation method is linear.
[in] | bmin | A three-element array specifying, in blocks, the minimum extents of the region of interest. The coordinate system employed is relative to the refinement level. I.e. with each successive refinement level the coordinate of a voxel is given by xyz = xyz' * 2, where xyz' is the coordinate a the preceeding level. |
[in] | bmax | A three-element array specifying, in blocks, the maximum extents of the region of interest. |
[in] | reflevel | The maximum refinement level of the grid. If a negative value is specified, the refinement level of the tree pointed to by the tree parameter is used. |
[out] | grid | A pointer to floating point array large enough to to contain the resampled data (bmax[i] - bmin[i] + 1); |
status | A non-negative value is returned upon success |
int VAPoR::AMRData::SetRegion | ( | const size_t | min[3], |
const size_t | max[3], | ||
int | reflevel | ||
) |
Change the spatial region of interest
This method redefines the spatial region of interest (spatial extents and the refinement level) of the AMR data object. Any field data contained in the object are lost.
[in] | min | A three-element array specifying the coordinates, in base blocks, of the minimum extents of the subgrid. |
[in] | max | A three-element array specifying the coordinates, in base blocks, of the maximum extents of the subgrid. |
[in] | reflevel | The maximum refinement level of the grid. If a negative value is specified, the refinement level of the tree pointed to by the tree parameter is used. |
void VAPoR::AMRData::Update | ( | ) |
Update the data range
This method updates the data range and should be called prior to calling GetDataRange() if the field values have been changed.
int VAPoR::AMRData::WriteNCDF | ( | const string & | path, |
int | reflevel = -1 |
||
) |
Save the object to a netCDF file
This method writes the entire AMR data object to the file specified by the path
paramter. The refiment levels stored may be limited with the reflevel
parameter.
[in] | path | Path name of the file to be written |
[in] | reflevel | The maximum refinement level to write. If negative, the maximum refinement level present is written |