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>

     12: #if defined(PETSC_HAVE_HDF5)

     14: /*
     15:   HDF5 function specifications usually read:
     16:   Returns a non-negative value if successful; otherwise returns a negative value.
     17:   (see e.g. https://support.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-Close)
     18: */
     19: #define PetscStackCallHDF5(func,args) do {                        \
     20:     herr_t _status;                                               \
     21:     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); \
     22:   } while (0)

     24: #define PetscStackCallHDF5Return(ret,func,args) do {              \
     25:     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); \
     26:   } while (0)

     28: typedef struct PetscViewerHDF5GroupList {
     29:   const char       *name;
     30:   struct PetscViewerHDF5GroupList *next;
     31: } PetscViewerHDF5GroupList;

     33: typedef struct {
     34:   char          *filename;
     35:   PetscFileMode btype;
     36:   hid_t         file_id;
     37:   hid_t         dxpl_id;   /* H5P_DATASET_XFER property list controlling raw data transfer (read/write). Properties are modified using H5Pset_dxpl_* functions. */
     38:   PetscInt      timestep;
     39:   PetscViewerHDF5GroupList *groups;
     40:   PetscBool     basedimension2;  /* save vectors and DMDA vectors with a dimension of at least 2 even if the bs/dof is 1 */
     41:   PetscBool     spoutput;  /* write data in single precision even if PETSc is compiled with double precision PetscReal */
     42: } PetscViewer_HDF5;

     44: #endif
     45: #endif