diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-24 19:23:11 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-03-24 19:23:11 (GMT) |
commit | 53e4b5b90b3f5cb9dc7fbe47e6787a5280b2fa04 (patch) | |
tree | 825d37444aa8c0f3bab4442c3f1b0068c7ac2924 /hl/fortran | |
parent | 65dc3358db37b04cc64b65b88065cbaf48e63a8b (diff) | |
download | hdf5-53e4b5b90b3f5cb9dc7fbe47e6787a5280b2fa04.zip hdf5-53e4b5b90b3f5cb9dc7fbe47e6787a5280b2fa04.tar.gz hdf5-53e4b5b90b3f5cb9dc7fbe47e6787a5280b2fa04.tar.bz2 |
[svn-r16601] Description:
Bring r16536:16600 from trunk back into revise_chunks branch
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.6 (amazon) in debug mode
Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'hl/fortran')
-rw-r--r-- | hl/fortran/Makefile.in | 6 | ||||
-rw-r--r-- | hl/fortran/examples/Makefile.in | 6 | ||||
-rwxr-xr-x | hl/fortran/src/H5LTfc.c | 31 | ||||
-rw-r--r-- | hl/fortran/src/Makefile.in | 6 | ||||
-rw-r--r-- | hl/fortran/test/Makefile.in | 6 | ||||
-rw-r--r-- | hl/fortran/test/tstlite.f90 | 76 |
6 files changed, 98 insertions, 33 deletions
diff --git a/hl/fortran/Makefile.in b/hl/fortran/Makefile.in index 3923b06..af080bb 100644 --- a/hl/fortran/Makefile.in +++ b/hl/fortran/Makefile.in @@ -249,6 +249,8 @@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ + +# Install directories that automake doesn't know about docdir = $(exec_prefix)/doc dvidir = @dvidir@ enable_shared = @enable_shared@ @@ -260,9 +262,7 @@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ - -# Install directories that automake doesn't know about -includedir = $(exec_prefix)/include +includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ diff --git a/hl/fortran/examples/Makefile.in b/hl/fortran/examples/Makefile.in index 7cc30e4..1de9302 100644 --- a/hl/fortran/examples/Makefile.in +++ b/hl/fortran/examples/Makefile.in @@ -239,6 +239,8 @@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ + +# Install directories that automake doesn't know about docdir = $(exec_prefix)/doc dvidir = @dvidir@ enable_shared = @enable_shared@ @@ -250,9 +252,7 @@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ - -# Install directories that automake doesn't know about -includedir = $(exec_prefix)/include +includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c index 93d65ef..61c7547 100755 --- a/hl/fortran/src/H5LTfc.c +++ b/hl/fortran/src/H5LTfc.c @@ -1247,6 +1247,7 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id, size_t c_type_size; hsize_t c_dims[32]; int i; + int c_rank; /* * Convert FORTRAN name to C name @@ -1261,15 +1262,23 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id, c_loc_id = (hid_t)*loc_id; ret = H5LTget_dataset_info(c_loc_id, c_name, c_dims, &c_classtype, &c_type_size); + if (ret < 0) return ret_value; *type_class = c_classtype; *type_size = (size_t_f)c_type_size; - for (i = 0; i < 32 ; i++) { - dims[i] = (hsize_t_f) c_dims[i]; - } + /* + * Transpose dimension arrays because of C-FORTRAN storage order + */ + ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank); if (ret < 0) return ret_value; + + for (i = 0; i < c_rank ; i++) { + dims[i] = (hsize_t_f) c_dims[c_rank - i - 1]; + } + + ret_value = 0; return ret_value; } @@ -1375,6 +1384,7 @@ nh5ltget_attribute_info_c(hid_t_f *loc_id, size_t c_type_size; hsize_t c_dims[32]; int i; + int c_rank; /* * Convert FORTRAN name to C name @@ -1388,20 +1398,27 @@ nh5ltget_attribute_info_c(hid_t_f *loc_id, if (c_attrname == NULL) return ret_value; /* - * Call H5LTget_dataset_ndims function. + * Call H5LTget_attribute_info function. */ c_loc_id = (hid_t)*loc_id; ret = H5LTget_attribute_info(c_loc_id,c_name,c_attrname,c_dims,&c_classtype,&c_type_size); + if (ret < 0) return ret_value; *type_class = c_classtype; *type_size = (size_t_f)c_type_size; - for (i = 0; i < 32 ; i++) { - dims[i] = (hsize_t_f) c_dims[i]; - } +/* + * Transpose dimension arrays because of C-FORTRAN storage order + */ + ret = H5LTget_attribute_ndims(c_loc_id,c_name,c_attrname,&c_rank); if (ret < 0) return ret_value; + + for (i = 0; i < c_rank ; i++) { + dims[i] = (hsize_t_f) c_dims[c_rank - i - 1]; + } + ret_value = 0; return ret_value; } diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index 0b269a4..4d4b6fc 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -269,6 +269,8 @@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ + +# Install directories that automake doesn't know about docdir = $(exec_prefix)/doc dvidir = @dvidir@ enable_shared = @enable_shared@ @@ -280,9 +282,7 @@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ - -# Install directories that automake doesn't know about -includedir = $(exec_prefix)/include +includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in index e43ab95..6958f34 100644 --- a/hl/fortran/test/Makefile.in +++ b/hl/fortran/test/Makefile.in @@ -259,6 +259,8 @@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ + +# Install directories that automake doesn't know about docdir = $(exec_prefix)/doc dvidir = @dvidir@ enable_shared = @enable_shared@ @@ -270,9 +272,7 @@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ - -# Install directories that automake doesn't know about -includedir = $(exec_prefix)/include +includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ diff --git a/hl/fortran/test/tstlite.f90 b/hl/fortran/test/tstlite.f90 index c261ad8..9332c10 100644 --- a/hl/fortran/test/tstlite.f90 +++ b/hl/fortran/test/tstlite.f90 @@ -379,6 +379,7 @@ character(LEN=5), parameter :: dsetname3 = "dset3" ! Dataset name character(LEN=5), parameter :: dsetname4 = "dset4" ! Dataset name integer(HID_T) :: file_id ! File identifier integer(HSIZE_T), dimension(3) :: dims = (/DIM1,DIM2,DIM3/) ! Dataset dimensions +integer(HSIZE_T), dimension(3) :: dimsr ! Dataset dimensions integer, dimension(DIM1*DIM2*DIM3) :: buf ! Data buffer integer, dimension(DIM1*DIM2*DIM3) :: bufr ! Data buffer integer, dimension(DIM1,DIM2,DIM3) :: buf2 ! Data buffer @@ -390,6 +391,8 @@ double precision, dimension(DIM1,DIM2,DIM3) :: buf4r ! Data buffer integer :: rank = 3 ! Dataset rank integer :: errcode ! Error flag integer :: i, j, k, n ! general purpose integers +integer :: type_class +integer(SIZE_T) :: type_size call test_begin(' Make/Read datasets (3D) ') @@ -537,6 +540,18 @@ do i = 1, dims(1) end do end do +call h5ltget_dataset_info_f(file_id,dsetname4,dimsr,type_class,type_size,errcode ) + +! +! compare dimensions +! +do i = 1, rank + if ( dimsr(i) .ne. dims(i) ) then + print *, 'dimensions differ ' + stop + endif +end do + ! ! Close the file. ! @@ -574,6 +589,7 @@ character(LEN=5), parameter :: dsetname1 = "dset1" ! Dataset name character(LEN=5), parameter :: dsetname2 = "dset2" ! Dataset name character(LEN=5), parameter :: dsetname3 = "dset3" ! Dataset name character(LEN=5), parameter :: dsetname4 = "dset4" ! Dataset name +character(LEN=5), parameter :: dsetname5 = "dset5" ! Dataset name integer(HSIZE_T), dimension(1) :: dims = (/DIM1/) ! Dataset dimensions integer(HSIZE_T), dimension(1) :: dimsr ! Dataset dimensions integer :: rank = 1 ! Dataset rank @@ -701,7 +717,7 @@ end do call passed() -call test_begin(' Get dataset dimensions ') +call test_begin(' Get dataset dimensions/info ') !------------------------------------------------------------------------- ! h5ltget_dataset_ndims_f @@ -713,20 +729,39 @@ if ( rankr .ne. rank ) then stop endif -call passed() !------------------------------------------------------------------------- -! test find dataset function +! test h5ltfind_dataset_f function !------------------------------------------------------------------------- -call test_begin(' Find dataset ') +has = h5ltfind_dataset_f(file_id,dsetname4) +if ( has .ne. 1 ) then + print *, 'h5ltfind_dataset_f return error' + stop +endif + +!------------------------------------------------------------------------- +! test h5ltget_dataset_info_f function +!------------------------------------------------------------------------- + + +call h5ltget_dataset_info_f(file_id,dsetname4,dimsr,type_class,type_size,errcode ) + +! +! compare dimensions +! +do i = 1, rank + if ( dimsr(i) .ne. dims(i) ) then + print *, 'dimensions differ ' + stop + endif +end do -!has = h5ltfind_dataset_f(file_id,dsetname4) -!if ( has .ne. 1 ) then -! print *, 'h5ltfind_dataset_f return error' -! stop -!endif +if ( type_class .ne. 1 ) then ! H5T_FLOAT + print *, 'wrong type class ' + stop +endif ! ! Close the file. @@ -756,15 +791,16 @@ use HDF5 ! module of HDF5 library implicit none -character(len=9), parameter :: filename = "dsetf4.h5"! File name +character(len=9), parameter :: filename = "dsetf5.h5"! File name integer(HID_T) :: file_id ! File identifier integer, parameter :: DIM1 = 10; ! Dimension of array character(LEN=5), parameter :: attrname1 = "attr1" ! Attribute name character(LEN=5), parameter :: attrname2 = "attr2" ! Attribute name character(LEN=5), parameter :: attrname3 = "attr3" ! Attribute name character(LEN=5), parameter :: attrname4 = "attr4" ! Attribute name -character(LEN=8), parameter :: buf1 = "mystring" ! Data buffer -character(LEN=8) :: bufr1 ! Data buffer +character(LEN=5), parameter :: attrname5 = "attr5" ! Attribute name +character(LEN=9), parameter :: buf1 = "mystring" ! Data buffer +character(LEN=9) :: bufr1 ! Data buffer integer, dimension(DIM1) :: buf2 ! Data buffer integer, dimension(DIM1) :: bufr2 ! Data buffer real, dimension(DIM1) :: buf3 ! Data buffer @@ -900,12 +936,11 @@ end do call passed() - !------------------------------------------------------------------------- ! get attribute rank !------------------------------------------------------------------------- -call test_begin(' Get attribute rank ') +call test_begin(' Get attribute rank/info ') call h5ltget_attribute_ndims_f(file_id,dsetname1,attrname2,rankr,errcode) @@ -916,6 +951,19 @@ if ( rankr .ne. 1 ) then endif +call h5ltget_attribute_info_f(file_id,dsetname1,attrname2,dimsr,type_class,type_size,errcode) + +! +! compare dimensions +! +do i = 1, rank + if ( dimsr(i) .ne. dims(i) ) then + print *, 'dimensions differ ' + stop + endif +end do + + ! ! Close the file. ! |