@@ -4,14 +4,14 @@ module h5fortran
44use , intrinsic :: iso_fortran_env, only : real32, real64, int64, int32, stderr= >error_unit
55use hdf5, only : HID_T, SIZE_T, HSIZE_T, H5F_ACC_RDONLY_F, H5F_ACC_RDWR_F, H5F_ACC_TRUNC_F, &
66 H5S_ALL_F, H5S_SELECT_SET_F, &
7- H5T_NATIVE_DOUBLE, H5T_NATIVE_REAL, H5T_NATIVE_INTEGER, H5T_NATIVE_CHARACTER, &
7+ H5T_NATIVE_DOUBLE, H5T_NATIVE_REAL, H5T_NATIVE_INTEGER, H5T_NATIVE_CHARACTER, H5F_SCOPE_GLOBAL_F, &
88 h5open_f, h5close_f, &
99 h5dopen_f, h5dclose_f, h5dget_space_f, &
1010 h5gcreate_f, h5gclose_f, &
1111 h5fopen_f, h5fcreate_f, h5fclose_f, h5fis_hdf5_f, &
1212 h5lexists_f, &
1313 h5sclose_f, h5sselect_hyperslab_f, h5screate_simple_f, &
14- h5get_libversion_f, h5eset_auto_f
14+ h5get_libversion_f, h5eset_auto_f, h5fflush_f
1515use h5lt, only : h5ltget_dataset_ndims_f, h5ltget_dataset_info_f
1616
1717use pathlib, only : unlink, get_tempdir, is_absolute_path
@@ -47,7 +47,7 @@ module h5fortran
4747! > initialize HDF5 file
4848procedure , public :: initialize = > hdf_initialize, finalize = > hdf_finalize, &
4949 write_group, writeattr, &
50- open = > hdf_open_group, close = > hdf_close_group, &
50+ open = > hdf_open_group, close = > hdf_close_group, flush = > hdf_flush, &
5151 rank = > hdf_get_ndims, ndims = > hdf_get_ndims, &
5252 shape = > hdf_get_shape, layout = > hdf_get_layout, chunks = > hdf_get_chunk, &
5353 exist = > hdf_check_exist, exists = > hdf_check_exist, &
@@ -522,6 +522,22 @@ subroutine hdf_finalize(self, ierr, close_hdf5_interface)
522522end subroutine hdf_finalize
523523
524524
525+ subroutine hdf_flush (self , ierr )
526+
527+ class(hdf5_file), intent (in ) :: self
528+ integer , intent (out ), optional :: ierr
529+ integer :: ier
530+
531+ call h5fflush_f(self% lid, H5F_SCOPE_GLOBAL_F, ier)
532+ if (present (ierr)) ierr = ier
533+ if (check(ier, ' ERROR: HDF5 flush ' // self% filename)) then
534+ if (present (ierr)) return
535+ error stop
536+ endif
537+
538+ end subroutine hdf_flush
539+
540+
525541subroutine hdf5_close (ierr )
526542! ! this subroutine will close ALL existing file handles
527543! ! only call it at end of your program
0 commit comments