VAPoR  0.1
Public Member Functions | Static Public Member Functions | List of all members
VAPoR::AMRData Class Reference

This class manages an Adaptive Mesh Refinement grid. More...

#include <AMRData.h>

Inheritance diagram for VAPoR::AMRData:
VetsUtil::MyBase

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 AMRTreeGetTree () 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)
 

Detailed Description

This class manages an Adaptive Mesh Refinement grid.

Author
John Clyne
Version
$Revision$
Date
$Date$

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.

Note
All blocks in the AMR grid, whether leaf or non-leaf nodes, contain data.

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().

See also
AMRTree

Definition at line 62 of file AMRData.h.

Constructor & Destructor Documentation

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

Parameters
treeparameter 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]treeA pointer to an initialized AMRTree
[in]cell_dimA three-element array specifying the topological dimensions, in voxels, of all blocks in the grid
[in]bminA three-element array specifying the coordinates, in base blocks, of the minimum extents of the subgrid. The default is (0,0,0).
[in]bmaxA 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]reflevelThe 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.
Note
The AMRTree object is shallow copied - it's contents may not be changed by application until after this object is destroyed.
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

Parameters
treeparameter 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]treeA pointer to an initialized AMRTree
[in]cell_dimA three-element array specifying the topological dimensions, in voxels, of all blocks in the grid
[in]bminA three-element array specifying the coordinates, in base blocks, of the minimum extents of the subgrid. The default is (0,0,0).
[in]bmaxA 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]reflevelThe 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.
Note
The AMRTree object is shallow copied - it's contents may not be changed by application until after this object is destroyed.
VAPoR::AMRData::AMRData ( const AMRTree tree)

Constructor for the AMRData class.

Construct block structured AMR grid data object. The

Parameters
treeparameter 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]treeA pointer to an initialized AMRTree
[in]cell_dimA three-element array specifying the topological dimensions, in voxels, of all blocks in the grid
[in]bminA three-element array specifying the coordinates, in base blocks, of the minimum extents of the subgrid. The default is (0,0,0).
[in]bmaxA 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]reflevelThe 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.
Note
The AMRTree object is shallow copied - it's contents may not be changed by application until after this object is destroyed.
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

Parameters
[in]treeA pointer to an initialized AMRTree
[in]cell_dimA three-element array specifying the topological dimensions, in voxels, of all blocks in the grid
[in]paramesh_gidsA paramesh global identifier array
[in]paramesh_bboxsAn array of Paramesh bounding boxes
[in]paramesh_unkA paramesh dependent data array
[in]paramesh_total_blocksTotal number of nodes (both leaf and
[in]reflevelThe 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.
Note
The AMRTree object is shallow copied - it's contents may not be changed by application until after this object is destroyed.
virtual VAPoR::AMRData::~AMRData ( )
inlinevirtual

Definition at line 148 of file AMRData.h.

Member Function Documentation

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

Parameters
[in]cellidThe cell identifier of the block to be returned.
Return values
dataA pointer to a block of field values
void VAPoR::AMRData::GetBounds ( size_t  bmin[3],
size_t  bmax[3] 
) const
inline

Definition at line 320 of file AMRData.h.

const float* VAPoR::AMRData::GetDataRange ( ) const
inline

Return the data range for the grid

The method returns the minimum and maximum data values, respectively, for the current AMR grid.

Parameters
[out]rangeMin and Max data values, respectively
Return values
statusA negative integer is returned on failure, otherwise the method has succeeded.

Definition at line 315 of file AMRData.h.

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

See also
SetRegion()
const AMRTree* VAPoR::AMRData::GetTree ( ) const
inline

Definition at line 318 of file AMRData.h.

static int VAPoR::AMRData::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

Read AMRData attributes from a netCDF file

This static method can be used to return attribute data from a netCDF file generated by WriteNCDF().

Parameters
[in]pathString containing path to input file
[out]cell_dimThree element array containing the the dimensions of each cell in the AMR data structure
[out]bminMinimum bounds of AMR mesh in block coordinates
[out]bmaxMaximum bounds of AMR mesh in block coordinates
[out]data_rangeMinimum and maximum values of floating point data stored in the mesh.
[out]num_nodesTotal number of nodes (blocks) in AMR mesh
Return values
statusA 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

Parameters
[in]pathPath name of the file to be read
[in]reflevelThe maximum refinement level to write. If negative, the maximum current refinement level defined by the object is read
[in]bminMinimum bounds of data subregion expressed in block coordinates. The default is the minimum bounds the object was constructed with.
[in]bmaxMaximum bounds of data subregion expressed in block coordinates. The default is the maximum bounds the object was constructed with.
See also
GetRegion(), SetRegion()
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

Parameters
[in]pathPath name of the file to be read
[in]reflevelThe maximum refinement level to write. If negative, the maximum current refinement level defined by the object is read
[in]bminMinimum bounds of data subregion expressed in block coordinates. The default is the minimum bounds the object was constructed with.
[in]bmaxMaximum bounds of data subregion expressed in block coordinates. The default is the maximum bounds the object was constructed with.
See also
GetRegion(), SetRegion()
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.

Parameters
[in]bminA 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]bmaxA three-element array specifying, in blocks, the maximum extents of the region of interest.
[in]reflevelThe 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]gridA pointer to floating point array large enough to to contain the resampled data (bmax[i] - bmin[i] + 1);
Return values
statusA 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.

Parameters
[in]minA three-element array specifying the coordinates, in base blocks, of the minimum extents of the subgrid.
[in]maxA three-element array specifying the coordinates, in base blocks, of the maximum extents of the subgrid.
[in]reflevelThe 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.

See also
GetDataRange();
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.

Parameters
[in]pathPath name of the file to be written
[in]reflevelThe maximum refinement level to write. If negative, the maximum refinement level present is written

The documentation for this class was generated from the following file: