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