diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-06-03 14:13:58 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-06-03 14:13:58 (GMT) |
commit | 4d500d49023156f1f8ef60375e63ac22e79e1749 (patch) | |
tree | d82c8df5cf1a3dc31e3678479fef9346cac709ee /fortran | |
parent | f486fe1a495840b0da77a7642a7e572fac3a64b0 (diff) | |
download | hdf5-4d500d49023156f1f8ef60375e63ac22e79e1749.zip hdf5-4d500d49023156f1f8ef60375e63ac22e79e1749.tar.gz hdf5-4d500d49023156f1f8ef60375e63ac22e79e1749.tar.bz2 |
[svn-r27140] fixed interger*16 support
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/Makefile.in | 1 | ||||
-rw-r--r-- | fortran/examples/Makefile.in | 1 | ||||
-rw-r--r-- | fortran/src/CMakeLists.txt | 52 | ||||
-rw-r--r-- | fortran/src/H5_f.c | 18 | ||||
-rw-r--r-- | fortran/src/H5_ff.F90 | 8 | ||||
-rw-r--r-- | fortran/src/H5config_f.inc.cmake | 28 | ||||
-rw-r--r-- | fortran/src/H5config_f.inc.in | 12 | ||||
-rw-r--r-- | fortran/src/H5fort_type_defines.h.in | 1 | ||||
-rw-r--r-- | fortran/src/Makefile.in | 1 | ||||
-rw-r--r-- | fortran/test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | fortran/test/Makefile.in | 1 | ||||
-rw-r--r-- | fortran/test/fflush2.f90 | 297 | ||||
-rw-r--r-- | fortran/test/tH5T_F03.F90 | 84 | ||||
-rw-r--r-- | fortran/testpar/Makefile.in | 1 |
14 files changed, 277 insertions, 230 deletions
diff --git a/fortran/Makefile.in b/fortran/Makefile.in index 3cc4f13..8359314 100644 --- a/fortran/Makefile.in +++ b/fortran/Makefile.in @@ -469,6 +469,7 @@ H5_LDFLAGS = @H5_LDFLAGS@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@ HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in index c9b7586..bc82f9f 100644 --- a/fortran/examples/Makefile.in +++ b/fortran/examples/Makefile.in @@ -413,6 +413,7 @@ H5_LDFLAGS = @H5_LDFLAGS@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@ HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index d6e77ba..03db548 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -31,7 +31,7 @@ configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5config_f.inc.cmake ${CMAKE_BINARY_D #----------------------------------------------------------------------------- # Setup the Fortran auto-detection utilities -# H5test_kind.F90 used to generate H5fortran_detect.F90 and H5_KINDff.F90 +# H5test_kind.F90 used to generate various KIND interfaces # H5fortran_detect.F90 used to generate H5fort_type_defines.h # H5fort_type_defines.h used to generate H5f90i_gen.h + H5fortran_types.F90 #----------------------------------------------------------------------------- @@ -67,31 +67,31 @@ add_custom_command ( DEPENDS H5test_FortranHavekind ) #----------------------------------------------------------------------------- -add_executable (H5fortran_detect - ${HDF5_F90_BINARY_DIR}/H5fortran_detect.F90 -) -if (WIN32 AND MSVC) - if (BUILD_SHARED_LIBS) - set_target_properties (H5fortran_detect - PROPERTIES - COMPILE_FLAGS "/MT" - ) - endif (BUILD_SHARED_LIBS) - set_target_properties (H5fortran_detect - PROPERTIES - LINK_FLAGS "/SUBSYSTEM:CONSOLE" - ) -endif (WIN32 AND MSVC) -set_target_properties (H5fortran_detect PROPERTIES LINKER_LANGUAGE Fortran) - -set (CMD $<TARGET_FILE:H5fortran_detect>) -add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h - COMMAND ${CMD} - ARGS > ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} - DEPENDS H5fortran_detect -) +#add_executable (H5fortran_detect +# ${HDF5_F90_BINARY_DIR}/H5fortran_detect.F90 +#) +#if (WIN32 AND MSVC) +# if (BUILD_SHARED_LIBS) +# set_target_properties (H5fortran_detect +# PROPERTIES +# COMPILE_FLAGS "/MT" +# ) +# endif (BUILD_SHARED_LIBS) +# set_target_properties (H5fortran_detect +# PROPERTIES +# LINK_FLAGS "/SUBSYSTEM:CONSOLE" +# ) +#endif (WIN32 AND MSVC) +#set_target_properties (H5fortran_detect PROPERTIES LINKER_LANGUAGE Fortran) +# +#set (CMD $<TARGET_FILE:H5fortran_detect>) +#add_custom_command ( +# OUTPUT ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h +# COMMAND ${CMD} +# ARGS > ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h +# WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} +# DEPENDS H5fortran_detect +#) INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY}) #----------------------------------------------------------------------------- diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 6a6be41..c12b610 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -240,7 +240,7 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes if ((types[15] = (hid_t_f)H5Tcopy(H5T_NATIVE_B32)) < 0) return ret_value; if ((types[16] = (hid_t_f)H5Tcopy(H5T_NATIVE_B64)) < 0) return ret_value; -/* #ifdef -MSB- */ +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 /* * FIND H5T_NATIVE_INTEGER_16 */ @@ -260,6 +260,10 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes if ((types[17] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; if ( H5Tset_precision (types[17], 128) < 0) return ret_value; } /*end else */ +#else + if ((types[17] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; + if ( H5Tset_precision (types[17], 128) < 0) return ret_value; +#endif /* #ifdef -MSB- */ @@ -356,16 +360,16 @@ h5close_types_c( hid_t_f * types, int_f *lentypes, int i; for (i = 0; i < *lentypes; i++) { - c_type_id = types[i]; - if ( H5Tclose(c_type_id) < 0) return ret_value; + c_type_id = types[i]; + if ( H5Tclose(c_type_id) < 0) return ret_value; } for (i = 0; i < *floatinglen; i++) { - c_type_id = floatingtypes[i]; - if ( H5Tclose(c_type_id) < 0) return ret_value; + c_type_id = floatingtypes[i]; + if ( H5Tclose(c_type_id) < 0) return ret_value; } for (i = 0; i < *integerlen; i++) { - c_type_id = integertypes[i]; - if ( H5Tclose(c_type_id) < 0) return ret_value; + c_type_id = integertypes[i]; + if ( H5Tclose(c_type_id) < 0) return ret_value; } ret_value = 0; return ret_value; diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 25c7eab..f4090cc 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -30,6 +30,8 @@ ! !***** +#include <H5config_f.inc> + MODULE H5LIB USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_ptr, C_INTPTR_T @@ -377,9 +379,10 @@ CONTAINS h5_type = H5T_NATIVE_INTEGER_4 ELSE IF(kind.EQ.Fortran_INTEGER_8)THEN h5_type = H5T_NATIVE_INTEGER_8 -! NEED ifdef -MSB- +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 ELSE IF(kind.EQ.Fortran_INTEGER_16)THEN h5_type = H5T_NATIVE_INTEGER_16 +#endif ENDIF ELSE IF(flag.EQ.H5_REAL_KIND)THEN IF(kind.EQ.Fortran_REAL_C_FLOAT)THEN @@ -388,9 +391,10 @@ CONTAINS h5_type = H5T_NATIVE_REAL_C_DOUBLE ELSE IF(kind.EQ.Fortran_REAL_C_LONG_DOUBLE)THEN h5_type = H5T_NATIVE_REAL_C_LONG_DOUBLE -! NEED ifdef -MSB- +#if H5_HAVE_FLOAT128!=0 ELSE IF(kind.EQ.Fortran_REAL_C_FLOAT128)THEN h5_type = H5T_NATIVE_FLOAT_128 +#endif ENDIF ENDIF diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index cbdfb9b..cb1d9e8 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -27,3 +27,31 @@ #if H5_FORTRAN_HAVE_C_SIZEOF==0 #undef H5_FORTRAN_HAVE_C_SIZEOF #endif + +! Define if the intrinsic function FORTRAN_HAVE_C_LONG_DOUBLE exists +#define H5_FORTRAN_HAVE_C_LONG_DOUBLE @FORTRAN_HAVE_C_LONG_DOUBLE@ + +#if H5_FORTRAN_HAVE_C_LONG_DOUBLE==0 +#undef H5_FORTRAN_HAVE_C_LONG_DOUBLE +#endif + +! should this be ${HDF_PREFIX} instead of H5 MSB +#define H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ + +#if H5_SIZEOF_LONG_DOUBLE==0 +#undef H5_SIZEOF_LONG_DOUBLE +#endif + +! Define if the C intrinsic __FLOAT128 exists +#define H5_HAVE_FLOAT128 @HAVE_FLOAT128@ + +#if H5_HAVE_FLOAT128==0 +#undef H5_HAVE_FLOAT128 +#endif + +! Define if INTEGER*16 is available +#define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @HAVE_Fortran_INTEGER_SIZEOF_16@ + +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16==0 +#undef H5_HAVE_Fortran_INTEGER_SIZEOF_16 +#endif diff --git a/fortran/src/H5config_f.inc.in b/fortran/src/H5config_f.inc.in index 0203315..b227c13 100644 --- a/fortran/src/H5config_f.inc.in +++ b/fortran/src/H5config_f.inc.in @@ -1,5 +1,8 @@ ! fortran/src/H5config_f.inc. Generated from fortran/src/H5config_f.inc.in by configure +! The script to replace the defines in H5config_f.inc.in is +! located in configure.ac in the Fortran section. + ! Define if we have parallel support #undef HAVE_PARALLEL @@ -19,4 +22,11 @@ #undef HAVE_ISO_FORTRAN_ENV ! Define the size of C's long double -#define H5_SIZEOF_LONG_DOUBLE +#undef SIZEOF_LONG_DOUBLE + +! Define if the C intrinsic __FLOAT128 exists +#undef HAVE_FLOAT128 + +! Define if INTEGER*16 is available +#undef HAVE_Fortran_INTEGER_SIZEOF_16 + diff --git a/fortran/src/H5fort_type_defines.h.in b/fortran/src/H5fort_type_defines.h.in index ad7b666..9e8015c 100644 --- a/fortran/src/H5fort_type_defines.h.in +++ b/fortran/src/H5fort_type_defines.h.in @@ -11,6 +11,7 @@ #define H5_FORTRAN_INTEGER_KINDS_SIZEOF @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@ #define H5_FORTRAN_REAL_KINDS @PAC_FC_ALL_REAL_KINDS@ #define H5_FORTRAN_REAL_KINDS_SIZEOF @PAC_FC_ALL_REAL_KINDS_SIZEOF@ +#define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @HAVE_Fortran_INTEGER_SIZEOF_16@ #define C_LONG_DOUBLE_KIND 10 #define C_LONG_DOUBLE_SIZEOF 12 #define C_DOUBLE_KIND 8 diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 3809775..8aea063 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -514,6 +514,7 @@ H5_LDFLAGS = @H5_LDFLAGS@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@ HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 7a718f8..d71fefd 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -123,7 +123,7 @@ add_executable (fortranlib_test_F03 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 - tH5T_F03.f90 + tH5T_F03.F90 tHDF5_F03.f90 ) TARGET_NAMING (fortranlib_test_F03 ${LIB_TYPE}) diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index 037ec97..a8a207e 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -525,6 +525,7 @@ H5_LDFLAGS = @H5_LDFLAGS@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@ HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ diff --git a/fortran/test/fflush2.f90 b/fortran/test/fflush2.f90 index 04ce439..4230832 100644 --- a/fortran/test/fflush2.f90 +++ b/fortran/test/fflush2.f90 @@ -27,152 +27,151 @@ ! !***** - PROGRAM FFLUSH2EXAMPLE - - USE HDF5 ! This module contains all necessary modules - USE TH5_MISC - - IMPLICIT NONE - - CHARACTER(LEN=7), PARAMETER :: filename = "fflush1" - CHARACTER(LEN=80) :: fix_filename - - ! - !data space rank and dimensions - ! - INTEGER, PARAMETER :: NX = 4 - INTEGER, PARAMETER :: NY = 5 - - ! - ! File identifiers - ! - INTEGER(HID_T) :: file_id - - ! - ! Group identifier - ! - INTEGER(HID_T) :: gid - - ! - ! dataset identifier - ! - INTEGER(HID_T) :: dset_id - - - ! - ! data type identifier - ! - INTEGER(HID_T) :: dtype_id - - ! - !flag to check operation success - ! - INTEGER :: error - - ! - !general purpose integer - ! - INTEGER :: i, j, total_error = 0 - - ! - !data buffers - ! - INTEGER, DIMENSION(NX,NY) :: data_out - INTEGER(HSIZE_T), DIMENSION(2) :: data_dims - data_dims(1) = NX - data_dims(2) = NY - - ! - !Initialize FORTRAN predifined datatypes - ! - CALL h5open_f(error) - CALL check("h5open_f",error,total_error) - - ! - !Open the file. - ! - CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) - if (error .ne. 0) then - write(*,*) "Cannot modify filename" - CALL h5_exit_f (1) - endif - CALL h5fopen_f(fix_filename, H5F_ACC_RDONLY_F, file_id, error) - CALL check("h5fopen_f",error,total_error) - - ! - !Open the dataset - ! - CALL h5dopen_f(file_id, "/D", dset_id, error) - CALL check("h5dopen_f",error,total_error) - - ! - !Get dataset's data type. - ! - CALL h5dget_type_f(dset_id, dtype_id, error) - CALL check("h5dget_type_f",error,total_error) - - ! - !Read the dataset. - ! - CALL h5dread_f(dset_id, dtype_id, data_out, data_dims, error) - CALL check("h5dread_f",error,total_error) - - ! - !Print the dataset. - ! - do i = 1, NX - write(*,*) (data_out(i,j), j = 1, NY) - end do -! -!result of the print statement -! -! 0, 1, 2, 3, 4 -! 1, 2, 3, 4, 5 -! 2, 3, 4, 5, 6 -! 3, 4, 5, 6, 7 - - ! - !Open the group. - ! - CALL h5gopen_f(file_id, "G", gid, error) - CALL check("h5gopen_f",error,total_error) - - ! - !In case error happens, exit. - ! - IF (error == -1) CALL h5_exit_f (1) - ! - !Close the datatype - ! - CALL h5tclose_f(dtype_id, error) - CALL check("h5tclose_f",error,total_error) - - ! - !Close the dataset. - ! - CALL h5dclose_f(dset_id, error) - CALL check("h5dclose_f",error,total_error) - - ! - !Close the group. - ! - CALL h5gclose_f(gid, error) - CALL check("h5gclose_f",error,total_error) - - ! - !Close the file. - ! - CALL h5fclose_f(file_id, error) - CALL check("h5fclose_f",error,total_error) - - ! - !Close FORTRAN predifined datatypes - ! - CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) - CALL h5close_f(error) - CALL check("h5close_types_f",error,total_error) - - ! if errors detected, exit with non-zero code. - IF (total_error .ne. 0) CALL h5_exit_f (1) - - END PROGRAM FFLUSH2EXAMPLE +PROGRAM FFLUSH2EXAMPLE + + USE HDF5 ! This module contains all necessary modules + USE TH5_MISC + + IMPLICIT NONE + + CHARACTER(LEN=7), PARAMETER :: filename = "fflush1" + CHARACTER(LEN=80) :: fix_filename + + ! + !data space rank and dimensions + ! + INTEGER, PARAMETER :: NX = 4 + INTEGER, PARAMETER :: NY = 5 + + ! + ! File identifiers + ! + INTEGER(HID_T) :: file_id + + ! + ! Group identifier + ! + INTEGER(HID_T) :: gid + + ! + ! dataset identifier + ! + INTEGER(HID_T) :: dset_id + + + ! + ! data type identifier + ! + INTEGER(HID_T) :: dtype_id + + ! + !flag to check operation success + ! + INTEGER :: error + + ! + !general purpose integer + ! + INTEGER :: i, j, total_error = 0 + + ! + !data buffers + ! + INTEGER, DIMENSION(NX,NY) :: data_out + INTEGER(HSIZE_T), DIMENSION(2) :: data_dims + data_dims(1) = NX + data_dims(2) = NY + + ! + !Initialize FORTRAN predifined datatypes + ! + CALL h5open_f(error) + CALL check("h5open_f",error,total_error) + + ! + !Open the file. + ! + CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) + IF (error .NE. 0) THEN + WRITE(*,*) "Cannot modify filename" + CALL h5_exit_f (1) + ENDIF + CALL h5fopen_f(fix_filename, H5F_ACC_RDONLY_F, file_id, error) + CALL check("h5fopen_f",error,total_error) + + ! + !Open the dataset + ! + CALL h5dopen_f(file_id, "/D", dset_id, error) + CALL check("h5dopen_f",error,total_error) + + ! + !Get dataset's data type. + ! + CALL h5dget_type_f(dset_id, dtype_id, error) + CALL check("h5dget_type_f",error,total_error) + ! + !Read the dataset. + ! + CALL h5dread_f(dset_id, dtype_id, data_out, data_dims, error) + CALL check("h5dread_f",error,total_error) + + ! + !Print the dataset. + ! + DO i = 1, NX + WRITE(*,*) (data_out(i,j), j = 1, NY) + END DO + ! + !result of the print statement + ! + ! 0, 1, 2, 3, 4 + ! 1, 2, 3, 4, 5 + ! 2, 3, 4, 5, 6 + ! 3, 4, 5, 6, 7 + + ! + !Open the group. + ! + CALL h5gopen_f(file_id, "G", gid, error) + CALL check("h5gopen_f",error,total_error) + + ! + !In case error happens, exit. + ! + IF (error == -1) CALL h5_exit_f (1) + ! + !Close the datatype + ! + CALL h5tclose_f(dtype_id, error) + CALL check("h5tclose_f",error,total_error) + + ! + !Close the dataset. + ! + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f",error,total_error) + + ! + !Close the group. + ! + CALL h5gclose_f(gid, error) + CALL check("h5gclose_f",error,total_error) + + ! + !Close the file. + ! + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f",error,total_error) + + ! + !Close FORTRAN predifined datatypes + ! + CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error) + CALL h5close_f(error) + CALL check("h5close_types_f",error,total_error) + + ! if errors detected, exit with non-zero code. + IF (total_error .ne. 0) CALL h5_exit_f (1) + +END PROGRAM FFLUSH2EXAMPLE diff --git a/fortran/test/tH5T_F03.F90 b/fortran/test/tH5T_F03.F90 index 8117578..076769b 100644 --- a/fortran/test/tH5T_F03.F90 +++ b/fortran/test/tH5T_F03.F90 @@ -41,6 +41,7 @@ !** !*************************************************************** ! +#include <H5config_f.inc> MODULE TH5T_F03 @@ -969,8 +970,6 @@ END SUBROUTINE test_array_compound_atomic END SUBROUTINE test_array_bkg - - SUBROUTINE test_h5kind_to_type(total_error) IMPLICIT NONE @@ -986,22 +985,24 @@ END SUBROUTINE test_array_compound_atomic 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 -!#ifdef +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 INTEGER, PARAMETER :: int_kind_32 = SELECTED_INT_KIND(36) !should map to INTEGER*16 on most modern processors INTEGER(int_kind_32), DIMENSION(1:4), TARGET :: dset_data_i32, data_out_i32 INTEGER(HID_T) :: dset_id32 ! Dataset identifier CHARACTER(LEN=6), PARAMETER :: dsetname16 = "dset16" ! Dataset name -!#endif - INTEGER, PARAMETER :: real_kind_7 = SELECTED_REAL_KIND(Fortran_REAL_C_FLOAT) !should map to REAL*4 on most modern processors - INTEGER, PARAMETER :: real_kind_15 = SELECTED_REAL_KIND(Fortran_REAL_C_DOUBLE) !should map to REAL*8 on most modern processors +#endif + INTEGER, PARAMETER :: real_kind_7 = SELECTED_REAL_KIND(C_FLOAT) !should map to REAL*4 on most modern processors + INTEGER, PARAMETER :: real_kind_15 = SELECTED_REAL_KIND(C_DOUBLE) !should map to REAL*8 on most modern processors -!#ifdef +#if H5_HAVE_FLOAT128!=0 INTEGER, PARAMETER :: real_kind_31 = SELECTED_REAL_KIND(31) +#else + INTEGER, PARAMETER :: real_kind_31 = SELECTED_REAL_KIND(C_LONG_DOUBLE) +#endif REAL(real_kind_31), DIMENSION(1:4), TARGET :: dset_data_r31, data_out_r31 INTEGER(HID_T) :: dset_idr16 ! Dataset identifier CHARACTER(LEN=7), PARAMETER :: dsetnamer16 = "dsetr16" ! Dataset name - -!#endif + CHARACTER(LEN=12), PARAMETER :: filename = "dsetf_F03.h5" ! File name CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name @@ -1043,19 +1044,17 @@ END SUBROUTINE test_array_compound_atomic ! Initialize the dset_data array. ! DO i = 1, 4 - dset_data_i1(i) = 2**(4)-i - dset_data_i4(i) = 2**(10)-i - dset_data_i8(i) = 2**(28)-i - dset_data_i16(i) = 2**(28)-i -!#ifdef - dset_data_i32(i) = 2**(28)-i -!#endif - dset_data_r(i) = (i)*100. - dset_data_r7(i) = (i)*100. - dset_data_r15(i) = (i)*1000. -!#ifdef - dset_data_r31(i) = 3.141592653589793238462643383279_real_kind_31 -!#endif + dset_data_i1(i) = HUGE(0_int_kind_1)-i + dset_data_i4(i) = HUGE(0_int_kind_4)-i + dset_data_i8(i) = HUGE(0_int_kind_8)-i + dset_data_i16(i) = HUGE(0_int_kind_16)-i +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 + dset_data_i32(i) = HUGE(0_int_kind_32)-i +#endif + dset_data_r(i) = 4.0*ATAN(1.0)-REAL(i-1) + dset_data_r7(i) = 4.0_real_kind_7*ATAN(1.0_real_kind_7)-REAL(i-1,real_kind_7) + dset_data_r15(i) = 4.0_real_kind_15*ATAN(1.0_real_kind_15)-REAL(i-1,real_kind_15) + dset_data_r31(i) = 4.0_real_kind_31*ATAN(1.0_real_kind_31)-REAL(i-1,real_kind_31) END DO @@ -1077,17 +1076,17 @@ END SUBROUTINE test_array_compound_atomic CALL check("H5Dcreate_f",error, total_error) CALL H5Dcreate_f(file_id, dsetname8, h5kind_to_type(int_kind_16,H5_INTEGER_KIND), dspace_id, dset_id16, error) CALL check("H5Dcreate_f",error, total_error) -!#ifdef +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 CALL H5Dcreate_f(file_id, dsetname16, h5kind_to_type(int_kind_32,H5_INTEGER_KIND), dspace_id, dset_id32, error) CALL check("H5Dcreate_f",error, total_error) -!#endif +#endif CALL H5Dcreate_f(file_id, dsetnamer, H5T_NATIVE_REAL, dspace_id, dset_idr, error) CALL check("H5Dcreate_f",error, total_error) CALL H5Dcreate_f(file_id, dsetnamer4, h5kind_to_type(real_kind_7,H5_REAL_KIND), dspace_id, dset_idr4, error) CALL check("H5Dcreate_f",error, total_error) CALL H5Dcreate_f(file_id, dsetnamer8, h5kind_to_type(real_kind_15,H5_REAL_KIND), dspace_id, dset_idr8, error) CALL check("H5Dcreate_f",error, total_error) -!#ifdef +!#ifdef H5_HAVE_FLOAT128 CALL H5Dcreate_f(file_id, dsetnamer16, h5kind_to_type(real_kind_31,H5_REAL_KIND), dspace_id, dset_idr16, error) CALL check("H5Dcreate_f",error, total_error) !#endif @@ -1106,11 +1105,11 @@ END SUBROUTINE test_array_compound_atomic f_ptr = C_LOC(dset_data_i16(1)) CALL h5dwrite_f(dset_id16, h5kind_to_type(int_kind_16,H5_INTEGER_KIND), f_ptr, error) CALL check("H5Dwrite_f",error, total_error) -!#ifdef +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 f_ptr = C_LOC(dset_data_i32(1)) CALL h5dwrite_f(dset_id32, h5kind_to_type(int_kind_32,H5_INTEGER_KIND), f_ptr, error) CALL check("H5Dwrite_f",error, total_error) -!#endif +#endif f_ptr = C_LOC(dset_data_r(1)) CALL h5dwrite_f(dset_idr, H5T_NATIVE_REAL, f_ptr, error) CALL check("H5Dwrite_f",error, total_error) @@ -1120,7 +1119,7 @@ END SUBROUTINE test_array_compound_atomic f_ptr = C_LOC(dset_data_r15(1)) CALL h5dwrite_f(dset_idr8, h5kind_to_type(real_kind_15,H5_REAL_KIND), f_ptr, error) CALL check("H5Dwrite_f",error, total_error) -!#ifdef +!#ifdef H5_HAVE_FLOAT128 f_ptr = C_LOC(dset_data_r31(1)) CALL h5dwrite_f(dset_idr16, h5kind_to_type(real_kind_31,H5_REAL_KIND), f_ptr, error) CALL check("H5Dwrite_f",error, total_error) @@ -1152,11 +1151,11 @@ END SUBROUTINE test_array_compound_atomic f_ptr = C_LOC(data_out_i16) CALL h5dread_f(dset_id16, h5kind_to_type(int_kind_16,H5_INTEGER_KIND), f_ptr, error) CALL check("h5dread_f",error, total_error) -!#ifdef +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 f_ptr = C_LOC(data_out_i32) CALL h5dread_f(dset_id32, h5kind_to_type(int_kind_32,H5_INTEGER_KIND), f_ptr, error) CALL check("h5dread_f",error, total_error) -!#endif +#endif f_ptr = C_LOC(data_out_r) CALL h5dread_f(dset_idr, H5T_NATIVE_REAL, f_ptr, error) CALL check("h5dread_f",error, total_error) @@ -1166,26 +1165,23 @@ END SUBROUTINE test_array_compound_atomic f_ptr = C_LOC(data_out_r15) CALL h5dread_f(dset_idr8, h5kind_to_type(real_kind_15,H5_REAL_KIND), f_ptr, error) CALL check("h5dread_f",error, total_error) -!#ifdef f_ptr = C_LOC(data_out_r31) CALL h5dread_f(dset_idr16, h5kind_to_type(real_kind_31,H5_REAL_KIND), f_ptr, error) CALL check("h5dread_f",error, total_error) -!#endif DO i = 1, 4 - CALL verify("h5kind_to_type1",dset_data_i1(i),data_out_i1(i),total_error) - CALL verify("h5kind_to_type2",dset_data_i4(i),data_out_i4(i),total_error) -!!$ CALL verify_Fortran_INTEGER_4("h5kind_to_type3",INT(dset_data_i8(i),int_kind_8),INT(data_out_i8(i),int_kind_8),total_error) -!!$ CALL verify_Fortran_INTEGER_4("h5kind_to_type4",INT(dset_data_i16(i),int_kind_8),INT(data_out_i16(i),int_kind_8),total_error) + CALL verify("h5kind_to_type",dset_data_i1(i),data_out_i1(i),total_error) + CALL verify("h5kind_to_type",dset_data_i4(i),data_out_i4(i),total_error) + CALL verify("h5kind_to_type",dset_data_i8(i),data_out_i8(i),total_error) + CALL verify("h5kind_to_type",dset_data_i16(i),data_out_i16(i),total_error) -!#ifdef -! PRINT*,dset_data_i16(i),data_out_i16(i) -!!$ CALL verify_Fortran_INTEGER_4("h5kind_to_type4",INT(dset_data_i16(i),int_kind_8),INT(data_out_i16(i),int_kind_8),total_error) -!#endif - CALL verify("h5kind_to_type5",dset_data_r(i),data_out_r(i),total_error) - CALL verify("h5kind_to_type6",dset_data_r7(i),data_out_r7(i),total_error) - CALL verify("h5kind_to_type7",dset_data_r15(i),data_out_r15(i),total_error) - +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 + CALL verify("h5kind_to_type",dset_data_i32(i),data_out_i32(i),total_error) +#endif + CALL verify("h5kind_to_type",dset_data_r(i),data_out_r(i),total_error) + CALL verify("h5kind_to_type",dset_data_r7(i),data_out_r7(i),total_error) + CALL verify("h5kind_to_type",dset_data_r15(i),data_out_r15(i),total_error) + CALL verify("h5kind_to_type",dset_data_r31(i),data_out_r31(i),total_error) END DO ! diff --git a/fortran/testpar/Makefile.in b/fortran/testpar/Makefile.in index 20eb895..000d2f0 100644 --- a/fortran/testpar/Makefile.in +++ b/fortran/testpar/Makefile.in @@ -465,6 +465,7 @@ H5_LDFLAGS = @H5_LDFLAGS@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@ HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ |