diff --git a/src/HDF5_utilities.f90 b/src/HDF5_utilities.f90 index 6dda88fbf..d63d2161a 100644 --- a/src/HDF5_utilities.f90 +++ b/src/HDF5_utilities.f90 @@ -184,42 +184,49 @@ integer(HID_T) function HDF5_openFile(fileName,mode,parallel) logical, intent(in), optional :: parallel character :: m - integer(HID_T) :: plist_id + integer(HID_T) :: p_access,p_create integer :: hdferr logical :: exist m = misc_optional(mode,'r') - call H5Pcreate_f(H5P_FILE_ACCESS_F, plist_id, hdferr) + call H5Pcreate_f(H5P_FILE_CREATE_F, p_create, hdferr) + call HDF5_chkerr(hdferr) + call H5Pset_link_creation_order_f(p_create, ior(H5P_CRT_ORDER_INDEXED_F,H5P_CRT_ORDER_TRACKED_F), hdferr) call HDF5_chkerr(hdferr) + call H5Pcreate_f(H5P_FILE_ACCESS_F, p_access, hdferr) + call HDF5_chkerr(hdferr) #ifdef PETSC if (misc_optional(parallel,.true.)) & #if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>14) && !defined(PETSC_HAVE_MPI_F90MODULE_VISIBILITY) - call H5Pset_fapl_mpio_f(plist_id, PETSC_COMM_WORLD, MPI_INFO_NULL_F90, hdferr) + call H5Pset_fapl_mpio_f(p_access, PETSC_COMM_WORLD, MPI_INFO_NULL_F90, hdferr) #else - call H5Pset_fapl_mpio_f(plist_id, PETSC_COMM_WORLD, MPI_INFO_NULL, hdferr) + call H5Pset_fapl_mpio_f(p_access, PETSC_COMM_WORLD, MPI_INFO_NULL, hdferr) #endif call HDF5_chkerr(hdferr) #endif if (m == 'w') then - call H5Fcreate_f(fileName,H5F_ACC_TRUNC_F,HDF5_openFile,hdferr,access_prp = plist_id) + call H5Fcreate_f(fileName,H5F_ACC_TRUNC_F,HDF5_openFile,hdferr,& + access_prp=p_access,creation_prp=p_create) call HDF5_chkerr(hdferr) elseif (m == 'a') then - call H5Fopen_f(fileName,H5F_ACC_RDWR_F,HDF5_openFile,hdferr,access_prp = plist_id) + call H5Fopen_f(fileName,H5F_ACC_RDWR_F,HDF5_openFile,hdferr,access_prp=p_access) call HDF5_chkerr(hdferr) elseif (m == 'r') then inquire(file=fileName,exist=exist) if (.not. exist) call IO_error(100,trim(fileName)) - call H5Fopen_f(fileName,H5F_ACC_RDONLY_F,HDF5_openFile,hdferr,access_prp = plist_id) + call H5Fopen_f(fileName,H5F_ACC_RDONLY_F,HDF5_openFile,hdferr,access_prp=p_access) call HDF5_chkerr(hdferr) else error stop 'unknown access mode' end if - call H5Pclose_f(plist_id, hdferr) + call H5Pclose_f(p_access, hdferr) + call HDF5_chkerr(hdferr) + call H5Pclose_f(p_create, hdferr) call HDF5_chkerr(hdferr) end function HDF5_openFile diff --git a/src/test/test_HDF5_utilities.f90 b/src/test/test_HDF5_utilities.f90 index 905c9ebda..311d79fd3 100644 --- a/src/test/test_HDF5_utilities.f90 +++ b/src/test/test_HDF5_utilities.f90 @@ -19,7 +19,8 @@ end subroutine test_HDF5_utilities_run subroutine read_write() - integer(HID_T) :: f + integer(HID_T) :: f, create_list + integer :: hdferr, order real(pREAL), dimension(3) :: real_d1_in,real_d1_out real(pREAL), dimension(3,3) :: real_d2_in,real_d2_out @@ -92,7 +93,15 @@ subroutine read_write() call HDF5_closeFile(f) f = HDF5_openFile('test.hdf5','r') - + call H5Fget_create_plist_f(f,create_list,hdferr) + call HDF5_chkerr(hdferr) + call H5Pget_link_creation_order_f(create_list,order,hdferr) + call HDF5_chkerr(hdferr) + ! https://github.com/HDFGroup/hdf5/issues/5183 + !if (iand(order,H5P_CRT_ORDER_INDEXED_F) /= H5P_CRT_ORDER_INDEXED_F) error stop 'CRT_ORDER_INDEXED' + !if (iand(order,H5P_CRT_ORDER_TRACKED_F) /= H5P_CRT_ORDER_TRACKED_F) error stop 'CRT_ORDER_TRACKED' + call H5Pclose_f(create_list,hdferr) + call HDF5_chkerr(hdferr) call HDF5_read(real_d1_out,f,'real_d1') call HDF5_read(real_d2_out,f,'real_d2')