diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2020-10-16 22:47:27 (GMT) |
---|---|---|
committer | Larry Knox <lrknox@hdfgroup.org> | 2020-10-16 22:47:27 (GMT) |
commit | db30c2da68ece4a155e9e50c28ec16d6057509b2 (patch) | |
tree | 1d36f673c36dfee71c266bba39511da21ecc782e /fortran/examples | |
parent | 5b9cf732caab9daa6ed1e00f2df4f5a792340196 (diff) | |
parent | 2e2b87d1cbdee3b919e6e5cba6c5ecd1b9434434 (diff) | |
download | hdf5-db30c2da68ece4a155e9e50c28ec16d6057509b2.zip hdf5-db30c2da68ece4a155e9e50c28ec16d6057509b2.tar.gz hdf5-db30c2da68ece4a155e9e50c28ec16d6057509b2.tar.bz2 |
Merge HDF5 1.10.7 release files into 1.10/masterhdf5-1_10_7
Diffstat (limited to 'fortran/examples')
-rw-r--r-- | fortran/examples/CMakeLists.txt | 107 | ||||
-rw-r--r-- | fortran/examples/CMakeTests.cmake | 138 | ||||
-rw-r--r-- | fortran/examples/Makefile.am | 4 | ||||
-rw-r--r-- | fortran/examples/Makefile.in | 70 | ||||
-rw-r--r-- | fortran/examples/compound_complex_fortran2003.f90 | 6 | ||||
-rw-r--r-- | fortran/examples/compound_fortran2003.f90 | 12 | ||||
-rw-r--r-- | fortran/examples/h5_cmprss.f90 | 26 | ||||
-rw-r--r-- | fortran/examples/h5_extend.f90 | 54 | ||||
-rw-r--r-- | fortran/examples/h5_subset.f90 | 64 | ||||
-rw-r--r-- | fortran/examples/nested_derived_type.f90 | 14 | ||||
-rw-r--r-- | fortran/examples/run-fortran-ex.sh.in | 27 | ||||
-rw-r--r-- | fortran/examples/rwdset_fortran2003.f90 | 38 | ||||
-rw-r--r-- | fortran/examples/testh5fc.sh.in | 16 |
13 files changed, 307 insertions, 269 deletions
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index e8dddd3..02a71c3 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.10) +cmake_minimum_required (VERSION 3.12) project (HDF5_F90_EXAMPLES C Fortran) # -------------------------------------------------------------------- # Notes: When creating examples they should be prefixed @@ -35,28 +35,22 @@ set (F2003_examples foreach (example ${examples}) add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_compile_options(f90_ex_${example} - PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> - ) -# set_property(TARGET f90_ex_${example} APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f90_ex_${example} APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> -# ) + target_compile_options(f90_ex_${example} PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>) +# set_property(TARGET f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET f90_ex_${example} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() if (NOT BUILD_SHARED_LIBS) target_include_directories (f90_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - ) - target_link_libraries (f90_ex_${example} - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + "${CMAKE_Fortran_MODULE_DIRECTORY}/static" + "${HDF5_SRC_DIR}" + "${HDF5_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}/static" ) + target_link_libraries (f90_ex_${example} PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran @@ -65,12 +59,13 @@ foreach (example ${examples}) else () target_include_directories (f90_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" - ) - target_link_libraries (f90_ex_${example} - PRIVATE - ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared" + "${HDF5_SRC_DIR}" + "${HDF5_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}/shared" ) + target_link_libraries (f90_ex_${example} PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran @@ -81,28 +76,22 @@ endforeach () foreach (example ${F2003_examples}) add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_compile_options(f03_ex_${example} - PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> - ) -# set_property(TARGET f03_ex_${example} APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f03_ex_${example} APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> -# ) + target_compile_options(f03_ex_${example} PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>) +# set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET f03_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() if (NOT ONLY_SHARED_LIBS) target_include_directories (f03_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - ) - target_link_libraries (f03_ex_${example} - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + "${CMAKE_Fortran_MODULE_DIRECTORY}/static" + "${HDF5_SRC_DIR}" + "${HDF5_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}/static" ) + target_link_libraries (f03_ex_${example} PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 @@ -111,12 +100,13 @@ foreach (example ${F2003_examples}) else () target_include_directories (f03_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" - ) - target_link_libraries (f03_ex_${example} - PRIVATE - ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared" + "${HDF5_SRC_DIR}" + "${HDF5_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}" + "${HDF5_F90_BINARY_DIR}/shared" ) + target_link_libraries (f03_ex_${example} PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 @@ -127,27 +117,26 @@ endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - target_compile_options(f90_ex_ph5example - PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> - ) -# set_property(TARGET f90_ex_ph5example APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f90_ex_ph5example APPEND PROPERTY -# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> -# ) + target_compile_options(f90_ex_ph5example PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>) +# set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">) +# set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET f90_ex_ph5example PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() if (NOT ONLY_SHARED_LIBS) 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;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>" + "${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_link_libraries (f90_ex_ph5example PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + ${HDF5_F90_LIB_TARGET} + ${HDF5_LIB_TARGET} $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}> ) set_target_properties (f90_ex_ph5example PROPERTIES @@ -158,11 +147,17 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) else () target_include_directories (f90_ex_ph5example PRIVATE - "${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}>" + "${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_link_libraries (f90_ex_ph5example PRIVATE - ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + ${HDF5_F90_LIBSH_TARGET} + ${HDF5_LIBSH_TARGET} $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}> ) set_target_properties (f90_ex_ph5example PROPERTIES @@ -173,6 +168,6 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) endif () endif () -if (BUILD_TESTING) +if (BUILD_TESTING AND HDF5_TEST_FORTRAN AND HDF5_TEST_EXAMPLES) include (CMakeTests.cmake) endif () diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index 5e7dfa8..a52375b 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -16,77 +16,79 @@ ############################################################################## ############################################################################## -set (test_ex_fortran_CLEANFILES - compound.h5 - copy1.h5 - copy2.h5 - dsetf.h5 - extend.h5 - FORTRAN.h5 - groupf.h5 - groupsf.h5 - h5_cmprss.h5 - mount1.h5 - mount2.h5 - sdsf.h5 - subset.h5 - SDScompound.h5 - test.h5 -) +if (HDF5_TEST_SERIAL) + set (test_ex_fortran_CLEANFILES + compound.h5 + copy1.h5 + copy2.h5 + dsetf.h5 + extend.h5 + FORTRAN.h5 + groupf.h5 + groupsf.h5 + h5_cmprss.h5 + mount1.h5 + mount2.h5 + sdsf.h5 + subset.h5 + SDScompound.h5 + test.h5 + ) -# Remove any output file left over from previous test run -add_test ( - NAME f90_ex-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_fortran_CLEANFILES} -) -set_tests_properties (f90_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_f90_ex) + # Remove any output file left over from previous test run + add_test ( + NAME f90_ex-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_fortran_CLEANFILES} + ) + set_tests_properties (f90_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_f90_ex) -foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f90_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:f90_ex_${example}>) - else () - add_test (NAME f90_ex_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:f90_ex_${example}>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f90_ex_${example}.txt" - #-D "TEST_REFERENCE=f90_ex_${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (f90_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) - if (last_test) - set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f90_ex_${example}") -endforeach () + foreach (example ${examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME f90_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:f90_ex_${example}>) + else () + add_test (NAME f90_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:f90_ex_${example}>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=f90_ex_${example}.txt" + #-D "TEST_REFERENCE=f90_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (f90_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) + if (last_test) + set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "f90_ex_${example}") + endforeach () -foreach (example ${F2003_examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f03_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:f03_ex_${example}>) - else () - add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f03_ex_${example}.txt" - #-D "TEST_REFERENCE=f03_ex_${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (f03_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) - if (last_test) - set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f03_ex_${example}") -endforeach () + foreach (example ${F2003_examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME f03_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:f03_ex_${example}>) + else () + add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=f03_ex_${example}.txt" + #-D "TEST_REFERENCE=f03_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (f03_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) + if (last_test) + set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "f03_ex_${example}") + endforeach () +endif () -if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) +if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL AND MPI_Fortran_FOUND) add_test (NAME MPI_TEST_f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS}) endif () diff --git a/fortran/examples/Makefile.am b/fortran/examples/Makefile.am index 6bf2edb..474126d 100644 --- a/fortran/examples/Makefile.am +++ b/fortran/examples/Makefile.am @@ -74,8 +74,8 @@ endif # Tell automake how to install examples # Note: no '/' after DESTDIR. Explanation in commence.am -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/fortran -EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples +EXAMPLEDIR=${DESTDIR}$(examplesdir)/fortran +EXAMPLETOPDIR=${DESTDIR}$(examplesdir) # List dependencies for each example. Normally, automake would take # care of this for us, but if we tell automake about the programs it diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in index 6df6b3d..6ae52ae 100644 --- a/fortran/examples/Makefile.in +++ b/fortran/examples/Makefile.in @@ -372,12 +372,12 @@ AMTAR = @AMTAR@ # H5_CFLAGS holds flags that should be used when building hdf5, # but which should not be exported to h5cc for building other programs. -# AM_CFLAGS is an automake construct which should be used by Makefiles +# AM_CFLAGS is an automake construct which should be used by Makefiles # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. # This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. -AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ +AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@ AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ +AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ AM_JAVACFLAGS = @AM_JAVACFLAGS@ @@ -397,6 +397,7 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CC_VERSION = @CC_VERSION@ CFLAGS = @CFLAGS@ +CLANG_SANITIZE_CHECKS = @CLANG_SANITIZE_CHECKS@ CODESTACK = @CODESTACK@ CONFIG_DATE = @CONFIG_DATE@ CONFIG_MODE = @CONFIG_MODE@ @@ -413,6 +414,7 @@ DEFAULT_API_VERSION = @DEFAULT_API_VERSION@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ +DESIRED_FILE_LOCKING = @DESIRED_FILE_LOCKING@ DEV_WARNINGS = @DEV_WARNINGS@ DIRECT_VFD = @DIRECT_VFD@ DLLTOOL = @DLLTOOL@ @@ -449,8 +451,11 @@ H5_CFLAGS = @H5_CFLAGS@ H5_CLASSPATH = @H5_CLASSPATH@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ +H5_ECFLAGS = @H5_ECFLAGS@ +H5_ECXXFLAGS = @H5_ECXXFLAGS@ H5_FCFLAGS = @H5_FCFLAGS@ H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@ +H5_IS_DARWIN = @H5_IS_DARWIN@ H5_JAVACFLAGS = @H5_JAVACFLAGS@ H5_JAVAFLAGS = @H5_JAVAFLAGS@ H5_JNIFLAGS = @H5_JNIFLAGS@ @@ -473,6 +478,7 @@ HL = @HL@ HL_FOR = @HL_FOR@ HSIZE_T = @HSIZE_T@ HSSIZE_T = @HSSIZE_T@ +IGNORE_DISABLED_FILE_LOCKS = @IGNORE_DISABLED_FILE_LOCKS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -509,6 +515,7 @@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@ +MIRROR_VFD = @MIRROR_VFD@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ NM = @NM@ @@ -568,6 +575,7 @@ TIME = @TIME@ TR = @TR@ TRACE_API = @TRACE_API@ UNAME_INFO = @UNAME_INFO@ +USE_FILE_LOCKING = @USE_FILE_LOCKING@ USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@ USE_FILTER_SZIP = @USE_FILTER_SZIP@ USINGMEMCHECKER = @USINGMEMCHECKER@ @@ -603,6 +611,7 @@ docdir = $(exec_prefix)/doc dvidir = @dvidir@ enable_shared = @enable_shared@ enable_static = @enable_static@ +examplesdir = @examplesdir@ exec_prefix = @exec_prefix@ fortran_linux_linker_option = @fortran_linux_linker_option@ host = @host@ @@ -659,15 +668,15 @@ LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la -# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below -# has been removed. According to the official description of DESTDIR by Gnu at -# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is -# prepended to the normal and complete install path that it precedes for the -# purpose of installing in a temporary directory which is useful for building -# rpms and other packages. The '/' after ${DESTDIR} will be followed by another -# '/' at the beginning of the normal install path. When DESTDIR is empty the -# path then begins with '//', which is incorrect and causes problems at least for -# Cygwin. +# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below +# has been removed. According to the official description of DESTDIR by Gnu at +# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is +# prepended to the normal and complete install path that it precedes for the +# purpose of installing in a temporary directory which is useful for building +# rpms and other packages. The '/' after ${DESTDIR} will be followed by another +# '/' at the beginning of the normal install path. When DESTDIR is empty the +# path then begins with '//', which is incorrect and causes problems at least for +# Cygwin. # Scripts used to build examples # If only shared libraries have been installed, have h5cc build examples with @@ -720,8 +729,8 @@ FORTRAN_API = yes # Tell automake how to install examples # Note: no '/' after DESTDIR. Explanation in commence.am -EXAMPLEDIR = ${DESTDIR}$(exec_prefix)/share/hdf5_examples/fortran -EXAMPLETOPDIR = ${DESTDIR}$(exec_prefix)/share/hdf5_examples +EXAMPLEDIR = ${DESTDIR}$(examplesdir)/fortran +EXAMPLETOPDIR = ${DESTDIR}$(examplesdir) # Assume that all tests in this directory are examples, and tell # conclude.am when to build them. @@ -744,7 +753,7 @@ LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \ PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \ $(EXTRA_PROG) -chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) +chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) TEST_EXTENSIONS = .sh SH_LOG_COMPILER = $(SHELL) AM_SH_LOG_FLAGS = @@ -1171,7 +1180,7 @@ install-data-local: uninstall-local: @$(MAKE) $(AM_MAKEFLAGS) uninstall-examples -install-examples: $(EXAMPLEDIR) $(INSTALL_FILES) +install-examples: $(EXAMPLEDIR) $(INSTALL_FILES) @for f in X $(INSTALL_FILES); do \ if test $$f != X; then \ (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1); \ @@ -1218,7 +1227,7 @@ installcheck-local: H5CCFLAGS="-shlib" $(MAKE) $(AM_MAKEFLAGS) check; \ else \ $(MAKE) $(AM_MAKEFLAGS) check; \ - fi + fi @if test "$(INSTALL_FILES)" -a $(TEST_EXAMPLES_SCRIPT) -a -d $(EXAMPLEDIR); then \ echo "============================"; \ echo "Testing $(TEST_EXAMPLES_SCRIPT)"; \ @@ -1326,28 +1335,37 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: echo "============================" > $${log}; \ fi; \ if test "X$(FORTRAN_API)" = "Xyes"; then \ - echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ + echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \ if test -n "$(REALTIMEOUTPUT)"; then \ - echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log}; \ + echo "Fortran API: Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log}; \ else \ - echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ + echo "Fortran API: Test log for $${tname} $(TEST_FLAGS)" >> $${log}; \ fi; \ elif test "X$(CXX_API)" = "Xyes"; then \ - echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ + echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \ if test -n "$(REALTIMEOUTPUT)"; then \ - echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log};\ + echo "C++ API: Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log};\ else \ - echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\ + echo "C++ API: Test log for $${tname} $(TEST_FLAGS)" >> $${log};\ fi; \ else \ - echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ + echo "Testing: $${tname} $(TEST_FLAGS)"; \ if test -n "$(REALTIMEOUTPUT)"; then \ - echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log}; \ + echo "Test log for $${tname} $(TEST_FLAGS)" | tee -a $${log}; \ else \ - echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ + echo "Test log for $${tname} $(TEST_FLAGS)" >> $${log}; \ fi; \ fi; \ if test -n "$(REALTIMEOUTPUT)"; then \ + if test -n "$(HDF5_DRIVER)"; then \ + echo "Virtual file driver (VFD): $(HDF5_DRIVER)" | tee -a $${log}; \ + fi; \ + else \ + if test -n "$(HDF5_DRIVER)"; then \ + echo "Virtual file driver (VFD): $(HDF5_DRIVER)" >> $${log}; \ + fi; \ + fi; \ + if test -n "$(REALTIMEOUTPUT)"; then \ echo "============================" | tee -a $${log}; \ else \ echo "============================" >> $${log}; \ diff --git a/fortran/examples/compound_complex_fortran2003.f90 b/fortran/examples/compound_complex_fortran2003.f90 index 6d0f291..9f0cc9f 100644 --- a/fortran/examples/compound_complex_fortran2003.f90 +++ b/fortran/examples/compound_complex_fortran2003.f90 @@ -11,8 +11,8 @@ ! help@hdfgroup.org. * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! -! This example shows how to create an array of a compound datatype which -! contains an array of type complex and how to write it to hdf5 +! This example shows how to create an array of a compound datatype which +! contains an array of type complex and how to write it to hdf5 ! and how to read it back into a compound datatype for hdf5. ! @@ -85,7 +85,7 @@ PROGRAM compound_complex_fortran2003 ! Open the file and the dataset. ! CALL H5Fopen_f("test.h5", H5F_ACC_RDONLY_F, file_id, error) - + CALL H5Dopen_f(file_id, "samples", dset_id, error) ! ! Create the memory data type. diff --git a/fortran/examples/compound_fortran2003.f90 b/fortran/examples/compound_fortran2003.f90 index 0168177..09e1b04 100644 --- a/fortran/examples/compound_fortran2003.f90 +++ b/fortran/examples/compound_fortran2003.f90 @@ -77,10 +77,10 @@ PROGRAM main INTEGER(SIZE_T) :: offset, sizeof_compound INTEGER :: hdferr TYPE(C_PTR) :: f_ptr - - INTEGER(SIZE_T) :: type_sizei ! Size of the integer datatype - INTEGER(SIZE_T) :: type_sizer ! Size of the real datatype - INTEGER(SIZE_T) :: type_sized ! Size of the double datatype + + INTEGER(SIZE_T) :: type_sizei ! Size of the integer datatype + INTEGER(SIZE_T) :: type_sizer ! Size of the real datatype + INTEGER(SIZE_T) :: type_sized ! Size of the double datatype INTEGER(hid_t) :: tid3 ! /* Nested Array Datatype ID */ INTEGER(HSIZE_T), DIMENSION(1) :: tdims1=(/13/) ! @@ -133,7 +133,7 @@ PROGRAM main ! ! Write data to the dataset ! - + f_ptr = C_LOC(s1(1)) CALL H5Dwrite_f(dataset, s1_tid, f_ptr, hdferr) @@ -150,7 +150,7 @@ PROGRAM main ! CALL H5Fopen_f(H5FILE_NAME, H5F_ACC_RDONLY_F, file, hdferr) - + CALL H5Dopen_f(file, DATASETNAME, dataset,hdferr) ! diff --git a/fortran/examples/h5_cmprss.f90 b/fortran/examples/h5_cmprss.f90 index 61dd7b0..f543024 100644 --- a/fortran/examples/h5_cmprss.f90 +++ b/fortran/examples/h5_cmprss.f90 @@ -10,17 +10,17 @@ ! If you do not have access to either file, you may request a copy from * ! help@hdfgroup.org. * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! +! ! This example illustrates how to create a compressed dataset. ! It is used in the HDF5 Tutorial. -! +! PROGRAM h5_cmprss - USE HDF5 ! This module contains all necessary modules + USE HDF5 ! This module contains all necessary modules IMPLICIT NONE ! - ! The dataset is stored in file "h5_cmprss.h5" + ! The dataset is stored in file "h5_cmprss.h5" ! CHARACTER(LEN=12), PARAMETER :: filename = "h5_cmprss.h5" INTEGER, PARAMETER :: rank = 2 ! Rank of the data set @@ -33,7 +33,7 @@ PROGRAM h5_cmprss INTEGER :: error INTEGER(hsize_t), DIMENSION(1:rank) :: dims ! dimensions of data INTEGER(hsize_t), DIMENSION(1:rank) :: cdims ! sizes of chunked data - + INTEGER :: i,j, numfilt INTEGER, DIMENSION(1:dim0,1:dim1) :: buf ! write buffer INTEGER, DIMENSION(1:dim0,1:dim1) :: rbuf ! read buffer @@ -63,15 +63,15 @@ PROGRAM h5_cmprss CALL h5screate_simple_f(rank, dims, dataspace_id, error) CALL h5pcreate_f(H5P_DATASET_CREATE_F, plist_id, error) ! - ! Dataset must be chunked for compression + ! Dataset must be chunked for compression cdims(1:2) = 20 CALL h5pset_chunk_f(plist_id, 2, cdims, error) ! Set ZLIB / DEFLATE Compression using compression level 6. - ! To use SZIP Compression comment out these lines. + ! To use SZIP Compression comment out these lines. CALL h5pset_deflate_f(plist_id, 6, error) - ! Uncomment these lines to set SZIP Compression + ! Uncomment these lines to set SZIP Compression !szip_options_mask = H5_SZIP_NN_OM_F !szip_pixels_per_block = 16 !CALL H5Pset_szip_f(plist_id, szip_options_mask, szip_pixels_per_block, error) @@ -86,7 +86,7 @@ PROGRAM h5_cmprss ENDDO ENDDO - data_dims(1:2) = (/dim0,dim1/) + data_dims(1:2) = (/dim0,dim1/) CALL h5dwrite_f(dataset_id, H5T_NATIVE_INTEGER, buf, data_dims, error) ! Close resources @@ -99,12 +99,12 @@ PROGRAM h5_cmprss CALL h5fopen_f(filename, H5F_ACC_RDONLY_F, file_id, error) CALL h5dopen_f(file_id, "Compressed_Data", dataset_id, error) - ! Retrieve filter information. + ! Retrieve filter information. CALL h5dget_create_plist_f(dataset_id, plist_id, error) - + CALL h5pget_nfilters_f(plist_id, numfilt, error) WRITE(*,'(A, I0)') "Number of filters associated with dataset: ", numfilt - + DO i = 1, numfilt nelmts = 1 CALL h5pget_filter_f(plist_id, 0, flags, nelmts, cd_values, & @@ -121,7 +121,7 @@ PROGRAM h5_cmprss ENDDO data_dims(1:2) = (/dim0,dim1/) CALL h5dread_f(dataset_id, H5T_NATIVE_INTEGER, rbuf, data_dims, error) - + CALL h5dclose_f(dataset_id, error) CALL h5pclose_f(plist_id, error) CALL h5fclose_f(file_id, error) diff --git a/fortran/examples/h5_extend.f90 b/fortran/examples/h5_extend.f90 index 20b91ff..93bfea8 100644 --- a/fortran/examples/h5_extend.f90 +++ b/fortran/examples/h5_extend.f90 @@ -15,12 +15,12 @@ PROGRAM H5_EXTEND - USE HDF5 ! This module contains all necessary modules + USE HDF5 ! This module contains all necessary modules IMPLICIT NONE ! - !the dataset is stored in file "extend.h5" + !the dataset is stored in file "extend.h5" ! CHARACTER(LEN=9), PARAMETER :: filename = "extend.h5" @@ -30,11 +30,11 @@ PROGRAM H5_EXTEND CHARACTER(LEN=15), PARAMETER :: dsetname = "ExtendibleArray" INTEGER :: RANK = 2 - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: dset_id ! Dataset identifier - INTEGER(HID_T) :: dataspace ! Dataspace identifier - INTEGER(HID_T) :: memspace ! Memory dataspace identifier - INTEGER(HID_T) :: crp_list ! Dataset creation property identifier + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dataspace ! Dataspace identifier + INTEGER(HID_T) :: memspace ! Memory dataspace identifier + INTEGER(HID_T) :: crp_list ! Dataset creation property identifier ! !dataset dimensions at creation time @@ -42,7 +42,7 @@ PROGRAM H5_EXTEND INTEGER(HSIZE_T), DIMENSION(1:2) :: dims = (/3,3/) ! - !data dimensions + !data dimensions ! INTEGER(HSIZE_T), DIMENSION(1:2) :: dimsc = (/2,5/) INTEGER(HSIZE_T), DIMENSION(1:2) :: dimsm = (/3,7/) @@ -50,49 +50,49 @@ PROGRAM H5_EXTEND ! !Maximum dimensions ! - INTEGER(HSIZE_T), DIMENSION(1:2) :: maxdims + INTEGER(HSIZE_T), DIMENSION(1:2) :: maxdims INTEGER(HSIZE_T), DIMENSION(1:2) :: offset - INTEGER(HSIZE_T), DIMENSION(1:2) :: count + INTEGER(HSIZE_T), DIMENSION(1:2) :: count ! - ! Variables for reading and writing + ! Variables for reading and writing ! - INTEGER, DIMENSION(1:3,1:3) :: data1 + INTEGER, DIMENSION(1:3,1:3) :: data1 INTEGER, DIMENSION(1:21) :: data2 = & (/2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4/) INTEGER(HSIZE_T), DIMENSION(1:2) :: data_dims ! - !Size of data in the file + !Size of data in the file ! INTEGER(HSIZE_T), DIMENSION(1:2) :: size ! - !general purpose integer + !general purpose integer ! INTEGER(HSIZE_T) :: i, j ! - !flag to check operation success + !flag to check operation success ! - INTEGER :: error + INTEGER :: error ! !Variables used in reading data back - ! + ! INTEGER(HSIZE_T), DIMENSION(1:2) :: dimsr, maxdimsr INTEGER :: rankr - INTEGER, DIMENSION(1:3,1:10) :: rdata + INTEGER, DIMENSION(1:3,1:10) :: rdata ! !Initialize FORTRAN predifined datatypes ! - CALL h5open_f(error) + CALL h5open_f(error) ! !Create a new file using default properties. - ! + ! CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) ! @@ -117,7 +117,7 @@ PROGRAM H5_EXTEND CALL h5sclose_f(dataspace, error) ! - !Fill data array with 1's + !Fill data array with 1's ! DO i = 1, dims(1) DO j = 1, dims(2) @@ -128,7 +128,7 @@ PROGRAM H5_EXTEND ! !Write data array to dataset ! - data_dims(1:2) = (/3,3/) + data_dims(1:2) = (/3,3/) CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data1, data_dims, error) ! @@ -144,7 +144,7 @@ PROGRAM H5_EXTEND ! !Write to 3x7 extended part of dataset - ! + ! CALL h5dget_space_f(dset_id, dataspace, error) CALL h5sselect_hyperslab_f(dataspace, H5S_SELECT_SET_F, & offset, count, error) @@ -185,7 +185,7 @@ PROGRAM H5_EXTEND ! !Get dataspace's dimensions. - ! + ! CALL h5sget_simple_extent_dims_f(dataspace, dimsr, maxdimsr, error) ! @@ -204,15 +204,15 @@ PROGRAM H5_EXTEND CALL h5screate_simple_f(rankr, dimsr, memspace, error) ! - !Read data + !Read data ! data_dims(1:2) = (/3,10/) CALL H5dread_f(dset_id, H5T_NATIVE_INTEGER, rdata, data_dims, & error, memspace, dataspace) - WRITE(*,'(A)') "Dataset:" + WRITE(*,'(A)') "Dataset:" DO i = 1, dimsr(1) - WRITE(*,'(100(I0,1X))') rdata(i,1:dimsr(2)) + WRITE(*,'(100(I0,1X))') rdata(i,1:dimsr(2)) END DO ! diff --git a/fortran/examples/h5_subset.f90 b/fortran/examples/h5_subset.f90 index ab33c86..9bebce5 100644 --- a/fortran/examples/h5_subset.f90 +++ b/fortran/examples/h5_subset.f90 @@ -11,23 +11,23 @@ ! help@hdfgroup.org. * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! -! This example shows how to write and read a hyperslab. +! This example shows how to write and read a hyperslab. ! It is used in the HDF5 Tutorial. ! -PROGRAM H5_SUBSET +PROGRAM H5_SUBSET - USE HDF5 ! This module contains all necessary modules + USE HDF5 ! This module contains all necessary modules IMPLICIT NONE CHARACTER(LEN=9), PARAMETER :: filename = "subset.h5" ! File name CHARACTER(LEN=8), PARAMETER :: dsetname = "IntArray" ! Dataset name - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: dset_id ! Dataset identifier - INTEGER(HID_T) :: dataspace ! Dataspace identifier - INTEGER(HID_T) :: memspace ! memspace identifier + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dataspace ! Dataspace identifier + INTEGER(HID_T) :: memspace ! memspace identifier ! ! To change the subset size, modify size of dimsm, sdata, dim0_sub, @@ -35,57 +35,57 @@ PROGRAM H5_SUBSET ! INTEGER(HSIZE_T), DIMENSION(1:2) :: dimsm = (/4,3/) ! Dataset dimensions INTEGER, DIMENSION(1:4,1:3) :: sdata ! Subset buffer - INTEGER :: dim0_sub = 4 - INTEGER :: dim1_sub = 3 + INTEGER :: dim0_sub = 4 + INTEGER :: dim1_sub = 3 INTEGER(HSIZE_T), DIMENSION(1:2) :: count = (/4,3/) ! Size of hyperslab INTEGER(HSIZE_T), DIMENSION(1:2) :: offset = (/2,1/) ! Hyperslab offset - INTEGER(HSIZE_T), DIMENSION(1:2) :: stride = (/1,1/) ! Hyperslab stride - INTEGER(HSIZE_T), DIMENSION(1:2) :: block = (/1,1/) ! Hyperslab block size + INTEGER(HSIZE_T), DIMENSION(1:2) :: stride = (/1,1/) ! Hyperslab stride + INTEGER(HSIZE_T), DIMENSION(1:2) :: block = (/1,1/) ! Hyperslab block size INTEGER(HSIZE_T), DIMENSION(1:2) :: dimsf = (/10,8/) ! Dataset dimensions INTEGER, DIMENSION(1:10,1:8) :: data ! Data to write - INTEGER, DIMENSION(1:10,1:8) :: rdata ! Data to read + INTEGER, DIMENSION(1:10,1:8) :: rdata ! Data to read INTEGER :: rank = 2 ! Dataset rank ( in file ) INTEGER :: dim0 = 10 ! Dataset size in file - INTEGER :: dim1 = 8 + INTEGER :: dim1 = 8 - INTEGER :: i, j + INTEGER :: i, j INTEGER :: error ! Error flag INTEGER(HSIZE_T), DIMENSION(2) :: data_dims ! - ! Write data to the HDF5 file. + ! Write data to the HDF5 file. ! ! - ! Data initialization. + ! Data initialization. ! - DO i = 1, dim0 + DO i = 1, dim0 DO j = 1, dim1 IF (i .LE. (dim0 / 2)) THEN - data(i,j) = 1 - ELSE - data(i,j) = 2 + data(i,j) = 1 + ELSE + data(i,j) = 2 END IF END DO END DO ! - ! Initialize FORTRAN interface. + ! Initialize FORTRAN interface. ! - CALL h5open_f(error) + CALL h5open_f(error) ! ! Create a new file using default properties. - ! + ! CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) ! - ! Create the data space for the dataset. + ! Create the data space for the dataset. ! CALL h5screate_simple_f(rank, dimsf, dataspace, error) @@ -98,12 +98,12 @@ PROGRAM H5_SUBSET ! ! Write the dataset. ! - data_dims(1) = dim0 - data_dims(2) = dim1 + data_dims(1) = dim0 + data_dims(2) = dim1 CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, data_dims, error) ! - ! Data Written to File + ! Data Written to File ! WRITE(*,'(/,A)') "Original Data Written to File:" DO i = 1, dim0 @@ -138,7 +138,7 @@ PROGRAM H5_SUBSET ! CALL h5dget_space_f(dset_id, dataspace, error) CALL h5sselect_hyperslab_f(dataspace, H5S_SELECT_SET_F, & - offset, count, error, stride, BLOCK) + offset, count, error, stride, BLOCK) ! ! Create memory dataspace. ! @@ -148,9 +148,9 @@ PROGRAM H5_SUBSET WRITE(*,'(A,/)') " offset=2x1 stride=1x1 count=4x3 block=1x1" ! - ! Write subset to dataset + ! Write subset to dataset ! - data_dims(1:2) = (/dim0_sub, dim1_sub/) + data_dims(1:2) = (/dim0_sub, dim1_sub/) CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, sdata, data_dims, error, & memspace, dataspace) @@ -158,10 +158,10 @@ PROGRAM H5_SUBSET CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, rdata, data_dims, error) ! - ! Read entire dataset back + ! Read entire dataset back ! WRITE(*,'(A)') "Data in File after Subset Written:" - DO i = 1, dim0 + DO i = 1, dim0 WRITE(*,'(100(1X,I0,1X))') rdata(i,1:dim1) END DO PRINT *, " " diff --git a/fortran/examples/nested_derived_type.f90 b/fortran/examples/nested_derived_type.f90 index 68354ac..651830c 100644 --- a/fortran/examples/nested_derived_type.f90 +++ b/fortran/examples/nested_derived_type.f90 @@ -1,4 +1,4 @@ -! +! ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -82,10 +82,10 @@ PROGRAM main INTEGER(SIZE_T) :: offset, sizeof_compound INTEGER :: hdferr TYPE(C_PTR) :: f_ptr - - INTEGER(SIZE_T) :: type_sizei ! Size of the integer datatype - INTEGER(SIZE_T) :: type_sizer ! Size of the real datatype - INTEGER(SIZE_T) :: type_sized ! Size of the double datatype + + INTEGER(SIZE_T) :: type_sizei ! Size of the integer datatype + INTEGER(SIZE_T) :: type_sizer ! Size of the real datatype + INTEGER(SIZE_T) :: type_sized ! Size of the double datatype INTEGER(hid_t) :: tid3 ! /* Nested Array Datatype ID */ INTEGER(HSIZE_T), DIMENSION(1) :: tdims1=(/7/) INTEGER(HSIZE_T), DIMENSION(1) :: tdims1a=(/4/) @@ -136,7 +136,7 @@ PROGRAM main ! ! Write data to the dataset ! - + f_ptr = C_LOC(s1(1)) CALL H5Dwrite_f(dataset, s1_tid, f_ptr, hdferr) @@ -153,7 +153,7 @@ PROGRAM main ! CALL H5Fopen_f(H5FILE_NAME, H5F_ACC_RDONLY_F, file, hdferr) - + CALL H5Dopen_f(file, DATASETNAME, dataset,hdferr) ! ! Create a data type for s2 diff --git a/fortran/examples/run-fortran-ex.sh.in b/fortran/examples/run-fortran-ex.sh.in index aa17f89..81e54ea 100644 --- a/fortran/examples/run-fortran-ex.sh.in +++ b/fortran/examples/run-fortran-ex.sh.in @@ -18,7 +18,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This script will compile and run the fortran examples from source files # -# installed in .../share/hdf5_examples/fortran using h5fc or h5pfc. The # +# installed in @examplesdir@/fortran using h5fc or h5pfc. The # # order for running programs with RunTest in the MAIN section below is taken # # from the Makefile. The order is important since some of the test programs # # use data files created by earlier test programs. Any future additions should # @@ -30,9 +30,32 @@ EXIT_SUCCESS=0 EXIT_FAILURE=1 +# +# Try to derive the path to the installation $prefix established +# by ./configure relative to the examples directory established by +# ./configure. If successful, set `prefix_relto_examplesdir` to the +# relative path. Otherwise, set `prefix_relto_examplesdir` to the +# absolute installation $prefix. +# +# This script uses the value of `prefix` in the user's environment, if +# it is set, below. The content of $() is evaluated in a sub-shell, so +# if `prefix` is set in the user's environment, the shell statements in +# $() won't clobbered it. +# +prefix_relto_examplesdir=$( +prefix=@prefix@ +examplesdir=@examplesdir@ +if [ ${examplesdir##${prefix}/} != ${examplesdir} ]; then + echo $(echo ${examplesdir##${prefix}/} | \ + sed 's,[^/][^/]*,..,g') +else + echo $prefix +fi +) + # Where the tool is installed. # default is relative path to installed location of the tools -prefix="${prefix:-../../..}" +prefix="${prefix:-../${prefix_relto_examplesdir}}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" RANLIB="@RANLIB@" diff --git a/fortran/examples/rwdset_fortran2003.f90 b/fortran/examples/rwdset_fortran2003.f90 index 36ebf0d..f79c8fe 100644 --- a/fortran/examples/rwdset_fortran2003.f90 +++ b/fortran/examples/rwdset_fortran2003.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -9,12 +9,12 @@ ! distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * ! If you do not have access to either file, you may request a copy from * ! help@hdfgroup.org. * -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! ! -! The following example shows how to write and read to/from an existing dataset. -! It opens the file created in the previous example, obtains the dataset -! identifier, writes the data to the dataset in the file, +! The following example shows how to write and read to/from an existing dataset. +! It opens the file created in the previous example, obtains the dataset +! identifier, writes the data to the dataset in the file, ! then reads the dataset to memory. Uses updated Fortran 2003 interface ! with different KINDs of integers and reals. ! @@ -22,8 +22,8 @@ PROGRAM RWDSET_FORTRAN2003 USE ISO_C_BINDING - USE HDF5 ! This module contains all necessary modules - + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE INTEGER, PARAMETER :: int_kind_1 = SELECTED_INT_KIND(2) !should map to INTEGER*1 on most modern processors @@ -42,13 +42,13 @@ PROGRAM RWDSET_FORTRAN2003 CHARACTER(LEN=6), PARAMETER :: dsetnamer4 = "dsetr4" ! Dataset name CHARACTER(LEN=6), PARAMETER :: dsetnamer8 = "dsetr8" ! Dataset name - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: dset_id1 ! Dataset identifier - INTEGER(HID_T) :: dset_id4 ! Dataset identifier - INTEGER(HID_T) :: dset_id8 ! Dataset identifier - INTEGER(HID_T) :: dset_id16 ! Dataset identifier - INTEGER(HID_T) :: dset_idr4 ! Dataset identifier - INTEGER(HID_T) :: dset_idr8 ! Dataset identifier + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id1 ! Dataset identifier + INTEGER(HID_T) :: dset_id4 ! Dataset identifier + INTEGER(HID_T) :: dset_id8 ! Dataset identifier + INTEGER(HID_T) :: dset_id16 ! Dataset identifier + INTEGER(HID_T) :: dset_idr4 ! Dataset identifier + INTEGER(HID_T) :: dset_idr8 ! Dataset identifier INTEGER :: error ! Error flag INTEGER :: i @@ -65,15 +65,15 @@ PROGRAM RWDSET_FORTRAN2003 REAL(real_kind_7), DIMENSION(1:4), TARGET :: dset_data_r7, data_out_r7 REAL(real_kind_15), DIMENSION(1:4), TARGET :: dset_data_r15, data_out_r15 - INTEGER(HSIZE_T), DIMENSION(1:1) :: data_dims = (/4/) + INTEGER(HSIZE_T), DIMENSION(1:1) :: data_dims = (/4/) INTEGER(HID_T) :: dspace_id ! Dataspace identifier - + TYPE(C_PTR) :: f_ptr ! ! Initialize FORTRAN interface. ! - CALL h5open_f(error) + CALL h5open_f(error) ! ! Initialize the dset_data array. ! @@ -130,7 +130,7 @@ PROGRAM RWDSET_FORTRAN2003 ! ! Read the dataset. ! - ! Read data back into an integer size that is larger then the original size used for + ! Read data back into an integer size that is larger then the original size used for ! writing the data f_ptr = C_LOC(data_out_i8a(1)) CALL h5dread_f(dset_id1, h5kind_to_type(int_kind_8,H5_INTEGER_KIND), f_ptr, error) @@ -172,5 +172,5 @@ PROGRAM RWDSET_FORTRAN2003 END PROGRAM RWDSET_FORTRAN2003 - + diff --git a/fortran/examples/testh5fc.sh.in b/fortran/examples/testh5fc.sh.in index f384909..200f311 100644 --- a/fortran/examples/testh5fc.sh.in +++ b/fortran/examples/testh5fc.sh.in @@ -71,13 +71,13 @@ temp_FILES="a.out $applib" # An application Main that calls hdf5 and application's own functions. cat > $appmain <<EOF PROGRAM FILEEXAMPLE - USE HDF5 ! This module contains all necessary modules - + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE CHARACTER(LEN=8), PARAMETER :: filename = "apptmp.h5" ! File name INTEGER(HID_T) :: file_id ! File identifier - + INTEGER :: error ! Error flag CALL sub1 @@ -86,7 +86,7 @@ cat > $appmain <<EOF CALL h5fclose_f(file_id, error) CALL h5close_f(error) CALL sub2 - END PROGRAM FILEEXAMPLE + END PROGRAM FILEEXAMPLE EOF # generate prog1 @@ -107,20 +107,20 @@ EOF # An HDF5 sample program that calls hdf5 functions. cat > $hdf5main <<EOF PROGRAM FILEEXAMPLE - USE HDF5 ! This module contains all necessary modules - + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE CHARACTER(LEN=8), PARAMETER :: filename = "apptmp.h5" ! File name INTEGER(HID_T) :: file_id ! File identifier - + INTEGER :: error ! Error flag CALL h5open_f (error) CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) CALL h5fclose_f(file_id, error) CALL h5close_f(error) - END PROGRAM FILEEXAMPLE + END PROGRAM FILEEXAMPLE EOF |