VAPoR  0.1
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
VAPoR::DataMgr Class Referenceabstract

A cache based data reader. More...

#include <DataMgr.h>

Inheritance diagram for VAPoR::DataMgr:
VetsUtil::MyBase VAPoR::DataMgrAMR VAPoR::DataMgrGRIB VAPoR::DataMgrMOM VAPoR::DataMgrROMS VAPoR::DataMgrWB VAPoR::DataMgrWC VAPoR::DataMgrWRF

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
 
RegularGridGetGrid (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
 

Detailed Description

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.

Author
John Clyne
Version
$Revision$
Date
$Date$

Definition at line 40 of file DataMgr.h.

Member Enumeration Documentation

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 

Definition at line 50 of file DataMgr.h.

Constructor & Destructor Documentation

VAPoR::DataMgr::DataMgr ( size_t  mem_size)

Constructor for the DataMgr class.

Parameters
[in]mem_sizeSize of memory cache to be created, specified in MEGABYTES!!
Note
The success or failure of this constructor can be checked with the GetErrCode() method.
See also
GetErrCode(),
virtual VAPoR::DataMgr::~DataMgr ( )
virtual

Member Function Documentation

virtual int VAPoR::DataMgr::_BlockReadRegion ( const size_t  bmin[3],
const size_t  bmax[3],
float *  region 
)
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.

Parameters
[in]bminMinimum region extents in block coordinates
[in]bmaxMaximum region extents in block coordinates
[out]regionThe requested volume subregion
Return values
statusReturns a non-negative value on success
See also
_OpenVariableRead(), _GetBlockSize()

Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, and VAPoR::DataMgrAMR.

virtual int VAPoR::DataMgr::_CloseVariable ( )
protectedpure virtual
virtual void VAPoR::DataMgr::_GetBlockSize ( size_t  bs[3],
int  reflevel 
) const
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.

Parameters
[in]reflevelRefinement level
bs]dim Transformed dimension.
Return values
bsA 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.

virtual vector<string> VAPoR::DataMgr::_GetCoordinateVariables ( ) const
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.

Note
The existence of a coordinate variable name does not imply the existence of the coordinate variable itself.
Return values
vectoris three-element vector of coordinate variable names.

Reimplemented in VAPoR::DataMgrWC, and VAPoR::DataMgrWB.

Definition at line 676 of file DataMgr.h.

virtual string VAPoR::DataMgr::_GetCoordSystemType ( ) const
inlineprotectedvirtual

Return the coordinate system type. One of cartesian or spherical

Return values
type

Reimplemented in VAPoR::DataMgrWC, and VAPoR::DataMgrWB.

Definition at line 553 of file DataMgr.h.

virtual vector<size_t> VAPoR::DataMgr::_GetCRatios ( ) const
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.

Return values
crA vector of one or more compression factors

Reimplemented in VAPoR::DataMgrWC.

Definition at line 545 of file DataMgr.h.

virtual const float* VAPoR::DataMgr::_GetDataRange ( ) const
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.

Returns
range A pointer to a two-element array containing the Min and Max data values, respectively. If the derived class' implementation of this method returns NULL, the DataMgr class will compute the min and max itself.

Reimplemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrAMR, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.

Definition at line 835 of file DataMgr.h.

virtual void VAPoR::DataMgr::_GetDim ( size_t  dim[3],
int  reflevel = 0 
) const
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

Parameters
[in]reflevelRefinement level of the variable
[out]dimA three element vector (ordered X, Y, Z) containing the voxel dimensions of the data at the specified resolution.
See also
GetNumTransforms()

Implemented in VAPoR::DataMgrWB, VAPoR::DataMgrWC, VAPoR::DataMgrAMR, VAPoR::DataMgrGRIB, VAPoR::DataMgrMOM, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.

virtual vector<double> VAPoR::DataMgr::_GetExtents ( size_t  ts = 0) const
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.

Parameters
[in]tsA 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.
Return values
extentsA 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.

virtual vector<long> VAPoR::DataMgr::_GetGridPermutation ( ) const
inlineprotectedvirtual

Return a three-element integer array indicating the coordinate ordering permutation.

Return values
integer-vector

Reimplemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, VAPoR::DataMgrWRF, and VAPoR::DataMgrAMR.

Definition at line 697 of file DataMgr.h.

virtual string VAPoR::DataMgr::_GetGridType ( ) const
inlineprotectedvirtual

Return the grid type. One of regular, stretched, block_amr, or spherical

Return values
type

Reimplemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrGRIB, VAPoR::DataMgrMOM, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.

Definition at line 561 of file DataMgr.h.

virtual string VAPoR::DataMgr::_GetMapProjection ( ) const
inlineprotectedvirtual

Return the Proj4 map projection string.

