summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
Diffstat (limited to 'fortran')
-rw-r--r--fortran/COPYING13
-rw-r--r--fortran/src/CMakeLists.txt109
-rw-r--r--fortran/src/H5Fff.F904
-rw-r--r--fortran/src/H5match_types.c4
-rw-r--r--fortran/src/Makefile.am2
-rw-r--r--fortran/test/CMakeLists.txt14
-rw-r--r--fortran/test/fortranlib_test.F904
-rw-r--r--fortran/test/tH5F.F90122
-rw-r--r--fortran/test/tH5Z.F907
9 files changed, 213 insertions, 66 deletions
diff --git a/fortran/COPYING b/fortran/COPYING
deleted file mode 100644
index 97969da..0000000
--- a/fortran/COPYING
+++ /dev/null
@@ -1,13 +0,0 @@
-
- Copyright by The HDF Group and
- The Board of Trustees of the University of Illinois.
- All rights reserved.
-
- The files and subdirectories in this directory are part of HDF5.
- The full HDF5 copyright notice, including terms governing use,
- modification, and redistribution, is contained in the COPYING file
- which can be found at the root of the source code distribution tree
- or in https://www.hdfgroup.org/licenses. If you do
- not have access to either file, you may request a copy from
- help@hdfgroup.org.
-
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index 37b5157..316d3c7 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -73,38 +73,35 @@ add_executable (H5match_types
)
target_include_directories (H5match_types PRIVATE "${HDF5_SRC_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}/H5f90i_gen.h
- ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90
+add_custom_command (TARGET H5match_types POST_BUILD
+ BYPRODUCTS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5match_types>
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}
DEPENDS H5match_types
)
if (NOT ONLY_SHARED_LIBS)
- add_custom_command (
- OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h
- ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90
+ add_custom_command (TARGET H5match_types POST_BUILD
+ BYPRODUCTS ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5f90i_gen.h" "${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h"
+ ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5fortran_types.F90" "${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90"
+ ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
- DEPENDS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h
+ DEPENDS H5_buildiface H5match_types ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h
)
set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE)
set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE)
endif ()
if (BUILD_SHARED_LIBS)
- add_custom_command (
- OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h
- ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90
+ add_custom_command (TARGET H5match_types POST_BUILD
+ BYPRODUCTS ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5f90i_gen.h" "${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h"
+ ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5fortran_types.F90" "${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90"
+ ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90 ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared
- DEPENDS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h
+ DEPENDS H5_buildiface H5match_types ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h
)
set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h PROPERTIES GENERATED TRUE)
set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 PROPERTIES GENERATED TRUE)
@@ -134,16 +131,33 @@ set (f90CStub_C_SOURCES
set_source_files_properties (${f90CStub_C_SOURCES} PROPERTIES LANGUAGE C)
set (f90CStub_C_HDRS
- # generated files
- ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h
-)
-set (f90CStub_C_SHHDRS
- # generated files
- ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5f90.h
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5f90i.h
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5f90proto.h
)
if (NOT ONLY_SHARED_LIBS)
- add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS})
+ set (f90CStub_CGEN_HDRS
+ # generated files
+ ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h
+ )
+ add_custom_target (H5gen_i ALL
+ DEPENDS H5match_types ${f90CStub_CGEN_HDRS}
+ )
+endif ()
+
+if (BUILD_SHARED_LIBS)
+ set (f90CStub_CGEN_SHHDRS
+ # generated files
+ ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h
+ )
+ add_custom_target (H5gen_iSH ALL
+ DEPENDS H5match_types ${f90CStub_CGEN_SHHDRS}
+ )
+endif ()
+
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS} ${f90CStub_CGEN_HDRS})
target_include_directories (${HDF5_F90_C_LIB_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_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>"
@@ -157,11 +171,12 @@ if (NOT ONLY_SHARED_LIBS)
FOLDER libraries/fortran
LINKER_LANGUAGE C
)
+ add_dependencies (${HDF5_F90_C_LIB_TARGET} H5gen_i)
set (install_targets ${HDF5_F90_C_LIB_TARGET})
endif ()
if (BUILD_SHARED_LIBS)
- add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_SHHDRS})
+ add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS} ${f90CStub_CGEN_SHHDRS})
target_include_directories (${HDF5_F90_C_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_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>"
@@ -176,6 +191,7 @@ if (BUILD_SHARED_LIBS)
FOLDER libraries/fortran
LINKER_LANGUAGE C
)
+ add_dependencies (${HDF5_F90_C_LIBSH_TARGET} H5gen_iSH)
set (install_targets ${install_targets} ${HDF5_F90_C_LIBSH_TARGET})
endif ()
@@ -210,39 +226,39 @@ set (f90_F_GEN_SOURCES
${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90
${HDF5_F90_SRC_SOURCE_DIR}/H5Pff.F90
)
-add_custom_command (
- OUTPUT ${HDF5_F90_BINARY_DIR}/H5_gen.F90
+add_custom_command (TARGET H5_buildiface POST_BUILD
+ BYPRODUCTS ${HDF5_F90_BINARY_DIR}/H5_gen.F90
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5_buildiface>
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}
- DEPENDS ${f90_F_GEN_SOURCES}
+ DEPENDS H5_buildiface ${f90_F_GEN_SOURCES}
COMMENT "Generating the H5_gen.F90 file"
)
if (NOT ONLY_SHARED_LIBS)
- add_custom_command (
- OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
+ add_custom_command (TARGET H5_buildiface POST_BUILD
+ BYPRODUCTS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5_gen.F90" "${HDF5_F90_BINARY_DIR}/static/H5_gen.F90"
+ ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5_gen.F90 ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
- DEPENDS ${HDF5_F90_BINARY_DIR}/H5_gen.F90
+ DEPENDS H5_buildiface ${HDF5_F90_BINARY_DIR}/H5_gen.F90
COMMENT "Generating the H5_gen.F90 file"
)
add_custom_target (H5gen ALL
- DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
+ DEPENDS H5_buildiface ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
)
set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE)
endif ()
if (BUILD_SHARED_LIBS)
- add_custom_command (
- OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90
+ add_custom_command (TARGET H5_buildiface POST_BUILD
+ BYPRODUCTS ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5_gen.F90" "${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90"
+ ARGS -E copy_if_different ${HDF5_F90_BINARY_DIR}/H5_gen.F90 ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared
DEPENDS ${HDF5_F90_BINARY_DIR}/H5_gen.F90
COMMENT "Generating the H5_gen.F90 shared file"
)
add_custom_target (H5genSH ALL
- DEPENDS ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90
+ DEPENDS H5_buildiface ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90
)
set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 PROPERTIES GENERATED TRUE)
endif ()
@@ -540,17 +556,21 @@ set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}"
configure_file (
${HDF_CONFIG_DIR}/libhdf5.pc.in
- ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}.pc
@ONLY
)
install (
- FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}.pc
DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig
COMPONENT fortlibraries
)
if (NOT WIN32 AND NOT MINGW)
- set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER})
+ if (HDF5_ENABLE_PARALLEL AND MPI_Fortran_FOUND)
+ set (_PKG_CONFIG_COMPILER ${MPI_Fortran_COMPILER})
+ else ()
+ set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER})
+ endif ()
configure_file (
${HDF_RESOURCES_DIR}/libh5cc.in
${HDF5_BINARY_DIR}/CMakeFiles/h5fc
@@ -562,4 +582,17 @@ if (NOT WIN32 AND NOT MINGW)
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
COMPONENT fortlibraries
)
+ if (HDF5_ENABLE_PARALLEL AND MPI_Fortran_FOUND)
+ configure_file (
+ ${HDF_RESOURCES_DIR}/libh5cc.in
+ ${HDF5_BINARY_DIR}/CMakeFiles/h5pfc
+ @ONLY
+ )
+ install (
+ FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5pfc
+ DESTINATION ${HDF5_INSTALL_BIN_DIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+ COMPONENT fortlibraries
+ )
+ endif ()
endif ()
diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90
index f772558..a273431 100644
--- a/fortran/src/H5Fff.F90
+++ b/fortran/src/H5Fff.F90
@@ -824,7 +824,7 @@ CONTAINS
SUBROUTINE h5fget_name_f(obj_id, buf, size, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier
- CHARACTER(LEN=*), INTENT(INOUT) :: buf
+ CHARACTER(LEN=*), INTENT(OUT) :: buf
! Buffer to hold file name
INTEGER(SIZE_T), INTENT(OUT) :: size ! Size of the file name
INTEGER, INTENT(OUT) :: hdferr ! Error code: 0 on success,
@@ -844,7 +844,7 @@ CONTAINS
CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: buf
END FUNCTION h5fget_name_c
END INTERFACE
- buflen = LEN_TRIM(buf)
+ buflen = LEN(buf)
hdferr = h5fget_name_c(obj_id, size, buf, buflen)
END SUBROUTINE h5fget_name_f
!****s* H5F/h5fget_filesize_f
diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c
index 10d873e..017bab4 100644
--- a/fortran/src/H5match_types.c
+++ b/fortran/src/H5match_types.c
@@ -70,8 +70,8 @@ initCfile(void)
* help@hdfgroup.org. *\n\
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\
\n\n\
-#ifndef _H5f90i_gen_H\n\
-#define _H5f90i_gen_H\n\
+#ifndef H5f90i_gen_H\n\
+#define H5f90i_gen_H\n\
\n\
/* This file is automatically generated by H5match_types.c at build time. */\n\
\n\
diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am
index 5168eb6..65ffa0c 100644
--- a/fortran/src/Makefile.am
+++ b/fortran/src/Makefile.am
@@ -155,7 +155,7 @@ H5Pff.lo: $(srcdir)/H5Pff.F90 H5f90global.lo H5fortkit.lo
H5Rff.lo: $(srcdir)/H5Rff.F90 H5f90global.lo
H5Sff.lo: $(srcdir)/H5Sff.F90 H5f90global.lo
H5Tff.lo: $(srcdir)/H5Tff.F90 H5f90global.lo
-H5VLff.lo: $(srcdir)/H5VLff.F90 H5f90global.lo
+H5VLff.lo: $(srcdir)/H5VLff.F90 H5f90global.lo H5fortkit.lo
H5Zff.lo: $(srcdir)/H5Zff.F90 H5f90global.lo
H5_gen.lo: H5_gen.F90 H5f90global.lo H5Aff.lo H5Dff.lo H5Pff.lo
HDF5.lo: $(srcdir)/HDF5.F90 H5f90global.lo H5_ff.lo H5Aff.lo \
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt
index 40aef6d..1e879e7 100644
--- a/fortran/test/CMakeLists.txt
+++ b/fortran/test/CMakeLists.txt
@@ -91,27 +91,27 @@ if (HDF5_ENABLE_FORMATTERS)
endif ()
if (NOT BUILD_SHARED_LIBS)
- add_custom_command (
- OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
+ add_custom_command (TARGET H5_test_buildiface POST_BUILD
+ BYPRODUCTS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5_test_buildiface>
WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static
DEPENDS H5_test_buildiface
- COMMENT "Generating the tf_gen.F90 file"
+ COMMENT "Generating the tf_gen.F90 static file"
)
add_custom_target (H5testgen ALL
- DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
+ DEPENDS H5_test_buildiface ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
)
set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE)
else ()
- add_custom_command (
- OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90
+ add_custom_command (TARGET H5_test_buildiface POST_BUILD
+ BYPRODUCTS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5_test_buildiface>
WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared
DEPENDS H5_test_buildiface
COMMENT "Generating the tf_gen.F90 shared file"
)
add_custom_target (H5testgenSH ALL
- DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90
+ DEPENDS H5_test_buildiface ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90
)
set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 PROPERTIES GENERATED TRUE)
endif ()
diff --git a/fortran/test/fortranlib_test.F90 b/fortran/test/fortranlib_test.F90
index eff4657..1640a8f 100644
--- a/fortran/test/fortranlib_test.F90
+++ b/fortran/test/fortranlib_test.F90
@@ -74,6 +74,10 @@ PROGRAM fortranlibtest
CALL write_test_status(ret_total_error, ' Reopen test', total_error)
ret_total_error = 0
+ CALL get_name_test(cleanup, ret_total_error)
+ CALL write_test_status(ret_total_error, ' Get name test', total_error)
+
+ ret_total_error = 0
CALL file_close(cleanup, ret_total_error)
CALL write_test_status(ret_total_error, ' File open/close test', total_error)
diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90
index f4a3232..06dc6de 100644
--- a/fortran/test/tH5F.F90
+++ b/fortran/test/tH5F.F90
@@ -21,7 +21,8 @@
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
!
! CONTAINS SUBROUTINES
-! mountingtest, reopentest, plisttest, file_close, file_space
+! mountingtest, reopentest, get_name_test, plisttest,
+! file_close, file_space
!
!*****
!
@@ -580,6 +581,125 @@ CONTAINS
END SUBROUTINE reopentest
+! The following subroutine checks that h5fget_name_f produces
+! correct output for a given obj_id and filename.
+!
+ SUBROUTINE check_get_name(obj_id, fix_filename, total_error)
+ USE HDF5 ! This module contains all necessary modules
+ USE TH5_MISC
+ IMPLICIT NONE
+ INTEGER(HID_T) :: obj_id ! Object identifier
+ CHARACTER(LEN=80), INTENT(IN) :: fix_filename ! Expected filename
+ INTEGER, INTENT(INOUT) :: total_error ! Error count
+
+ CHARACTER(LEN=80):: file_name ! Filename buffer
+ INTEGER:: error ! HDF5 error code
+ INTEGER(SIZE_T):: name_size ! Filename length
+ !
+ !Get file name from the dataset identifier
+ !
+
+ ! Use an uninitialized buffer
+ CALL h5fget_name_f(obj_id, file_name, name_size, error)
+ CALL check("h5fget_name_f",error,total_error)
+ IF(name_size .NE. LEN_TRIM(fix_filename))THEN
+ WRITE(*,*) " file name size obtained from the object id is incorrect"
+ total_error = total_error + 1
+ ENDIF
+ IF(file_name(1:name_size) .NE. TRIM(fix_filename)) THEN
+ WRITE(*,*) " file name obtained from the object id is incorrect"
+ total_error = total_error + 1
+ END IF
+
+ ! Use a buffer initialized with spaces
+ file_name(:) = " "
+ CALL h5fget_name_f(obj_id, file_name, name_size, error)
+ CALL check("h5fget_name_f",error,total_error)
+ IF(name_size .NE. LEN_TRIM(fix_filename))THEN
+ WRITE(*,*) " file name size obtained from the object id is incorrect"
+ total_error = total_error + 1
+ ENDIF
+ IF(file_name(1:name_size) .NE. TRIM(fix_filename)) THEN
+ WRITE(*,*) " file name obtained from the object id is incorrect"
+ total_error = total_error + 1
+ END IF
+
+ ! Use a buffer initialized with non-whitespace characters
+ file_name(:) = "a"
+ CALL h5fget_name_f(obj_id, file_name, name_size, error)
+ CALL check("h5fget_name_f",error,total_error)
+ IF(name_size .NE. LEN_TRIM(fix_filename))THEN
+ WRITE(*,*) " file name size obtained from the object id is incorrect"
+ total_error = total_error + 1
+ ENDIF
+ IF(file_name(1:name_size) .NE. TRIM(fix_filename)) THEN
+ WRITE(*,*) " file name obtained from the object id is incorrect"
+ total_error = total_error + 1
+ END IF
+
+ END SUBROUTINE check_get_name
+
+! The following subroutine tests h5fget_name_f.
+! It creates the file which has name "filename.h5" and
+! tests that h5fget_name_f also returns the name "filename.h5"
+!
+
+ SUBROUTINE get_name_test(cleanup, total_error)
+ USE HDF5 ! This module contains all necessary modules
+ USE TH5_MISC
+ IMPLICIT NONE
+ LOGICAL, INTENT(IN) :: cleanup
+ INTEGER, INTENT(INOUT) :: total_error
+
+ CHARACTER(LEN=*), PARAMETER :: filename = "filename"
+ CHARACTER(LEN=80) :: fix_filename
+
+ INTEGER(HID_T) :: file_id ! File identifier
+ INTEGER(HID_T) :: g_id ! Group identifier
+
+ !
+ ! Flag to check operation success
+ !
+ INTEGER :: error
+
+ !
+ ! Create file "filename.h5" using default properties.
+ !
+ CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error)
+ IF (error .NE. 0) THEN
+ WRITE(*,*) "Cannot modify filename"
+ STOP
+ ENDIF
+ CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error)
+ CALL check("h5fcreate_f",error,total_error)
+
+ !
+ ! Create group.
+ !
+ CALL h5gopen_f(file_id,"/",g_id, error)
+ CALL check("h5gopen_f",error,total_error)
+
+ CALL check_get_name(file_id, fix_filename, total_error)
+ CALL check_get_name(g_id, fix_filename, total_error)
+
+ ! Close the group.
+ !
+ CALL h5gclose_f(g_id, error)
+ CALL check("h5gclose_f",error,total_error)
+
+ !
+ ! Close the file identifiers.
+ !
+ CALL h5fclose_f(file_id, error)
+ CALL check("h5fclose_f",error,total_error)
+
+ IF(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error)
+ CALL check("h5_cleanup_f", error, total_error)
+ RETURN
+
+ END SUBROUTINE get_name_test
+
+
!
! The following example demonstrates how to get creation property list,
! and access property list.
diff --git a/fortran/test/tH5Z.F90 b/fortran/test/tH5Z.F90
index 0eaa941..8c39fea 100644
--- a/fortran/test/tH5Z.F90
+++ b/fortran/test/tH5Z.F90
@@ -192,7 +192,8 @@ CONTAINS
INTEGER(HSIZE_T), DIMENSION(2) :: chunk_dims = (/NN, MM/)
INTEGER :: rank = 2 ! Dataset rank
- INTEGER, DIMENSION(N,M) :: dset_data, data_out ! Data buffers
+ INTEGER, DIMENSION(N,M) :: dset_data ! Data buffers
+ INTEGER, DIMENSION(:,:), ALLOCATABLE :: data_out ! Data buffers
INTEGER :: error ! Error flag
INTEGER :: num_errors = 0 ! Number of data errors
@@ -363,8 +364,9 @@ CONTAINS
!
! Read the dataset.
!
+ ALLOCATE(data_out(1:N,1:M))
CALL h5dread_f (dset_id, H5T_NATIVE_INTEGER, data_out, data_dims, error)
- CALL check("h5dread_f", error, total_error)
+ CALL check("h5dread_f", error, total_error)
!
!Compare the data.
@@ -385,6 +387,7 @@ CONTAINS
100 IF (num_errors .GT. 0) THEN
total_error=total_error + 1
END IF
+ DEALLOCATE(data_out)
!
! End access to the dataset and release resources used by it.