Actual source code: viewerhdf5impl.h
2: #ifndef __VIEWERHDF5IMPL_H
5: #if defined(H5_VERSION)
6: # error "viewerhdf5impl.h must be included *before* any other HDF5 headers"
7: #else
8: # define H5_USE_18_API
9: #endif
10: #include <petscviewerhdf5.h>
11: #include <petsc/private/viewerimpl.h>
13: #if defined(PETSC_HAVE_HDF5)
15: /*
16: HDF5 function specifications usually read:
17: Returns a non-negative value if successful; otherwise returns a negative value.
18: (see e.g. https://support.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-Close)
19: */
20: #define PetscStackCallHDF5(func,args) do { \
21: herr_t _status; \
22: PetscStackPush(#func);_status = func args;PetscStackPop; if (_status < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in HDF5 call %s() Status %d",#func,(int)_status); \
23: } while (0)
25: #define PetscStackCallHDF5Return(ret,func,args) do { \
26: PetscStackPush(#func);ret = func args;PetscStackPop; if (ret < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_LIB,"Error in HDF5 call %s() Status %d",#func,(int)ret); \
27: } while (0)
29: typedef struct PetscViewerHDF5GroupList {
30: const char *name;
31: struct PetscViewerHDF5GroupList *next;
32: } PetscViewerHDF5GroupList;
34: typedef struct {
35: char *filename;
36: PetscFileMode btype;
37: hid_t file_id;
38: hid_t dxpl_id; /* H5P_DATASET_XFER property list controlling raw data transfer (read/write). Properties are modified using H5Pset_dxpl_* functions. */
39: PetscBool timestepping;
40: PetscInt timestep;
41: PetscViewerHDF5GroupList *groups;
42: PetscBool basedimension2; /* save vectors and DMDA vectors with a dimension of at least 2 even if the bs/dof is 1 */
43: PetscBool spoutput; /* write data in single precision even if PETSc is compiled with double precision PetscReal */
44: PetscBool horizontal; /* store column vectors as blocks (needed for MATDENSE I/O) */
45: } PetscViewer_HDF5;
47: PETSC_EXTERN PetscErrorCode PetscViewerHDF5CheckTimestepping_Internal(PetscViewer, const char[]); /* currently used in src/dm/impls/da/gr2.c so needs to be extern */
48: #endif
49: #endif