kspaceFirstOrder3D-OMP 1.0
The C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes
THDF5_File Class Reference

Class wrapping the HDF5 routines.

#include <HDF5_File.h>

Collaboration diagram for THDF5_File:
Collaboration graph
[legend]

List of all members.

Public Types

enum  THDF5_MatrixDataType { hdf5_mdt_float = 0, hdf5_mdt_long = 1 }
 HDF5 matrix data type.
enum  THDF5_MatrixDomainType { hdf5_mdt_real = 0, hdf5_mdt_complex = 1 }
 HDF5 Matrix domain type.

Public Member Functions

 THDF5_File ()
 Constructor.
void Create (const char *FileName, unsigned int Flags=H5F_ACC_TRUNC)
 Create the file.
void Open (const char *FileName, unsigned int Flags=H5F_ACC_RDONLY)
 Open the file.
bool IsOpened () const
void Close ()
 Close file.
hid_t OpenDataset (const char *DatasetName)
 Open the HDF5 dataset.
hid_t CreateFloatDataset (const char *DatasetName, const TDimensionSizes &DimensionSizes, const TDimensionSizes &ChunkSizes, const int CompressionLevel)
 Create the HDF5 dataset.
void CloseDataset (const hid_t &HDF5_Dataset_id)
 Close the HDF5 dataset.
void WriteCompleteDataset (const char *DatasetName, const TDimensionSizes &DimensionSizes, const float *Data)
 Write data into a dataset.
void WriteCompleteDataset (const char *DatasetName, const TDimensionSizes &DimensionSizes, const long *Data)
 Write data into a dataset.
void WriteHyperSlab (const hid_t HDF5_Dataset_id, const TDimensionSizes &Position, const TDimensionSizes &Size, const float *Data)
 Write a hyper-slab into the dataset.
void WriteHyperSlab (const hid_t HDF5_Dataset_id, const TDimensionSizes &Position, const TDimensionSizes &Size, const long *Data)
 Write a hyper-slab into the dataset.
void WriteScalarValue (const char *DatasetName, const float Value)
 Write the scalar value.
void WriteScalarValue (const char *DatasetName, const long Value)
 Write the scalar value.
void ReadCompleteDataset (const char *DatasetName, const TDimensionSizes &DimensionSizes, float *Data)
 Read data from the dataset.
void ReadCompleteDataset (const char *DatasetName, const TDimensionSizes &DimensionSizes, long *Data)
 Read data from the dataset.
TDimensionSizes GetDatasetDimensionSizes (const char *DatasetName)
 Check dataset dimension sizes.
size_t GetDatasetElementCount (const char *DatasetName)
 Get dataset element count.
void WriteMatrixDataType (const char *DatasetName, const THDF5_MatrixDataType &MatrixDataType)
 Write matrix data type into the dataset.
void WriteMatrixDomainType (const char *DatasetName, const THDF5_MatrixDomainType &MatrixDomainType)
 Write matrix domain type into the dataset.
THDF5_File::THDF5_MatrixDataType ReadMatrixDataType (const char *DatasetName)
 Read matrix data type from the dataset.
THDF5_File::THDF5_MatrixDomainType ReadMatrixDomainType (const char *DatasetName)
 Read matrix domain type from the dataset.
void WriteStringAttribute (const char *DatasetName, const char *AttributeName, const string &Value)
 Write string attribute into the dataset.
string ReadStringAttribute (const char *DatasetName, const char *AttributeName)
 Read string attribute from the dataset.
virtual ~THDF5_File ()
 Destructor.

Protected Member Functions

 THDF5_File (const THDF5_File &src)
 Copy constructor is not allowed for public.
THDF5_Fileoperator= (const THDF5_File &src)
 Operator = is not allowed for public.

Private Attributes

hid_t HDF5_FileId
 HDF file handle.
string FileName
 File name.

Static Private Attributes

static const char * HDF5_MatrixDomainTypeName = "domain_type"
 String representation of the Domain type in the HDF5 file.
