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