diff options
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/examples/CMakeLists.txt | 6 | ||||
-rw-r--r-- | fortran/src/CMakeLists.txt | 6 | ||||
-rw-r--r-- | fortran/src/H5Af.c | 2 | ||||
-rw-r--r-- | fortran/src/H5Fff.F90 | 10 | ||||
-rw-r--r-- | fortran/src/H5Gf.c | 2 | ||||
-rw-r--r-- | fortran/src/H5Of.c | 18 | ||||
-rw-r--r-- | fortran/src/H5_ff.F90 | 6 | ||||
-rw-r--r-- | fortran/src/Makefile.am | 2 | ||||
-rw-r--r-- | fortran/test/CMakeLists.txt | 4 | ||||
-rw-r--r-- | fortran/test/tH5F.F90 | 76 |
10 files changed, 111 insertions, 21 deletions
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 68b817e..0c570c6 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -155,7 +155,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) target_include_directories (f90_ex_ph5example PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>" ) target_compile_options(f90_ex_ph5example PRIVATE @@ -164,6 +164,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_link_libraries (f90_ex_ph5example PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}> ) # set_property(TARGET f90_ex_ph5example APPEND PROPERTY # LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> @@ -183,7 +184,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) target_include_directories (f90_ex_ph5example-shared PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>" ) target_compile_options(f90_ex_ph5example-shared PRIVATE @@ -192,6 +193,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_link_libraries (f90_ex_ph5example-shared PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}> ) # set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY # LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 5750d05..025fab5 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -81,7 +81,7 @@ add_executable (H5match_types ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h ${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c ) -target_include_directories(H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR}") +target_include_directories(H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 @@ -137,7 +137,7 @@ set (f90CStub_C_SHHDRS add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) target_include_directories(${HDF5_F90_C_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC) @@ -153,7 +153,7 @@ set (install_targets ${HDF5_F90_C_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_SHHDRS}) target_include_directories(${HDF5_F90_C_LIBSH_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_definitions(${HDF5_F90_C_LIBSH_TARGET} diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c index 23dd936..31a18fc 100644 --- a/fortran/src/H5Af.c +++ b/fortran/src/H5Af.c @@ -143,7 +143,7 @@ h5aget_num_attrs_c (hid_t_f *obj_id, int_f *attr_num) /* * Call H5Oget_info function. */ - if(H5Oget_info((hid_t)*obj_id, &oinfo) < 0) + if(H5Oget_info2((hid_t)*obj_id, &oinfo, H5O_INFO_NUM_ATTRS) < 0) HGOTO_DONE(FAIL); /* Set number of attributes */ diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index a3bef37..358e421 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -42,6 +42,9 @@ MODULE H5F USE H5GLOBAL IMPLICIT NONE + ! Number of objects opened in H5open_f + INTEGER(SIZE_T) :: H5OPEN_NUM_OBJ + CONTAINS !****s* H5F/h5fcreate_f ! @@ -616,9 +619,14 @@ CONTAINS INTEGER(SIZE_T), INTENT(OUT) :: obj_count END FUNCTION h5fget_obj_count_c END INTERFACE - + hdferr = h5fget_obj_count_c(file_id, obj_type, obj_count) + ! Don't include objects created by H5open in the H5F_OBJ_ALL_F count + IF(file_id.EQ.INT(H5F_OBJ_ALL_F,HID_T))THEN + obj_count = obj_count - H5OPEN_NUM_OBJ + ENDIF + END SUBROUTINE h5fget_obj_count_f !****s* H5F/h5fget_obj_ids_f diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index b829b20..def67e1 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -200,7 +200,7 @@ h5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, /* Query the object's information */ if(H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, c_obj_name, c_obj_namelen, H5P_DEFAULT) < 0) goto DONE; - if(H5Oget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, &oinfo, H5P_DEFAULT) < 0) + if(H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) goto DONE; /* XXX: Switch from using H5Gget_objtype_by_idx() means that this routine won't diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c index 7d065a5..45b7f09 100644 --- a/fortran/src/H5Of.c +++ b/fortran/src/H5Of.c @@ -248,9 +248,9 @@ h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, herr_t func_ret_value; /* H5Linterate return value */ /* - * Call H5Ovisit + * Call H5Ovisit2 */ - func_ret_value = H5Ovisit( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data); + func_ret_value = H5Ovisit2( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, H5O_INFO_ALL); ret_value = (int_f)func_ret_value; @@ -330,8 +330,8 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l /* * Call H5Oinfo_by_name function. */ - if(H5Oget_info_by_name((hid_t)*loc_id, c_name, - &Oinfo, (hid_t)*lapl_id) < 0) + if(H5Oget_info_by_name2((hid_t)*loc_id, c_name, + &Oinfo, H5O_INFO_ALL, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -385,8 +385,8 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, /* * Call H5Oinfo_by_idx function. */ - if(H5Oget_info_by_idx((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, - &Oinfo, (hid_t)*lapl_id) < 0) + if(H5Oget_info_by_idx2((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, + &Oinfo, H5O_INFO_ALL, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -424,7 +424,7 @@ h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info) /* * Call H5Oinfo_by_name function. */ - if(H5Oget_info((hid_t)*object_id, &Oinfo) < 0) + if(H5Oget_info2((hid_t)*object_id, &Oinfo, H5O_INFO_ALL) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -532,8 +532,8 @@ h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f /* * Call H5Ovisit */ - func_ret_value = H5Ovisit_by_name( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, - op, op_data, (hid_t)*lapl_id); + func_ret_value = H5Ovisit_by_name2( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, + op, op_data, H5O_INFO_ALL, (hid_t)*lapl_id); ret_value = (int_f)func_ret_value; done: diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index db57f03..f63e734 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -169,8 +169,10 @@ CONTAINS ! October 13, 2011 ! Fortran90 Interface: SUBROUTINE h5open_f(error) + USE H5F, ONLY : h5fget_obj_count_f, H5OPEN_NUM_OBJ IMPLICIT NONE INTEGER, INTENT(OUT) :: error + INTEGER(SIZE_T) :: H5OPEN_NUM_OBJ_LOC = 0 !***** INTERFACE @@ -612,6 +614,10 @@ CONTAINS H5_SZIP_EC_OM_F = H5LIB_flags(1) H5_SZIP_NN_OM_F = H5LIB_flags(2) + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, H5OPEN_NUM_OBJ_LOC, error) + + H5OPEN_NUM_OBJ = H5OPEN_NUM_OBJ_LOC + END SUBROUTINE h5open_f !****s* H5LIB/h5close_f diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index a863a67..666f6cb 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -142,7 +142,7 @@ FORTRAN_API=yes # modules they depend upon are actually made. *sigh* H5f90global.lo: $(srcdir)/H5f90global.F90 H5fortran_types.lo H5_buildiface.lo: $(srcdir)/H5_buildiface.F90 -H5_ff.lo: $(srcdir)/H5_ff.F90 H5f90global.lo +H5_ff.lo: $(srcdir)/H5_ff.F90 H5Fff.lo H5f90global.lo H5Aff.lo: $(srcdir)/H5Aff.F90 H5f90global.lo H5Dff.lo: $(srcdir)/H5Dff.F90 H5f90global.lo H5Eff.lo: $(srcdir)/H5Eff.F90 H5f90global.lo diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index fc1add1..b862fcd 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -44,7 +44,7 @@ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c) set_source_files_properties (t.c PROPERTIES LANGUAGE C) target_include_directories(${HDF5_F90_C_TEST_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC) @@ -60,7 +60,7 @@ set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c) target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) target_compile_definitions(${HDF5_F90_C_TEST_LIBSH_TARGET} diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90 index d91ee9c..72920f2 100644 --- a/fortran/test/tH5F.F90 +++ b/fortran/test/tH5F.F90 @@ -103,6 +103,10 @@ CONTAINS ! INTEGER :: i, j + !number of objects + INTEGER(SIZE_T) :: obj_count + INTEGER(HID_T) :: t1, t2, t3, t4 + ! !data buffers ! @@ -133,11 +137,51 @@ CONTAINS CALL h5_fixname_f(filename2, fix_filename2, H5P_DEFAULT_F, error) if(error .ne. 0) stop + ! Test object counts + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, t1, error) + CALL check(" h5tcopy_f",error,total_error) + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, t2, error) + CALL check(" h5tcopy_f",error,total_error) + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, t3, error) + CALL check(" h5tcopy_f",error,total_error) + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, t4, error) + CALL check(" h5tcopy_f",error,total_error) + + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.4)THEN + total_error = total_error + 1 + ENDIF + ! !Create first file "mount1.h5" using default properties. ! CALL h5fcreate_f(fix_filename1, H5F_ACC_TRUNC_F, file1_id, error) - CALL check("h5fcreate_f",error,total_error) + CALL check("h5fcreate_f",error,total_error) + + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.5)THEN + total_error = total_error + 1 + ENDIF + + CALL h5tclose_f(t1, error) + CALL check("h5tclose_f",error,total_error) + CALL h5tclose_f(t2, error) + CALL check("h5tclose_f",error,total_error) + CALL h5tclose_f(t3, error) + CALL check("h5tclose_f",error,total_error) + CALL h5tclose_f(t4, error) + CALL check("h5tclose_f",error,total_error) + + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.1)THEN + total_error = total_error + 1 + ENDIF ! !Create group "/G" inside file "mount1.h5". @@ -211,9 +255,23 @@ CONTAINS ! CALL h5fopen_f (fix_filename1, H5F_ACC_RDWR_F, file1_id, error) CALL check("hfopen_f",error,total_error) + + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.1)THEN + total_error = total_error + 1 + ENDIF + CALL h5fopen_f (fix_filename2, H5F_ACC_RDWR_F, file2_id, error) CALL check("h5fopen_f",error,total_error) + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.2)THEN + total_error = total_error + 1 + ENDIF ! !mount the second file under the first file's "/G" group. ! @@ -245,6 +303,7 @@ CONTAINS do i = 1, NX do j = 1, NY IF (data_out(i,j) .NE. data_in(i, j)) THEN + total_error = total_error + 1 END IF end do end do @@ -267,11 +326,26 @@ CONTAINS ! !Close both files. ! + + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.2)THEN + total_error = total_error + 1 + ENDIF + CALL h5fclose_f(file1_id, error) CALL check("h5fclose_f",error,total_error) CALL h5fclose_f(file2_id, error) CALL check("h5fclose_f",error,total_error) + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, obj_count, error) + CALL check(" h5fget_obj_count_f",error,total_error) + + IF(obj_count.NE.0)THEN + total_error = total_error + 1 + ENDIF + if(cleanup) CALL h5_cleanup_f(filename1, H5P_DEFAULT_F, error) CALL check("h5_cleanup_f", error, total_error) if(cleanup) CALL h5_cleanup_f(filename2, H5P_DEFAULT_F, error) |