@@ -190,49 +190,49 @@ integer(HID_T) function HDF5_openFile(fileName,mode,parallel)
190
190
logical , intent (in ), optional :: parallel
191
191
192
192
character :: m
193
- integer (HID_T) :: p_access,p_create
193
+ integer (HID_T) :: plist_access_id,plist_create_id
194
194
integer :: hdferr
195
195
logical :: exist
196
196
197
197
198
198
m = misc_optional(mode,' r' )
199
199
200
- call H5Pcreate_f(H5P_FILE_CREATE_F, p_create, hdferr)
200
+ call H5Pcreate_f(H5P_FILE_CREATE_F,plist_create_id, hdferr)
201
201
call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
202
- call H5Pset_link_creation_order_f(p_create, ior (H5P_CRT_ORDER_INDEXED_F,H5P_CRT_ORDER_TRACKED_F), hdferr)
202
+ call H5Pset_link_creation_order_f(plist_create_id, ior (H5P_CRT_ORDER_INDEXED_F,H5P_CRT_ORDER_TRACKED_F),hdferr)
203
203
call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
204
204
205
- call H5Pcreate_f(H5P_FILE_ACCESS_F, p_access, hdferr)
205
+ call H5Pcreate_f(H5P_FILE_ACCESS_F, plist_access_id, hdferr)
206
206
call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
207
207
#ifdef PETSC
208
208
if (misc_optional(parallel,.true. )) &
209
209
#if (PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR>14) && !defined(PETSC_HAVE_MPI_F90MODULE_VISIBILITY)
210
- call H5Pset_fapl_mpio_f(p_access , PETSC_COMM_WORLD, MPI_INFO_NULL_F90, hdferr)
210
+ call H5Pset_fapl_mpio_f(plist_access_id , PETSC_COMM_WORLD, MPI_INFO_NULL_F90, hdferr)
211
211
#else
212
- call H5Pset_fapl_mpio_f(p_access , PETSC_COMM_WORLD, MPI_INFO_NULL, hdferr)
212
+ call H5Pset_fapl_mpio_f(plist_access_id , PETSC_COMM_WORLD, MPI_INFO_NULL, hdferr)
213
213
#endif
214
214
call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
215
215
#endif
216
216
217
217
if (m == ' w' ) then
218
218
call H5Fcreate_f(fileName,H5F_ACC_TRUNC_F,HDF5_openFile,hdferr,&
219
- access_prp= p_access ,creation_prp= p_create )
219
+ access_prp= plist_access_id ,creation_prp= plist_create_id )
220
220
call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
221
221
elseif (m == ' a' ) then
222
- call H5Fopen_f(fileName,H5F_ACC_RDWR_F,HDF5_openFile,hdferr,access_prp= p_access )
222
+ call H5Fopen_f(fileName,H5F_ACC_RDWR_F,HDF5_openFile,hdferr,access_prp= plist_access_id )
223
223
call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
224
224
elseif (m == ' r' ) then
225
225
inquire (file= fileName,exist= exist)
226
226
if (.not. exist) call IO_error(100 ,trim (fileName))
227
- call H5Fopen_f(fileName,H5F_ACC_RDONLY_F,HDF5_openFile,hdferr,access_prp= p_access )
227
+ call H5Fopen_f(fileName,H5F_ACC_RDONLY_F,HDF5_openFile,hdferr,access_prp= plist_access_id )
228
228
call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
229
229
else
230
230
error stop ' unknown access mode'
231
231
end if
232
232
233
- call H5Pclose_f(p_access , hdferr)
233
+ call H5Pclose_f(plist_access_id , hdferr)
234
234
call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
235
- call H5Pclose_f(p_create , hdferr)
235
+ call H5Pclose_f(plist_create_id , hdferr)
236
236
call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
237
237
238
238
end function HDF5_openFile
@@ -247,6 +247,7 @@ subroutine HDF5_closeFile(fileHandle)
247
247
248
248
integer :: hdferr
249
249
250
+
250
251
call H5Fclose_f(fileHandle,hdferr)
251
252
call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
252
253
@@ -262,26 +263,35 @@ integer(HID_T) function HDF5_addGroup(fileHandle,groupName)
262
263
character (len=* ), intent (in ) :: groupName
263
264
264
265
integer :: hdferr
265
- integer (HID_T) :: aplist_id
266
+ integer (HID_T) :: gapl_id, gcpl_id
266
267
267
- !- ------------------------------------------------------------------------------------------------
268
- ! creating a property list for data access properties
269
- call H5Pcreate_f(H5P_GROUP_ACCESS_F, aplist_id, hdferr)
270
- call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
271
268
272
269
!- ------------------------------------------------------------------------------------------------
273
- ! setting I/O mode to collective
270
+ ! set I/O mode to collective (for MPI parallel simulations)
271
+ call H5Pcreate_f(H5P_GROUP_ACCESS_F,gapl_id,hdferr)
272
+ call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
274
273
#ifdef PETSC
275
- call H5Pset_all_coll_metadata_ops_f(aplist_id, .true. , hdferr)
274
+ call H5Pset_all_coll_metadata_ops_f(gapl_id, .true. ,hdferr)
276
275
call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
277
276
#endif
278
277
278
+ !- ------------------------------------------------------------------------------------------------
279
+ ! keep creation order in group
280
+ call H5Pcreate_f(H5P_GROUP_CREATE_F,gcpl_id,hdferr)
281
+ call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
282
+ call H5Pset_link_creation_order_f(gcpl_id,ior (H5P_CRT_ORDER_INDEXED_F,H5P_CRT_ORDER_TRACKED_F),hdferr)
283
+ call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
284
+
279
285
!- ------------------------------------------------------------------------------------------------
280
286
! Create group
281
- call H5Gcreate_f(fileHandle, trim (groupName), HDF5_addGroup, hdferr, OBJECT_NAMELEN_DEFAULT_F,gapl_id = aplist_id)
287
+ call H5Gcreate_f(fileHandle,trim (groupName),HDF5_addGroup,hdferr, &
288
+ OBJECT_NAMELEN_DEFAULT_F,gcpl_id= gcpl_id,gapl_id= gapl_id)
282
289
call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
283
290
284
- call H5Pclose_f(aplist_id,hdferr)
291
+ call H5Pclose_f(gcpl_id,hdferr)
292
+ call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
293
+ call H5Pclose_f(gapl_id,hdferr)
294
+ call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
285
295
286
296
end function HDF5_addGroup
287
297
@@ -331,6 +341,7 @@ subroutine HDF5_closeGroup(group_id)
331
341
332
342
integer :: hdferr
333
343
344
+
334
345
call H5Gclose_f(group_id, hdferr)
335
346
call HDF5_chkerr(hdferr,__FILE__// ' :' // IO_intAsStr(__LINE__))
336
347
0 commit comments