static const char * HDF5_MatrixDataTypeName = "data_type"
 String representation of the Data type in the HDF5 file.
static const string HDF5_MatrixDomainTypeNames [] = {"real","complex"}
 String representation of different domain types.
static const string HDF5_MatrixDataTypeNames [] = {"float","long"}
 String representation of different data types.

Detailed Description

Definition at line 357 of file HDF5_File.h.


Constructor & Destructor Documentation

THDF5_File::THDF5_File ( )

Constructor

Definition at line 72 of file HDF5_File.cpp.

THDF5_File::~THDF5_File ( ) [virtual]

Destructor

Definition at line 175 of file HDF5_File.cpp.

Here is the call graph for this function:


Member Function Documentation

void THDF5_File::Close ( )

Close the HDF5 file.

Definition at line 155 of file HDF5_File.cpp.

Here is the caller graph for this function:

void THDF5_File::CloseDataset ( const hid_t &  HDF5_Dataset_id)

Close dataset.

Parameters:
[in]HDF5_Dataset_id

Definition at line 275 of file HDF5_File.cpp.

Here is the caller graph for this function:

void THDF5_File::Create ( const char *  FileName,
unsigned int  Flags = H5F_ACC_TRUNC 
)

Create the HDF5 file.

Parameters:
[in]FileName- File name
[in]Flags- Flags for the HDF5 runtime
Exceptions:
ios:failureif error happened

Definition at line 89 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

hid_t THDF5_File::CreateFloatDataset ( const char *  DatasetName,
const TDimensionSizes DimensionSizes,
const TDimensionSizes ChunkSizes,
const int  CompressionLevel 
)

Create the dataset.

Exceptions:
ios::failure
Parameters:
[in]DatasetName- Dataset name
[in]DimensionSizes- Dataset dimension sizes
[in]ChunkSizes- 3D Chunk size
[in]CompressionLevel- Compression level
Returns:
Dataset_id

Definition at line 218 of file HDF5_File.cpp.

Here is the caller graph for this function:

TDimensionSizes THDF5_File::GetDatasetDimensionSizes ( const char *  DatasetName)

Get dimension sizes of the dataset.

Parameters:
[in]DatasetName
Returns:
DimensionSizes
Exceptions:
ios::failure

Definition at line 548 of file HDF5_File.cpp.

Here is the caller graph for this function:

size_t THDF5_File::GetDatasetElementCount ( const char *  DatasetName)

Get number of elements of the dataset.

Parameters:
[in]DatasetName
Returns:
Number of elements
Exceptions:
ios::failure

Definition at line 572 of file HDF5_File.cpp.

Here is the caller graph for this function:

bool THDF5_File::IsOpened ( ) const [inline]

Is the file opened?

Returns:
true if the file is opened

Definition at line 385 of file HDF5_File.h.

Here is the caller graph for this function:

void THDF5_File::Open ( const char *  FileName,
unsigned int  Flags = H5F_ACC_RDONLY 
)

Open the HDF5 file.

Parameters:
[in]FileName
[in]Flags- flags for the HDF5 runtime
Exceptions:
ios:failureif error happened

Definition at line 122 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

hid_t THDF5_File::OpenDataset ( const char *  DatasetName)

Open the dataset.

Exceptions:
ios::failure
Parameters:
[in]DatasetName
Returns:
Dataset id

Definition at line 191 of file HDF5_File.cpp.

void THDF5_File::ReadCompleteDataset ( const char *  DatasetName,
const TDimensionSizes DimensionSizes,
float *  Data 
)

Read data from the dataset.

Parameters:
[in]DatasetName
[in]DimensionSizes
[out]Data
Exceptions:
ios::failure

Definition at line 491 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_File::ReadCompleteDataset ( const char *  DatasetName,
const TDimensionSizes DimensionSizes,
long *  Data 
)

Write data from the dataset.

Parameters:
[in]DatasetName
[in]DimensionSizes
[out]Data
Exceptions:
ios::failure

