summaryrefslogtreecommitdiffstats
path: root/fortran/examples
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2015-08-11 14:35:30 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2015-08-11 14:35:30 (GMT)
commitcaf0e7692a2f3cf0f2d0957c30a404e6c706d3df (patch)
treeec3eddd4abad940acc89f83c0f114203ff3d6345 /fortran/examples
parent3b4696ccd16c2b98e2700a46bf7a5c76ef4a9764 (diff)
downloadhdf5-caf0e7692a2f3cf0f2d0957c30a404e6c706d3df.zip
hdf5-caf0e7692a2f3cf0f2d0957c30a404e6c706d3df.tar.gz
hdf5-caf0e7692a2f3cf0f2d0957c30a404e6c706d3df.tar.bz2
[svn-r27493] Trying again to merge the F2003_v1.10 branch to the trunk.
Tested: h5committest --PASSED--
Diffstat (limited to 'fortran/examples')
-rw-r--r--fortran/examples/CMakeLists.txt54
-rw-r--r--fortran/examples/Makefile.am12
-rw-r--r--fortran/examples/Makefile.in51
-rw-r--r--fortran/examples/nested_derived_type.f9012
-rw-r--r--fortran/examples/rwdset_fortran2003.f9024
5 files changed, 81 insertions, 72 deletions
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
index fabc5cd..f2dc896 100644
--- a/fortran/examples/CMakeLists.txt
+++ b/fortran/examples/CMakeLists.txt
@@ -69,38 +69,36 @@ foreach (example ${examples})
endif (BUILD_SHARED_LIBS)
endforeach (example ${examples})
-if (HDF5_ENABLE_F2003)
- foreach (example ${F2003_examples})
- add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- TARGET_NAMING (f03_ex_${example} STATIC)
- TARGET_FORTRAN_PROPERTIES (f03_ex_${example} STATIC " " " ")
- target_link_libraries (f03_ex_${example}
- ${HDF5_F90_LIB_TARGET}
- ${HDF5_LIB_TARGET}
+foreach (example ${F2003_examples})
+ add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
+ TARGET_NAMING (f03_ex_${example} STATIC)
+ TARGET_FORTRAN_PROPERTIES (f03_ex_${example} STATIC " " " ")
+ target_link_libraries (f03_ex_${example}
+ ${HDF5_F90_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+ target_include_directories (f03_ex_${example} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+ set_target_properties (f03_ex_${example} PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER examples/fortran03
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+ )
+ if (BUILD_SHARED_LIBS)
+ add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
+ TARGET_NAMING (f03_ex_${example}-shared SHARED)
+ TARGET_FORTRAN_PROPERTIES (f03_ex_${example}-shared SHARED " " " ")
+ target_link_libraries (f03_ex_${example}-shared
+ ${HDF5_F90_LIBSH_TARGET}
+ ${HDF5_LIBSH_TARGET}
)
- target_include_directories (f03_ex_${example} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
- set_target_properties (f03_ex_${example} PROPERTIES
+ target_include_directories (f03_ex_${example}-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
+ set_target_properties (f03_ex_${example}-shared PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran03
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- if (BUILD_SHARED_LIBS)
- add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- TARGET_NAMING (f03_ex_${example}-shared SHARED)
- TARGET_FORTRAN_PROPERTIES (f03_ex_${example}-shared SHARED " " " ")
- target_link_libraries (f03_ex_${example}-shared
- ${HDF5_F90_LIBSH_TARGET}
- ${HDF5_LIBSH_TARGET}
- )
- target_include_directories (f03_ex_${example}-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
- set_target_properties (f03_ex_${example}-shared PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/fortran03
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
- )
- endif (BUILD_SHARED_LIBS)
- endforeach (example ${F2003_examples})
-endif (HDF5_ENABLE_F2003)
+ endif (BUILD_SHARED_LIBS)
+endforeach (example ${F2003_examples})
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90)
diff --git a/fortran/examples/Makefile.am b/fortran/examples/Makefile.am
index caaa08c..cdd9317 100644
--- a/fortran/examples/Makefile.am
+++ b/fortran/examples/Makefile.am
@@ -46,12 +46,10 @@ INSTALL_FILES=h5_crtdat.f90 h5_rdwt.f90 \
# Add attention tests for Fortran 2003 features
-if FORTRAN_2003_CONDITIONAL_F
- EXAMPLE_PROG += rwdset_fortran2003 nested_derived_type \
- compound_fortran2003 compound_complex_fortran2003
- INSTALL_FILES += rwdset_fortran2003.f90 nested_derived_type.f90 \
- compound_fortran2003.f90 compound_complex_fortran2003.f90
-endif
+EXAMPLE_PROG += rwdset_fortran2003 nested_derived_type \
+ compound_fortran2003 compound_complex_fortran2003
+INSTALL_FILES += rwdset_fortran2003.f90 nested_derived_type.f90 \
+ compound_fortran2003.f90 compound_complex_fortran2003.f90
TEST_SCRIPT=testh5fc.sh
TEST_EXAMPLES_SCRIPT=$(INSTALL_SCRIPT_FILES)
@@ -103,12 +101,10 @@ refregexample: refregexample.f90
mountexample: mountexample.f90
compound: compound.f90
ph5example: ph5example.f90
-if FORTRAN_2003_CONDITIONAL_F
rwdset_fortran2003: rwdset_fortran2003.f90
nested_derived_type: nested_derived_type.f90
compound_fortran2003: compound_fortran2003.f90
compound_complex_fortran2003: compound_complex_fortran2003.f90
-endif
include $(top_srcdir)/config/examples.am
include $(top_srcdir)/config/conclude.am
diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in
index c894b75..f97fdc8 100644
--- a/fortran/examples/Makefile.in
+++ b/fortran/examples/Makefile.in
@@ -104,14 +104,6 @@ DIST_COMMON = $(top_srcdir)/config/commence.am \
$(srcdir)/Makefile.am $(top_srcdir)/bin/mkinstalldirs \
$(srcdir)/run-fortran-ex.sh.in $(srcdir)/testh5fc.sh.in \
$(top_srcdir)/bin/test-driver
-
-# Add attention tests for Fortran 2003 features
-@FORTRAN_2003_CONDITIONAL_F_TRUE@am__append_1 = rwdset_fortran2003 nested_derived_type \
-@FORTRAN_2003_CONDITIONAL_F_TRUE@ compound_fortran2003 compound_complex_fortran2003
-
-@FORTRAN_2003_CONDITIONAL_F_TRUE@am__append_2 = rwdset_fortran2003.f90 nested_derived_type.f90 \
-@FORTRAN_2003_CONDITIONAL_F_TRUE@ compound_fortran2003.f90 compound_complex_fortran2003.f90
-
TESTS = $(TEST_SCRIPT)
subdir = fortran/examples
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -120,7 +112,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/src/H5config.h
+CONFIG_HEADER = $(top_builddir)/src/H5config.h \
+ $(top_builddir)/fortran/src/H5config_f.inc
CONFIG_CLEAN_FILES = run-fortran-ex.sh testh5fc.sh
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
@@ -404,14 +397,21 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FC2003 = @FC2003@
FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FC_VERSION = @FC_VERSION@
FGREP = @FGREP@
+FORTRAN_C_LONG_DOUBLE_IS_UNIQUE = @FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@
+FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@
+FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@
FSEARCH_DIRS = @FSEARCH_DIRS@
GREP = @GREP@
+H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@
+H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@
+H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@
+H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@
+H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@
H5_CFLAGS = @H5_CFLAGS@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
@@ -421,13 +421,12 @@ H5_LDFLAGS = @H5_LDFLAGS@
H5_VERSION = @H5_VERSION@
HADDR_T = @HADDR_T@
HAVE_DMALLOC = @HAVE_DMALLOC@
-HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@
HAVE_PTHREAD = @HAVE_PTHREAD@
HDF5_HL = @HDF5_HL@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF_CXX = @HDF_CXX@
HDF_FORTRAN = @HDF_FORTRAN@
-HDF_FORTRAN2003 = @HDF_FORTRAN2003@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
@@ -469,6 +468,18 @@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
+PAC_C_MAX_REAL_PRECISION = @PAC_C_MAX_REAL_PRECISION@
+PAC_FC_ALL_INTEGER_KINDS = @PAC_FC_ALL_INTEGER_KINDS@
+PAC_FC_ALL_INTEGER_KINDS_SIZEOF = @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@
+PAC_FC_ALL_REAL_KINDS = @PAC_FC_ALL_REAL_KINDS@
+PAC_FC_ALL_REAL_KINDS_SIZEOF = @PAC_FC_ALL_REAL_KINDS_SIZEOF@
+PAC_FC_MAX_REAL_PRECISION = @PAC_FC_MAX_REAL_PRECISION@
+PAC_FORTRAN_NATIVE_DOUBLE_KIND = @PAC_FORTRAN_NATIVE_DOUBLE_KIND@
+PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF = @PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF@
+PAC_FORTRAN_NATIVE_INTEGER_KIND = @PAC_FORTRAN_NATIVE_INTEGER_KIND@
+PAC_FORTRAN_NATIVE_INTEGER_SIZEOF = @PAC_FORTRAN_NATIVE_INTEGER_SIZEOF@
+PAC_FORTRAN_NATIVE_REAL_KIND = @PAC_FORTRAN_NATIVE_REAL_KIND@
+PAC_FORTRAN_NATIVE_REAL_SIZEOF = @PAC_FORTRAN_NATIVE_REAL_SIZEOF@
PARALLEL = @PARALLEL@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
@@ -619,17 +630,21 @@ INSTALL_SCRIPT_FILES = run-fortran-ex.sh
# be run.
# We don't tell automake about these programs so that it doesn't try to
# compile them with the regular fortran compiler.
+
+# Add attention tests for Fortran 2003 features
EXAMPLE_PROG = h5_crtdat h5_rdwt h5_crtatt h5_crtgrp h5_crtgrpar \
h5_crtgrpd h5_extend h5_subset h5_cmprss hyperslab selectele \
refobjexample refregexample mountexample compound \
- $(am__append_1)
+ rwdset_fortran2003 nested_derived_type compound_fortran2003 \
+ compound_complex_fortran2003
# List files to be installed here
INSTALL_FILES = h5_crtdat.f90 h5_rdwt.f90 h5_crtatt.f90 h5_crtgrp.f90 \
h5_crtgrpar.f90 h5_crtgrpd.f90 h5_extend.f90 h5_subset.f90 \
h5_cmprss.f90 hyperslab.f90 selectele.f90 refobjexample.f90 \
refregexample.f90 mountexample.f90 compound.f90 ph5example.f90 \
- $(am__append_2)
+ rwdset_fortran2003.f90 nested_derived_type.f90 \
+ compound_fortran2003.f90 compound_complex_fortran2003.f90
TEST_SCRIPT = testh5fc.sh
TEST_EXAMPLES_SCRIPT = $(INSTALL_SCRIPT_FILES)
@@ -1067,10 +1082,10 @@ refregexample: refregexample.f90
mountexample: mountexample.f90
compound: compound.f90
ph5example: ph5example.f90
-@FORTRAN_2003_CONDITIONAL_F_TRUE@rwdset_fortran2003: rwdset_fortran2003.f90
-@FORTRAN_2003_CONDITIONAL_F_TRUE@nested_derived_type: nested_derived_type.f90
-@FORTRAN_2003_CONDITIONAL_F_TRUE@compound_fortran2003: compound_fortran2003.f90
-@FORTRAN_2003_CONDITIONAL_F_TRUE@compound_complex_fortran2003: compound_complex_fortran2003.f90
+rwdset_fortran2003: rwdset_fortran2003.f90
+nested_derived_type: nested_derived_type.f90
+compound_fortran2003: compound_fortran2003.f90
+compound_complex_fortran2003: compound_complex_fortran2003.f90
# How to create EXAMPLEDIR if it doesn't already exist
$(EXAMPLEDIR):
diff --git a/fortran/examples/nested_derived_type.f90 b/fortran/examples/nested_derived_type.f90
index f806110..65e7e75 100644
--- a/fortran/examples/nested_derived_type.f90
+++ b/fortran/examples/nested_derived_type.f90
@@ -23,13 +23,13 @@ PROGRAM main
IMPLICIT NONE
! KIND parameters
- INTEGER, PARAMETER :: int_k1 = SELECTED_INT_KIND(Fortran_INTEGER_1) ! This should map to INTEGER*1 on most modern processors
- INTEGER, PARAMETER :: int_k4 = SELECTED_INT_KIND(Fortran_INTEGER_2) ! This should map to INTEGER*2 on most modern processors
- INTEGER, PARAMETER :: int_k8 = SELECTED_INT_KIND(Fortran_INTEGER_4) ! This should map to INTEGER*4 on most modern processors
- INTEGER, PARAMETER :: int_k16 = SELECTED_INT_KIND(Fortran_INTEGER_8) ! This should map to INTEGER*8 on most modern processors
+ INTEGER, PARAMETER :: int_k1 = SELECTED_INT_KIND(2) ! This should map to INTEGER*1 on most modern processors
+ INTEGER, PARAMETER :: int_k4 = SELECTED_INT_KIND(4) ! This should map to INTEGER*2 on most modern processors
+ INTEGER, PARAMETER :: int_k8 = SELECTED_INT_KIND(9) ! This should map to INTEGER*4 on most modern processors
+ INTEGER, PARAMETER :: int_k16 = SELECTED_INT_KIND(18) ! This should map to INTEGER*8 on most modern processors
- INTEGER, PARAMETER :: r_k4 = SELECTED_REAL_KIND(Fortran_REAL_4) ! This should map to REAL*4 on most modern processors
- INTEGER, PARAMETER :: r_k8 = SELECTED_REAL_KIND(Fortran_REAL_8) ! This should map to REAL*8 on most modern processors
+ INTEGER, PARAMETER :: r_k4 = SELECTED_REAL_KIND(6,37) ! This should map to REAL*4 on most modern processors
+ INTEGER, PARAMETER :: r_k8 = SELECTED_REAL_KIND(15,307) ! This should map to REAL*8 on most modern processors
! FILES
diff --git a/fortran/examples/rwdset_fortran2003.f90 b/fortran/examples/rwdset_fortran2003.f90
index d65db9e..682676f 100644
--- a/fortran/examples/rwdset_fortran2003.f90
+++ b/fortran/examples/rwdset_fortran2003.f90
@@ -28,13 +28,13 @@ PROGRAM RWDSET_FORTRAN2003
IMPLICIT NONE
- INTEGER, PARAMETER :: int_kind_1 = SELECTED_INT_KIND(Fortran_INTEGER_1) !should map to INTEGER*1 on most modern processors
- INTEGER, PARAMETER :: int_kind_4 = SELECTED_INT_KIND(Fortran_INTEGER_2) !should map to INTEGER*2 on most modern processors
- INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(Fortran_INTEGER_4) !should map to INTEGER*4 on most modern processors
- INTEGER, PARAMETER :: int_kind_16 = SELECTED_INT_KIND(Fortran_INTEGER_8) !should map to INTEGER*8 on most modern processors
+ INTEGER, PARAMETER :: int_kind_1 = SELECTED_INT_KIND(2) !should map to INTEGER*1 on most modern processors
+ INTEGER, PARAMETER :: int_kind_4 = SELECTED_INT_KIND(4) !should map to INTEGER*2 on most modern processors
+ INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(9) !should map to INTEGER*4 on most modern processors
+ INTEGER, PARAMETER :: int_kind_16 = SELECTED_INT_KIND(18) !should map to INTEGER*8 on most modern processors
- INTEGER, PARAMETER :: real_kind_7 = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors
- INTEGER, PARAMETER :: real_kind_15 = SELECTED_REAL_KIND(Fortran_REAL_8) !should map to REAL*8 on most modern processors
+ INTEGER, PARAMETER :: real_kind_7 = SELECTED_REAL_KIND(6,37) !should map to REAL*4 on most modern processors
+ INTEGER, PARAMETER :: real_kind_15 = SELECTED_REAL_KIND(15,307) !should map to REAL*8 on most modern processors
CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5" ! File name
CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name
@@ -148,12 +148,12 @@ PROGRAM RWDSET_FORTRAN2003
CALL h5dread_f(dset_idr8, h5kind_to_type(real_kind_15,H5_REAL_KIND), f_ptr, error)
! memory type
- WRITE(*,'(A,4i8)' )'SELECTED_INT_KIND(Fortran_INTEGER_1): ',data_out_i8a
- WRITE(*,'(A,4i8)' )'SELECTED_INT_KIND(Fortran_INTEGER_4): ',data_out_i4
- WRITE(*,'(A,4i8)' )'SELECTED_INT_KIND(Fortran_INTEGER_8): ',data_out_i8
- WRITE(*,'(A,4i8)' )'SELECTED_INT_KIND(Fortran_INTEGER_16): ',data_out_i16
- WRITE(*,'(A,4(1x,f9.4))' )'SELECTED_REAL_KIND(Fortran_REAL_7): ',data_out_r7
- WRITE(*,'(A,4(1x,f16.10))' )'SELECTED_REAL_KIND(Fortran_REAL_15): ',data_out_r15
+ WRITE(*,'(A,4i8)' )'SELECTED_INT_KIND(2): ',data_out_i8a
+ WRITE(*,'(A,4i8)' )'SELECTED_INT_KIND(4): ',data_out_i4
+ WRITE(*,'(A,4i8)' )'SELECTED_INT_KIND(9): ',data_out_i8
+ WRITE(*,'(A,4i8)' )'SELECTED_INT_KIND(18): ',data_out_i16
+ WRITE(*,'(A,4(1x,f9.4))' )'SELECTED_REAL_KIND(6,37): ',data_out_r7
+ WRITE(*,'(A,4(1x,f16.10))' )'SELECTED_REAL_KIND(15,307): ',data_out_r15
!
! Close the dataset.
!