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

Performs data IO to VDF files. More...

#include <AMRIO.h>

Inheritance diagram for VAPoR::AMRIO:
VAPoR::VDFIOBase VAPoR::MetadataVDC VAPoR::Metadata VetsUtil::MyBase VAPoR::ParsedXml VAPoR::DataMgrAMR

Public Member Functions

 AMRIO (const MetadataVDC &metadata)
 
 AMRIO (const string &metafile)
 
virtual ~AMRIO ()
 
int VariableExists (size_t ts, const char *varname, int reflevel=0, int lod=0) const
 
int OpenTreeWrite (size_t timestep)
 
int OpenTreeRead (size_t timestep)
 
int CloseTree ()
 
int TreeRead (AMRTree *tree)
 
int TreeWrite (const AMRTree *tree)
 
int OpenVariableWrite (size_t timestep, const char *varname, int reflevel=-1, int lod=-1)
 
virtual int BlockWriteRegion (const float *region, const size_t bmin[3], const size_t bmax[3], bool block=true)
 
virtual int WriteRegion (const float *region, const size_t min[3], const size_t max[3])
 
virtual int WriteRegion (const float *region)
 
virtual int WriteSlice (const float *slice)
 
int OpenVariableRead (size_t timestep, const char *varname, int reflevel=0, int lod=0)
 
virtual int BlockReadRegion (const size_t bmin[3], const size_t bmax[3], float *region, bool unblock=true)
 
virtual int ReadRegion (const size_t min[3], const size_t max[3], float *region)
 
virtual int ReadRegion (float *region)
 
virtual int ReadSlice (float *slice)
 
virtual int CloseVariable ()
 
int VariableRead (AMRData *data)
 
int VariableWrite (AMRData *data)
 
int GetBlockMins (const float **mins, int reflevel) const
 
int GetBlockMaxs (const float **maxs, int reflevel) const
 
const float * GetDataRange () const
 
void GetValidRegion (size_t min[3], size_t max[3], int reflevel) const
 
- Public Member Functions inherited from VAPoR::VDFIOBase
 VDFIOBase (const MetadataVDC &metadata)
 
 VDFIOBase (const string &metafile)
 
virtual ~VDFIOBase ()
 
double GetReadTimer () const
 
double GetSeekTimer () const
 
void SeekTimerReset ()
 
void SeekTimerStart ()
 
void SeekTimerStop ()
 
double GetWriteTimer () const
 
double GetXFormTimer () const
 
- Public Member Functions inherited from VAPoR::MetadataVDC
 MetadataVDC (const size_t dim[3], size_t numTransforms, const size_t bs[3], int nFilterCoef=1, int nLiftingCoef=1, int msbFirst=1, int vdfVersion=VDF_VERSION)
 
 MetadataVDC (const size_t dim[3], const size_t bs[3], const vector< size_t > &cratios, string wname, string wmode)
 
 MetadataVDC (const string &metafile)
 
 MetadataVDC (const MetadataVDC &node)
 
virtual ~MetadataVDC ()
 
int Merge (const MetadataVDC &metadata, size_t ts=0)
 
int Merge (const string &path, size_t ts=0)
 
int MakeCurrent () const
 
const string & GetParentDir () const
 
const string & GetMetafileName () const
 
const string & GetDataDirName () const
 
int ConstructFullVBase (size_t ts, const string &var, string *path) const
 
int ConstructFullAuxBase (size_t ts, string *path) const
 
int Write (const string &path, int relative_path=1)
 
virtual const size_t * GetBlockSize () const
 
virtual void GetBlockSize (size_t bs[3], int) const
 
virtual void GetGridDim (size_t dim[3]) const
 
const size_t * GetDimension () const
 
int GetFilterCoef () const
 
int GetLiftingCoef () const
 
virtual int GetNumTransforms () const
 
int GetMSBFirst () const
 
int GetVDFVersion () const
 
string GetWaveName () const
 
string GetBoundaryMode () const
 
virtual vector< size_t > GetCRatios () const
 
int GetVDCType () const
 
int SetGridType (const string &value)
 
string GetGridType () const
 
int IsValidGridType (const string &value) const
 
