VAPoR
0.1
|
A cache based data reader. More...
#include <DataMgr.h>
Public Types | |
enum | VarType_T { VARUNKNOWN = -1, VAR3D, VAR2D_XY, VAR2D_XZ, VAR2D_YZ } |
Public Types inherited from VetsUtil::MyBase | |
typedef void(* | ErrMsgCB_T )(const char *msg, int err_code) |
typedef void(* | DiagMsgCB_T )(const char *msg) |
Public Member Functions | |
DataMgr (size_t mem_size) | |
virtual | ~DataMgr () |
virtual void | GetDim (size_t dim[3], int reflevel=0) const |
int | GetNumTransforms () const |
virtual vector< size_t > | GetCRatios () const |
virtual string | GetCoordSystemType () const |
virtual string | GetGridType () const |
virtual vector< double > | GetExtents (size_t ts=0) |
virtual long | GetNumTimeSteps () const |
virtual string | GetMapProjection () const |
virtual vector< string > | GetVariableNames () const |
virtual vector< string > | GetVariables3D () const |
virtual vector< string > | GetVariables2DXY () const |
virtual vector< string > | GetVariables2DXZ () const |
virtual vector< string > | GetVariables2DYZ () const |
virtual vector< string > | GetCoordinateVariables () const |
virtual vector< long > | GetPeriodicBoundary () const |
virtual vector< long > | GetGridPermutation () const |
virtual double | GetTSUserTime (size_t ts) const |
virtual void | GetTSUserTimeStamp (size_t ts, string &s) const |
RegularGrid * | GetGrid (size_t ts, string varname, int reflevel, int lod, const size_t min[3], const size_t max[3], bool lock=false) |
void | UnlockGrid (const RegularGrid *rg) |
int | UnlockRegion (const float *) |
void | Clear () |
int | GetDataRange (size_t ts, const char *varname, float range[2], int reflevel=0, int lod=0) |
int | GetValidRegion (size_t ts, const char *varname, int reflevel, size_t min[3], size_t max[3]) |
virtual int | VariableExists (size_t ts, const char *varname, int reflevel=0, int lod=0) |
bool | BestMatch (size_t ts, const char *varname, int req_reflevel, int req_lod, int &reflevel, int &lod) |
int | NewPipeline (PipeLine *pipeline) |
void | RemovePipeline (string name) |
bool | IsVariableDerived (string varname) const |
bool | IsVariableNative (string varname) const |
virtual VarType_T | GetVarType (const string &varname) const |
bool | GetMissingValue (string varname, float &value) const |
void | PurgeVariable (string varname) |
virtual void | MapUserToVox (size_t timestep, const double vcoord0[3], size_t vcoord1[3], int reflevel=0, int lod=0) |
virtual void | MapVoxToUser (size_t timestep, const size_t vcoord0[3], double vcoord1[3], int ref_level=0, int lod=0) |
virtual void | GetEnclosingRegion (size_t ts, const double minu[3], const double maxu[3], size_t min[3], size_t max[3], int reflevel=0, int lod=0) |
virtual bool | IsCoordinateVariable (string varname) const |
void | PrintCache (std::ostream &o) |
Public Member Functions inherited from VetsUtil::MyBase | |
MyBase () | |
const string & | getClassName () const |
Protected Member Functions | |
virtual void | _GetDim (size_t dim[3], int reflevel=0) const =0 |
virtual void | _GetBlockSize (size_t bs[3], int reflevel) const =0 |
virtual int | _GetNumTransforms () const =0 |
virtual vector< size_t > | _GetCRatios () const |
virtual string | _GetCoordSystemType () const |
virtual string | _GetGridType () const |
virtual vector< double > | _GetExtents (size_t ts=0) const =0 |
virtual vector< double > | _GetTSXCoords (size_t ts) const |
virtual vector< double > | _GetTSYCoords (size_t ts) const |
virtual vector< double > | _GetTSZCoords (size_t ts) const |
virtual long | _GetNumTimeSteps () const =0 |
virtual string | _GetMapProjection () const |
virtual vector< string > | _GetVariables3D () const =0 |
virtual vector< string > | _GetVariables2DXY () const =0 |
virtual vector< string > | _GetVariables2DXZ () const =0 |
virtual vector< string > | _GetVariables2DYZ () const =0 |
virtual vector< string > | _GetCoordinateVariables () const |
virtual vector< long > | _GetPeriodicBoundary () const =0 |
virtual vector< long > | _GetGridPermutation () const |
virtual double | _GetTSUserTime (size_t ts) const =0 |
virtual void | _GetTSUserTimeStamp (size_t ts, string &s) const =0 |
virtual int | _VariableExists (size_t ts, const char *varname, int reflevel=0, int lod=0) const =0 |
virtual int | _OpenVariableRead (size_t timestep, const char *varname, int reflevel=0, int lod=0)=0 |
virtual void | _GetValidRegion (size_t min[3], size_t max[3], int reflevel) const =0 |
virtual const float * | _GetDataRange () const |
virtual bool | _GetMissingValue (string varname, float &value) const |
virtual int | _BlockReadRegion (const size_t bmin[3], const size_t bmax[3], float *region)=0 |
virtual int | _CloseVariable ()=0 |
Protected Member Functions inherited from VetsUtil::MyBase | |
void | SetClassName (const string &name) |
Protected Attributes | |
const vector< string > | emptyVec |
Additional Inherited Members | |
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) |
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 |
A cache based data reader.
The DataMgr class is an abstract class that defines public methods for accessing (reading) 2D and 3D field variables. The class implements a memory cache to speed data access – once a variable is read it is stored in cache for subsequent access. The DataMgr class is abstract: it declares a number of protected pure virtual methods that must be implemented by specializations of this class.
An enum of variable types. Variables defined in a data collection may be either three-dimensional (VAR3D
), or two-dimensional. In the latter case the two-dimesional data are constrained to lie in the XY, XZ, or YZ coordinate planes of a 3D volume
Enumerator | |
---|---|
VARUNKNOWN | |
VAR3D | |
VAR2D_XY | |
VAR2D_XZ | |
VAR2D_YZ |
VAPoR::DataMgr::DataMgr | ( | size_t | mem_size | ) |
Constructor for the DataMgr class.
[in] | mem_size | Size of memory cache to be created, specified in MEGABYTES!! |
|
virtual |
|
protectedpure virtual |
Read in and return a subregion from the currently opened multiresolution data volume.
The dimensions of the region are provided in block coordinates. However, the returned region is not blocked.
[in] | bmin | Minimum region extents in block coordinates |
[in] | bmax | Maximum region extents in block coordinates |
[out] | region | The requested volume subregion |
status | Returns a non-negative value on success |
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, and VAPoR::DataMgrAMR.
|
protectedpure virtual |
Close the currently opened variable.
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, VAPoR::DataMgrWRF, and VAPoR::DataMgrAMR.
|
protectedpure virtual |
Return the internal blocking factor at a given refinement level
For multi-resolution data this method returns the dimensions of a data block at refinement level reflevel
, where reflevel is in the range 0 to GetNumTransforms(). A value of -1 may be specified to indicate the maximum refinement level. In fact, any value outside the valid refinement level range will be treated as the maximum refinement level.
[in] | reflevel | Refinement level |
bs] | dim Transformed dimension. |
bs | A three element vector containing the voxel dimension of a data block |
Implemented in VAPoR::DataMgrWB, VAPoR::DataMgrWC, VAPoR::DataMgrAMR, VAPoR::DataMgrGRIB, VAPoR::DataMgrMOM, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.
|
inlineprotectedvirtual |
Return the names of the coordinate variables.
This method returns a three-element vector naming the X, Y, and Z coordinate variables, respectively. The special name "NONE" indicates that a coordinate variable name does not exist for a particular dimension.
vector | is three-element vector of coordinate variable names. |
Reimplemented in VAPoR::DataMgrWC, and VAPoR::DataMgrWB.
|
inlineprotectedvirtual |
Return the coordinate system type. One of cartesian or spherical
type |
Reimplemented in VAPoR::DataMgrWC, and VAPoR::DataMgrWB.
|
inlineprotectedvirtual |
Return the compression ratios available.
For data sets offering level-of-detail, the method returns a vector of integers, each specifying an available compression factor. For example, a factor of 10 indicates a compression ratio of 10:1. The vector returned is sorted from highest compression ratio to lowest. I.e. the most compressed data maps to index 0 in the returned vector.
cr | A vector of one or more compression factors |
Reimplemented in VAPoR::DataMgrWC.
|
inlineprotectedvirtual |
Return the data range for the currently open variable
The method returns the minimum and maximum data values, respectively, for the variable currently opened. If the variable is not opened, or if it is opened for writing, the results are undefined.
Reimplemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrAMR, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.
|
protectedpure virtual |
Get the dimension of a volume
Returns the X,Y,Z coordinate dimensions of all data variables in grid (voxel) coordinates at the resolution level indicated by reflevel
. Hence, all variables of a given type (3D or 2D) must have the same dimension. If reflevel
is -1 (or the value returned by GetNumTransforms()) the native grid resolution is returned. In fact, any value outside the valid range is treated as the maximum refinement level
[in] | reflevel | Refinement level of the variable |
[out] | dim | A three element vector (ordered X, Y, Z) containing the voxel dimensions of the data at the specified resolution. |
Implemented in VAPoR::DataMgrWB, VAPoR::DataMgrWC, VAPoR::DataMgrAMR, VAPoR::DataMgrGRIB, VAPoR::DataMgrMOM, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.
|
protectedpure virtual |
Return the domain extents specified in user coordinates
Return the domain extents specified in user coordinates for the indicated time step. Variables in the data have spatial positions defined in a user coordinate system. These positions may vary with time. This method returns min and max bounds, in user coordinates, of all variables at a given time step.
[in] | ts | A valid data set time step in the range from zero to GetNumTimeSteps() - 1. If ts is out of range, GetExtents() will return a reasonable default value. |
extents | A six-element array containing the min and max bounds of the data domain in user-defined coordinates. The first three elements specify the minimum X, Y, and Z bounds, respectively, the second three elements specify the maximum bounds. |
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrAMR, VAPoR::DataMgrGRIB, VAPoR::DataMgrMOM, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.
|
inlineprotectedvirtual |
Return a three-element integer array indicating the coordinate ordering permutation.
integer-vector |
Reimplemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, VAPoR::DataMgrWRF, and VAPoR::DataMgrAMR.
|
inlineprotectedvirtual |
Return the grid type. One of regular, stretched, block_amr, or spherical
type |
Reimplemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrGRIB, VAPoR::DataMgrMOM, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.
|
inlineprotectedvirtual |
Return the Proj4 map projection string.
value | An empty string if a Proj4 map projection is not available, otherwise a properly formatted Proj4 projection string is returned. |
Reimplemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.
|
inlineprotectedvirtual |
Return the value of the missing data value
This method returns the value of the missing data value for the currently opened variable. If no missing data are present the method returns false
[out] | value | The missing data value. Undefined if no missing value is present. |
returns | true if missing data are present |
Reimplemented in VAPoR::DataMgrWC, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.
|
protectedpure virtual |
Return the number of time steps in the data collection
value | The number of time steps |
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrAMR, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.
|
protectedpure virtual |
Return number of transformations in hierarchy
For multi-resolution data this method returns the number of coarsened approximations present. If no approximations are available - if only the native data are present - the return value is 0.
n | The number of coarsened data approximations available |
Implemented in VAPoR::DataMgrWB, VAPoR::DataMgrWC, VAPoR::DataMgrAMR, VAPoR::DataMgrGRIB, VAPoR::DataMgrMOM, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.
|
protectedpure virtual |
Return a three-element boolean array indicating if the X,Y,Z axes have periodic boundaries, respectively.
boolean-vector |
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, VAPoR::DataMgrWRF, and VAPoR::DataMgrAMR.
|
protectedpure virtual |
Return the time for a time step
This method returns the time, in user-defined coordinates, associated with the time step, ts
. Variables such as velocity field components that are expressed in distance per units of time are expected to use the same time coordinates as the values returned by this mehtod.
[in] | ts | A valid data set time step in the range from zero to GetNumTimeSteps() - 1. |
value | The user time at time step ts . If ts is outside the valid range zero is returned. |
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, VAPoR::DataMgrWRF, and VAPoR::DataMgrAMR.
|
protectedpure virtual |
Return the time for a time step
This method returns the user time, associated with the time step, ts
, as a formatted string. The returned time stamp is intended to be used for annotation purposes
[in] | ts | A valid data set time step in the range from zero to GetNumTimeSteps() - 1. |
[out] | s | A formated time string. If ts is outside the valid range zero the empty string is returned. |
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, VAPoR::DataMgrWRF, and VAPoR::DataMgrAMR.
|
inlineprotectedvirtual |
Return the X dimension coordinate array, if it exists
For stretched grids, _GetGridType() == "stretched", this method returns the X component of the grid user coordinates. This method is only called for stretched grids.
value | An array of monotonically changing values specifying the X dimension user coordinates, in a user-defined coordinate system, of each YZ sample plane. An empty vector is returned if the coordinate dimension array is not defined for the specified time step. |
Reimplemented in VAPoR::DataMgrWC, and VAPoR::DataMgrWB.
|
inlineprotectedvirtual |
Return the Y dimension coordinate array, if it exists
Reimplemented in VAPoR::DataMgrWC, and VAPoR::DataMgrWB.
|
inlineprotectedvirtual |
Return the Z dimension coordinate array, if it exists
Reimplemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, and VAPoR::DataMgrMOM.
|
protectedpure virtual |
Return the valid bounds of the currently opened region
The data model permits the storage of volume subregions. This method may be used to query the valid domain of the currently opened volume. Results are returned in voxel coordinates, relative to the refinement level indicated by reflevel
.
[out] | min | A pointer to the minimum bounds of the subvolume |
[out] | max | A pointer to the maximum bounds of the subvolume |
[in] | reflevel | Refinement level of the variable. A value of -1 indicates the maximum refinment level defined for the VDC |
status | Returns a negative value if the volume is not opened for reading. |
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, VAPoR::DataMgrWRF, and VAPoR::DataMgrAMR.
|
protectedpure virtual |
Return the names of the 2D, XY variables in the collection
value | is a space-separated list of 2D XY variable names An emptry string is returned if no variables of this type are present |
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrAMR, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.
|
protectedpure virtual |
Return the names of the 2D, XZ variables in the collection
value | is a space-separated list of 2D ZY variable names An emptry string is returned if no variables of this type are present |
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrAMR, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.
|
protectedpure virtual |
Return the names of the 2D, YZ variables in the collection
value | is a space-separated list of 2D YZ variable names An emptry string is returned if no variables of this type are present |
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, VAPoR::DataMgrWRF, and VAPoR::DataMgrAMR.
|
protectedpure virtual |
value | is a space-separated list of 3D variable names. An emptry string is returned if no variables of this type are present |
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrAMR, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.
|
protectedpure virtual |
Open the named variable for reading
This method prepares the multi-resolution, multi-lod data volume, indicated by a variable name and time step pair, for subsequent read operations by methods of this class. Furthermore, the number of the refinement level parameter, reflevel
indicates the resolution of the volume in the multiresolution hierarchy, and the lod
parameter indicates the level of detail.
The valid range of values for reflevel
is [0..max_refinement], where max_refinement
is the maximum finement level of the data set: GetNumTransforms(). A value of zero indicates the coarsest resolution data, a value of max_refinement
indicates the finest resolution data.
The valid range of values for lod
is [0..max_lod], where max_lod
is the maximum lod of the data set: GetCRatios().size() - 1. A value of zero indicates the highest compression ratio, a value of max_lod
indicates the lowest compression ratio.
An error occurs, indicated by a negative return value, if the volume identified by the {varname, timestep, reflevel, lod} tupple is not present on disk. Note the presence of a volume can be tested for with the VariableExists() method.
[in] | timestep | Time step of the variable to read |
[in] | varname | Name of the variable to read |
[in] | reflevel | Refinement level of the variable. A value of -1 indicates the maximum refinment level defined for the VDC |
[in] | lod | Level of detail requested. A value of -1 indicates the lowest compression level available for the VDC |
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, VAPoR::DataMgrWRF, and VAPoR::DataMgrAMR.
|
protectedpure virtual |
Returns true if indicated data volume is available
Returns true if the variable identified by the timestep, variable name, refinement level, and level-of-detail is present in the data set. Returns 0 if the variable is not present.
[in] | ts | A valid time step between 0 and GetNumTimesteps()-1 |
[in] | varname | A valid variable name |
[in] | reflevel | Refinement level requested. The coarsest refinement level is 0 (zero). A value of -1 indicates the finest refinement level contained in the VDC. |
[in] | lod | Compression level of detail requested. The coarsest approximation level is 0 (zero). A value of -1 indicates the finest refinement level contained in the VDC. |
Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrAMR, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.
bool VAPoR::DataMgr::BestMatch | ( | size_t | ts, |
const char * | varname, | ||
int | req_reflevel, | ||
int | req_lod, | ||
int & | reflevel, | ||
int & | lod | ||
) |
void VAPoR::DataMgr::Clear | ( | ) |
Clear the memory cache
This method clears the internal memory cache of all entries
|
inlinevirtual |
Return the names of the coordinate variables.
This method returns a three-element vector naming the X, Y, and Z coordinate variables, respectively. The special name "NONE" indicates that a coordinate variable name does not exist for a particular dimension.
vector | is three-element vector of coordinate variable names. |
|
inlinevirtual |
|
inlinevirtual |
int VAPoR::DataMgr::GetDataRange | ( | size_t | ts, |
const char * | varname, | ||
float | range[2], | ||
int | reflevel = 0 , |
||
int | lod = 0 |
||
) |
Return the current data range as a two-element array
This method returns the minimum and maximum data values for the indicated time step and variable
[in] | ts | A valid time step between 0 and GetNumTimesteps()-1 |
[in] | varname | Name of variable |
[in] | reflevel | Refinement level requested |
[in] | lod | Level of detail requested |
[out] | range | A two-element vector containing the current minimum and maximum. |
status | Returns a non-negative value on success quantization mapping. |
|
inlinevirtual |
Get the dimension of a volume
Returns the X,Y,Z coordinate dimensions of all data variables in grid (voxel) coordinates at the resolution level indicated by reflevel
. Hence, all variables of a given type (3D or 2D) must have the same dimension. If reflevel
is -1 (or the value returned by GetNumTransforms()) the native grid resolution is returned. In fact, any value outside the valid range is treated as the maximum refinement level
[in] | reflevel | Refinement level of the variable |
[out] | dim | A three element vector (ordered X, Y, Z) containing the voxel dimensions of the data at the specified resolution. |
|
virtual |
Get voxel coordinates of grid containing a region
Calculates the IJK voxel coordinates of the smallest grid completely containing the region defined by the user coordinates minu
and maxu
[in] | timestep | Time step of the variable If an invalid timestep is supplied the global domain extents are used. |
[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 |
[in] | reflevel | Refinement level of the variable. A value of -1 indicates the maximum refinment level defined for the VDC. In fact, any invalid value is treated as the maximum refinement level |
|
virtual |
Return the domain extents specified in user coordinates
Return the domain extents specified in user coordinates for the indicated time step. Variables in the data have spatial positions defined in a user coordinate system. These positions may vary with time. This method returns min and max bounds, in user coordinates, of all variables at a given time step.
[in] | ts | A valid data set time step in the range from zero to GetNumTimeSteps() - 1. If ts is out of range, GetExtents() will return a reasonable default value. |
extents | A six-element array containing the min and max bounds of the data domain in user-defined coordinates. The first three elements specify the minimum X, Y, and Z bounds, respectively, the second three elements specify the maximum bounds. |
RegularGrid* VAPoR::DataMgr::GetGrid | ( | size_t | ts, |
string | varname, | ||
int | reflevel, | ||
int | lod, | ||
const size_t | min[3], | ||
const size_t | max[3], | ||
bool | lock = false |
||
) |
Read in and return a subregion from the dataset.
GetGrid() will first check to see if the requested region resides in cache. If so, no reads are performed. If the named variable is not in cache, GetGrid() will next check to see if the variable can be calculated by recursively executing PipeLine stages (
The ts
, varname
, lod
, and level
pararmeter tuple identifies the time step, variable name, level-of-detail, and refinement level, respectively, of the requested volume. The min
and max
vectors identify the minium and maximum extents, in voxel coordinates, of the subregion of interest. The minimum valid value of min
is (0,0,0), the maximum valid value of max
is (nx-1,ny-1,nz-1), where nx, ny, and nz are the voxel dimensions of the volume at the resolution indicated by level
. I.e. the coordinates are specified relative to the desired volume resolution. If the requested region is available, GetGrid() returns a pointer to a RegularGrid class containg the requested subregion. It is the callers responsbility to delete the returned pointer when it is no longer needed. Subsequent calls to GetGrid() may invalidate the memory space returned by previous calls unless the lock
parameter is set, in which case the grid returned by GetGrid() is locked into memory until freed by a call the UnlockGrid() method (or the class is destroyed).
GetGrid() will fail if the requested data are not present. The VariableExists() method may be used to determine if the data identified by a (resolution,timestep,variable) tupple are available on disk.
lock
parameter increments a counter associated with the requested region of memory. The counter is decremented when UnlockGrid() is invoked.If varname
is the empty string, a pointer to dataless RegularGrid is returned.
[in] | ts | A valid time step between 0 and GetNumTimesteps()-1 |
[in] | varname | A valid variable name or the empty string |
[in] | reflevel | Refinement level requested |
[in] | lod | Level of detail requested |
[in] | min | Minimum region bounds in voxels |
[in] | max | Maximum region bounds in voxels |
[in] | lock | If true, the memory region will be locked into the cache (i.e. valid after subsequent GetRegion() calls). |
ptr | A pointer to a region containing the desired data, or NULL if the region can not be extracted. |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
bool VAPoR::DataMgr::GetMissingValue | ( | string | varname, |
float & | value | ||
) | const |
|
inlinevirtual |
|
inline |
Return number of transformations in hierarchy
For multi-resolution data this method returns the number of coarsened approximations present. If no approximations are available - if only the native data are present - the return value is 0.
n | The number of coarsened data approximations available |
|
inlinevirtual |
|
inlinevirtual |
Return the time for a time step
This method returns the time, in user-defined coordinates, associated with the time step, ts
. Variables such as velocity field components that are expressed in distance per units of time are expected to use the same time coordinates as the values returned by this mehtod.
[in] | ts | A valid data set time step in the range from zero to GetNumTimeSteps() - 1. |
value | The user time at time step ts . If ts is outside the valid range zero is returned. |
|
inlinevirtual |
Return the time for a time step
This method returns the user time, associated with the time step, ts
, as a formatted string. The returned time stamp is intended to be used for annotation purposes
[in] | ts | A valid data set time step in the range from zero to GetNumTimeSteps() - 1. |
[out] | s | A formated time string. If ts is outside the valid range zero the empty string is returned. |
int VAPoR::DataMgr::GetValidRegion | ( | size_t | ts, |
const char * | varname, | ||
int | reflevel, | ||
size_t | min[3], | ||
size_t | max[3] | ||
) |
Return the valid region bounds for the specified region
This method returns the minimum and maximum valid coordinate bounds (in voxels) of the subregion indicated by the timestep ts
, variable name varname
, and refinement level reflevel
for the indicated time step and variable. Data are guaranteed to be available for this region.
[in] | ts | A valid time step between 0 and GetNumTimesteps()-1 |
[in] | varname | Name of variable |
[in] | reflevel | Refinement level of the variable |
[out] | min | Minimum coordinate bounds (in voxels) of volume |
[out] | max | Maximum coordinate bounds (in voxels) of volume |
status | A non-negative int is returned on success |
|
virtual |
|
virtual |
Return the names of the 2D, XY variables in the collection
value | is a space-separated list of 2D XY variable names An emptry string is returned if no variables of this type are present |
|
virtual |
|
virtual |
|
virtual |
value | is a space-separated list of 3D variable names. An emptry string is returned if no variables of this type are present |
|
virtual |
|
virtual |
Returns true if the named variable is a coordinate variable
This method is a convenience function that returns true if if the variable named by varname
is a coordinate variable. A variable is a coordinate variable if it is returned by GetCoordinateVariables();
bool VAPoR::DataMgr::IsVariableDerived | ( | string | varname | ) | const |
Return true if the named variable is the output of a pipeline
This method returns true if varname
matches a variable name in the output list (PipeLine::GetOutputs()) of any pipeline added with NewPipeline()
bool VAPoR::DataMgr::IsVariableNative | ( | string | varname | ) | const |
Return true if the named variable is availble from the derived classes data access methods.
A return value of true does not imply that the variable can be read (
|
virtual |
Map floating point coordinates to integer voxel offsets.
Map floating point coordinates, specified relative to a user-defined coordinate system, to the closest integer voxel coordinates for a voxel at a given refinement level. The integer voxel coordinates, vcoord1
, returned are specified relative to the refinement level indicated by reflevel
for time step, timestep
. The mapping is performed by using linear interpolation Results are undefined if vcoord0
is outside of the volume boundary.
If a user coordinate system is not defined for the specified time step, timestep
, the global extents for the VDC will be used.
[in] | timestep | Time step of the variable If an invalid timestep is supplied the global domain extents are used. |
[in] | vcoord0 | Coordinate of input point in floating point coordinates |
[out] | vcoord1 | Integer coordinates of closest voxel, at the indicated refinement level, to the specified point. integer coordinates |
[in] | reflevel | Refinement level of the variable. A value of -1 indicates the maximum refinment level defined for the VDC. In fact, any invalid value is treated as the maximum refinement level |
|
virtual |
Map integer voxel coordinates to user-defined floating point coords.
Map the integer coordinates of the specified voxel to floating point coordinates in a user defined space. The voxel coordinates, vcoord0
are specified relative to the refinement level indicated by reflevel
for time step timestep
. The mapping is performed by using linear interpolation The user coordinates are returned in vcoord1
. Results are undefined if vcoord is outside of the volume boundary.
[in] | timestep | Time step of the variable. If an invalid timestep is supplied the global domain extents are used. |
[in] | vcoord0 | Coordinate of input voxel in integer (voxel) coordinates |
[out] | vcoord1 | Coordinate of transformed voxel in user-defined, floating point coordinates |
[in] | reflevel | Refinement level of the variable. A value of -1 indicates the maximum refinment level defined. In fact, any invalid value is treated as the maximum refinement level |
int VAPoR::DataMgr::NewPipeline | ( | PipeLine * | pipeline | ) |
Add a pipeline stage to produce derived variables
Add a new pipline stage for derived variable calculation. If a pipeline already exists with the same name it is replaced. The output variable names are added to the list of variables available for this data set (see GetVariables3D, etc.).
An error occurs if:
pipeline
status | A negative int is returned on failure. |
void VAPoR::DataMgr::PrintCache | ( | std::ostream & | o | ) |
Print out contents of data cache
Debugging method for dumping out the contents of the data cache
void VAPoR::DataMgr::PurgeVariable | ( | string | varname | ) |
Purge the cache of a variable
[in] | varname | is the variable name |
void VAPoR::DataMgr::RemovePipeline | ( | string | name | ) |
Remove the named pipline if it exists. Otherwise this method is a no-op
[in] | name | The name of the pipeline as returned by PipeLine::GetName() |
void VAPoR::DataMgr::UnlockGrid | ( | const RegularGrid * | rg | ) |
Unlock a floating-point region of memory
Decrement the lock counter associatd with a region of memory, and if zero, unlock region of memory previously locked GetRegion(). When the lock counter reaches zero the region is simply marked available for internal garbage collection during subsequent GetRegion() calls
[in] | rg | A pointer to a RegularGrid previosly returned by GetGrid() |
status | Returns a non-negative value on success |
|
inline |
|
virtual |
Returns true if indicated data volume is available
Returns true if the variable identified by the timestep, variable name, refinement level, and level-of-detail is present in the data set. Returns 0 if the variable is not present.
[in] | ts | A valid time step between 0 and GetNumTimesteps()-1 |
[in] | varname | A valid variable name |
[in] | reflevel | Refinement level requested. The coarsest refinement level is 0 (zero). A value of -1 indicates the finest refinement level contained in the VDC. |
[in] | lod | Compression level of detail requested. The coarsest approximation level is 0 (zero). A value of -1 indicates the finest refinement level contained in the VDC. |