7#ifndef PARALLELIO_PNETCDF_H
8#define PARALLELIO_PNETCDF_H
62 MPI_Offset* count, MPI_Offset memoryStride,
const size_type noChunks, MPI_Offset diskStride);
70 MPI_Offset memoryStride,
const size_type noChunks, MPI_Offset diskStride);
96 using NcDimMap = std::map<size_type, NcDimProxy>;
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.
MInt b_getDatasetType(const MString &name)
Returns the data type of a dataset in the file (can be array, multi-D array or scalar).
static const MString b_fileExt()
Returns backend-specific ending of filename (either ".Netcdf" or ".Hdf5")
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)....
void b_writeArray(const T *const 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 (generic version). [MPI]
void b_saveHeader()
Adds all additional header information that are needed in the file.
void b_defineArray(maiabd_type, const MString &, const MString &, const size_type, const size_type *)
~ParallelIoPNetcdf() override
Calls close(). [MPI]
void b_readScalar(T *scalar, const MString &name)
Read scalar data from file (generic version). [MPI]
void b_printFileHints()
Print PNetCDF file hints to cerr.
void b_writeAdditionalData()
Write additional data to file (NetCDF-specific). [MPI]
void b_getAttribute(T *const value, const MString &name, const MString &datasetName="", const size_type totalCount=1)
Retrieve an attribute from file (generic version).
std::map< size_type, NcDimProxy > NcDimMap
void b_getAttributeCount(const MString &name, size_type *totalCount, const MString &datasetName="")
void b_getGroupNames(std::vector< MString > &names, const MString &path)
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_defineScalar(maiabd_type type, const MString &name)
Defines a scalar in the file. [MPI]
void b_defineArray(maiabd_type type, const MString &name, size_type noDims, size_type *totalCount)
Defines an array in the file. [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).
size_type b_getDatasetNoDims(const MString &name)
Get number of dimensions of a dataset with the given name.
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_hasObject(const MString &path)
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.
MInt b_getAttributeType(const MString &name, const MString &datasetName="")
Returns the data type of an attribute in the file.
void b_addAdditionalHeader()
Write additional headers to file (e.g. grid file name, creation date etc.). [MPI]
void b_readArray(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)
Read array data from file (generic version). [MPI]
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.
void close()
Close the file (normally called by the destructor but needs to be explicitely called earlier in speci...
MBool b_hasAttribute(const MString &name, const MString &datasetName="")
Check if a given attribute exists in the file.
void b_ncEndDef()
Leave the define mode (NetCDF-specific). [MPI]
void b_writeScalar(const T scalar, const MString &name)
Writes scalar data to file (generic version). [MPI]
void b_ncRedef()
Enter define mode (NetCDF-specific). [MPI]
std::basic_string< char > MString