Return values
valueAn 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.

Definition at line 630 of file DataMgr.h.

virtual bool VAPoR::DataMgr::_GetMissingValue ( string  varname,
float &  value 
) const
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

Parameters
[out]valueThe missing data value. Undefined if no missing value is present.
Return values
returnstrue if missing data are present

Reimplemented in VAPoR::DataMgrWC, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.

Definition at line 848 of file DataMgr.h.

virtual long VAPoR::DataMgr::_GetNumTimeSteps ( ) const
protectedpure virtual

Return the number of time steps in the data collection

Return values
valueThe number of time steps

Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrAMR, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.

virtual int VAPoR::DataMgr::_GetNumTransforms ( ) const
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.

Return values
nThe number of coarsened data approximations available

Implemented in VAPoR::DataMgrWB, VAPoR::DataMgrWC, VAPoR::DataMgrAMR, VAPoR::DataMgrGRIB, VAPoR::DataMgrMOM, VAPoR::DataMgrROMS, and VAPoR::DataMgrWRF.

virtual vector<long> VAPoR::DataMgr::_GetPeriodicBoundary ( ) const
protectedpure virtual

Return a three-element boolean array indicating if the X,Y,Z axes have periodic boundaries, respectively.

Return values
boolean-vector

Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, VAPoR::DataMgrWRF, and VAPoR::DataMgrAMR.

virtual double VAPoR::DataMgr::_GetTSUserTime ( size_t  ts) const
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.

Parameters
[in]tsA valid data set time step in the range from zero to GetNumTimeSteps() - 1.
Return values
valueThe 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.

virtual void VAPoR::DataMgr::_GetTSUserTimeStamp ( size_t  ts,
string &  s 
) const
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

Parameters
[in]tsA valid data set time step in the range from zero to GetNumTimeSteps() - 1.
[out]sA 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.

virtual vector<double> VAPoR::DataMgr::_GetTSXCoords ( size_t  ts) const
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.

Return values
valueAn 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.
See also
_GetGridType(), GetTSXCoords()

Reimplemented in VAPoR::DataMgrWC, and VAPoR::DataMgrWB.

Definition at line 599 of file DataMgr.h.

virtual vector<double> VAPoR::DataMgr::_GetTSYCoords ( size_t  ts) const
inlineprotectedvirtual

Return the Y dimension coordinate array, if it exists

Reimplemented in VAPoR::DataMgrWC, and VAPoR::DataMgrWB.

Definition at line 605 of file DataMgr.h.

virtual vector<double> VAPoR::DataMgr::_GetTSZCoords ( size_t  ts) const
inlineprotectedvirtual

Return the Z dimension coordinate array, if it exists

Reimplemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, and VAPoR::DataMgrMOM.

Definition at line 611 of file DataMgr.h.

virtual void VAPoR::DataMgr::_GetValidRegion ( size_t  min[3],
size_t  max[3],
int  reflevel 
) const
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.

Parameters
[out]minA pointer to the minimum bounds of the subvolume
[out]maxA pointer to the maximum bounds of the subvolume
[in]reflevelRefinement level of the variable. A value of -1 indicates the maximum refinment level defined for the VDC
Return values
statusReturns a negative value if the volume is not opened for reading.
See also
_OpenVariableRead()

Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, VAPoR::DataMgrWRF, and VAPoR::DataMgrAMR.

virtual vector<string> VAPoR::DataMgr::_GetVariables2DXY ( ) const
protectedpure virtual

Return the names of the 2D, XY variables in the collection

Return values
valueis 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.

virtual vector<string> VAPoR::DataMgr::_GetVariables2DXZ ( ) const
protectedpure virtual

Return the names of the 2D, XZ variables in the collection

Return values
valueis 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.

virtual vector<string> VAPoR::DataMgr::_GetVariables2DYZ ( ) const
protectedpure virtual

Return the names of the 2D, YZ variables in the collection

Return values
valueis 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.

virtual vector<string> VAPoR::DataMgr::_GetVariables3D ( ) const
protectedpure virtual
Return values
valueis 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.

virtual int VAPoR::DataMgr::_OpenVariableRead ( size_t  timestep,
const char *  varname,
int  reflevel = 0,
int  lod = 0 
)
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.

Parameters
[in]timestepTime step of the variable to read
[in]varnameName of the variable to read
[in]reflevelRefinement level of the variable. A value of -1 indicates the maximum refinment level defined for the VDC
[in]lodLevel of detail requested. A value of -1 indicates the lowest compression level available for the VDC
See also
GetVariables3D(), GetVariables2DXY(), GetNumTransforms()

