Date: 2022-08-02T03:15:21+00:00

Actual source code: viewerhdf5impl.h

      1: #ifndef __VIEWERHDF5IMPL_H

      4: #if defined(H5_VERSION)
      5: #  error "viewerhdf5impl.h must be included *before* any other HDF5 headers"
      6: #else
      7: #  define H5_USE_18_API
      8: #endif
      9: #include <petscviewerhdf5.h>
     10: #include <petsc/private/viewerimpl.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;                                               \
     22:   } while (0)

     24: #define PetscStackCallHDF5ReturnNoCheck(ret,func,args) do {       \
     25:     PetscStackPush(#func);ret = func args;PetscStackPop;          \
     26:   } while (0)

     28: #define PetscStackCallHDF5Return(ret,func,args) do {              \
     30:   } while (0)

     32: typedef struct PetscViewerHDF5GroupList {
     33:   const char       *name;
     34:   struct PetscViewerHDF5GroupList *next;
     35: } PetscViewerHDF5GroupList;

     37: typedef struct {
     38:   char          *filename;
     39:   PetscFileMode btype;
     40:   hid_t         file_id;
     41:   hid_t         dxpl_id;   /* H5P_DATASET_XFER property list controlling raw data transfer (read/write). Properties are modified using H5Pset_dxpl_* functions. */
     42:   PetscBool     timestepping;    /* Flag to indicate whether objects are stored by tiem index */
     43:   PetscInt      timestep;        /* The time index to look for an object at */
     44:   PetscBool     defTimestepping; /* Default if timestepping attribute is not found. Support for legacy files with no timestepping attribute */
     45:   PetscViewerHDF5GroupList *groups;
     46:   PetscBool     basedimension2;  /* save vectors and DMDA vectors with a dimension of at least 2 even if the bs/dof is 1 */
     47:   PetscBool     spoutput;        /* write data in single precision even if PETSc is compiled with double precision PetscReal */
     48:   PetscBool     horizontal;      /* store column vectors as blocks (needed for MATDENSE I/O) */
     49: } PetscViewer_HDF5;

     51: PETSC_EXTERN PetscErrorCode PetscViewerHDF5CheckTimestepping_Internal(PetscViewer, const char[]); /* currently used in src/dm/impls/da/gr2.c so needs to be extern */
     52: #endif
     53: #endif