diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-05-27 22:07:18 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-05-27 22:07:18 (GMT) |
commit | 244784ab2cf816b135f27bf03b5a4fb91502aed9 (patch) | |
tree | 1ec533dc1c9d680a53152df36a63cdf604595f28 /hl/fortran | |
parent | b15fc6e4a0b7a5f35c68742de8ceb8dabcb7bad0 (diff) | |
download | hdf5-244784ab2cf816b135f27bf03b5a4fb91502aed9.zip hdf5-244784ab2cf816b135f27bf03b5a4fb91502aed9.tar.gz hdf5-244784ab2cf816b135f27bf03b5a4fb91502aed9.tar.bz2 |
[svn-r27115] Moved testing KINDs and SIZEOFs to configure.
Diffstat (limited to 'hl/fortran')
-rw-r--r-- | hl/fortran/Makefile.in | 11 | ||||
-rw-r--r-- | hl/fortran/examples/Makefile.in | 11 | ||||
-rw-r--r-- | hl/fortran/src/H5LTf90proto.h | 5 | ||||
-rw-r--r-- | hl/fortran/src/H5LTfc.c | 34 | ||||
-rw-r--r-- | hl/fortran/src/H5LTff.F90 | 271 | ||||
-rw-r--r-- | hl/fortran/src/Makefile.in | 11 | ||||
-rw-r--r-- | hl/fortran/test/Makefile.in | 11 | ||||
-rw-r--r-- | hl/fortran/test/tstlite.f90 | 242 |
8 files changed, 414 insertions, 182 deletions
diff --git a/hl/fortran/Makefile.in b/hl/fortran/Makefile.in index 012c84a..3380d01 100644 --- a/hl/fortran/Makefile.in +++ b/hl/fortran/Makefile.in @@ -469,6 +469,7 @@ H5_LDFLAGS = @H5_LDFLAGS@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FLOAT128 = @HAVE_FLOAT128@ HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ @@ -515,6 +516,16 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +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_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@ diff --git a/hl/fortran/examples/Makefile.in b/hl/fortran/examples/Makefile.in index ae07190..4150781 100644 --- a/hl/fortran/examples/Makefile.in +++ b/hl/fortran/examples/Makefile.in @@ -412,6 +412,7 @@ H5_LDFLAGS = @H5_LDFLAGS@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FLOAT128 = @HAVE_FLOAT128@ HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ @@ -458,6 +459,16 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +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_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@ diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h index 6234635..02409d9 100644 --- a/hl/fortran/src/H5LTf90proto.h +++ b/hl/fortran/src/H5LTf90proto.h @@ -86,8 +86,7 @@ h5ltread_dataset_c (hid_t_f *loc_id, size_t_f *namelen, _fcd name, hid_t_f *type_id, - void *buf, - hsize_t_f *dims); + void *buf); HDF5_HL_F90CSTUBDLL int_f @@ -97,7 +96,7 @@ h5ltset_attribute_c(hid_t_f *loc_id, size_t_f *attrnamelen, _fcd attrname, size_t_f *size, - void *buf, char *dtype); + void *buf, char *dtype, size_t_f *sizeof_val); HDF5_HL_F90CSTUBDLL diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c index 7f52eb2..3122b60 100644 --- a/hl/fortran/src/H5LTfc.c +++ b/hl/fortran/src/H5LTfc.c @@ -113,8 +113,7 @@ h5ltread_dataset_c (hid_t_f *loc_id, size_t_f *namelen, _fcd name, hid_t_f *type_id, - void *buf, - hsize_t_f *dims) + void *buf) { int ret_value = -1; herr_t ret; @@ -296,7 +295,7 @@ h5ltset_attribute_c(hid_t_f *loc_id, size_t_f *attrnamelen, _fcd attrname, size_t_f *size, - void *buf, char *dtype) + void *buf, char *dtype, size_t_f *sizeof_val) { int ret_value = -1; herr_t ret; @@ -324,18 +323,25 @@ h5ltset_attribute_c(hid_t_f *loc_id, c_size = (size_t)*size; if( HDstrncmp(dtype,"I",1) == 0 ) { - if (sizeof(int_f) == sizeof(int)) - ret = H5LTset_attribute_int(c_loc_id,c_name,c_attrname,(const int *)buf,c_size); - else if (sizeof(int_f) == sizeof(long)) - ret = H5LTset_attribute_long(c_loc_id,c_name,c_attrname,(const long *)buf,c_size); - else if (sizeof(int_f) == sizeof(long long)) - ret = H5LTset_attribute_long_long(c_loc_id,c_name,c_attrname,(const long long *)buf,c_size); + if ((size_t)*sizeof_val == sizeof(int)) + ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_INT, (const int *)buf); + else if ((size_t)*sizeof_val == sizeof(long)) + ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_LONG, (const long *)buf); + else if ((size_t)*sizeof_val == sizeof(long long)) + ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_LLONG, (const long long *)buf); else goto done; } else if ( HDstrncmp(dtype,"R",1) == 0 ) { - ret = H5LTset_attribute_float(c_loc_id,c_name,c_attrname, (float *)buf,c_size); - } else if ( HDstrncmp(dtype,"D",1) == 0 ) { - ret = H5LTset_attribute_double(c_loc_id,c_name,c_attrname, (double *)buf,c_size); + if((size_t)*sizeof_val == sizeof(float)) + ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_FLOAT, (const float *)buf); + else if((size_t)*sizeof_val == sizeof(double)) + ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_DOUBLE, (const double *)buf); +#if H5_SIZEOF_LONG_DOUBLE !=0 + else if((size_t)*sizeof_val == sizeof(long double)) + ret = H5LT_set_attribute_numerical(c_loc_id,c_name,c_attrname, c_size, H5T_NATIVE_LDOUBLE, (const long double *)buf); +#endif + else + goto done; } else if ( HDstrncmp(dtype,"C",1) == 0 ) { c_buf = (char *)HD5f2cstring((_fcd)buf, c_size); @@ -636,6 +642,10 @@ h5ltget_attribute_c(hid_t_f *loc_id, ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_FLOAT,buf); else if((size_t)*sizeof_val == sizeof(double)) ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_DOUBLE,buf); +#if H5_SIZEOF_LONG_DOUBLE !=0 + else if((size_t)*sizeof_val == sizeof(long double)) + ret = H5LTget_attribute(c_loc_id,c_name,c_attrname,H5T_NATIVE_LDOUBLE,buf); +#endif else goto done; } diff --git a/hl/fortran/src/H5LTff.F90 b/hl/fortran/src/H5LTff.F90 index 10169c5..c1ca6be 100644 --- a/hl/fortran/src/H5LTff.F90 +++ b/hl/fortran/src/H5LTff.F90 @@ -246,7 +246,7 @@ MODULE h5lt END INTERFACE INTERFACE - INTEGER FUNCTION h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,buf,dims) & + INTEGER FUNCTION h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,buf) & BIND(C,NAME='h5ltread_dataset_c') IMPORT :: C_CHAR, C_PTR IMPORT :: HID_T, SIZE_T, HSIZE_T @@ -255,13 +255,12 @@ MODULE h5lt INTEGER(hid_t), INTENT(in) :: type_id ! datatype identifier INTEGER(size_t) :: namelen ! length of name buffer CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: dset_name ! name of the dataset - INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims ! size of the buffer buf TYPE(C_PTR), VALUE :: buf ! data buffer END FUNCTION h5ltread_dataset_c END INTERFACE INTERFACE - INTEGER FUNCTION h5ltset_attribute_c(loc_id,namelen,dset_name,attrlen,attr_name,size,buf,dtype) & + INTEGER FUNCTION h5ltset_attribute_c(loc_id,namelen,dset_name,attrlen,attr_name,size,buf,dtype, SizeOf_buf) & BIND(C,NAME='h5ltset_attribute_c') IMPORT :: C_CHAR, C_PTR IMPORT :: HID_T, SIZE_T, HSIZE_T @@ -276,6 +275,7 @@ MODULE h5lt CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: dtype ! flag indicating the datatype of the ! the buffer: ! R=Real, D=DOUBLE, I=Interger, C=Character + INTEGER(size_t) :: SizeOf_buf ! Sizeof the buf datatype END FUNCTION h5ltset_attribute_c END INTERFACE @@ -1092,20 +1092,18 @@ CONTAINS dset_name,& type_id,& buf,& - dims,& errcode ) IMPLICIT NONE INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset INTEGER(hid_t), INTENT(in) :: type_id ! datatype identifier - INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims ! size of the buffer buf TYPE(C_PTR) :: buf ! data buffer INTEGER :: errcode ! error code INTEGER(size_t) :: namelen namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id, buf, dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id, buf) END SUBROUTINE h5ltread_dataset_f_ptr @@ -1146,7 +1144,7 @@ CONTAINS f_ptr = C_LOC(buf(1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_int1 @@ -1188,7 +1186,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_int2 @@ -1213,7 +1211,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_int3 @@ -1234,7 +1232,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_int4 @@ -1255,7 +1253,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_int5 @@ -1293,7 +1291,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_int6 @@ -1314,7 +1312,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_int7 @@ -1356,7 +1354,7 @@ CONTAINS f_ptr = C_LOC(buf(1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_float1 @@ -1381,7 +1379,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_float2 @@ -1406,7 +1404,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_float3 @@ -1427,7 +1425,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_float4 @@ -1448,7 +1446,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_float5 @@ -1486,7 +1484,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_float6 @@ -1507,7 +1505,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_float7 @@ -1549,7 +1547,7 @@ CONTAINS f_ptr = C_LOC(buf(1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_double1 @@ -1574,7 +1572,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_double2 @@ -1599,7 +1597,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_double3 @@ -1620,7 +1618,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_double4 @@ -1641,7 +1639,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_double5 @@ -1662,7 +1660,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_double6 @@ -1683,7 +1681,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_double7 @@ -1725,7 +1723,7 @@ CONTAINS f_ptr = C_LOC(buf(1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_long_double1 @@ -1750,7 +1748,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_long_double2 @@ -1775,7 +1773,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_long_double3 @@ -1796,7 +1794,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_long_double4 @@ -1817,7 +1815,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_long_double5 @@ -1838,7 +1836,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_long_double6 @@ -1859,7 +1857,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr) END SUBROUTINE h5ltread_dataset_f_c_long_double7 #endif @@ -2604,7 +2602,7 @@ CONTAINS f_ptr = C_LOC(buf(1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr) END SUBROUTINE h5ltread_dataset_int_f_1 @@ -2627,7 +2625,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr) END SUBROUTINE h5ltread_dataset_int_f_2 @@ -2650,7 +2648,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr) END SUBROUTINE h5ltread_dataset_int_f_3 @@ -2669,7 +2667,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr) END SUBROUTINE h5ltread_dataset_int_f_4 @@ -2688,7 +2686,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr) END SUBROUTINE h5ltread_dataset_int_f_5 @@ -2707,7 +2705,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr) END SUBROUTINE h5ltread_dataset_int_f_6 @@ -2726,7 +2724,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_INTEGER,f_ptr) END SUBROUTINE h5ltread_dataset_int_f_7 @@ -2767,7 +2765,7 @@ CONTAINS f_ptr = C_LOC(buf(1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr) END SUBROUTINE h5ltread_dataset_c_float_f_1 @@ -2790,7 +2788,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr) END SUBROUTINE h5ltread_dataset_c_float_f_2 @@ -2813,7 +2811,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr) END SUBROUTINE h5ltread_dataset_c_float_f_3 @@ -2832,7 +2830,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr) END SUBROUTINE h5ltread_dataset_c_float_f_4 @@ -2851,7 +2849,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr) END SUBROUTINE h5ltread_dataset_c_float_f_5 @@ -2870,7 +2868,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr) END SUBROUTINE h5ltread_dataset_c_float_f_6 @@ -2889,7 +2887,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr) END SUBROUTINE h5ltread_dataset_c_float_f_7 @@ -2929,7 +2927,7 @@ CONTAINS f_ptr = C_LOC(buf(1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_double_f_1 @@ -2952,7 +2950,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_double_f_2 @@ -2975,7 +2973,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_double_f_3 @@ -2994,7 +2992,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_double_f_4 @@ -3013,7 +3011,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_double_f_5 @@ -3032,7 +3030,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_double_f_6 @@ -3051,7 +3049,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_double_f_7 @@ -3092,7 +3090,7 @@ CONTAINS f_ptr = C_LOC(buf(1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_long_double_f_1 @@ -3115,7 +3113,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_long_double_f_2 @@ -3138,7 +3136,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_long_double_f_3 @@ -3157,7 +3155,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_long_double_f_4 @@ -3176,7 +3174,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_long_double_f_5 @@ -3195,7 +3193,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_long_double_f_6 @@ -3214,7 +3212,7 @@ CONTAINS f_ptr = C_LOC(buf(1,1,1,1,1,1,1)) namelen = LEN(dset_name) - errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) + errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltread_dataset_c_long_double_f_7 #endif @@ -3320,6 +3318,61 @@ CONTAINS ! Make/Read attribute functions !------------------------------------------------------------------------- + !------------------------------------------------------------------------- + ! Function: h5ltset_attribute_f + ! + ! Purpose: Create and write an attribute + ! + ! Return: Success: 0, Failure: -1 + ! + ! Programmer: M. Scot Breitenfeld + ! + ! Date: May 4, 2015 + ! + ! Comments: + ! + ! Modifications: + ! + !------------------------------------------------------------------------- + + SUBROUTINE h5ltset_attribute_f(loc_id,& + dset_name,& + attr_name,& + buf,& + buf_type, SizeOf_buf_type, & + size,& + errcode ) + + IMPLICIT NONE + INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier + CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset + CHARACTER(LEN=*), INTENT(in) :: attr_name ! name of the attribute + TYPE(C_PTR) :: buf ! data buffer + CHARACTER(LEN=*), INTENT(in) :: buf_type ! + INTEGER(size_t), INTENT(in) :: size ! size of attribute array + INTEGER :: errcode ! error code + INTEGER(size_t) :: namelen ! name length + INTEGER(size_t) :: attrlen ! name length + + CHARACTER(KIND=C_CHAR) :: buf_type_uppercase + INTEGER(size_t) :: SizeOf_buf_type + + namelen = LEN(dset_name) + attrlen = LEN(attr_name) + + buf_type_uppercase(1:1) = buf_type(1:1) + IF(buf_type_uppercase(1:1).EQ.'i')THEN + buf_type_uppercase(1:1) = 'I' + ELSE IF(buf_type_uppercase(1:1).EQ.'r')THEN + buf_type_uppercase(1:1) = 'R' + ELSE IF(buf_type_uppercase(1:1).EQ.'c')THEN + buf_type_uppercase(1:1) = 'C' + ENDIF + + errcode = h5ltset_attribute_c(loc_id,namelen,dset_name,attrlen,attr_name,size,& + buf,buf_type_uppercase(1:1)//C_NULL_CHAR, SizeOf_buf_type) + + END SUBROUTINE h5ltset_attribute_f !------------------------------------------------------------------------- ! Function: h5ltset_attribute_int_f @@ -3355,12 +3408,20 @@ CONTAINS INTEGER(size_t) :: namelen ! name length INTEGER(size_t) :: attrlen ! name length TYPE(C_PTR) :: f_ptr + INTEGER(size_t) :: SizeOf_buf_type f_ptr = C_LOC(buf(1:1)) +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + SizeOf_buf_type = STORAGE_SIZE(buf(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t) +#else + SizeOf_buf_type = SIZEOF(buf(1)) +#endif + namelen = LEN(dset_name) attrlen = LEN(attr_name) - errcode = h5ltset_attribute_c(loc_id,namelen,dset_name,attrlen,attr_name,size,f_ptr,'I'//C_NULL_CHAR) + errcode = h5ltset_attribute_c(loc_id,namelen,dset_name,attrlen,attr_name,size,& + f_ptr,'I'//C_NULL_CHAR,SizeOf_buf_type) END SUBROUTINE h5ltset_attribute_int_f @@ -3398,12 +3459,20 @@ CONTAINS INTEGER(size_t) :: namelen ! name length INTEGER(size_t) :: attrlen ! name length TYPE(C_PTR) :: f_ptr + INTEGER(size_t) :: SizeOf_buf_type f_ptr = C_LOC(buf(1)) +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + SizeOf_buf_type = STORAGE_SIZE(buf(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t) +#else + SizeOf_buf_type = SIZEOF(buf(1)) +#endif + namelen = LEN(dset_name) attrlen = LEN(attr_name) - errcode = h5ltset_attribute_c(loc_id,namelen,dset_name,attrlen,attr_name,size,f_ptr,'R'//C_NULL_CHAR) + errcode = h5ltset_attribute_c(loc_id,namelen,dset_name,attrlen,attr_name,size,& + f_ptr,'R'//C_NULL_CHAR, SizeOf_buf_type) END SUBROUTINE h5ltset_attribute_float_f @@ -3441,12 +3510,20 @@ CONTAINS INTEGER(size_t) :: namelen ! name length INTEGER(size_t) :: attrlen ! name length TYPE(C_PTR) :: f_ptr + INTEGER(size_t) :: SizeOf_buf_type f_ptr = C_LOC(buf(1)) +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + SizeOf_buf_type = STORAGE_SIZE(buf(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t) +#else + SizeOf_buf_type = SIZEOF(buf(1)) +#endif + namelen = LEN(dset_name) attrlen = LEN(attr_name) - errcode = h5ltset_attribute_c(loc_id,namelen,dset_name,attrlen,attr_name,size,f_ptr,'D'//C_NULL_CHAR) + errcode = h5ltset_attribute_c(loc_id,namelen,dset_name,attrlen,attr_name,size,& + f_ptr,'R'//C_NULL_CHAR,SizeOf_buf_type) END SUBROUTINE h5ltset_attribute_double_f @@ -3484,13 +3561,21 @@ CONTAINS INTEGER(size_t) :: attrlen ! name length INTEGER(size_t) :: buflen ! data buffer length TYPE(C_PTR) :: f_ptr + INTEGER(size_t) :: SizeOf_buf_type f_ptr = C_LOC(buf(1)(1:1)) +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + SizeOf_buf_type = STORAGE_SIZE(buf(1)(1:1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t) +#else + SizeOf_buf_type = SIZEOF((buf(1)(1:1)) +#endif + namelen = LEN(dset_name) attrlen = LEN(attr_name) buflen = LEN(buf) - errcode = h5ltset_attribute_c(loc_id,namelen,dset_name,attrlen,attr_name,buflen,f_ptr,'C'//C_NULL_CHAR) + errcode = h5ltset_attribute_c(loc_id,namelen,dset_name,attrlen,attr_name,buflen,& + f_ptr,'C'//C_NULL_CHAR, SizeOf_buf_type) END SUBROUTINE h5ltset_attribute_string_f @@ -3511,26 +3596,40 @@ CONTAINS ! !------------------------------------------------------------------------- -!!$ SUBROUTINE h5ltget_attribute_f(loc_id,& -!!$ dset_name,& -!!$ attr_name,& -!!$ buf,& -!!$ errcode ) -!!$ -!!$ IMPLICIT NONE -!!$ INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier -!!$ CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset -!!$ CHARACTER(LEN=*), INTENT(in) :: attr_name ! name of the attribute -!!$ INTEGER :: errcode ! error code -!!$ TYPE(C_PTR) :: buf! data buffer -!!$ INTEGER(size_t) :: namelen ! name length -!!$ INTEGER(size_t) :: attrlen ! name length -!!$ -!!$ namelen = LEN(dset_name) -!!$ attrlen = LEN(attr_name) -!!$ errcode = h5ltget_attribute_c(loc_id,namelen,dset_name,attrlen,attr_name,buf,'I'//C_NULL_CHAR) -!!$ -!!$ END SUBROUTINE h5ltget_attribute_f + SUBROUTINE h5ltget_attribute_f(loc_id,& + dset_name,& + attr_name,& + buf, buf_type, SizeOf_buf_type, & + errcode ) + + IMPLICIT NONE + INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier + CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset + CHARACTER(LEN=*), INTENT(in) :: attr_name ! name of the attribute + INTEGER, INTENT(out) :: errcode ! error code + CHARACTER(LEN=*), INTENT(in) :: buf_type + TYPE(C_PTR) :: buf! data buffer + INTEGER(size_t) :: namelen ! name length + INTEGER(size_t) :: attrlen ! name length + CHARACTER(KIND=C_CHAR) :: buf_type_uppercase + INTEGER(size_t) :: SizeOf_buf_type + + namelen = LEN(dset_name) + attrlen = LEN(attr_name) + + buf_type_uppercase(1:1) = buf_type(1:1) + IF(buf_type_uppercase(1:1).EQ.'i')THEN + buf_type_uppercase(1:1) = 'I' + ELSE IF(buf_type_uppercase(1:1).EQ.'r')THEN + buf_type_uppercase(1:1) = 'R' + ELSE IF(buf_type_uppercase(1:1).EQ.'c')THEN + buf_type_uppercase(1:1) = 'C' + ENDIF + errcode = h5ltget_attribute_c(loc_id,namelen,dset_name,attrlen,attr_name, & + buf, buf_type_uppercase//C_NULL_CHAR, SizeOf_buf_type) + + + END SUBROUTINE h5ltget_attribute_f !------------------------------------------------------------------------- ! Function: h5ltget_attribute_int_f diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index 510e4148..f513337 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -489,6 +489,7 @@ H5_LDFLAGS = @H5_LDFLAGS@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FLOAT128 = @HAVE_FLOAT128@ HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ @@ -535,6 +536,16 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +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_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@ diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in index 371b6fd..2c75fa5 100644 --- a/hl/fortran/test/Makefile.in +++ b/hl/fortran/test/Makefile.in @@ -477,6 +477,7 @@ H5_LDFLAGS = @H5_LDFLAGS@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_FLOAT128 = @HAVE_FLOAT128@ HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ @@ -523,6 +524,16 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +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_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@ diff --git a/hl/fortran/test/tstlite.f90 b/hl/fortran/test/tstlite.f90 index 22b99a5..8fe9612 100644 --- a/hl/fortran/test/tstlite.f90 +++ b/hl/fortran/test/tstlite.f90 @@ -38,6 +38,7 @@ END PROGRAM lite_test SUBROUTINE test_dataset1D() +USE, INTRINSIC :: ISO_C_BINDING USE H5LT ! module of H5LT USE HDF5 ! module of HDF5 library @@ -55,11 +56,12 @@ INTEGER, DIMENSION(DIM1) :: buf1 ! Data buffer INTEGER, DIMENSION(DIM1) :: bufr1 ! Data buffer REAL, DIMENSION(DIM1) :: buf2 ! Data buffer REAL, DIMENSION(DIM1) :: bufr2 ! Data buffer -DOUBLE PRECISION, DIMENSION(DIM1) :: buf3 ! Data buffer -DOUBLE PRECISION, DIMENSION(DIM1) :: bufr3 ! Data buffer +DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf3 ! Data buffer +DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr3 ! Data buffer INTEGER :: errcode ! Error flag INTEGER :: i ! general purpose integer - +TYPE(C_PTR) :: f_ptr +integer(HID_T) :: mytype CALL test_begin(' Make/Read datasets (1D) ') @@ -101,7 +103,7 @@ CALL h5ltread_dataset_f(file_id, dsetname1, H5T_NATIVE_INTEGER, bufr1, dims, err ! DO i = 1, DIM1 IF ( buf1(i) .NE. bufr1(i) ) THEN - PRINT *, 'read buffer differs from write buffer' + PRINT *, 'read buffer differs from write buffer (I)' PRINT *, bufr1(i), ' and ', buf1(i) STOP ENDIF @@ -126,7 +128,7 @@ CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_REAL, bufr2, dims, errcod ! DO i = 1, DIM1 IF ( buf2(i) .NE. bufr2(i) ) THEN - PRINT *, 'read buffer differs from write buffer' + PRINT *, 'read buffer differs from write buffer (R)' PRINT *, bufr2(i), ' and ', buf2(i) STOP ENDIF @@ -139,19 +141,30 @@ END DO ! ! write dataset. ! -CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_DOUBLE, buf3, errcode) - +f_ptr = C_LOC(buf3(1)) +!PRINT*,h5kind_to_type(INT(KIND(buf3(1))), INT(H5_REAL_KIND)), H5T_NATIVE_REAL_8,H5T_NATIVE_REAL,H5T_NATIVE_REAL_16 +PRINT*, KIND(buf3(1)), Fortran_REAL_16 +mytype = h5kind_to_type(KIND(buf3(1)), H5_REAL_KIND) +PRINT*,sizeof(buf3(1)) +CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, & + mytype, f_ptr, errcode) +!CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_DOUBLE, buf3, errcode) +! h5kind_to_type(KIND(buf3(1)), H5_REAL_KIND) +stop ! ! read dataset. ! -CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_DOUBLE, bufr3, dims, errcode) +f_ptr = C_LOC(bufr3(1)) +CALL h5ltread_dataset_f(file_id, dsetname3, & + h5kind_to_type(KIND(bufr3(1)), H5_REAL_KIND), f_ptr, errcode) +!CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_DOUBLE, bufr3, dims, errcode) ! ! compare read and write buffers. ! DO i = 1, DIM1 IF ( buf3(i) .NE. bufr3(i) ) THEN - PRINT *, 'read buffer differs from write buffer' + PRINT *, 'read buffer differs from write buffer (D)' PRINT *, bufr3(i), ' and ', buf3(i) STOP ENDIF @@ -179,6 +192,7 @@ END SUBROUTINE test_dataset1D SUBROUTINE test_dataset2D() +USE, INTRINSIC :: ISO_C_BINDING USE H5LT ! module of H5LT USE HDF5 ! module of HDF5 library @@ -199,12 +213,13 @@ INTEGER, DIMENSION(DIM1*DIM2) :: buf ! Data buffer INTEGER, DIMENSION(DIM1*DIM2) :: bufr ! Data buffer INTEGER, DIMENSION(DIM1,DIM2) :: buf2 ! Data buffer INTEGER, DIMENSION(DIM1,DIM2) :: buf2r ! Data buffer -REAL, DIMENSION(DIM1,DIM2) :: buf3 ! Data buffer -REAL, DIMENSION(DIM1,DIM2) :: buf3r ! Data buffer -DOUBLE PRECISION, DIMENSION(DIM1,DIM2) :: buf4 ! Data buffer -DOUBLE PRECISION, DIMENSION(DIM1,DIM2) :: buf4r ! Data buffer +REAL, DIMENSION(DIM1,DIM2), TARGET :: buf3 ! Data buffer +REAL, DIMENSION(DIM1,DIM2), TARGET :: buf3r ! Data buffer +DOUBLE PRECISION, DIMENSION(DIM1,DIM2), TARGET :: buf4 ! Data buffer +DOUBLE PRECISION, DIMENSION(DIM1,DIM2), TARGET :: buf4r ! Data buffer INTEGER :: errcode ! Error flag INTEGER(HSIZE_T) :: i, j, n ! general purpose integers +TYPE(C_PTR) :: f_ptr CALL test_begin(' Make/Read datasets (2D) ') @@ -296,12 +311,16 @@ END DO ! ! write dataset. ! -CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, buf3, errcode) +f_ptr = C_LOC(buf3(1,1)) +CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, f_ptr, errcode) +!CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, buf3, errcode) ! ! read dataset. ! -CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, buf3r, dims, errcode) +f_ptr = C_LOC(buf3r(1,1)) +CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode) +!CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, buf3r, dims, errcode) ! ! compare read and write buffers. @@ -323,12 +342,16 @@ END DO ! ! write dataset. ! -CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, buf4, errcode) +f_ptr = C_LOC(buf4(1,1)) +CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, f_ptr, errcode) +!CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, buf4, errcode) ! ! read dataset. -! -CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, buf4r, dims, errcode) +f_ptr = C_LOC(buf4r(1,1)) +CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode) + +!CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, buf4r, dims, errcode) ! ! compare read and write buffers. @@ -366,7 +389,7 @@ END SUBROUTINE test_dataset2D SUBROUTINE test_dataset3D() - +USE, INTRINSIC :: ISO_C_BINDING USE H5LT ! module of H5LT USE HDF5 ! module of HDF5 library @@ -387,16 +410,16 @@ INTEGER, DIMENSION(DIM1*DIM2*DIM3) :: buf ! Data buffer INTEGER, DIMENSION(DIM1*DIM2*DIM3) :: bufr ! Data buffer INTEGER, DIMENSION(DIM1,DIM2,DIM3) :: buf2 ! Data buffer INTEGER, DIMENSION(DIM1,DIM2,DIM3) :: buf2r ! Data buffer -REAL, DIMENSION(DIM1,DIM2,DIM3) :: buf3 ! Data buffer -REAL, DIMENSION(DIM1,DIM2,DIM3) :: buf3r ! Data buffer -DOUBLE PRECISION, DIMENSION(DIM1,DIM2,DIM3) :: buf4 ! Data buffer -DOUBLE PRECISION, DIMENSION(DIM1,DIM2,DIM3) :: buf4r ! Data buffer +REAL, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf3 ! Data buffer +REAL, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf3r ! Data buffer +DOUBLE PRECISION, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf4 ! Data buffer +DOUBLE PRECISION, DIMENSION(DIM1,DIM2,DIM3), TARGET :: buf4r ! Data buffer INTEGER :: rank = 3 ! Dataset rank INTEGER :: errcode ! Error flag INTEGER(HSIZE_T) :: i, j, k, n ! general purpose integers INTEGER :: type_class INTEGER(SIZE_T) :: type_size - +TYPE(C_PTR) :: f_ptr CALL test_begin(' Make/Read datasets (3D) ') @@ -492,12 +515,16 @@ END DO ! ! write dataset. ! -CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, buf3, errcode) +f_ptr = C_LOC(buf3(1,1,1)) +CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, f_ptr, errcode) +!CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, buf3, errcode) ! ! read dataset. ! -CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, buf3r, dims, errcode) +f_ptr = C_LOC(buf3r(1,1,1)) +CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode) +!CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, buf3r, dims, errcode) ! ! compare read and write buffers. @@ -521,12 +548,14 @@ END DO ! ! write dataset. ! -CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, buf4, errcode) +f_ptr = C_LOC(buf4(1,1,1)) +CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, f_ptr, errcode) ! ! read dataset. ! -CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, buf4r, dims, errcode) +f_ptr = C_LOC(buf4r(1,1,1)) +CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode) ! ! compare read and write buffers. @@ -608,22 +637,22 @@ SUBROUTINE test_datasetND(rank) INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:,:) :: ibufr_6 ! Data buffer INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:) :: ibuf_7 ! Data buffer INTEGER, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:) :: ibufr_7 ! Data buffer - REAL, ALLOCATABLE, DIMENSION(:,:,:,:) :: rbuf_4 ! Data buffer - REAL, ALLOCATABLE, DIMENSION(:,:,:,:) :: rbufr_4 ! Data buffer + REAL, ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: rbuf_4 ! Data buffer + REAL, ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: rbufr_4 ! Data buffer REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: rbuf_5 ! Data buffer REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: rbufr_5 ! Data buffer - REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:) :: rbuf_6 ! Data buffer - REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:) :: rbufr_6 ! Data buffer - REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:) :: rbuf_7 ! Data buffer - REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:) :: rbufr_7 ! Data buffer - DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:) :: dbuf_4 ! Data buffer - DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:) :: dbufr_4 ! Data buffer - DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:) :: dbuf_5 ! Data buffer - DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:) :: dbufr_5 ! Data buffer - DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:) :: dbuf_6 ! Data buffer - DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:) :: dbufr_6 ! Data buffer - DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:) :: dbuf_7 ! Data buffer - DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:) :: dbufr_7 ! Data buffer + REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: rbuf_6 ! Data buffer + REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: rbufr_6 ! Data buffer + REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: rbuf_7 ! Data buffer + REAL, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: rbufr_7 ! Data buffer + DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: dbuf_4 ! Data buffer + DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:), TARGET :: dbufr_4 ! Data buffer + DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: dbuf_5 ! Data buffer + DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:), TARGET :: dbufr_5 ! Data buffer + DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: dbuf_6 ! Data buffer + DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:), TARGET :: dbufr_6 ! Data buffer + DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: dbuf_7 ! Data buffer + DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:,:,:,:,:,:), TARGET :: dbufr_7 ! Data buffer INTEGER :: errcode ! Error flag INTEGER(HSIZE_T) :: i, j, k, l, m, n, o, nn ! general purpose integers INTEGER :: type_class @@ -786,7 +815,7 @@ SUBROUTINE test_datasetND(rank) CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, ibufr_4, dims(1:rank), errcode) ELSE IF(rank.EQ.5)THEN f_ptr = C_LOC(ibufr_5(1,1,1,1,1)) - CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, f_ptr, dims(1:rank), errcode) + CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, f_ptr, errcode) ELSE IF(rank.EQ.6)THEN CALL h5ltread_dataset_f(file_id, dsetname2, H5T_NATIVE_INTEGER, ibufr_6, dims(1:rank), errcode) ELSE IF(rank.EQ.7)THEN @@ -846,14 +875,20 @@ SUBROUTINE test_datasetND(rank) ! write dataset. ! IF(rank.EQ.4)THEN - CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_4, errcode) + f_ptr = C_LOC(rbuf_4(1,1,1,1)) + CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode) + ! CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_4, errcode) ELSE IF(rank.EQ.5)THEN f_ptr = C_LOC(rbuf_5(1,1,1,1,1)) CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode) ELSE IF(rank.EQ.6)THEN - CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_6, errcode) + f_ptr = C_LOC(rbuf_6(1,1,1,1,1,1)) + CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode) + !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_6, errcode) ELSE IF(rank.EQ.7)THEN - CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_7, errcode) + f_ptr = C_LOC(rbuf_7(1,1,1,1,1,1,1)) + CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, f_ptr, errcode) + !CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims(1:rank), H5T_NATIVE_REAL, rbuf_7, errcode) ENDIF @@ -861,14 +896,17 @@ SUBROUTINE test_datasetND(rank) ! read dataset. ! IF(rank.EQ.4)THEN - CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, rbufr_4, dims(1:rank), errcode) + f_ptr = C_LOC(rbufr_4(1,1,1,1)) + CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode) ELSE IF(rank.EQ.5)THEN f_ptr = C_LOC(rbufr_5(1,1,1,1,1)) - CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, dims(1:rank), errcode) + CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode) ELSE IF(rank.EQ.6)THEN - CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, rbufr_6, dims(1:rank), errcode) + f_ptr = C_LOC(rbufr_6(1,1,1,1,1,1)) + CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode) ELSE IF(rank.EQ.7)THEN - CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, rbufr_7, dims(1:rank), errcode) + f_ptr = C_LOC(rbufr_7(1,1,1,1,1,1,1)) + CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode) ENDIF ! @@ -925,13 +963,17 @@ SUBROUTINE test_datasetND(rank) ! write dataset. ! IF(rank.EQ.4)THEN - CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, dbuf_4, errcode) + f_ptr = C_LOC(dbuf_4(1,1,1,1)) + CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, f_ptr, errcode) ELSE IF(rank.EQ.5)THEN - CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, dbuf_5, errcode) + f_ptr = C_LOC(dbuf_5(1,1,1,1,1)) + CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, f_ptr, errcode) ELSE IF(rank.EQ.6)THEN - CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, dbuf_6, errcode) + f_ptr = C_LOC(dbuf_6(1,1,1,1,1,1)) + CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, f_ptr, errcode) ELSE IF(rank.EQ.7)THEN - CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, dbuf_7, errcode) + f_ptr = C_LOC(dbuf_7(1,1,1,1,1,1,1)) + CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims(1:rank), H5T_NATIVE_DOUBLE, f_ptr, errcode) ENDIF @@ -939,13 +981,17 @@ SUBROUTINE test_datasetND(rank) ! read dataset. ! IF(rank.EQ.4)THEN - CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, dbufr_4, dims(1:rank), errcode) + f_ptr = C_LOC(dbufr_4(1,1,1,1)) + CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode) ELSE IF(rank.EQ.5)THEN - CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, dbufr_5, dims(1:rank), errcode) + f_ptr = C_LOC(dbufr_5(1,1,1,1,1)) + CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode) ELSE IF(rank.EQ.6)THEN - CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, dbufr_6, dims(1:rank), errcode) + f_ptr = C_LOC(dbufr_6(1,1,1,1,1,1)) + CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode) ELSE IF(rank.EQ.7)THEN - CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, dbufr_7, dims(1:rank), errcode) + f_ptr = C_LOC(dbufr_7(1,1,1,1,1,1,1)) + CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode) ENDIF ! @@ -1042,6 +1088,7 @@ END SUBROUTINE test_datasetND SUBROUTINE test_datasets() + USE, INTRINSIC :: ISO_C_BINDING USE H5LT ! module of H5LT USE HDF5 ! module of HDF5 library @@ -1064,10 +1111,10 @@ SUBROUTINE test_datasets() CHARACTER(LEN=8) :: buf1r ! Data buffer INTEGER, DIMENSION(DIM1) :: buf2 ! Data buffer INTEGER, DIMENSION(DIM1) :: bufr2 ! Data buffer - REAL, DIMENSION(DIM1) :: buf3 ! Data buffer - REAL, DIMENSION(DIM1) :: bufr3 ! Data buffer - DOUBLE PRECISION, DIMENSION(DIM1) :: buf4 ! Data buffer - DOUBLE PRECISION, DIMENSION(DIM1) :: bufr4 ! Data buffer + REAL, DIMENSION(DIM1), TARGET :: buf3 ! Data buffer + REAL, DIMENSION(DIM1) , TARGET :: bufr3 ! Data buffer + DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf4 ! Data buffer + DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr4 ! Data buffer INTEGER :: i, n ! general purpose integer INTEGER :: has ! general purpose integer INTEGER :: type_class @@ -1075,6 +1122,7 @@ SUBROUTINE test_datasets() LOGICAL :: path_valid ! status of the path CHARACTER(LEN=6) :: chr_exact CHARACTER(LEN=8) :: chr_lg + TYPE(C_PTR) :: f_ptr ! ! Initialize FORTRAN predefined datatypes. @@ -1137,12 +1185,14 @@ SUBROUTINE test_datasets() ! ! write dataset. ! - CALL h5ltmake_dataset_float_f(file_id, dsetname3, rank, dims, buf3, errcode) + f_ptr = C_LOC(buf3(1)) + CALL h5ltmake_dataset_f(file_id, dsetname3, rank, dims, H5T_NATIVE_REAL, f_ptr, errcode) ! ! read dataset. ! - CALL h5ltread_dataset_float_f(file_id, dsetname3, bufr3, dims, errcode) + f_ptr = C_LOC(bufr3(1)) + CALL h5ltread_dataset_f(file_id, dsetname3, H5T_NATIVE_REAL, f_ptr, errcode) ! ! compare read and write buffers. @@ -1167,12 +1217,16 @@ SUBROUTINE test_datasets() ! ! write dataset. ! - CALL h5ltmake_dataset_double_f(file_id, dsetname4, rank, dims, buf4, errcode) + f_ptr = C_LOC(buf4(1)) + CALL h5ltmake_dataset_f(file_id, dsetname4, rank, dims, H5T_NATIVE_DOUBLE, f_ptr, errcode) + !CALL h5ltmake_dataset_double_f(file_id, dsetname4, rank, dims, buf4, errcode) ! ! read dataset. ! - CALL h5ltread_dataset_double_f(file_id, dsetname4, bufr4, dims, errcode) + f_ptr = C_LOC(buf4(1)) + CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode) + !CALL h5ltread_dataset_double_f(file_id, dsetname4, bufr4, dims, errcode) ! ! compare read and write buffers. @@ -1341,7 +1395,7 @@ END SUBROUTINE test_datasets SUBROUTINE test_attributes() - USE ISO_C_BINDING + USE, INTRINSIC :: ISO_C_BINDING USE H5LT ! module of H5LT USE HDF5 ! module of HDF5 library @@ -1365,10 +1419,10 @@ SUBROUTINE test_attributes() ! CHARACTER(LEN=18) :: bufr_c_lg ! Data buffer INTEGER, DIMENSION(DIM1) :: buf2 ! Data buffer INTEGER, DIMENSION(DIM1) :: bufr2 ! Data buffer - REAL(C_FLOAT), DIMENSION(DIM1) :: buf3 ! Data buffer - REAL(C_FLOAT), DIMENSION(DIM1) :: bufr3 ! Data buffer - REAL(C_DOUBLE), DIMENSION(DIM1) :: buf4 ! Data buffer - REAL(C_DOUBLE), DIMENSION(DIM1) :: bufr4 ! Data buffer + REAL, DIMENSION(DIM1), target :: buf3 ! Data buffer + REAL, DIMENSION(DIM1), target :: bufr3 ! Data buffer + DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf4 ! Data buffer + DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr4 ! Data buffer INTEGER :: errcode ! Error flag INTEGER :: i, n ! general purpose integer INTEGER(SIZE_T) size ! size of attribute array @@ -1380,7 +1434,8 @@ SUBROUTINE test_attributes() INTEGER :: rank = 1 ! Dataset rank CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name INTEGER, DIMENSION(DIM1) :: buf ! Data buffer - + INTEGER(SIZE_T) :: SizeOf_buf_type + TYPE(C_PTR) :: f_ptr ! ! Initialize FORTRAN predefined datatypes. @@ -1448,11 +1503,26 @@ SUBROUTINE test_attributes() ! ! write attribute. ! - CALL h5ltset_attribute_float_f(file_id,dsetname1,attrname3,buf3,size,errcode) +!#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + SizeOf_buf_type = STORAGE_SIZE(buf3(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t) +!#else +! SizeOf_buf_type = SIZEOF(bufr4(1)) +!#endif + f_ptr = C_LOC(buf3(1)) + CALL h5ltset_attribute_f(file_id,dsetname1,attrname3,f_ptr,"REAL", SizeOf_buf_type, size,errcode) + !CALL h5ltset_attribute_float_f(file_id,dsetname1,attrname3,buf3,size,errcode) ! ! read attribute. ! - CALL h5ltget_attribute_float_f(file_id,dsetname1,attrname3,bufr3,errcode) +!#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + SizeOf_buf_type = STORAGE_SIZE(bufr3(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t) +!#else +! SizeOf_buf_type = SIZEOF(bufr4(1)) +!#endif + + f_ptr = C_LOC(bufr3(1)) + CALL h5ltget_attribute_f(file_id,dsetname1,attrname3,f_ptr,"REAL",SizeOf_buf_type,errcode) + !CALL h5ltget_attribute_float_f(file_id,dsetname1,attrname3,bufr3,errcode) ! ! compare read and write buffers. @@ -1473,15 +1543,30 @@ SUBROUTINE test_attributes() CALL test_begin(' Set/Get attributes double ') + SizeOf_buf_type = STORAGE_SIZE(buf4(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t) + ! ! write attribute. ! - CALL h5ltset_attribute_double_f(file_id,dsetname1,attrname4,buf4,size,errcode) + f_ptr = C_LOC(buf4(1)) + CALL h5ltset_attribute_f(file_id,dsetname1,attrname4,f_ptr,"real", SizeOf_buf_type, size, errcode) + + !CALL h5ltset_attribute_double_f(file_id,dsetname1,attrname4,f_ptr,"Real", SizeOf_buf_type, size, errcode) ! ! read attribute. ! - CALL h5ltget_attribute_double_f(file_id,dsetname1,attrname4,bufr4,errcode) + +!#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + SizeOf_buf_type = STORAGE_SIZE(bufr4(1), c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t) +!#else +! SizeOf_buf_type = SIZEOF(bufr4(1)) +!#endif + + f_ptr = C_LOC(bufr4(1)) + CALL h5ltget_attribute_f(file_id,dsetname1,attrname4,f_ptr,"REAL",SizeOf_buf_type,errcode) + +! CALL h5ltget_attribute_double_f(file_id,dsetname1,attrname4,bufr4,errcode) ! ! compare read and write buffers. @@ -1611,11 +1696,6 @@ SUBROUTINE test_attributes() ! END SUBROUTINE test_attributes - - - - - !------------------------------------------------------------------------- ! test_begin !------------------------------------------------------------------------- |