int SetCoordSystemType (const string &value)
 
string GetCoordSystemType () const
 
int IsValidCoordSystemType (const string &value) const
 
int SetExtents (const vector< double > &value)
 
vector< double > GetExtents (size_t ts=0) const
 
int IsValidExtents (const vector< double > &value) const
 
int SetNumTimeSteps (long value)
 
long GetNumTimeSteps () const
 
int IsValidTimeStep (long value) const
 
int SetVariableNames (const vector< string > &value)
 
int SetVariables3D (const vector< string > &value)
 
vector< string > GetVariables3D () const
 
vector< string > GetCoordinateVariables () const
 
int SetCoordinateVariables (const vector< string > &value)
 
int SetVariables2DXY (const vector< string > &value)
 
int SetVariables2DXZ (const vector< string > &value)
 
int SetVariables2DYZ (const vector< string > &value)
 
vector< string > GetVariables2DXY () const
 
vector< string > GetVariables2DXZ () const
 
vector< string > GetVariables2DYZ () const
 
int SetComment (const string &value)
 
string GetComment () const
 
int SetPeriodicBoundary (const vector< long > &value)
 
vector< long > GetPeriodicBoundary () const
 
int SetGridPermutation (const vector< long > &value)
 
int SetMissingValue (double value)
 
int SetMissingValue ()
 
vector< double > GetMissingValue () const
 
vector< long > GetGridPermutation () const
 
int SetMapProjection (const string &value)
 
virtual string GetMapProjection () const
 
int SetTSUserTime (size_t ts, const vector< double > &value)
 
double GetTSUserTime (size_t ts) const
 
int SetTSUserTimeStamp (size_t ts, const string &s)
 
void GetTSUserTimeStamp (size_t ts, string &s) const
 
string GetTSAuxBasePath (size_t ts) const
 
int HasTSUserTime (size_t ts) const
 
int IsValidUserTime (const vector< double > &value) const
 
int SetTSXCoords (size_t ts, const vector< double > &value)
 
vector< double > GetTSXCoords (size_t ts) const
 
int SetTSYCoords (size_t ts, const vector< double > &value)
 
vector< double > GetTSYCoords (size_t ts) const
 
int SetTSZCoords (size_t ts, const vector< double > &value)
 
vector< double > GetTSZCoords (size_t ts) const
 
int SetTSComment (size_t ts, const string &value)
 Set a comment for the time step indicated by ts. More...
 
string GetTSComment (size_t ts) const
 Return the comment for the indicated time step, ts, if it exists. More...
 
int SetTSExtents (size_t ts, const vector< double > &value)
 
vector< double > GetTSExtents (size_t ts) const
 
int SetTSMissingValue (size_t ts, double v)
 
vector< double > GetTSMissingValue (size_t ts) const
 Returns the time-varying missing value, if any. More...
 
int SetVComment (size_t ts, const string &var, const string &value)
 
string GetVComment (size_t ts, const string &var) const
 
string GetVBasePath (size_t ts, const string &var) const
 
int SetVBasePath (size_t ts, const string &var, const string &value)
 
int SetVDataRange (size_t ts, const string &var, const vector< double > &value)
 
vector< double > GetVDataRange (size_t ts, const string &var) const
 
int IsValidVDataRange (const vector< double > &value) const
 
int SetVMissingValue (size_t ts, const string &var, double v)
 
vector< double > GetVMissingValue (size_t ts, const string &var) const
 
vector< string > GetUserDataLongTags () const
 
int SetUserDataLong (const string &tag, const vector< long > &value)
 
vector< long > GetUserDataLong (const string &tag) const
 
vector< string > GetUserDataDoubleTags () const
 
int SetUserDataDouble (const string &tag, const vector< double > &value)
 
vector< double > GetUserDataDouble (const string &tag) const
 
vector< string > GetUserDataStringTags () const
 
int SetUserDataString (const string &tag, const string &value)
 
string GetUserDataString (const string &tag) const
 
int SetUserDataStringVec (const string &tag, const vector< string > &value)
 
vector< string > GetUserDataStringVec (const string &tag) const
 
vector< string > GetTSUserDataLongTags () const
 
int SetTSUserDataLong (size_t ts, const string &tag, const vector< long > &value)
 
vector< long > GetTSUserDataLong (size_t ts, const string &tag) const
 
int SetTSUserDataDouble (size_t ts, const string &tag, const vector< double > &value)
 
vector< double > GetTSUserDataDouble (size_t ts, const string &tag) const
 
vector< string > GetTSUserDataDoubleTags () const
 
int SetTSUserDataString (size_t ts, const string &tag, const string &value)
 
string GetTSUserDataString (size_t ts, const string &tag) const
 
vector< string > GetTSUserDataStringTags () const
 
vector< string > GetVUserDataLongTags () const
 
int SetVUserDataLong (size_t ts, const string &var, const string &tag, const vector< long > &value)
 
vector< long > GetVUserDataLong (size_t ts, const string &var, const string &tag) const
 
vector< string > GetVUserDataDoubleTags () const
 
int SetVUserDataDouble (size_t ts, const string &var, const string &tag, const vector< double > &value)
 
vector< double > GetVUserDataDouble (size_t ts, const string &var, const string &tag) const
 
int SetVUserDataString (size_t ts, const string &var, const string &tag, const string &value)
 
string GetVUserDataString (size_t ts, const string &var, const string &tag) const
 
vector< string > GetVUserDataStringTags () const
 
- Public Member Functions inherited from VetsUtil::MyBase
 MyBase ()
 
const string & getClassName () const
 
- Public Member Functions inherited from VAPoR::ParsedXml
virtual ~ParsedXml ()
 
virtual bool charHandler (ExpatParseMgr *, const XML_Char *, int)
 

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 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)
 
- Public Attributes inherited from VAPoR::ParsedXml
ParsedXmlpreviousClass
 
- 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 VAPoR::VDFIOBase
void _ReadTimerReset ()
 
void _ReadTimerStart ()
 
void _ReadTimerStop ()
 
void _WriteTimerReset ()
 
void _WriteTimerStart ()
 
void _WriteTimerStop ()
 
void _XFormTimerReset ()
 
void _XFormTimerStart ()
 
void _XFormTimerStop ()
 
int _MaskOpenWrite (size_t timestep, string varname, int reflevel)
 
int _MaskOpenRead (size_t timestep, string varname, int reflevel)
 
int _MaskClose ()
 
int _MaskWrite (const float *srcblk, const size_t bmin_p[3], const size_t bmax_p[3], bool block)
 
int _MaskRead (const size_t bmin_p[3], const size_t bmax_p[3])
 
void _MaskRemove (float *blk, bool &valid_data) const
 
void _MaskReplace (size_t bx, size_t by, size_t bz, float *blk) const
 
- Protected Member Functions inherited from VetsUtil::MyBase
void SetClassName (const string &name)
 
- Static Protected Member Functions inherited from VAPoR::VDFIOBase
static void _UnpackCoord (VarType_T vtype, const size_t src[3], size_t dst[3], size_t fill)
 
static void _PackCoord (VarType_T vtype, const size_t src[3], size_t dst[3], size_t fill)
 
static void _FillPackedCoord (VarType_T vtype, const size_t src[3], size_t dst[3], size_t fill)
 
- Static Protected Attributes inherited from VAPoR::ParsedXml
static const string _stringType
 
static const string _longType
 
static const string _doubleType
 
static const string _typeAttr
 

Detailed Description

Performs data IO to VDF files.

Author
John Clyne
Version
$$
Date
$$

This class provides an API for performing IO on AMR data sets to/from Vapor Data Collections (VDCs)

Definition at line 45 of file AMRIO.h.

Constructor & Destructor Documentation

VAPoR::AMRIO::AMRIO ( const MetadataVDC metadata)

Constructor for the AMRIO class.

Parameters
[in]metadataPointer to a metadata class object for which all future class operations will apply. The metadata class object identifies the VDC for all subsequent data operations
[in]nthreadsNumber of execution threads that may be used by the class for parallel execution.
Note
The success or failure of this constructor can be checked with the GetErrCode() method.
See also
MetadataVDC, GetErrCode(),
VAPoR::AMRIO::AMRIO ( const string &  metafile)