Definition at line 520 of file HDF5_File.cpp.

Here is the call graph for this function:

THDF5_File::THDF5_MatrixDataType THDF5_File::ReadMatrixDataType ( const char *  DatasetName)

Read matrix data type.

Parameters:
[in]DatasetName
Returns:
MatrixDataType
Exceptions:
ios::failure

Definition at line 626 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

THDF5_File::THDF5_MatrixDomainType THDF5_File::ReadMatrixDomainType ( const char *  DatasetName)

Read matrix domain type.

Parameters:
[in]DatasetName
Returns:
DomainType
Exceptions:
ios::failure

Definition at line 652 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

string THDF5_File::ReadStringAttribute ( const char *  DatasetName,
const char *  AttributeName 
) [inline]

Read integer attribute.

Parameters:
[in]DatasetName
[in]AttributeName
Returns:
Attribute value
Exceptions:
ios::failure

Definition at line 705 of file HDF5_File.cpp.

Here is the caller graph for this function:

void THDF5_File::WriteCompleteDataset ( const char *  DatasetName,
const TDimensionSizes DimensionSizes,
const float *  Data 
)

Write data into a dataset.

Parameters:
[in]DatasetName
[in]DimensionSizes
[in]Data
Exceptions:
ios::failure

Definition at line 293 of file HDF5_File.cpp.

Here is the caller graph for this function:

void THDF5_File::WriteCompleteDataset ( const char *  DatasetName,
const TDimensionSizes DimensionSizes,
const long *  Data 
)

Write data into a dataset.

Parameters:
[in]DatasetName
[in]DimensionSizes
[in]Data
Exceptions:
ios::failure

Definition at line 320 of file HDF5_File.cpp.

void THDF5_File::WriteHyperSlab ( const hid_t  HDF5_Dataset_id,
const TDimensionSizes Position,
const TDimensionSizes Size,
const long *  Data 
)

Write hyperslab.

Parameters:
[in]HDF5_Dataset_id- Dataset id
[in]Position- Position in the dataset
[in]Size- Size of the hyperslab
[in]Data
Exceptions:
ios::failure

Definition at line 403 of file HDF5_File.cpp.

void THDF5_File::WriteHyperSlab ( const hid_t  HDF5_Dataset_id,
const TDimensionSizes Position,
const TDimensionSizes Size,
const float *  Data 
)

Write a hyperslab into the dataset.

Parameters:
[in]HDF5_Dataset_id- Dataset id
[in]Position- Position in the dataset
[in]Size- Size of the hyperslab
[in]Data
Exceptions:
ios::failure

Definition at line 349 of file HDF5_File.cpp.

Here is the caller graph for this function:

void THDF5_File::WriteMatrixDataType ( const char *  DatasetName,
const THDF5_MatrixDataType MatrixDataType 
)

Write matrix data type into the dataset.

Parameters:
[in]DatasetName
[in]MatrixDataType

Definition at line 597 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_File::WriteMatrixDomainType ( const char *  DatasetName,
const THDF5_MatrixDomainType MatrixDomainType 
)

Write matrix data type into the dataset.

Parameters:
[in]DatasetName
[in]MatrixDomainType

Definition at line 611 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_File::WriteScalarValue ( const char *  DatasetName,
const long  Value 
)

Write a scalar value.

Parameters:
[in]DatasetName
[in]Value

Definition at line 471 of file HDF5_File.cpp.

Here is the call graph for this function:

void THDF5_File::WriteScalarValue ( const char *  DatasetName,
const float  Value 
)

Write a scalar value into the file.

Parameters:
[in]DatasetName
[in]Value

Definition at line 455 of file HDF5_File.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void THDF5_File::WriteStringAttribute ( const char *  DatasetName,
const char *  AttributeName,
const string &  Value 
) [inline]

Write integer attribute.

Parameters:
[in]DatasetName
[in]AttributeName
[in]Value
Exceptions:
ios::failure

Definition at line 681 of file HDF5_File.cpp.

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations