7#ifndef PARALLELIO_HDF5_H
8#define PARALLELIO_HDF5_H
10#ifdef MAIA_GCC_COMPILER
11#pragma GCC diagnostic ignored "-Wredundant-tags"
14#ifdef MAIA_GCC_COMPILER
15#pragma GCC diagnostic pop
69 MPI_Offset memoryStride,
const size_type noChunks, MPI_Offset diskStride);
This class is intended to do all the heavy lifting when it comes to reading and writing "big data" fi...
MLong size_type
Type used for all size- and offset-related values.
maia::parallel_io::maiabd_type maiabd_type
Type used for all constants that are defined in maia::parallel_io.
MBool b_hasObject(const MString &path)
void b_createAttribute(const T *value, const MString &name, const MString &datasetName, hid_t type_id, const size_type totalCount)
Creates an attribute in the file (generic version).
void b_defineScalar(maiabd_type type, const MString &name)
Defines a scalar in the file. [MPI]
void b_saveHeader()
Adds all additional header information that are needed in the file.
void b_readArray(T *, const MString &, const size_type, MPI_Offset *, MPI_Offset *, MPI_Offset, const size_type, MPI_Offset)
Read array data from file (float version). [MPI]
void b_writeScalar(T scalar, const MString &name)
Writes scalar data to file (Hdf5 version). [MPI]
hid_t b_h5DatasetXferHandle
void b_defineArray(maiabd_type, const MString &, const MString &, const size_type, const size_type *)
void b_writeArray(const T *array, const MString &name, const size_type noDims, MPI_Offset *start, MPI_Offset *count, MPI_Offset memoryStride, const size_type noChunks, MPI_Offset diskStride)
Writes array data to file (Hdf5 version). [MPI]
void b_addAdditionalHeader()
Write additional headers to file (e.g. grid file name, creation date etc.). [MPI]
void b_getAttribute(T *value, const MString &name, const MString &datasetName="", const size_type totalCount=1)
Retrieve an attribute from file (float version).
static void b_error(MInt status, const MString &name, const MString &location)
Check the status code of a HDF5 operation and output a meaningful message.
MBool b_hasAttribute(const MString &name, const MString &path="")
Check if object exists. [MPI]
size_type b_getDatasetNoDims(const MString &name)
Get number of dimensions of a dataset with the given name.
MInt b_getDatasetType(const MString &name)
Returns the data type of a dataset in the file (can be array, multi-D array or scalar).
void b_readScalar(T *scalar, const MString &name)
Read scalar data from file (float version). [MPI]
MInt b_getAttributeType(const MString &name, const MString &datasetName="")
Returns the data type of an attribute in the file.
void b_defineArray(maiabd_type type, const MString &name, size_type noDims, size_type *totalCount)
Defines an array in the file. [MPI]
~ParallelIoHdf5() override
Close open identifiers and release memory. [MPI]
void b_writeAdditionalData()
Write additional data to file. [MPI]
size_type b_getNoDatasets(const MString &path)
Gets the number of datasetes in the given group [MPI]
void b_setAttribute(const T *value, const MString &name, const MString &datasetName="", const size_type totalCount=1)
Set an attribute in the file (generic version).
static void b_warning(MInt status, const MString &name, const MString &location)
Check the status code of a HDF5 operation and output a meaningful message (Warning)
void b_getGroupNames(std::vector< MString > &names, const MString &path)
Gets the groups in the given group [MPI]
void b_getDatasetNames(std::vector< MString > &names, const size_type dimension)
Returns a vector of all existing datasets with the given number of dimensions in the file (if any)....
static const MString b_fileExt()
Returns backend-specific ending of filename (either ".Netcdf" or ".Hdf5")
static MBool b_isValidFile(const MString &name, const MPI_Comm &mpiComm)
Check if specified file is a valid HDF5 file (i.e. can be opened). [MPI]
void b_getAttributeCount(const MString &name, size_type *totalCount, const MString &datasetName="")
void b_createGroup(const MString &path)
Creates an HDF5 group [MPI]
size_type b_getDatasetSize(const MString &name, const size_type dimensionId=0)
Get the length of one dimension of an arbitrary array in the file.
MBool b_hasDataset(const MString &name, const size_type dimension)
Check if the file contains a dataset with the given name and number of dimensions.
size_type b_getNoGroups(const MString &path)
Gets the number of groups in the given group [MPI]
std::basic_string< char > MString