Constructor for the AMRIO class.

Parameters
[in]metafilePath to a metadata file for which all future class operations will apply. The metadata class object identifies the VDC for all subsequent data operations
Note
The success or failure of this constructor can be checked with the GetErrCode() method.
See also
MetadataVDC, GetErrCode(),
virtual VAPoR::AMRIO::~AMRIO ( )
virtual

Member Function Documentation

virtual int VAPoR::AMRIO::BlockReadRegion ( const size_t  bmin[3],
const size_t  bmax[3],
float *  region,
bool  unblock = true 
)
inlinevirtual

Implements VAPoR::VDFIOBase.

Definition at line 240 of file AMRIO.h.

virtual int VAPoR::AMRIO::BlockWriteRegion ( const float *  region,
const size_t  bmin[3],
const size_t  bmax[3],
bool  block = true 
)
inlinevirtual

Implements VAPoR::VDFIOBase.

Definition at line 192 of file AMRIO.h.

int VAPoR::AMRIO::CloseTree ( )

Close the currently opened octree.

See also
OpenTreeWrite(), OpenTreeRead()
virtual int VAPoR::AMRIO::CloseVariable ( )
virtual

Close the currently opened variable.

See also
OpenVariableWrite(), OpenVariableRead()

Reimplemented from VAPoR::VDFIOBase.

Referenced by VAPoR::DataMgrAMR::_CloseVariable().

int VAPoR::AMRIO::GetBlockMaxs ( const float **  maxs,
int  reflevel 
) const

Return the maximum data values for each block in the volume

int VAPoR::AMRIO::GetBlockMins ( const float **  mins,
int  reflevel 
) const

Return the minimum data values for each block in the volume

This method returns an a pointer to an internal array containing the minimum data value for each block at the specified refinement level. The serial array is dimensioned nbx by nby by nbz, where nbx, nby, and nbz are the dimensions of the volume in blocks at the requested refinement level.

Parameters
[in]reflevelRefinement level requested. The coarsest refinement level is 0 (zero). A value of -1 indicates the finest refinement level contained in the VDC.
[out]minsThe address of a pointer to float to which will be assigned the address of the internal min data array

The values returned are undefined if the variable is either not open for reading, closed after writing

const float* VAPoR::AMRIO::GetDataRange ( ) const
inlinevirtual

Implements VAPoR::VDFIOBase.

Definition at line 306 of file AMRIO.h.

Referenced by VAPoR::DataMgrAMR::_GetDataRange().

void VAPoR::AMRIO::GetValidRegion ( size_t  min[3],
size_t  max[3],
int  reflevel 
) const
int VAPoR::AMRIO::OpenTreeRead ( size_t  timestep)

Open the specified AMR octree for reading

Prepare a VDC for the reading of an AMR grid topology octree. AMR grids contain two components: a topology octree which describes the cell refinement hierarchy, and the field values associated with the cells in the octree. A single octree is associated with each time step, whereas multiple field variables may be defined for each time step, all associated with the same octree.

Parameters
[in]timestepTime step of the octree to write
Return values
statusReturns a non-negative value on success
See also
Metadata::GetVariableNames(), Metadata::GetNumTransforms()
int VAPoR::AMRIO::OpenTreeWrite ( size_t  timestep)

Open the specified AMR octree for writing

Prepare a VDC for the storage of an AMR grid topology octree. AMR grids contain two components: a topology octree which describes the cell refinement hierarchy, and the field values associated with the cells in the octree. A single octree is associated with each time step, whereas multiple field variables may be defined for each time step, all associated with the same octree.

Parameters
[in]timestepTime step of the octree to write
Return values
statusReturns a non-negative value on success
See also
Metadata::GetVariableNames(), Metadata::GetNumTransforms()
TreeWrite()
int VAPoR::AMRIO::OpenVariableRead ( size_t  timestep,
const char *  varname,
int  reflevel = 0,
int  lod = 0 
)
virtual

Open the named AMR grid for reading

This method prepares the AMR data grid, 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. The valid range of values for reflevel is [0..max_refinement], where max_refinement is the maximum finement level of the data set: Metadata::GetNumTransforms(). volume when the volume was created. A value of zero indicates the coarsest resolution data, a value of max_refinement indicates the finest resolution data.

An error occurs, indicated by a negative return value, if the volume identified by the {varname, timestep, reflevel} tripple 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
Return values
statusReturns a non-negative value on success
See also
Metadata::GetVariableNames(), Metadata::GetNumTransforms()

Reimplemented from VAPoR::VDFIOBase.

int VAPoR::AMRIO::OpenVariableWrite ( size_t  timestep,
const char *  varname,
int  reflevel = -1,
int  lod = -1 
)
virtual

Open the named AMR variable for writing

Prepare a VDC for the storage of an AMR grid via subsequent write operations. The AMR grid is identified by the specfied time step and variable name. The maximum number of refinement level is determined by the Metadata object used to initialize the class. The number of refinement levels actually saved to the data collection are determined by reflevels. If reflevels is zero, the default, only the coarsest approximation is saved. If reflevels is one, the coarsest and first refinement level is saved, and so on. A value of -1 indicates the maximum refinment level permitted by the associated Metadata object

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.
Return values
statusReturns a non-negative value on success
See also
Metadata::GetVariableNames(), Metadata::GetNumTransforms()

Reimplemented from VAPoR::VDFIOBase.

virtual int VAPoR::AMRIO::ReadRegion ( const size_t  min[3],
const size_t  max[3],
float *  region 
)
inlinevirtual

Implements VAPoR::VDFIOBase.

Definition at line 244 of file AMRIO.h.

virtual int VAPoR::AMRIO::ReadRegion ( float *  region)
inlinevirtual

Implements VAPoR::VDFIOBase.

Definition at line 248 of file AMRIO.h.

virtual int VAPoR::AMRIO::ReadSlice ( float *  slice)
inlinevirtual

Implements VAPoR::VDFIOBase.

Definition at line 252 of file AMRIO.h.

int VAPoR::AMRIO::TreeRead ( AMRTree tree)

Read an AMR octree

Read the currently opened octree into the AMRTree structure pointed to tree.

Parameters
[out]treeUpon success the octree pointed to by tree will contain the octree associated with the currently opened time step.
See also
OpenTreeRead()
int VAPoR::AMRIO::TreeWrite ( const AMRTree tree)

Write an AMR octree

Write the octree pointed to by tree to the VDC at the time step associated with the currently opened tree.

Parameters
[in]treeA pointer to an AMR octree
See also
OpenTreeRead()
int VAPoR::AMRIO::VariableExists ( size_t  ts,
const char *  varname,
int  reflevel = 0,
int  lod = 0 
) const

Returns true if indicated AMR grid exists on disk

Returns true if the variable identified by the timestep, variable name, and refinement level is present on disk. Returns 0 if the variable is not present.

Parameters
[in]tsA valid time step from the Metadata object used to initialize the class
[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.

Referenced by VAPoR::DataMgrAMR::_VariableExists().

int VAPoR::AMRIO::VariableRead ( AMRData data)

Read an AMR grid

Read the currently opened AMR grid into the AMRData structure pointed to data.

Parameters
[out]dataUpon success the AMR grid pointed to by data will contain the AMR Grid associated with the currently opened time step and variable.
See also
OpenDataRead()
int VAPoR::AMRIO::VariableWrite ( AMRData data)

Write an AMR grid

Write the AMR grid pointed to by data to the VDC at the time step associated and variable with the currently opened grid.

Parameters
[in]treeA pointer to an AMR octree
See also
OpenDataRead()
virtual int VAPoR::AMRIO::WriteRegion ( const float *  region,
const size_t  min[3],
const size_t  max[3] 
)
inlinevirtual

Implements VAPoR::VDFIOBase.

Definition at line 197 of file AMRIO.h.

virtual int VAPoR::AMRIO::WriteRegion ( const float *  region)
inlinevirtual

Implements VAPoR::VDFIOBase.

Definition at line 201 of file AMRIO.h.

virtual int VAPoR::AMRIO::WriteSlice ( const float *  slice)
inlinevirtual

Implements VAPoR::VDFIOBase.

Definition at line 205 of file AMRIO.h.


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