|
| WaveCodecIO (const MetadataVDC &metadata, int nthreads=0) |
|
| WaveCodecIO (const string &metafile, int nthreads=0) |
|
virtual | ~WaveCodecIO () |
|
virtual int | OpenVariableRead (size_t timestep, const char *varname, int reflevel=0, int lod=0) |
|
virtual int | OpenVariableWrite (size_t timestep, const char *varname, int reflevel=-1, int lod=-1) |
|
virtual int | CloseVariable () |
|
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 | 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) |
|
virtual void | SetBoundaryPadOnOff (bool pad) |
|
const float * | GetDataRange () const |
|
void | GetValidRegion (size_t min[3], size_t max[3], int reflevel) const |
|
virtual int | VariableExists (size_t ts, const char *varname, int reflevel=0, int lod=0) const |
|
virtual int | GetNumTransforms () const |
|
virtual void | GetBlockSize (size_t bs[3], int reflevel) const |
|
void | SetCollectiveIO (bool newCollectiveIO) |
|
int | getNumThread () |
|
void | EnableBuffering (size_t count[3], size_t divisor, int rank) |
|
|
typedef void(* | ErrMsgCB_T) (const char *msg, int err_code) |
|
typedef void(* | DiagMsgCB_T) (const char *msg) |
|
| EasyThreads (int nthreads) |
|
| ~EasyThreads () |
|
int | ParRun (void *(*start)(void *), std::vector< void * > arg) |
|
int | ParRun (void *(*start)(void *), void **arg) |
|
int | Barrier () |
|
int | MutexLock () |
|
int | MutexUnlock () |
|
int | GetNumThreads () const |
|
void | SetClassName (const string &name) |
|
| MyBase () |
|
const string & | getClassName () const |
|
static void | Decompose (int n, int size, int rank, int *offset, int *length) |
|
static int | NProc () |
|
static void | SetErrMsg (const char *format,...) |
| Record a formatted error message.
|
|
static void | SetErrMsg (int errcode, const char *format,...) |
| Record a formatted error message and an error code.
|
|
static const char * | GetErrMsg () |
|
static void | SetErrCode (int err_code) |
| Record an error code.
|
|
static int | GetErrCode () |
| Retrieve the current error code.
|
|
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.
|
|
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 bool | GetEnableErrMsg () |
|
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 sub-region reader for VDF files.
- Author
- John Clyne
- Version
- $Revision$
- Date
- $Date$
This class provides an API for reading and writing VDC2 data. VDC2 data may be accessed with two forms of wavelet based progressive refinement, : hierarchical or level-of-detail. The former supports coarsening and refinement of the sampling grid resolution (the dimensions of the sampling grid) at varying powers-of-two, and is controled by the reflevel
parameter. The latter allows for arbitrary approximations by restricting the number of wavelet basis coefficients used when reconstructing the data from their wavelet representation. The level-of-detail is controled with the lod
parameter.
Definition at line 38 of file WaveCodecIO.h.
virtual int VAPoR::WaveCodecIO::BlockReadRegion |
( |
const size_t |
bmin[3], |
|
|
const size_t |
bmax[3], |
|
|
float * |
region, |
|
|
bool |
unblock = true |
|
) |
| |
|
virtual |
Read in and return a subregion from the currently opened data volume.
The bmin
and bmax
vectors identify the minimum and maximum extents, in block coordinates, of the subregion of interest. The minimum valid value of 'bmin' is (0,0,0), the maximum valid value of bmax
is (nbx-1,nby-1,nbz-1), where nx, ny, and nz are the block dimensions of the volume at the currently opened refinement level as retuned by GetDimBlk(). The volume returned is stored in the memory region pointed to by region
. It is the caller's responsbility to ensure adequate space is available.
- Parameters
-
[in] | bmin | Minimum region extents in block coordinates |
[in] | bmax | Maximum region extents in block coordinates |
[out] | region | The requested volume subregion |
[in] | unblock | If true, unblock the data before copying to region |
- Return values
-
status | Returns a non-negative value on success |
- See also
- OpenVariableRead(), GetBlockSize(), MapVoxToBlk()
virtual int VAPoR::WaveCodecIO::BlockWriteRegion |
( |
const float * |
region, |
|
|
const size_t |
bmin[3], |
|
|
const size_t |
bmax[3], |
|
|
bool |
block = true |
|
) |
| |
|
virtual |
Write a volume subregion to the currently opened progressive access data volume.
This method is identical to the WriteRegion() method with the exception that the region boundaries are defined in block, not voxel, coordinates. Secondly, unless the 'block' parameter is set, the internal blocking of the data will be preserved. I.e. the data are assumed to already be blocked.
The number of voxels contained in region
must be the product over i :
(bmax[i] - bmin
[i] + 1) * bs[i]
where bs[i] is the ith dimension of the block size.
- Parameters
-
[in] | bmin | Minimum region extents in block coordinates |
[in] | bmax | Maximum region extents in block coordinates |
[in] | region | The volume subregion to write |
[in] | block | If true, block the data before writing/transforming |
- Return values
-
status | Returns a non-negative value on success |
- See also
- OpenVariableWrite() SetBoundarPadOnOff()
static size_t VAPoR::WaveCodecIO::GetMaxCRatio |
( |
const size_t |
bs[3], |
|
|
string |
wavename, |
|
|
string |
wmode |
|
) |
| |
|
static |
Return the maximimum compression ratio possible
This static methods returns the maximum possible compression ratio possible for a given combination of blocksize, ps
, wavele name, wname
, and wavelet boundary handling mode, wmode
.
- Parameters
-
[in] | bs | A three-element vector providing the dimensions of a block |
[in] | wavename | The name of the wavelet |
[in] | wmode | The wavelet boundary handling mode |
- Return values
-
ratio | A value of zero is returned if the wavename or wmode are invalid, otherwise the maximum possible data compression ratio is returned. |
- See also
- Metadata::GetCRatios()
void VAPoR::WaveCodecIO::GetValidRegion |
( |
size_t |
min[3], |
|
|
size_t |
max[3], |
|
|
int |
reflevel |
|
) |
| const |
Return the valid region bounds for the currently opened variable
This method returns the minimum and maximum valid coordinate bounds (in voxels) of the currently opened variable. In general, the minimum bounds are (0,0,0) and the maximum bounds are (nx-1, ny-1, nz-1), where nx, ny, and nz are the volume dimensions returned by GetDim(). However, partial regions (sub-volumes) may be written to the VDC as well.
- Parameters
-
[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 |
- Return values
-
status | A non-negative int is returned on success |
virtual int VAPoR::WaveCodecIO::OpenVariableRead |
( |
size_t |
timestep, |
|
|
const char * |
varname, |
|
|
int |
reflevel = 0 , |
|
|
int |
lod = 0 |
|
) |
| |
|
virtual |
Open the named variable for reading
This method prepares a data volume (slice), indicated by a variable name and time step pair, for subsequent read operations by methods of this class. The number of the refinement levels 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 refinement level of the data set: Metadata::GetNumTransforms(). A value of zero indicates the coarsest resolution data, a value of max_refinement
(or -1) indicates the finest resolution data. The level-of-detail parameter, lod
, selects the approximation level. Valid values for lod
are integers in the range 0..GetCRatios().size()-1, or the value -1 may be used to select the best approximation available: GetCRatios().size()-1.
An error occurs, indicated by a negative return value, if the volume identified by the {varname, timestep, reflevel, lod} tupple is not available. Note the availability of a volume can be tested with the VariableExists() method.
- Parameters
-
[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 | Approximation level of the variable. A value of -1 indicates the maximum approximation level defined for the VDC |
- Return values
-
status | Returns a non-negative value on success |
- See also
- Metadata::GetVariableNames(), Metadata::GetNumTransforms(), GetNumTimeSteps(), GetCRatios()
virtual int VAPoR::WaveCodecIO::OpenVariableWrite |
( |
size_t |
timestep, |
|
|
const char * |
varname, |
|
|
int |
reflevel = -1 , |
|
|
int |
lod = -1 |
|
) |
| |
|
virtual |
Open the named variable for writing
Prepare a VDC for writing a data volume (slice). The data volume is identified by the specfied time step and variable name. The number of resulting approximations for the data volume is determined by the Metadata object used to initialize the class. Moreover, the number of levels-of-detail actually saved to the data collection are determined by lod
. If lod
is maximum level of detail (or the special value -1, the default) all of the wavelet coefficients are saved, and it is possible to fully reconstruct the volume later without loss of information (beyond floating point round off).
- Parameters
-
[in] | timestep | Time step of the variable to read |
[in] | varname | Name of the variable to read |
[in] | lod | Level of detail saved. A value of -1 indicates the maximum level of detail. |
- Return values
-
status | Returns a non-negative value on success |
- See also
- Metadata::GetVariableNames(), Metadata::GetNumTransforms()
virtual int VAPoR::WaveCodecIO::ReadRegion |
( |
const size_t |
min[3], |
|
|
const size_t |
max[3], |
|
|
float * |
region |
|
) |
| |
|
virtual |
Read in and return a subregion from the currently opened data volume.
This method is similar to BlockReadRegion() with the exception that the region bounds are specified in voxel coordinates. The min
and max
vectors identify the minimum 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 currently opened refinement level as returned by GetDim().
The volume returned is stored in the memory region pointed to by region
. It is the caller's responsbility to ensure adequate space is available.
- Parameters
-
[in] | min | Minimum region extents in voxel coordinates |
[in] | max | Maximum region extents in voxel coordinates |
[out] | region | The requested volume subregion |
- Return values
-
status | Returns a non-negative value on success |
- See also
- OpenVariableRead(), GetDim(), MapVoxToBlk()
virtual int VAPoR::WaveCodecIO::ReadSlice |
( |
float * |
slice | ) |
|
|
virtual |
Read the next volume slice from the currently opened file
Read in and return a slice (2D array) of voxels from the currently opened data volume at the current refinement level. Subsequent calls will read successive slices until the entire volume has been read. It is the caller's responsibility to ensure that the array pointed to by slice
contains enough space to accomodate an NX by NY dimensioned slice, where NX is the dimesion of the volume along the X axis, specified in voxels, and NY is the Y axis dimension, as returned by GetDim().
- Note
- ReadSlice returns 0 if the entire volume has been read.
- Parameters
-
[out] | slice | The requested volume slice |
- Return values
-
status | Returns a non-negative value on success |
- See also
- OpenVariableRead(), Metadata::GetDim()
virtual int VAPoR::WaveCodecIO::WriteRegion |
( |
const float * |
region, |
|
|
const size_t |
min[3], |
|
|
const size_t |
max[3] |
|
) |
| |
|
virtual |
Write a volume subregion to the currently opened progressive access data volume.
This method is identical to the WriteRegion() method with the exception that the region boundaries are defined in block, not voxel, coordinates. Secondly, unless the 'block' parameter is set, the internal blocking of the data will be preserved. I.e. the data are assumed to already be blocked.
The number of voxels contained in region
must be the product over i :
(max[i] - min
[i] + 1)
- Parameters
-
[in] | min | Minimum region extents in voxel coordinates |
[in] | max | Maximum region extents in voxel coordinates |
[in] | region | The volume subregion to write |
- Return values
-
status | Returns a non-negative value on success |
- See also
- OpenVariableWrite(), GetBlockSize(), MapVoxToBlk()
-
SetBoundarPadOnOff()
- Note
- Unexpected results may be obtained if this method is invoked multiple times for adjacent regions if the region boundaries do not coincide with block boundaries.
virtual int VAPoR::WaveCodecIO::WriteSlice |
( |
const float * |
slice | ) |
|
|
virtual |
Write a single slice of voxels to the currently opened variable
Transform and write a single slice (2D array) of voxels to the variable indicated by the most recent call to OpenVariableWrite(). The dimensions of a slices is NX by NY, where NX is the dimesion of the volume along the X axis, specified in voxels, and NY is the Y axis dimension.
This method should be called exactly NZ times for each opened variable, where NZ is the dimension of the volume in voxels along the Z axis. Each invocation should pass a successive slice of volume data.
- Parameters
-
[in] | slice | A slices of volume data |
- Return values
-
status | Returns a non-negative value on success |
- See also
- OpenVariableRead()