1 2 #if !defined(__PETSCVIEWERHDF5_H) 3 #define __PETSCVIEWERHDF5_H 4 5 #include <petscviewer.h> 6 7 #include <hdf5.h> 8 PETSC_EXTERN PetscErrorCode PetscViewerHDF5GetFileId(PetscViewer,hid_t*); 9 PETSC_EXTERN PetscErrorCode PetscViewerHDF5OpenGroup(PetscViewer, hid_t *, hid_t *); 10 11 /* On 32 bit systems HDF5 is limited by size of integer, because hsize_t is defined as size_t */ 12 #define PETSC_HDF5_INT_MAX 2147483647 13 #define PETSC_HDF5_INT_MIN -2147483647 14 15 #undef __FUNCT__ 16 #define __FUNCT__ "PetscHDF5IntCast" 17 PETSC_STATIC_INLINE PetscErrorCode PetscHDF5IntCast(PetscInt a,hsize_t *b) 18 { 19 PetscFunctionBegin; 20 #if defined(PETSC_USE_64BIT_INDICES) && (PETSC_SIZEOF_SIZE_T == 4) 21 if ((a) > PETSC_HDF5_INT_MAX) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Array too long for HDF5"); 22 #endif 23 *b = (hsize_t)(a); 24 PetscFunctionReturn(0); 25 } 26 27 PETSC_EXTERN PetscErrorCode PetscViewerHDF5WriteSDS(PetscViewer,float *,int,int *,int); 28 29 PETSC_EXTERN PetscErrorCode PetscViewerHDF5Open(MPI_Comm,const char[],PetscFileMode,PetscViewer*); 30 PETSC_EXTERN PetscErrorCode PetscViewerHDF5PushGroup(PetscViewer,const char *); 31 PETSC_EXTERN PetscErrorCode PetscViewerHDF5PopGroup(PetscViewer); 32 PETSC_EXTERN PetscErrorCode PetscViewerHDF5GetGroup(PetscViewer, const char **); 33 PETSC_EXTERN PetscErrorCode PetscViewerHDF5IncrementTimestep(PetscViewer); 34 PETSC_EXTERN PetscErrorCode PetscViewerHDF5SetTimestep(PetscViewer,PetscInt); 35 PETSC_EXTERN PetscErrorCode PetscViewerHDF5GetTimestep(PetscViewer,PetscInt*); 36 37 #endif 38