Implemented in VAPoR::DataMgrWC, VAPoR::DataMgrWB, VAPoR::DataMgrMOM, VAPoR::DataMgrGRIB, VAPoR::DataMgrROMS, VAPoR::DataMgrWRF, and VAPoR::DataMgrAMR.

virtual int VAPoR::DataMgr::_VariableExists ( size_t  ts,
const char *  varname,
int  reflevel = 0,
int  lod = 0 
) const
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.

Parameters
[in]tsA valid time step between 0 and GetNumTimesteps()-1
[in]varnameA valid variable name
[in]reflevelRefinement level requested. The coarsest refinement level is 0 (zero). A value of -1 indicates the finest refinement level contained in the VDC.
[in]lodCompression 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

virtual vector<string> VAPoR::DataMgr::GetCoordinateVariables ( ) const
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.

Note
The existence of a coordinate variable name does not imply the existence of the coordinate variable itself.
Return values
vectoris three-element vector of coordinate variable names.

Definition at line 130 of file DataMgr.h.

virtual string VAPoR::DataMgr::GetCoordSystemType ( ) const
inlinevirtual

Return the coordinate system type. One of cartesian or spherical

Return values
type

Definition at line 87 of file DataMgr.h.

virtual vector<size_t> VAPoR::DataMgr::GetCRatios ( ) const
inlinevirtual

Definition at line 83 of file DataMgr.h.

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

Parameters
[in]tsA valid time step between 0 and GetNumTimesteps()-1
[in]varnameName of variable
[in]reflevelRefinement level requested
[in]lodLevel of detail requested
[out]rangeA two-element vector containing the current minimum and maximum.
Return values
statusReturns a non-negative value on success quantization mapping.
virtual void VAPoR::DataMgr::GetDim ( size_t  dim[3],
int  reflevel = 0 
) const
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

Parameters
[in]reflevelRefinement level of the variable
[out]dimA three element vector (ordered X, Y, Z) containing the voxel dimensions of the data at the specified resolution.
See also
GetNumTransforms()

Definition at line 73 of file DataMgr.h.

virtual void VAPoR::DataMgr::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

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

Parameters
[in]timestepTime step of the variable If an invalid timestep is supplied the global domain extents are used.
[in]minuUser coordinates of minimum coorner
[in]maxuUser coordinates of maximum coorner
[out]minInteger coordinates of minimum coorner
[out]maxInteger coordinates of maximum coorner
[in]reflevelRefinement 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 vector<double> VAPoR::DataMgr::GetExtents ( size_t  ts = 0)
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.

Parameters
[in]tsA 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.
Return values
extentsA 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 (

See also
NewPipeline()). Finally, if the varible is not the result of PipeLine execution GetGrid() will attempt to access the varible through methods implemented by derived classes of the DataMgr class.

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.

Note
The 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.

Parameters
[in]tsA valid time step between 0 and GetNumTimesteps()-1
[in]varnameA valid variable name or the empty string
[in]reflevelRefinement level requested
[in]lodLevel of detail requested
[in]minMinimum region bounds in voxels
[in]maxMaximum region bounds in voxels
[in]lockIf true, the memory region will be locked into the cache (i.e. valid after subsequent GetRegion() calls).
Return values
ptrA pointer to a region containing the desired data, or NULL if the region can not be extracted.
See also
NewPipeline(), GetErrMsg()
virtual vector<long> VAPoR::DataMgr::GetGridPermutation ( ) const
inlinevirtual

Return a three-element integer array indicating the coordinate ordering permutation.

Return values
integer-vector

Definition at line 142 of file DataMgr.h.

virtual string VAPoR::DataMgr::GetGridType ( ) const
inlinevirtual

Return the grid type. One of regular, stretched, block_amr, or spherical

Return values
type

Definition at line 93 of file DataMgr.h.

virtual string VAPoR::DataMgr::GetMapProjection ( ) const
inlinevirtual

Return the Proj4 map projection string.

Return values
valueAn empty string if a Proj4 map projection is not available, otherwise a properly formatted Proj4 projection string is returned.

Definition at line 106 of file DataMgr.h.

bool VAPoR::DataMgr::GetMissingValue ( string  varname,
float &  value 
) const
virtual long VAPoR::DataMgr::GetNumTimeSteps ( ) const
inlinevirtual

Return the number of time steps in the data collection

Return values
valueThe number of time steps

Definition at line 101 of file DataMgr.h.

int VAPoR::DataMgr::GetNumTransforms ( ) const
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.

Return values
nThe number of coarsened data approximations available

Definition at line 79 of file DataMgr.h.

virtual vector<long> VAPoR::DataMgr::GetPeriodicBoundary ( ) const
inlinevirtual

Return a three-element boolean array indicating if the X,Y,Z axes have periodic boundaries, respectively.

Return values
boolean-vector

Definition at line 136 of file DataMgr.h.

virtual double VAPoR::DataMgr::GetTSUserTime ( size_t  ts) const
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.

Parameters
[in]tsA valid data set time step in the range from zero to GetNumTimeSteps() - 1.
Return values
valueThe user time at time step ts. If ts is outside the valid range zero is returned.

Definition at line 148 of file DataMgr.h.

virtual void VAPoR::DataMgr::GetTSUserTimeStamp ( size_t  ts,
string &  s 
) const
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

Parameters
[in]tsA valid data set time step in the range from zero to GetNumTimeSteps() - 1.
[out]sA formated time string. If ts is outside the valid range zero the empty string is returned.

Definition at line 154 of file DataMgr.h.

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.

Parameters
[in]tsA valid time step between 0 and GetNumTimesteps()-1
[in]varnameName of variable
[in]reflevelRefinement level of the variable
[out]minMinimum coordinate bounds (in voxels) of volume
[out]maxMaximum coordinate bounds (in voxels) of volume
Return values
statusA non-negative int is returned on success
virtual vector<string> VAPoR::DataMgr::GetVariableNames ( ) const
virtual
virtual vector<string> VAPoR::DataMgr::GetVariables2DXY ( ) const
virtual

Return the names of the 2D, XY variables in the collection

Return values
valueis a space-separated list of 2D XY variable names An emptry string is returned if no variables of this type are present
virtual vector<string> VAPoR::DataMgr::GetVariables2DXZ ( ) const
virtual

virtual vector<string> VAPoR::DataMgr::GetVariables2DYZ ( ) const
virtual

virtual vector<string> VAPoR::DataMgr::GetVariables3D ( ) const
virtual

Return values
valueis a space-separated list of 3D variable names. An emptry string is returned if no variables of this type are present
virtual VarType_T VAPoR::DataMgr::GetVarType ( const string &  varname) const
virtual
virtual bool VAPoR::DataMgr::IsCoordinateVariable ( string  varname) const
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();

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

See also
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 (

See also
VariableExists()), only that it is part of the data set known to the derived class
NewPipeline()
virtual void VAPoR::DataMgr::MapUserToVox ( size_t  timestep,
const double  vcoord0[3],
size_t  vcoord1[3],
int  reflevel = 0,
int  lod = 0 
)
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.

Parameters
[in]timestepTime step of the variable If an invalid timestep is supplied the global domain extents are used.
[in]vcoord0Coordinate of input point in floating point coordinates
[out]vcoord1Integer coordinates of closest voxel, at the indicated refinement level, to the specified point. integer coordinates
[in]reflevelRefinement 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
See also
GetGridType(), GetExtents()
virtual void VAPoR::DataMgr::MapVoxToUser ( size_t  timestep,
const size_t  vcoord0[3],
double  vcoord1[3],
int  ref_level = 0,
int  lod = 0 
)
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.

Parameters
[in]timestepTime step of the variable. If an invalid timestep is supplied the global domain extents are used.
[in]vcoord0Coordinate of input voxel in integer (voxel) coordinates
[out]vcoord1Coordinate of transformed voxel in user-defined, floating point coordinates
[in]reflevelRefinement 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
See also
Metatdata::GetGridType(), GetExtents(), GetTSXCoords()
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:

  • The output variable names match any of the native variable names - variable names returned via _GetVariables3D(), etc.
  • The output variable names match the output variable names of pipeline stage previously added with NewPipeline()
  • A circular dependency is introduced by adding pipeline
Return values
statusA 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

Parameters
[in]varnameis the variable name
void VAPoR::DataMgr::RemovePipeline ( string  name)

Remove the named pipline if it exists. Otherwise this method is a no-op

Parameters
[in]nameThe 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

Parameters
[in]rgA pointer to a RegularGrid previosly returned by GetGrid()
Return values
statusReturns a non-negative value on success
See also
GetRegion(), GetRegion()
int VAPoR::DataMgr::UnlockRegion ( const float *  )
inline
Deprecated:

Definition at line 242 of file DataMgr.h.

virtual int VAPoR::DataMgr::VariableExists ( size_t  ts,
const char *  varname,
int  reflevel = 0,
int  lod = 0 
)
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.

Parameters
[in]tsA valid time step between 0 and GetNumTimesteps()-1
[in]varnameA valid variable name
[in]reflevelRefinement level requested. The coarsest refinement level is 0 (zero). A value of -1 indicates the finest refinement level contained in the VDC.
[in]lodCompression level of detail requested. The coarsest approximation level is 0 (zero). A value of -1 indicates the finest refinement level contained in the VDC.

Member Data Documentation

const vector<string> VAPoR::DataMgr::emptyVec
protected

Definition at line 481 of file DataMgr.h.


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