diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2013-03-15 05:08:29 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2013-03-15 05:08:29 (GMT) |
commit | c129390dfe2438988f4b43fc1d93b91989116731 (patch) | |
tree | 4617b95bafbfa14a55a6046bd27d666534e9d6bc /fortran | |
parent | f0769763b565784a959c855311c58933110c66ba (diff) | |
download | hdf5-c129390dfe2438988f4b43fc1d93b91989116731.zip hdf5-c129390dfe2438988f4b43fc1d93b91989116731.tar.gz hdf5-c129390dfe2438988f4b43fc1d93b91989116731.tar.bz2 |
[svn-r23352] merged -r22826:23050 and -r23060:23351 from trunk into branch.
Tested: jam (gnu, intel)
Diffstat (limited to 'fortran')
72 files changed, 4339 insertions, 1363 deletions
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 2d35f89..0536183 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -14,16 +14,17 @@ INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${ # Define Sources #----------------------------------------------------------------------------- SET (examples - dsetexample - fileexample - rwdsetexample - attrexample - groupexample - grpsexample - grpdsetexample + h5_cmprss + h5_crtdat + h5_rdwt + h5_crtatt + h5_crtgrp + h5_crtgrpar + h5_crtgrpd + h5_extend + h5_subset hyperslab selectele - grpit refobjexample refregexample mountexample @@ -64,7 +65,7 @@ FOREACH (example ${examples}) ENDFOREACH (example ${examples}) -IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +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} ${LIB_TYPE}) @@ -89,7 +90,7 @@ IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) SET (last_test "f03_ex_${example}") ENDIF (BUILD_TESTING) ENDFOREACH (example ${F2003_examples}) -ENDIF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +ENDIF (HDF5_ENABLE_F2003) 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 4fb4180..e994d4e 100644 --- a/fortran/examples/Makefile.am +++ b/fortran/examples/Makefile.am @@ -32,15 +32,15 @@ endif # We don't tell automake about these programs so that it doesn't try to # compile them with the regular fortran compiler. -EXAMPLE_PROG=dsetexample fileexample rwdsetexample attrexample groupexample \ - grpsexample grpdsetexample hyperslab selectele grpit refobjexample \ - refregexample mountexample compound +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 # List files to be installed here -INSTALL_FILES=dsetexample.f90 fileexample.f90 rwdsetexample.f90 \ - attrexample.f90 groupexample.f90 grpsexample.f90 grpdsetexample.f90 \ - hyperslab.f90 selectele.f90 grpit.f90 refobjexample.f90 \ - refregexample.f90 mountexample.f90 compound.f90 ph5example.f90 +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 INSTALL_SCRIPT_FILES = run-fortran-ex.sh @@ -57,12 +57,12 @@ TEST_SCRIPT=testh5fc.sh FORTRAN_API=yes # Some examples depend on files created by other examples. -grpdsetexample.chkexe_: grpsexample.chkexe_ +h5_crtgrpd.chkexe_: h5_crtgrpar.chkexe_ refregexample.chkexe_: refobjexample.chkexe_ -# rwdsetexample and attrexample both modify the same file created by -# dsetexample. Serialize them. -rwdsetexample.chkexe_: dsetexample.chkexe_ -attrexample.chkexe_: rwdsetexample.chkexe_ +# h5_rdwt and h5_crtatt both modify the same file created by +# h5_crtdat. Serialize them. +h5_rdwt.chkexe_: h5_crtdat.chkexe_ +h5_crtatt.chkexe_: h5_rdwt.chkexe_ # Tell automake how to build examples using h5fc # Additional dependencies for the examples are listed below @@ -84,16 +84,17 @@ EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/fortran # an inelegant way of solving the problem. # All programs share the same build rule and a dependency on the main hdf5 # and fortran libraries above. -dsetexample: dsetexample.f90 -fileexample: fileexample.f90 -rwdsetexample: rwdsetexample.f90 -attrexample: attrexample.f90 -groupexample: groupexample.f90 -grpsexample: grpsexample.f90 -grpdsetexample: grpdsetexample.f90 +h5_crtdat: h5_crtdat.f90 +h5_extend: h5_extend.f90 +h5_subset: h5_subset.f90 +h5_rdwt: h5_rdwt.f90 +h5_crtatt: h5_crtatt.f90 +h5_crtgrp: h5_crtgrp.f90 +h5_crtgrpar: h5_crtgrpar.f90 +h5_crtgrpd: h5_crtgrpd.f90 +h5_cmprss: h5_cmprss.f90 hyperslab: hyperslab.f90 selectele: selectele.f90 -grpit: grpit.f90 refobjexample: refobjexample.f90 refregexample: refregexample.f90 mountexample: mountexample.f90 diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in index 1170797..93a2af1 100644 --- a/fortran/examples/Makefile.in +++ b/fortran/examples/Makefile.in @@ -405,17 +405,17 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 # be run. # We don't tell automake about these programs so that it doesn't try to # compile them with the regular fortran compiler. -EXAMPLE_PROG = dsetexample fileexample rwdsetexample attrexample \ - groupexample grpsexample grpdsetexample hyperslab selectele \ - grpit refobjexample refregexample mountexample compound \ +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) # List files to be installed here -INSTALL_FILES = dsetexample.f90 fileexample.f90 rwdsetexample.f90 \ - attrexample.f90 groupexample.f90 grpsexample.f90 \ - grpdsetexample.f90 hyperslab.f90 selectele.f90 grpit.f90 \ - refobjexample.f90 refregexample.f90 mountexample.f90 \ - compound.f90 ph5example.f90 $(am__append_2) +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) INSTALL_SCRIPT_FILES = run-fortran-ex.sh TEST_SCRIPT = testh5fc.sh @@ -668,12 +668,12 @@ help: @$(top_srcdir)/bin/makehelp # Some examples depend on files created by other examples. -grpdsetexample.chkexe_: grpsexample.chkexe_ +h5_crtgrpd.chkexe_: h5_crtgrpar.chkexe_ refregexample.chkexe_: refobjexample.chkexe_ -# rwdsetexample and attrexample both modify the same file created by -# dsetexample. Serialize them. -rwdsetexample.chkexe_: dsetexample.chkexe_ -attrexample.chkexe_: rwdsetexample.chkexe_ +# h5_rdwt and h5_crtatt both modify the same file created by +# h5_crtdat. Serialize them. +h5_rdwt.chkexe_: h5_crtdat.chkexe_ +h5_crtatt.chkexe_: h5_rdwt.chkexe_ # Tell automake how to build examples using h5fc # Additional dependencies for the examples are listed below @@ -688,16 +688,17 @@ attrexample.chkexe_: rwdsetexample.chkexe_ # an inelegant way of solving the problem. # All programs share the same build rule and a dependency on the main hdf5 # and fortran libraries above. -dsetexample: dsetexample.f90 -fileexample: fileexample.f90 -rwdsetexample: rwdsetexample.f90 -attrexample: attrexample.f90 -groupexample: groupexample.f90 -grpsexample: grpsexample.f90 -grpdsetexample: grpdsetexample.f90 +h5_crtdat: h5_crtdat.f90 +h5_extend: h5_extend.f90 +h5_subset: h5_subset.f90 +h5_rdwt: h5_rdwt.f90 +h5_crtatt: h5_crtatt.f90 +h5_crtgrp: h5_crtgrp.f90 +h5_crtgrpar: h5_crtgrpar.f90 +h5_crtgrpd: h5_crtgrpd.f90 +h5_cmprss: h5_cmprss.f90 hyperslab: hyperslab.f90 selectele: selectele.f90 -grpit: grpit.f90 refobjexample: refobjexample.f90 refregexample: refregexample.f90 mountexample: mountexample.f90 diff --git a/fortran/examples/attrexample.f90 b/fortran/examples/attrexample.f90 deleted file mode 100644 index ffbeabe..0000000 --- a/fortran/examples/attrexample.f90 +++ /dev/null @@ -1,117 +0,0 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! Copyright by The HDF Group. * -! Copyright by the Board of Trustees of the University of Illinois. * -! All rights reserved. * -! * -! This file is part of HDF5. The full HDF5 copyright notice, including * -! terms governing use, modification, and redistribution, is contained in * -! the files COPYING and Copyright.html. COPYING can be found at the root * -! of the source code distribution tree; Copyright.html can be found at the * -! root level of an installed copy of the electronic HDF5 document set and * -! is linked from the top-level documents page. It can also be found at * -! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -! access to either file, you may request a copy from help@hdfgroup.org. * -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! -! This example shows how to create and write a dataset attribute. -! It opens the existing file 'dset.h5', obtains the identifier of -! the dataset "/dset", defines attribute's dataspace, -! creates dataset attribute, writes the attribute, and then closes -! the attribute's dataspace, attribute, dataset, and file. - - PROGRAM ATTREXAMPLE - - - USE HDF5 ! This module contains all necessary modules - - IMPLICIT NONE - - CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5" ! File name - CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name - CHARACTER(LEN=9), PARAMETER :: aname = "attr_long" ! Attribute name - - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: dset_id ! Dataset identifier - INTEGER(HID_T) :: attr_id ! Attribute identifier - INTEGER(HID_T) :: aspace_id ! Attribute Dataspace identifier - INTEGER(HID_T) :: atype_id ! Attribute Dataspace identifier - INTEGER(HSIZE_T), DIMENSION(1) :: adims = (/2/) ! Attribute dimension - INTEGER :: arank = 1 ! Attribure rank - INTEGER(SIZE_T) :: attrlen ! Length of the attribute string - - CHARACTER(LEN=80), DIMENSION(2) :: attr_data ! Attribute data - - INTEGER :: error ! Error flag - INTEGER(HSIZE_T), DIMENSION(1) :: data_dims - - - ! - ! Initialize attribute's data - ! - attr_data(1) = "Dataset character attribute" - attr_data(2) = "Some other string here " - attrlen = 80 - ! - ! Initialize FORTRAN interface. - ! - CALL h5open_f(error) - - ! - ! Open an existing file. - ! - CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) - - ! - ! Open an existing dataset. - ! - CALL h5dopen_f(file_id, dsetname, dset_id, error) - - ! - ! Create scalar data space for the attribute. - ! - CALL h5screate_simple_f(arank, adims, aspace_id, error) - ! - ! Create datatype for the attribute. - ! - CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype_id, error) - CALL h5tset_size_f(atype_id, attrlen, error) - - ! - ! Create dataset attribute. - ! - CALL h5acreate_f(dset_id, aname, atype_id, aspace_id, & - attr_id, error) - - ! - ! Write the attribute data. - ! - data_dims(1) = 2 - CALL h5awrite_f(attr_id, atype_id, attr_data, data_dims, error) - - ! - ! Close the attribute. - ! - CALL h5aclose_f(attr_id, error) - - ! - ! Terminate access to the data space. - ! - CALL h5sclose_f(aspace_id, error) - - ! - ! End access to the dataset and release resources used by it. - ! - CALL h5dclose_f(dset_id, error) - - ! - ! Close the file. - ! - CALL h5fclose_f(file_id, error) - - ! - ! Close FORTRAN interface. - ! - CALL h5close_f(error) - - END PROGRAM ATTREXAMPLE - diff --git a/fortran/examples/dsetexample.f90 b/fortran/examples/dsetexample.f90 deleted file mode 100644 index 209a516..0000000 --- a/fortran/examples/dsetexample.f90 +++ /dev/null @@ -1,85 +0,0 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! Copyright by The HDF Group. * -! Copyright by the Board of Trustees of the University of Illinois. * -! All rights reserved. * -! * -! This file is part of HDF5. The full HDF5 copyright notice, including * -! terms governing use, modification, and redistribution, is contained in * -! the files COPYING and Copyright.html. COPYING can be found at the root * -! of the source code distribution tree; Copyright.html can be found at the * -! root level of an installed copy of the electronic HDF5 document set and * -! is linked from the top-level documents page. It can also be found at * -! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -! access to either file, you may request a copy from help@hdfgroup.org. * -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! -! -! The following example shows how to create an empty dataset. -! It creates a file called 'dsetf.h5', defines the -! dataset dataspace, creates a dataset which is a 4x6 integer array, -! and then closes the dataspace, the dataset, and the file. -! - - PROGRAM DSETEXAMPLE - - USE HDF5 ! This module contains all necessary modules - - IMPLICIT NONE - - CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5" ! File name - CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name - - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: dset_id ! Dataset identifier - INTEGER(HID_T) :: dspace_id ! Dataspace identifier - - - INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions - INTEGER :: rank = 2 ! Dataset rank - - INTEGER :: error ! Error flag - - ! - ! Initialize FORTRAN interface. - ! - CALL h5open_f(error) - - ! - ! Create a new file using default properties. - ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) - - ! - ! Create the dataspace. - ! - CALL h5screate_simple_f(rank, dims, dspace_id, error) - - ! - ! Create the dataset with default properties. - ! - CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, & - dset_id, error) - - ! - ! End access to the dataset and release resources used by it. - ! - CALL h5dclose_f(dset_id, error) - - ! - ! Terminate access to the data space. - ! - CALL h5sclose_f(dspace_id, error) - - ! - ! Close the file. - ! - CALL h5fclose_f(file_id, error) - - ! - ! Close FORTRAN interface. - ! - CALL h5close_f(error) - - END PROGRAM DSETEXAMPLE - - diff --git a/fortran/examples/grpdsetexample.f90 b/fortran/examples/grpdsetexample.f90 deleted file mode 100644 index 19fc660..0000000 --- a/fortran/examples/grpdsetexample.f90 +++ /dev/null @@ -1,156 +0,0 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! Copyright by The HDF Group. * -! Copyright by the Board of Trustees of the University of Illinois. * -! All rights reserved. * -! * -! This file is part of HDF5. The full HDF5 copyright notice, including * -! terms governing use, modification, and redistribution, is contained in * -! the files COPYING and Copyright.html. COPYING can be found at the root * -! of the source code distribution tree; Copyright.html can be found at the * -! root level of an installed copy of the electronic HDF5 document set and * -! is linked from the top-level documents page. It can also be found at * -! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -! access to either file, you may request a copy from help@hdfgroup.org. * -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! -! -! This example shows how to create a dataset in a particular group. -! It opens the file created in the previous example and creates two datasets. -! Absolute and relative dataset names are used. -! - - - PROGRAM GRPDSETEXAMPLE - - USE HDF5 ! This module contains all necessary modules - - IMPLICIT NONE - - CHARACTER(LEN=10), PARAMETER :: filename = "groupsf.h5" ! File name - CHARACTER(LEN=15), PARAMETER :: groupname = "MyGroup/Group_A" ! Group name - CHARACTER(LEN=13), PARAMETER :: dsetname1 = "MyGroup/dset1" ! Dataset name - CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! dataset name - - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: group_id ! Group identifier - INTEGER(HID_T) :: dataset_id ! Dataset identifier - INTEGER(HID_T) :: dataspace_id ! Data space identifier - - INTEGER :: i, j - INTEGER :: error ! Error flag - - INTEGER, DIMENSION(3,3) :: dset1_data ! Data arrays - INTEGER, DIMENSION(2,10) :: dset2_data ! - - INTEGER(HSIZE_T), DIMENSION(2) :: dims1 = (/3,3/) ! Datasets dimensions - INTEGER(HSIZE_T), DIMENSION(2) :: dims2 = (/2,10/)! - INTEGER(HSIZE_T), DIMENSION(2) :: data_dims - - INTEGER :: rank = 2 ! Datasets rank - - ! - !Initialize dset1_data array - ! - do i = 1, 3 - do j = 1, 3 - dset1_data(i,j) = j; - end do - end do - - - ! - !Initialize dset2_data array - ! - do i = 1, 2 - do j = 1, 10 - dset2_data(i,j) = j; - end do - end do - - ! - ! Initialize FORTRAN interface. - ! - CALL h5open_f(error) - - ! - ! Open an existing file. - ! - CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) - - ! - ! Create the data space for the first dataset. - ! - CALL h5screate_simple_f(rank, dims1, dataspace_id, error) - - ! - ! Create a dataset in group "MyGroup" with default properties. - ! - CALL h5dcreate_f(file_id, dsetname1, H5T_NATIVE_INTEGER, dataspace_id, & - dataset_id, error) - - ! - ! Write the first dataset. - ! - data_dims(1) = 3 - data_dims(2) = 3 - CALL h5dwrite_f(dataset_id, H5T_NATIVE_INTEGER, dset1_data, data_dims, error) - - ! - ! Close the dataspace for the first dataset. - ! - CALL h5sclose_f(dataspace_id, error) - - ! - ! Close the first dataset. - ! - CALL h5dclose_f(dataset_id, error) - - ! - ! Open an existing group in the specified file. - ! - CALL h5gopen_f(file_id, groupname, group_id, error) - - ! - !Create the data space for the second dataset. - ! - CALL h5screate_simple_f(rank, dims2, dataspace_id, error) - - ! - ! Create the second dataset in group "Group_A" with default properties. - ! - CALL h5dcreate_f(group_id, dsetname2, H5T_NATIVE_INTEGER, dataspace_id, & - dataset_id, error) - - ! - ! Write the second dataset. - ! - data_dims(1) = 2 - data_dims(1) = 10 - CALL h5dwrite_f(dataset_id, H5T_NATIVE_INTEGER, dset2_data, data_dims, error) - - ! - ! Close the dataspace for the second dataset. - ! - CALL h5sclose_f(dataspace_id, error) - - ! - ! Close the second dataset. - ! - CALL h5dclose_f(dataset_id, error) - - ! - ! Close the group. - ! - CALL h5gclose_f(group_id, error) - - ! - ! Close the file. - ! - CALL h5fclose_f(file_id, error) - - ! - ! Close FORTRAN interface. - ! - CALL h5close_f(error) - - END PROGRAM GRPDSETEXAMPLE diff --git a/fortran/examples/grpit.f90 b/fortran/examples/grpit.f90 deleted file mode 100644 index 9361b17..0000000 --- a/fortran/examples/grpit.f90 +++ /dev/null @@ -1,215 +0,0 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! Copyright by The HDF Group. * -! Copyright by the Board of Trustees of the University of Illinois. * -! All rights reserved. * -! * -! This file is part of HDF5. The full HDF5 copyright notice, including * -! terms governing use, modification, and redistribution, is contained in * -! the files COPYING and Copyright.html. COPYING can be found at the root * -! of the source code distribution tree; Copyright.html can be found at the * -! root level of an installed copy of the electronic HDF5 document set and * -! is linked from the top-level documents page. It can also be found at * -! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -! access to either file, you may request a copy from help@hdfgroup.org. * -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! -! -! In this example we iterate through the members of the groups. -! - - - PROGRAM GRPITEXAMPLE - - USE HDF5 ! This module contains all necessary modules - - IMPLICIT NONE - - CHARACTER(LEN=11), PARAMETER :: filename = "iteratef.h5" ! File name - CHARACTER(LEN=7), PARAMETER :: groupname1 = "MyGroup" ! Group name - CHARACTER(LEN=15), PARAMETER :: groupname2 = "Group_A" ! Group name - CHARACTER(LEN=13), PARAMETER :: dsetname1 = "dset1" ! Dataset name - CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! - - CHARACTER(LEN=20) :: name_buffer ! Buffer to hold object's name - INTEGER :: type ! Type of the object - INTEGER :: nmembers ! Number of group members - - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: dataset1_id ! Dataset1 identifier - INTEGER(HID_T) :: dataset2_id ! Dataset2 identifier - INTEGER(HID_T) :: dataspace1_id ! Data space identifier - INTEGER(HID_T) :: dataspace2_id ! Data space identifier - INTEGER(HID_T) :: group1_id, group2_id ! Group identifiers - - INTEGER :: i, j - - INTEGER :: error ! Error flag - - INTEGER, DIMENSION(3,3) :: dset1_data ! Arrays to hold data - INTEGER, DIMENSION(2,10) :: dset2_data ! - - - INTEGER(HSIZE_T), DIMENSION(2) :: dims1 = (/3,3/) ! Dataset dimensions - INTEGER(HSIZE_T), DIMENSION(2) :: dims2 = (/2,10/)! - INTEGER :: rank = 2 ! Datasets rank - INTEGER(HSIZE_T), DIMENSION(2) :: data_dims - - ! - ! Initialize dset1_data array. - ! - do i = 1, 3 - do j = 1, 3 - dset1_data(i,j) = j; - end do - end do - - - ! - ! Initialize dset2_data array. - ! - do i = 1, 2 - do j = 1, 10 - dset2_data(i,j) = j; - end do - end do - - ! - ! Initialize FORTRAN interface. - ! - CALL h5open_f(error) - - ! - ! Create a new file using default properties. - ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) - - ! - ! Create group "MyGroup" in the root group using absolute name. - ! - CALL h5gcreate_f(file_id, groupname1, group1_id, error) - - ! - ! Create group "Group_A" in group "MyGroup" using relative name. - ! - CALL h5gcreate_f(group1_id, groupname2, group2_id, error) - - ! - ! Create the data space for the first dataset. - ! - CALL h5screate_simple_f(rank, dims1, dataspace1_id, error) - - ! - ! Create a dataset in group "MyGroup" with default properties. - ! - CALL h5dcreate_f(group1_id, dsetname1, H5T_NATIVE_INTEGER, dataspace1_id, & - dataset1_id, error) - - ! - ! Write the first dataset. - ! - data_dims(1) = 3 - data_dims(2) = 3 - CALL h5dwrite_f(dataset1_id, H5T_NATIVE_INTEGER, dset1_data, data_dims, error) - - ! - ! Create the data space for the second dataset. - ! - CALL h5screate_simple_f(rank, dims2, dataspace2_id, error) - - ! - ! Create the second dataset in group "Group_A" with default properties - ! - CALL h5dcreate_f(group2_id, dsetname2, H5T_NATIVE_INTEGER, dataspace2_id, & - dataset2_id, error) - - ! - ! Write the second dataset - ! - data_dims(1) = 2 - data_dims(2) = 10 - CALL h5dwrite_f(dataset2_id, H5T_NATIVE_INTEGER, dset2_data, data_dims, error) - - ! - ! Get number of members in the root group. - ! - CALL h5gn_members_f(file_id, "/", nmembers, error) - write(*,*) "Number of root group member is " , nmembers - - ! - ! Print each group member's name and type. - ! - do i = 0, nmembers - 1 - CALL h5gget_obj_info_idx_f(file_id, "/", i, name_buffer, type, & - error) - write(*,*) name_buffer, type - end do - - ! - ! Get number of members in MyGroup. - ! - CALL h5gn_members_f(file_id, "MyGroup", nmembers, error) - write(*,*) "Number of group MyGroup member is ", nmembers - - ! - ! Print each group member's name and type in "MyGroup" group. - ! - do i = 0, nmembers - 1 - CALL h5gget_obj_info_idx_f(file_id, groupname1, i, name_buffer, type, & - error) - write(*,*) name_buffer, type - end do - - - ! - ! Get number of members in MyGroup/Group_A. - ! - CALL h5gn_members_f(file_id, "MyGroup/Group_A", nmembers, error) - write(*,*) "Number of group MyGroup/Group_A member is ", nmembers - - ! - ! Print each group member's name and type in "MyGroup/Group_A" group. - ! - do i = 0, nmembers - 1 - CALL h5gget_obj_info_idx_f(file_id,"MyGroup/Group_A" , i, name_buffer, type, & - error) - write(*,*) name_buffer, type - end do - - ! - ! Close the dataspace for the first dataset. - ! - CALL h5sclose_f(dataspace1_id, error) - - ! - ! Close the first dataset. - ! - CALL h5dclose_f(dataset1_id, error) - - ! - ! Close the dataspace for the second dataset. - ! - CALL h5sclose_f(dataspace2_id, error) - - ! - ! Close the second dataset. - ! - CALL h5dclose_f(dataset2_id, error) - - ! - ! Close the groups. - ! - CALL h5gclose_f(group1_id, error) - - CALL h5gclose_f(group2_id, error) - - ! - ! Close the file. - ! - CALL h5fclose_f(file_id, error) - - ! - ! Close FORTRAN interface. - ! - CALL h5close_f(error) - - END PROGRAM GRPITEXAMPLE diff --git a/fortran/examples/grpsexample.f90 b/fortran/examples/grpsexample.f90 deleted file mode 100644 index 0f694e9..0000000 --- a/fortran/examples/grpsexample.f90 +++ /dev/null @@ -1,83 +0,0 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! Copyright by The HDF Group. * -! Copyright by the Board of Trustees of the University of Illinois. * -! All rights reserved. * -! * -! This file is part of HDF5. The full HDF5 copyright notice, including * -! terms governing use, modification, and redistribution, is contained in * -! the files COPYING and Copyright.html. COPYING can be found at the root * -! of the source code distribution tree; Copyright.html can be found at the * -! root level of an installed copy of the electronic HDF5 document set and * -! is linked from the top-level documents page. It can also be found at * -! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -! access to either file, you may request a copy from help@hdfgroup.org. * -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! -! -! The following example code shows how to create groups -! using absolute and relative names. It creates three groups: -! the first two groups are created using the file identifier and -! the group absolute names, and the third group is created using -! a group identifier and the name relative to the specified group. -! - - - PROGRAM GRPSEXAMPLE - - USE HDF5 ! This module contains all necessary modules - - IMPLICIT NONE - - CHARACTER(LEN=10), PARAMETER :: filename = "groupsf.h5" ! File name - CHARACTER(LEN=8), PARAMETER :: groupname1 = "/MyGroup" ! Group name - CHARACTER(LEN=16), PARAMETER :: groupname2 = "/MyGroup/Group_A" - ! Group name - CHARACTER(LEN=7), PARAMETER :: groupname3 = "Group_B" ! Group name - - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: group1_id, group2_id, group3_id ! Group identifiers - - INTEGER :: error ! Error flag - ! - ! Initialize FORTRAN interface. - ! - CALL h5open_f(error) - - ! - ! Create a new file using default properties. - ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) - - ! - ! Create group "MyGroup" in the root group using absolute name. - ! - CALL h5gcreate_f(file_id, groupname1, group1_id, error) - - ! - ! Create group "Group_A" in group "MyGroup" using absolute name. - ! - CALL h5gcreate_f(file_id, groupname2, group2_id, error) - - ! - ! Create group "Group_B" in group "MyGroup" using relative name. - ! - CALL h5gcreate_f(group1_id, groupname3, group3_id, error) - - ! - ! Close the groups. - ! - CALL h5gclose_f(group1_id, error) - CALL h5gclose_f(group2_id, error) - CALL h5gclose_f(group3_id, error) - - ! - ! Terminate access to the file. - ! - CALL h5fclose_f(file_id, error) - - ! - ! Close FORTRAN interface. - ! - CALL h5close_f(error) - - END PROGRAM GRPSEXAMPLE diff --git a/fortran/examples/h5_cmprss.f90 b/fortran/examples/h5_cmprss.f90 new file mode 100644 index 0000000..847a922 --- /dev/null +++ b/fortran/examples/h5_cmprss.f90 @@ -0,0 +1,131 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+! Copyright by The HDF Group. *
+! Copyright by the Board of Trustees of the University of Illinois. *
+! All rights reserved. *
+! *
+! This file is part of HDF5. The full HDF5 copyright notice, including *
+! terms governing use, modification, and redistribution, is contained in *
+! the files COPYING and Copyright.html. COPYING can be found at the root *
+! of the source code distribution tree; Copyright.html can be found at the *
+! root level of an installed copy of the electronic HDF5 document set and *
+! is linked from the top-level documents page. It can also be found at *
+! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+! access to either file, you may request a copy from help@hdfgroup.org. *
+! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+!
+! This example illustrates how to create a compressed dataset.
+! It is used in the HDF5 Tutorial.
+!
+PROGRAM h5_cmprss
+
+ USE HDF5 ! This module contains all necessary modules
+
+ IMPLICIT NONE
+ !
+ ! The dataset is stored in file "h5_cmprss.h5"
+ !
+ CHARACTER(LEN=12), PARAMETER :: filename = "h5_cmprss.h5"
+ INTEGER, PARAMETER :: rank = 2 ! Rank of the data set
+ INTEGER, PARAMETER :: dim0 = 100 ! Data set sizes
+ INTEGER, PARAMETER :: dim1 = 20
+
+ INTEGER(hid_t) :: file_id, dataset_id, dataspace_id ! Identifiers
+ INTEGER(hid_t) :: plist_id ! Property list identifier
+
+ INTEGER :: error
+ INTEGER(hsize_t), DIMENSION(1:rank) :: dims ! dimensions of data
+ INTEGER(hsize_t), DIMENSION(1:rank) :: cdims ! sizes of chunked data
+
+ INTEGER :: i,j, numfilt
+ INTEGER, DIMENSION(1:dim0,1:dim1) :: buf ! write buffer
+ INTEGER, DIMENSION(1:dim0,1:dim1) :: rbuf ! read buffer
+ INTEGER(HSIZE_T), DIMENSION(1:rank) :: data_dims ! dimensions of data buffers
+
+ INTEGER, DIMENSION(1:1) :: cd_values ! Auxiliary data for the filter
+ INTEGER(size_t) :: nelmts ! Number of elements in cd_values
+ INTEGER :: flags ! Bit vector specifying certain general properties of the filter
+ INTEGER(SIZE_T) :: namelen = 180 ! Anticipated number of characters in name
+ CHARACTER(LEN=180) :: name ! Name of the filter
+ INTEGER :: filter_id ! Filter identification number
+
+ ! Uncomment these variables to use SZIP compression
+ !INTEGER :: szip_options_mask
+ !INTEGER :: szip_pixels_per_block
+
+ !
+ !Initialize FORTRAN predifined datatypes
+ !
+ CALL h5open_f(error)
+ !
+ ! Create a file
+ CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error)
+ !
+ ! Create dataset "Compressed Data" in the group using absolute name.
+ dims(1:2) = (/dim0, dim1/)
+ CALL h5screate_simple_f(rank, dims, dataspace_id, error)
+ CALL h5pcreate_f(H5P_DATASET_CREATE_F, plist_id, error)
+ !
+ ! Dataset must be chunked for compression
+ cdims(1:2) = 20
+ CALL h5pset_chunk_f(plist_id, 2, cdims, error)
+
+ ! Set ZLIB / DEFLATE Compression using compression level 6.
+ ! To use SZIP Compression comment out these lines.
+ CALL h5pset_deflate_f(plist_id, 6, error)
+
+ ! Uncomment these lines to set SZIP Compression
+ !szip_options_mask = H5_SZIP_NN_OM_F
+ !szip_pixels_per_block = 16
+ !CALL H5Pset_szip_f(plist_id, szip_options_mask, szip_pixels_per_block, error)
+
+ ! Create data set
+ CALL h5dcreate_f(file_id, "Compressed_Data", H5T_NATIVE_INTEGER, dataspace_id, &
+ dataset_id, error, dcpl_id=plist_id)
+
+ DO j = 1, dim1
+ DO i = 1, dim0
+ buf(i,j) = i+j
+ ENDDO
+ ENDDO
+
+ data_dims(1:2) = (/dim0,dim1/)
+ CALL h5dwrite_f(dataset_id, H5T_NATIVE_INTEGER, buf, data_dims, error)
+
+ ! Close resources
+ CALL h5sclose_f(dataspace_id, error)
+ CALL h5pclose_f(plist_id, error)
+ CALL h5dclose_f(dataset_id, error)
+ CALL h5fclose_f(file_id, error)
+
+ ! Now reopen the file and dataset in the file.
+ CALL h5fopen_f(filename, H5F_ACC_RDONLY_F, file_id, error)
+ CALL h5dopen_f(file_id, "Compressed_Data", dataset_id, error)
+
+ ! Retrieve filter information.
+ CALL h5dget_create_plist_f(dataset_id, plist_id, error)
+
+ CALL h5pget_nfilters_f(plist_id, numfilt, error)
+ WRITE(*,'(A, I0)') "Number of filters associated with dataset: ", numfilt
+
+ DO i = 1, numfilt
+ nelmts = 1
+ CALL h5pget_filter_f(plist_id, 0, flags, nelmts, cd_values, &
+ namelen, name, filter_id, error)
+
+ WRITE(*,'(30X,A)', ADVANCE='NO')"Filter Type: "
+ IF(filter_id.EQ.H5Z_FILTER_DEFLATE_F)THEN
+ WRITE(*,'(A)') "H5Z_FILTER_DEFLATE"
+ ELSEIF (filter_id.EQ.H5Z_FILTER_SZIP_F)THEN
+ WRITE(*,'(A)') "H5Z_FILTER_SZIP"
+ ELSE
+ WRITE(*,'(A)') "Other filter type included"
+ ENDIF
+ ENDDO
+ data_dims(1:2) = (/dim0,dim1/)
+ CALL h5dread_f(dataset_id, H5T_NATIVE_INTEGER, rbuf, data_dims, error)
+
+ CALL h5dclose_f(dataset_id, error)
+ CALL h5pclose_f(plist_id, error)
+ CALL h5fclose_f(file_id, error)
+
+END PROGRAM h5_cmprss
diff --git a/fortran/examples/h5_crtatt.f90 b/fortran/examples/h5_crtatt.f90 new file mode 100644 index 0000000..79bc576 --- /dev/null +++ b/fortran/examples/h5_crtatt.f90 @@ -0,0 +1,106 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! This example shows how to create and write a dataset attribute. +! It opens the existing file 'dset.h5', obtains the identifier of +! the dataset "/dset", defines attribute's dataspace, +! creates dataset attribute, writes the attribute, and then closes +! the attribute's dataspace, attribute, dataset, and file. +! +! This example is used in the HDF5 Tutorial. + +PROGRAM H5_CRTATT + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5" ! File name + CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name + CHARACTER(LEN=9), PARAMETER :: aname = "attr_long" ! Attribute name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: attr_id ! Attribute identifier + INTEGER(HID_T) :: aspace_id ! Attribute Dataspace identifier + INTEGER(HID_T) :: atype_id ! Attribute Dataspace identifier + INTEGER(HSIZE_T), DIMENSION(1) :: adims = (/2/) ! Attribute dimension + INTEGER :: arank = 1 ! Attribure rank + INTEGER(SIZE_T) :: attrlen ! Length of the attribute string + + CHARACTER(LEN=80), DIMENSION(2) :: attr_data ! Attribute data + + INTEGER :: error ! Error flag + INTEGER(HSIZE_T), DIMENSION(1) :: data_dims + + ! + ! Initialize attribute's data + ! + attr_data(1) = "Dataset character attribute" + attr_data(2) = "Some other string here " + attrlen = 80 + ! + ! Initialize FORTRAN interface. + ! + CALL h5open_f(error) + ! + ! Open an existing file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + ! + ! Open an existing dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + ! + ! Create scalar data space for the attribute. + ! + CALL h5screate_simple_f(arank, adims, aspace_id, error) + ! + ! Create datatype for the attribute. + ! + CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype_id, error) + CALL h5tset_size_f(atype_id, attrlen, error) + ! + ! Create dataset attribute. + ! + CALL h5acreate_f(dset_id, aname, atype_id, aspace_id, attr_id, error) + ! + ! Write the attribute data. + ! + data_dims(1) = 2 + CALL h5awrite_f(attr_id, atype_id, attr_data, data_dims, error) + ! + ! Close the attribute. + ! + CALL h5aclose_f(attr_id, error) + ! + ! Terminate access to the data space. + ! + CALL h5sclose_f(aspace_id, error) + ! + ! End access to the dataset and release resources used by it. + ! + CALL h5dclose_f(dset_id, error) + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + ! + ! Close FORTRAN interface. + ! + CALL h5close_f(error) + +END PROGRAM H5_CRTATT + diff --git a/fortran/examples/h5_crtdat.f90 b/fortran/examples/h5_crtdat.f90 new file mode 100644 index 0000000..6e4c3a4 --- /dev/null +++ b/fortran/examples/h5_crtdat.f90 @@ -0,0 +1,86 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! +! The following example shows how to create an empty dataset. +! It creates a file called 'dsetf.h5', defines the +! dataset dataspace, creates a dataset which is a 4x6 integer array, +! and then closes the dataspace, the dataset, and the file. +! +! This example is used in the HDF5 Tutorial. + +PROGRAM H5_CRTDAT + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5" ! File name + CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dspace_id ! Dataspace identifier + + + INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions + INTEGER :: rank = 2 ! Dataset rank + + INTEGER :: error ! Error flag + + ! + ! Initialize FORTRAN interface. + ! + CALL h5open_f(error) + + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + + ! + ! Create the dataspace. + ! + CALL h5screate_simple_f(rank, dims, dspace_id, error) + + ! + ! Create the dataset with default properties. + ! + CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, & + dset_id, error) + + ! + ! End access to the dataset and release resources used by it. + ! + CALL h5dclose_f(dset_id, error) + + ! + ! Terminate access to the data space. + ! + CALL h5sclose_f(dspace_id, error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + + ! + ! Close FORTRAN interface. + ! + CALL h5close_f(error) + +END PROGRAM H5_CRTDAT + + diff --git a/fortran/examples/groupexample.f90 b/fortran/examples/h5_crtgrp.f90 index 91ebc50..278d175 100644 --- a/fortran/examples/groupexample.f90 +++ b/fortran/examples/h5_crtgrp.f90 @@ -18,47 +18,47 @@ ! It creates a file called 'group.h5', creates a group ! called MyGroup in the root group, and then closes the group and file. ! +! This example is used in the HDF5 Tutorial. +PROGRAM H5_CRTGRP - PROGRAM GROUPEXAMPLE + USE HDF5 ! This module contains all necessary modules - USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE - IMPLICIT NONE + CHARACTER(LEN=9), PARAMETER :: filename = "groupf.h5" ! File name + CHARACTER(LEN=7), PARAMETER :: groupname = "MyGroup" ! Group name - CHARACTER(LEN=9), PARAMETER :: filename = "groupf.h5" ! File name - CHARACTER(LEN=7), PARAMETER :: groupname = "MyGroup" ! Group name + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: group_id ! Group identifier - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: group_id ! Group identifier + INTEGER :: error ! Error flag + ! + ! Initialize FORTRAN interface. + ! + CALL h5open_f(error) + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) - INTEGER :: error ! Error flag -! -! Initialize FORTRAN interface. -! - CALL h5open_f(error) - ! - ! Create a new file using default properties. - ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) - - ! - ! Create a group named "/MyGroup" in the file. - ! - CALL h5gcreate_f(file_id, groupname, group_id, error) + ! + ! Create a group named "/MyGroup" in the file. + ! + CALL h5gcreate_f(file_id, groupname, group_id, error) - ! - ! Close the group. - ! - CALL h5gclose_f(group_id, error) + ! + ! Close the group. + ! + CALL h5gclose_f(group_id, error) - ! - ! Terminate access to the file. - ! - CALL h5fclose_f(file_id, error) -! -! Close FORTRAN interface. -! - CALL h5close_f(error) + ! + ! Terminate access to the file. + ! + CALL h5fclose_f(file_id, error) + ! + ! Close FORTRAN interface. + ! + CALL h5close_f(error) - END PROGRAM GROUPEXAMPLE +END PROGRAM H5_CRTGRP diff --git a/fortran/examples/h5_crtgrpar.f90 b/fortran/examples/h5_crtgrpar.f90 new file mode 100644 index 0000000..4ef008a --- /dev/null +++ b/fortran/examples/h5_crtgrpar.f90 @@ -0,0 +1,83 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! +! The following example code shows how to create groups +! using absolute and relative names. It creates three groups: +! the first two groups are created using the file identifier and +! the group absolute names, and the third group is created using +! a group identifier and the name relative to the specified group. +! +! This example is used in the HDF5 Tutorial. + +PROGRAM H5_CRTGRPAR + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=10), PARAMETER :: filename = "groupsf.h5" ! File name + CHARACTER(LEN=8), PARAMETER :: groupname1 = "/MyGroup" ! Group name + CHARACTER(LEN=16), PARAMETER :: groupname2 = "/MyGroup/Group_A" + ! Group name + CHARACTER(LEN=7), PARAMETER :: groupname3 = "Group_B" ! Group name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: group1_id, group2_id, group3_id ! Group identifiers + + INTEGER :: error ! Error flag + ! + ! Initialize FORTRAN interface. + ! + CALL h5open_f(error) + + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + + ! + ! Create group "MyGroup" in the root group using absolute name. + ! + CALL h5gcreate_f(file_id, groupname1, group1_id, error) + + ! + ! Create group "Group_A" in group "MyGroup" using absolute name. + ! + CALL h5gcreate_f(file_id, groupname2, group2_id, error) + + ! + ! Create group "Group_B" in group "MyGroup" using relative name. + ! + CALL h5gcreate_f(group1_id, groupname3, group3_id, error) + + ! + ! Close the groups. + ! + CALL h5gclose_f(group1_id, error) + CALL h5gclose_f(group2_id, error) + CALL h5gclose_f(group3_id, error) + + ! + ! Terminate access to the file. + ! + CALL h5fclose_f(file_id, error) + + ! + ! Close FORTRAN interface. + ! + CALL h5close_f(error) + +END PROGRAM H5_CRTGRPAR diff --git a/fortran/examples/h5_crtgrpd.f90 b/fortran/examples/h5_crtgrpd.f90 new file mode 100644 index 0000000..d35f03d --- /dev/null +++ b/fortran/examples/h5_crtgrpd.f90 @@ -0,0 +1,155 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! +! This example shows how to create a dataset in a particular group. +! It opens the file created in the previous example and creates two datasets. +! Absolute and relative dataset names are used. +! +! This example is used in the HDF5 Tutorial. + +PROGRAM H5_CRTGRPD + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=10), PARAMETER :: filename = "groupsf.h5" ! File name + CHARACTER(LEN=15), PARAMETER :: groupname = "MyGroup/Group_A" ! Group name + CHARACTER(LEN=13), PARAMETER :: dsetname1 = "MyGroup/dset1" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! dataset name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: group_id ! Group identifier + INTEGER(HID_T) :: dataset_id ! Dataset identifier + INTEGER(HID_T) :: dataspace_id ! Data space identifier + + INTEGER :: i, j + INTEGER :: error ! Error flag + + INTEGER, DIMENSION(3,3) :: dset1_data ! Data arrays + INTEGER, DIMENSION(2,10) :: dset2_data ! + + INTEGER(HSIZE_T), DIMENSION(2) :: dims1 = (/3,3/) ! Datasets dimensions + INTEGER(HSIZE_T), DIMENSION(2) :: dims2 = (/2,10/)! + INTEGER(HSIZE_T), DIMENSION(2) :: data_dims + + INTEGER :: rank = 2 ! Datasets rank + + ! + !Initialize dset1_data array + ! + DO i = 1, 3 + DO j = 1, 3 + dset1_data(i,j) = j; + END DO + END DO + + ! + !Initialize dset2_data array + ! + DO i = 1, 2 + DO j = 1, 10 + dset2_data(i,j) = j; + END DO + END DO + + ! + ! Initialize FORTRAN interface. + ! + CALL h5open_f(error) + + ! + ! Open an existing file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + + ! + ! Create the data space for the first dataset. + ! + CALL h5screate_simple_f(rank, dims1, dataspace_id, error) + + ! + ! Create a dataset in group "MyGroup" with default properties. + ! + CALL h5dcreate_f(file_id, dsetname1, H5T_NATIVE_INTEGER, dataspace_id, & + dataset_id, error) + + ! + ! Write the first dataset. + ! + data_dims(1) = 3 + data_dims(2) = 3 + CALL h5dwrite_f(dataset_id, H5T_NATIVE_INTEGER, dset1_data, data_dims, error) + + ! + ! Close the dataspace for the first dataset. + ! + CALL h5sclose_f(dataspace_id, error) + + ! + ! Close the first dataset. + ! + CALL h5dclose_f(dataset_id, error) + + ! + ! Open an existing group in the specified file. + ! + CALL h5gopen_f(file_id, groupname, group_id, error) + + ! + !Create the data space for the second dataset. + ! + CALL h5screate_simple_f(rank, dims2, dataspace_id, error) + + ! + ! Create the second dataset in group "Group_A" with default properties. + ! + CALL h5dcreate_f(group_id, dsetname2, H5T_NATIVE_INTEGER, dataspace_id, & + dataset_id, error) + + ! + ! Write the second dataset. + ! + data_dims(1) = 2 + data_dims(1) = 10 + CALL h5dwrite_f(dataset_id, H5T_NATIVE_INTEGER, dset2_data, data_dims, error) + + ! + ! Close the dataspace for the second dataset. + ! + CALL h5sclose_f(dataspace_id, error) + + ! + ! Close the second dataset. + ! + CALL h5dclose_f(dataset_id, error) + + ! + ! Close the group. + ! + CALL h5gclose_f(group_id, error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + + ! + ! Close FORTRAN interface. + ! + CALL h5close_f(error) + +END PROGRAM H5_CRTGRPD diff --git a/fortran/examples/h5_extend.f90 b/fortran/examples/h5_extend.f90 new file mode 100644 index 0000000..1316281 --- /dev/null +++ b/fortran/examples/h5_extend.f90 @@ -0,0 +1,233 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! This example extends an HDF5 dataset. It is used in the HDF5 Tutorial. + +PROGRAM H5_EXTEND + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + ! + !the dataset is stored in file "extend.h5" + ! + CHARACTER(LEN=9), PARAMETER :: filename = "extend.h5" + + ! + !dataset rank is 2 and name is "ExtendibleArray" + ! + CHARACTER(LEN=15), PARAMETER :: dsetname = "ExtendibleArray" + INTEGER :: RANK = 2 + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dataspace ! Dataspace identifier + INTEGER(HID_T) :: memspace ! Memory dataspace identifier + INTEGER(HID_T) :: crp_list ! Dataset creation property identifier + + ! + !dataset dimensions at creation time + ! + INTEGER(HSIZE_T), DIMENSION(1:2) :: dims = (/3,3/) + + ! + !data dimensions + ! + INTEGER(HSIZE_T), DIMENSION(1:2) :: dimsc = (/2,5/) + INTEGER(HSIZE_T), DIMENSION(1:2) :: dimsm = (/3,7/) + + ! + !Maximum dimensions + ! + INTEGER(HSIZE_T), DIMENSION(1:2) :: maxdims + + INTEGER(HSIZE_T), DIMENSION(1:2) :: offset + INTEGER(HSIZE_T), DIMENSION(1:2) :: count + + ! + ! Variables for reading and writing + ! + INTEGER, DIMENSION(1:3,1:3) :: data1 + INTEGER, DIMENSION(1:21) :: data2 = & + (/2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4/) + INTEGER(HSIZE_T), DIMENSION(1:2) :: data_dims + + ! + !Size of data in the file + ! + INTEGER(HSIZE_T), DIMENSION(1:2) :: size + + ! + !general purpose integer + ! + INTEGER :: i, j + + ! + !flag to check operation success + ! + INTEGER :: error + + ! + !Variables used in reading data back + ! + INTEGER(HSIZE_T), DIMENSION(1:2) :: dimsr, maxdimsr + INTEGER :: rankr + INTEGER, DIMENSION(1:3,1:10) :: rdata + + ! + !Initialize FORTRAN predifined datatypes + ! + CALL h5open_f(error) + + ! + !Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + + ! + !Create the data space with unlimited dimensions. + ! + maxdims = (/H5S_UNLIMITED_F, H5S_UNLIMITED_F/) + + CALL h5screate_simple_f(RANK, dims, dataspace, error, maxdims) + + ! + !Modify dataset creation properties, i.e. enable chunking + ! + CALL h5pcreate_f(H5P_DATASET_CREATE_F, crp_list, error) + + CALL h5pset_chunk_f(crp_list, RANK, dimsc, error) + + ! + !Create a dataset with 3X3 dimensions using cparms creation propertie . + ! + CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dataspace, & + dset_id, error, crp_list ) + CALL h5sclose_f(dataspace, error) + + ! + !Fill data array with 1's + ! + DO i = 1, dims(1) + DO j = 1, dims(2) + data1(i,j) = 1 + END DO + END DO + + ! + !Write data array to dataset + ! + data_dims(1:2) = (/3,3/) + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data1, data_dims, error) + + ! + !Extend the dataset. Dataset becomes 10 x 3. + ! + size(1:2) = (/3,10/) + CALL h5dset_extent_f(dset_id, size, error) + + offset(1:2) = (/0,3/) + count(1:2) = (/3,7/) + + CALL h5screate_simple_f (2, dimsm, memspace, error) + + ! + !Write to 3x7 extended part of dataset + ! + CALL h5dget_space_f(dset_id, dataspace, error) + CALL h5sselect_hyperslab_f(dataspace, H5S_SELECT_SET_F, & + offset, count, error) + + data_dims(1:2) = (/3,7/) + CALL H5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data2, data_dims, error, & + memspace, dataspace) + + ! + !Close the objects that were opened. + ! + CALL h5sclose_f(dataspace, error) + CALL h5pclose_f(crp_list, error) + CALL h5dclose_f(dset_id, error) + CALL h5fclose_f(file_id, error) + + ! + !read the data back + ! + !Open the file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDONLY_F, file_id, error) + + ! + !Open the dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + + ! + !Get dataset's dataspace handle. + ! + CALL h5dget_space_f(dset_id, dataspace, error) + + ! + !Get dataspace's rank. + ! + CALL h5sget_simple_extent_ndims_f(dataspace, rankr, error) + + ! + !Get dataspace's dimensions. + ! + CALL h5sget_simple_extent_dims_f(dataspace, dimsr, maxdimsr, error) + + ! + !Get creation property list. + ! + CALL h5dget_create_plist_f(dset_id, crp_list, error) + + ! + ! Fill read buffer with zeroes + ! + rdata(1:dimsr(1),1:dimsr(2)) = 0 + + ! + !create memory dataspace + ! + CALL h5screate_simple_f(rankr, dimsr, memspace, error) + + ! + !Read data + ! + data_dims(1:2) = (/3,10/) + CALL H5dread_f(dset_id, H5T_NATIVE_INTEGER, rdata, data_dims, & + error, memspace, dataspace) + + WRITE(*,'(A)') "Dataset:" + DO i = 1, dimsr(1) + WRITE(*,'(100(I0,1X))') rdata(i,1:dimsr(2)) + END DO + + ! + !Close the objects that were opened. + ! + CALL h5sclose_f(dataspace, error) + CALL h5sclose_f(memspace, error) + CALL h5pclose_f(crp_list, error) + CALL h5dclose_f(dset_id, error) + CALL h5fclose_f(file_id, error) + + !Close FORTRAN predefined datatypes + ! + CALL h5close_f(error) + +END PROGRAM H5_EXTEND diff --git a/fortran/examples/h5_rdwt.f90 b/fortran/examples/h5_rdwt.f90 new file mode 100644 index 0000000..ba05b2f --- /dev/null +++ b/fortran/examples/h5_rdwt.f90 @@ -0,0 +1,96 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! +! The following example shows how to write and read to/from an existing dataset. +! It opens the file created in the previous example, obtains the dataset +! identifier, writes the data to the dataset in the file, +! then reads the dataset to memory. +! +! This example is used in the HDF5 Tutorial. + +PROGRAM H5_RDWT + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5" ! File name + CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + + INTEGER :: error ! Error flag + INTEGER :: i, j + + INTEGER, DIMENSION(4,6) :: dset_data, data_out ! Data buffers + INTEGER(HSIZE_T), DIMENSION(2) :: data_dims + + ! + ! Initialize the dset_data array. + ! + DO i = 1, 4 + DO j = 1, 6 + dset_data(i,j) = (i-1)*6 + j + END DO + END DO + + ! + ! Initialize FORTRAN interface. + ! + CALL h5open_f(error) + + ! + ! Open an existing file. + ! + CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) + + ! + ! Open an existing dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + + ! + ! Write the dataset. + ! + data_dims(1) = 4 + data_dims(2) = 6 + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, data_dims, error) + + ! + ! Read the dataset. + ! + CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, data_dims, error) + + ! + ! Close the dataset. + ! + CALL h5dclose_f(dset_id, error) + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, error) + + ! + ! Close FORTRAN interface. + ! + CALL h5close_f(error) + +END PROGRAM H5_RDWT + + + diff --git a/fortran/examples/h5_subset.f90 b/fortran/examples/h5_subset.f90 new file mode 100644 index 0000000..6cb8f7a --- /dev/null +++ b/fortran/examples/h5_subset.f90 @@ -0,0 +1,184 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! This example shows how to write and read a hyperslab. +! It is used in the HDF5 Tutorial. +! + +PROGRAM H5_SUBSET + + USE HDF5 ! This module contains all necessary modules + + IMPLICIT NONE + + CHARACTER(LEN=9), PARAMETER :: filename = "subset.h5" ! File name + CHARACTER(LEN=8), PARAMETER :: dsetname = "IntArray" ! Dataset name + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: dataspace ! Dataspace identifier + INTEGER(HID_T) :: memspace ! memspace identifier + + ! + ! To change the subset size, modify size of dimsm, sdata, dim0_sub, + ! dim1_sub, and count + ! + INTEGER(HSIZE_T), DIMENSION(1:2) :: dimsm = (/4,3/) ! Dataset dimensions + INTEGER, DIMENSION(1:4,1:3) :: sdata ! Subset buffer + INTEGER :: dim0_sub = 4 + INTEGER :: dim1_sub = 3 + INTEGER(HSIZE_T), DIMENSION(1:2) :: count = (/4,3/) ! Size of hyperslab + INTEGER(HSIZE_T), DIMENSION(1:2) :: offset = (/2,1/) ! Hyperslab offset + INTEGER(HSIZE_T), DIMENSION(1:2) :: stride = (/1,1/) ! Hyperslab stride + INTEGER(HSIZE_T), DIMENSION(1:2) :: block = (/1,1/) ! Hyperslab block size + + INTEGER(HSIZE_T), DIMENSION(1:2) :: dimsf = (/10,8/) ! Dataset dimensions + + + INTEGER, DIMENSION(1:10,1:8) :: data ! Data to write + INTEGER, DIMENSION(1:10,1:8) :: rdata ! Data to read + + INTEGER :: rank = 2 ! Dataset rank ( in file ) + INTEGER :: dim0 = 10 ! Dataset size in file + INTEGER :: dim1 = 8 + + INTEGER :: i, j + + INTEGER :: error ! Error flag + INTEGER(HSIZE_T), DIMENSION(2) :: data_dims + + ! + ! Write data to the HDF5 file. + ! + + ! + ! Data initialization. + ! + DO i = 1, dim0 + DO j = 1, dim1 + IF (i .LE. (dim0 / 2)) THEN + data(i,j) = 1 + ELSE + data(i,j) = 2 + END IF + END DO + END DO + + ! + ! Initialize FORTRAN interface. + ! + CALL h5open_f(error) + + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + + ! + ! Create the data space for the dataset. + ! + CALL h5screate_simple_f(rank, dimsf, dataspace, error) + + ! + ! Create the dataset with default properties. + ! + CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dataspace, & + dset_id, error) + + ! + ! Write the dataset. + ! + data_dims(1) = dim0 + data_dims(2) = dim1 + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, data_dims, error) + + ! + ! Data Written to File + ! + WRITE(*,'(/,A)') "Original Data Written to File:" + DO i = 1, dim0 + WRITE(*,'(100(1X,I0,1X))') DATA(i,1:dim1) + END DO + + ! + ! + ! Close the dataspace, dataset, and file. + ! + CALL h5sclose_f(dataspace, error) + CALL h5dclose_f(dset_id, error) + CALL h5fclose_f(file_id, error) + + ! + ! Initialize subset data array. + ! + sdata(1:dim0_sub,1:dim1_sub) = 5 + + ! + ! Open the file. + ! + CALL h5fopen_f(filename, H5F_ACC_RDWR_F, file_id, error) + + ! + ! Open the dataset. + ! + CALL h5dopen_f(file_id, dsetname, dset_id, error) + + ! + ! Get dataset's dataspace identifier and select subset. + ! + CALL h5dget_space_f(dset_id, dataspace, error) + CALL h5sselect_hyperslab_f(dataspace, H5S_SELECT_SET_F, & + offset, count, error, stride, BLOCK) + ! + ! Create memory dataspace. + ! + CALL h5screate_simple_f(rank, dimsm, memspace, error) + + WRITE(*,'(/,A)') "Write subset to file specifying:" + WRITE(*,'(A,/)') " offset=2x1 stride=1x1 count=4x3 block=1x1" + + ! + ! Write subset to dataset + ! + data_dims(1:2) = (/dim0_sub, dim1_sub/) + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, sdata, data_dims, error, & + memspace, dataspace) + + data_dims(1:2) = (/dim0, dim1/) + CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, rdata, data_dims, error) + + ! + ! Read entire dataset back + ! + WRITE(*,'(A)') "Data in File after Subset Written:" + DO i = 1, dim0 + WRITE(*,'(100(1X,I0,1X))') rdata(i,1:dim1) + END DO + PRINT *, " " + + ! + ! Close everything opened. + ! + CALL h5sclose_f(dataspace, error) + CALL h5sclose_f(memspace, error) + CALL h5dclose_f(dset_id, error) + CALL h5fclose_f(file_id, error) + + ! + ! Close FORTRAN interface. + ! + CALL h5close_f(error) + +END PROGRAM H5_SUBSET diff --git a/fortran/examples/run-fortran-ex.sh.in b/fortran/examples/run-fortran-ex.sh.in index 873669f..c5c379e 100644 --- a/fortran/examples/run-fortran-ex.sh.in +++ b/fortran/examples/run-fortran-ex.sh.in @@ -70,20 +70,24 @@ RunTest() # Run tests if [ $? -eq 0 ] then - if (RunTest dsetexample &&\ - rm dsetexample &&\ - RunTest fileexample &&\ - rm fileexample &&\ - RunTest rwdsetexample &&\ - rm rwdsetexample &&\ - RunTest attrexample &&\ - rm attrexample &&\ - RunTest groupexample &&\ - rm groupexample &&\ - RunTest grpsexample &&\ - rm grpsexample &&\ - RunTest grpdsetexample &&\ - rm grpdsetexample &&\ + if (RunTest h5_cmprss &&\ + rm h5_cmprss &&\ + RunTest h5_crtdat &&\ + rm h5_crtdat &&\ + RunTest h5_extend &&\ + rm h5_extend &&\ + RunTest h5_rdwt &&\ + rm h5_rdwt &&\ + RunTest h5_crtatt &&\ + rm h5_crtatt &&\ + RunTest h5_crtgrp &&\ + rm h5_crtgrp &&\ + RunTest h5_crtgrpar &&\ + rm h5_crtgrpar &&\ + RunTest h5_crtgrpd &&\ + rm h5_crtgrpd &&\ + RunTest h5_subset &&\ + rm h5_subset &&\ RunTest hyperslab &&\ rm hyperslab &&\ RunTest selectele &&\ diff --git a/fortran/examples/rwdsetexample.f90 b/fortran/examples/rwdsetexample.f90 deleted file mode 100644 index 1e84e23..0000000 --- a/fortran/examples/rwdsetexample.f90 +++ /dev/null @@ -1,96 +0,0 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! Copyright by The HDF Group. * -! Copyright by the Board of Trustees of the University of Illinois. * -! All rights reserved. * -! * -! This file is part of HDF5. The full HDF5 copyright notice, including * -! terms governing use, modification, and redistribution, is contained in * -! the files COPYING and Copyright.html. COPYING can be found at the root * -! of the source code distribution tree; Copyright.html can be found at the * -! root level of an installed copy of the electronic HDF5 document set and * -! is linked from the top-level documents page. It can also be found at * -! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * -! access to either file, you may request a copy from help@hdfgroup.org. * -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -! -! -! The following example shows how to write and read to/from an existing dataset. -! It opens the file created in the previous example, obtains the dataset -! identifier, writes the data to the dataset in the file, -! then reads the dataset to memory. -! - - - PROGRAM RWDSETEXAMPLE - - USE HDF5 ! This module contains all necessary modules - - IMPLICIT NONE - - CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5" ! File name - CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name - - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: dset_id ! Dataset identifier - - INTEGER :: error ! Error flag - INTEGER :: i, j - - INTEGER, DIMENSION(4,6) :: dset_data, data_out ! Data buffers - INTEGER(HSIZE_T), DIMENSION(2) :: data_dims - - ! - ! Initialize the dset_data array. - ! - do i = 1, 4 - do j = 1, 6 - dset_data(i,j) = (i-1)*6 + j; - end do - end do - - ! - ! Initialize FORTRAN interface. - ! - CALL h5open_f(error) - - ! - ! Open an existing file. - ! - CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) - - ! - ! Open an existing dataset. - ! - CALL h5dopen_f(file_id, dsetname, dset_id, error) - - ! - ! Write the dataset. - ! - data_dims(1) = 4 - data_dims(2) = 6 - CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, data_dims, error) - - ! - ! Read the dataset. - ! - CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, data_dims, error) - - ! - ! Close the dataset. - ! - CALL h5dclose_f(dset_id, error) - - ! - ! Close the file. - ! - CALL h5fclose_f(file_id, error) - - ! - ! Close FORTRAN interface. - ! - CALL h5close_f(error) - - END PROGRAM RWDSETEXAMPLE - - - diff --git a/fortran/robodoc.rc b/fortran/robodoc.rc index 1366f77..07b8b35 100644 --- a/fortran/robodoc.rc +++ b/fortran/robodoc.rc @@ -9,13 +9,11 @@ items: AUTHOR CREATION DATE MODIFICATION HISTORY - HISTORY - INPUTS + HISTORY ARGUMENTS OPTIONS PARAMETERS SWITCHES - OUTPUTS SIDE EFFECTS RESULT RETURN VALUE @@ -41,12 +39,77 @@ items: USED BY PARENTS COMMANDS - SOURCE - CONTAINS SUBROUTINES + SOURCE + INPUTS + OUTPUTS OPTIONAL PARAMETERS + CONTAINS SUBROUTINES FILE + Fortran2003 Interface: + Fortran90 Interface: + Fortran2003 Derived Type: + Outputs: + Inputs: + Optional parameters: + Components: ignore items: + NAME COPYRIGHT + SYNOPSIS + USAGE + FUNCTION + DESCRIPTION + PURPOSE + AUTHOR + CREATION DATE + MODIFICATION HISTORY + HISTORY + ARGUMENTS + OPTIONS + PARAMETERS + SWITCHES + SIDE EFFECTS + RESULT + RETURN VALUE + EXAMPLE + NOTES + DIAGNOSTICS + WARNINGS + ERRORS + BUGS + TODO + IDEAS + PORTABILITY + SEE ALSO + METHODS + NEW METHODS + ATTRIBUTES + NEW ATTRIBUTES + TAGS + DERIVED FROM + DERIVED BY + USES + CHILDREN + USED BY + PARENTS + COMMANDS + CONTAINS SUBROUTINES + FILE +item order: + Fortran90 Interface: + Fortran2003 Interface: + Inputs: + Outputs: + Optional parameters: + Fortran2003 Derived Type: + Components: +source items: + Fortran90 Interface: + Fortran2003 Interface: + Fortran2003 Derived Type: + SOURCE + + headertypes: s Subroutines robo_subroutines options: @@ -60,14 +123,19 @@ options: --sections --sectionnameonly --documenttitle "HDF5 FORTRAN Developer's Guide" - --cmode + --footless + --headless + --one_file_per_header ignore files: .svn *~ *.o *e *.mod -accept files: + *_F90.f90 *.c +accept files: + *_F03.f90 + *_F90.f90 *.f90 *.h diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 3a47233..c41916a 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -142,13 +142,13 @@ SET_TARGET_PROPERTIES (${HDF5_F90_C_LIB_TARGET} PROPERTIES LINKER_LANGUAGE C) #----------------------------------------------------------------------------- # Fortran 2003 standard #----------------------------------------------------------------------------- -IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +IF (HDF5_ENABLE_F2003) # default real is 4 bytes, so include double signatures SET (F_STATUS "_F03") -ELSE (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +ELSE (HDF5_ENABLE_F2003) # default real is 8 bytes, so exclude double signatures SET (F_STATUS "_F90") -ENDIF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +ENDIF (HDF5_ENABLE_F2003) #----------------------------------------------------------------------------- # Fortran Real Size @@ -188,6 +188,7 @@ SET (f90_F_SRCS ${HDF5_F90_SRC_SOURCE_DIR}/H5Aff${F_STATUS}.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff${F_STATUS}.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Eff${F_STATUS}.f90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5Fff${F_STATUS}.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Lff${F_STATUS}.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Off${F_STATUS}.f90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Pff${F_STATUS}.f90 diff --git a/fortran/src/H5Aff.f90 b/fortran/src/H5Aff.f90 index 1926dd1..25f7fa7 100644 --- a/fortran/src/H5Aff.f90 +++ b/fortran/src/H5Aff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5A function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Aff_F03.f90 b/fortran/src/H5Aff_F03.f90 index b9e6c92..26c911a 100644 --- a/fortran/src/H5Aff_F03.f90 +++ b/fortran/src/H5Aff_F03.f90 @@ -61,7 +61,7 @@ ! (B) ! *** IMPORTANT *** ! If you add a new H5A function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Aff_F90.f90 b/fortran/src/H5Aff_F90.f90 index 7e14f7a..974b023 100644 --- a/fortran/src/H5Aff_F90.f90 +++ b/fortran/src/H5Aff_F90.f90 @@ -33,7 +33,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5A function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Dff.f90 b/fortran/src/H5Dff.f90 index b1e1df1..3ad868c 100644 --- a/fortran/src/H5Dff.f90 +++ b/fortran/src/H5Dff.f90 @@ -30,7 +30,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Dff_F03.f90 b/fortran/src/H5Dff_F03.f90 index 61d5dfc..be4bd69 100644 --- a/fortran/src/H5Dff_F03.f90 +++ b/fortran/src/H5Dff_F03.f90 @@ -74,7 +74,7 @@ ! ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Dff_F90.f90 b/fortran/src/H5Dff_F90.f90 index 3bb0fc0..46ea3ad 100644 --- a/fortran/src/H5Dff_F90.f90 +++ b/fortran/src/H5Dff_F90.f90 @@ -42,7 +42,7 @@ ! (3) ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5Eff.f90 b/fortran/src/H5Eff.f90 index 2e137df..7b56376 100644 --- a/fortran/src/H5Eff.f90 +++ b/fortran/src/H5Eff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5E function to the module you must add the function name -! to the Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! to the Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Eff_F03.f90 b/fortran/src/H5Eff_F03.f90 index 3a40a55..3ba3ce96 100644 --- a/fortran/src/H5Eff_F03.f90 +++ b/fortran/src/H5Eff_F03.f90 @@ -1,7 +1,7 @@ !****h* ROBODoc/H5E (F03) ! ! NAME -! H5L_PROVISIONAL +! H5E_PROVISIONAL ! ! FILE ! src/fortran/src/H5Eff_F03.f90 @@ -9,9 +9,9 @@ ! PURPOSE ! ! This file contains Fortran 90 and Fortran 2003 interfaces for H5E functions. -! It contains the same functions as H5Eff_DEPRECIATE.f90 but includes the +! It contains the same functions as H5Eff_F90.f90 but includes the ! Fortran 2003 functions and the interface listings. This file will be compiled -! instead of H5Eff_DEPRECIATE.f90 if Fortran 2003 functions are enabled. +! instead of H5Eff_F90.f90 if Fortran 2003 functions are enabled. ! ! ! COPYRIGHT @@ -33,7 +33,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5E function to the module you must add the function name -! to the Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! to the Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** @@ -44,10 +44,10 @@ MODULE H5E_PROVISIONAL CONTAINS -!****s* H5E/h5eset_auto2_f +!****s* H5E/h5eset_auto_f ! ! NAME -! h5eset_auto2_f +! h5eset_auto_f ! ! PURPOSE ! Returns settings for automatic error stack traversal function and its data. @@ -68,9 +68,9 @@ CONTAINS ! M. Scot Breitenfeld ! July 10, 2009 ! -! Signature: +! Fortran2003 Interface: SUBROUTINE h5eset_auto_f(printflag, hdferr, estack_id, func, client_data) - USE ISO_C_BINDING + USE, INTRINSIC :: ISO_C_BINDING INTEGER , INTENT(IN) :: printflag INTEGER , INTENT(OUT) :: hdferr INTEGER(HID_T), INTENT(IN) , OPTIONAL :: estack_id @@ -82,7 +82,7 @@ CONTAINS TYPE(C_PTR) :: client_data_default INTERFACE INTEGER FUNCTION h5eset_auto2_c(printflag, estack_id, func, client_data) - USE ISO_C_BINDING + USE, INTRINSIC :: ISO_C_BINDING USE H5GLOBAL !DEC$IF DEFINED(HDF5F90_WINDOWS) !DEC$ATTRIBUTES C,reference,decorate,alias:'H5ESET_AUTO2_C'::h5eset_auto2_c diff --git a/fortran/src/H5Eff_F90.f90 b/fortran/src/H5Eff_F90.f90 index e698a84..158ec12 100644 --- a/fortran/src/H5Eff_F90.f90 +++ b/fortran/src/H5Eff_F90.f90 @@ -28,7 +28,7 @@ ! ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5FDmpioff.f90 b/fortran/src/H5FDmpioff.f90 index f6f3108..5c81bc8 100644 --- a/fortran/src/H5FDmpioff.f90 +++ b/fortran/src/H5FDmpioff.f90 @@ -26,7 +26,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5P function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** @@ -174,24 +174,23 @@ CONTAINS ! access property list. ! ! INPUTS -! prp_id - file access property list identifier -! comm - MPI-2 communicator -! use_gpfs - logical flag to use the GPFS hints +! prp_id - File access property list identifier. +! comm - MPI-2 communicator. +! use_gpfs - Logical flag to use the GPFS hints. ! OUTPUTS -! hdferr - Returns 0 if successful and -1 if fails +! hdferr - Returns 0 if successful and -1 if fails. ! ! AUTHOR ! Elena Pourmal ! May 6, 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_fapl_mpiposix_f(prp_id, comm, use_gpfs, hdferr) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier - INTEGER, INTENT(IN) :: comm ! MPI communicator to be used for file open - ! as defined in MPI_FILE_OPEN of MPI-2 - LOGICAL, INTENT(IN) :: use_gpfs - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: prp_id + INTEGER, INTENT(IN) :: comm + LOGICAL, INTENT(IN) :: use_gpfs + INTEGER, INTENT(OUT) :: hdferr !***** INTEGER :: flag INTEGER, EXTERNAL :: h5pset_fapl_mpiposix_c @@ -209,22 +208,22 @@ CONTAINS ! Returns MPI communicator information. ! ! INPUTS -! prp_id - file access property list identifier +! prp_id - File access property list identifier. ! OUTPUTS -! comm - MPI-2 communicator -! use_gpfs - flag to use GPFS hints -! hdferr - Returns 0 if successful and -1 if fails +! comm - MPI-2 communicator. +! use_gpfs - Flag to use GPFS hints. +! hdferr - Returns 0 if successful and -1 if fails. ! AUTHOR ! Elena Pourmal ! May 6, 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_fapl_mpiposix_f(prp_id, comm, use_gpfs, hdferr) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier - INTEGER, INTENT(OUT) :: comm ! Buffer to return communicator - LOGICAL, INTENT(OUT) :: use_gpfs - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: prp_id + INTEGER, INTENT(OUT) :: comm + LOGICAL, INTENT(OUT) :: use_gpfs + INTEGER, INTENT(OUT) :: hdferr !***** INTEGER :: flag @@ -260,8 +259,8 @@ CONTAINS IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: dxpl_id INTEGER , INTENT(OUT) :: actual_io_mode - INTEGER , INTENT(OUT) :: hdferr -!***** + INTEGER , INTENT(OUT) :: hdferr +!***** INTERFACE INTEGER FUNCTION h5pget_mpio_actual_io_mode_c(dxpl_id, actual_io_mode) USE H5GLOBAL diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c index 1259d4d..4910aca 100644 --- a/fortran/src/H5Ff.c +++ b/fortran/src/H5Ff.c @@ -679,3 +679,37 @@ nh5fget_filesize_c(hid_t_f *file_id, hsize_t_f *size) done: return ret_value; } + +/****if* H5Ff/h5fget_file_image_c + * NAME + * h5fget_file_image_c + * PURPOSE + * Calls h5fget_file_image + * INPUTS + * file_id - Target file identifier. + * buf_ptr - Pointer to the buffer into which the image of the HDF5 file is to be copied. + * buf_len - Size of the supplied buffer. + * OUTPUTS + * buf_req - The size in bytes of the buffer required to store the file image. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * November 26, 2012 + * SOURCE +*/ +int_f +nh5fget_file_image_c(hid_t_f *file_id, void *buf_ptr, size_t_f *buf_len, size_t_f *buf_req) +/******/ +{ + herr_t ret_value=0; /* Return value */ + + /* + * Call h5fget_file_image function + */ + if ((*buf_req = (size_t_f)H5Fget_file_image((hid_t)*file_id, buf_ptr, (size_t)*buf_len)) < 0) + HGOTO_DONE(FAIL); + +done: + return ret_value; +} diff --git a/fortran/src/H5Fff.f90 b/fortran/src/H5Fff.f90 index 0c70ad4..faa1967 100644 --- a/fortran/src/H5Fff.f90 +++ b/fortran/src/H5Fff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5F function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Fff_F03.f90 b/fortran/src/H5Fff_F03.f90 new file mode 100644 index 0000000..1ccd39a --- /dev/null +++ b/fortran/src/H5Fff_F03.f90 @@ -0,0 +1,104 @@ +!****h* ROBODoc/H5F (F03) +! +! NAME +! H5F_PROVISIONAL +! +! PURPOSE +! This file contains Fortran 2003 interfaces for H5F functions. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! NOTES +! *** IMPORTANT *** +! If you add a new H5T function you must add the function name to the +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. +! This is needed for Windows based operating systems. +! +!***** + + +MODULE H5F_PROVISIONAL + + USE H5GLOBAL + USE, INTRINSIC :: ISO_C_BINDING + + +CONTAINS +!****s* H5F (F03)/h5fget_file_image_f_F03 +! +! NAME +! h5fget_file_image_f +! +! PURPOSE +! Retrieves a copy of the image of an existing, open file. +! +! Inputs: +! file_id - Target file identifier. +! buf_ptr - Pointer to the buffer into which the image of the HDF5 file is to be copied. +! buf_len - Size of the supplied buffer. +! +! Outputs: +! hdferr - error code: +! 0 on success and -1 on failure +! Optional: +! buf_size - The size in bytes of the buffer required to store the file image. +! +! AUTHOR +! M. Scot Breitenfeld +! November 26, 2012 +! +! Fortran2003 Interface: + SUBROUTINE h5fget_file_image_f(file_id, buf_ptr, buf_len, hdferr, buf_size) + USE, INTRINSIC :: ISO_C_BINDING + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: file_id + TYPE(C_PTR) , INTENT(INOUT) :: buf_ptr + INTEGER(SIZE_T) , INTENT(IN) :: buf_len + INTEGER(SIZE_T) , INTENT(OUT), OPTIONAL :: buf_size + INTEGER , INTENT(OUT) :: hdferr +!***** + + INTEGER(SIZE_T) :: buf_size_default + + INTERFACE + INTEGER FUNCTION h5fget_file_image_c(file_id, buf_ptr, buf_len, buf_size) + USE, INTRINSIC :: ISO_C_BINDING + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5FGET_FILE_IMAGE_C'::h5fget_file_image_c + !DEC$ENDIF + INTEGER(HID_T) , INTENT(IN) :: file_id + TYPE(C_PTR) , VALUE :: buf_ptr + INTEGER(SIZE_T) , INTENT(IN) :: buf_len + INTEGER(SIZE_T), INTENT(IN) :: buf_size + END FUNCTION h5fget_file_image_c + END INTERFACE + + + IF(PRESENT(buf_size))THEN + buf_ptr = C_NULL_PTR + ENDIF + + hdferr = h5fget_file_image_c(file_id, buf_ptr, buf_len, buf_size_default) + + IF(PRESENT(buf_size))THEN + buf_size = buf_size_default + ENDIF + + END SUBROUTINE h5fget_file_image_f + +END MODULE H5F_PROVISIONAL diff --git a/fortran/examples/fileexample.f90 b/fortran/src/H5Fff_F90.f90 index 87119d2..b6e659b 100644 --- a/fortran/examples/fileexample.f90 +++ b/fortran/src/H5Fff_F90.f90 @@ -1,3 +1,16 @@ +!****h* ROBODoc/H5F (F90) +! +! NAME +! H5F_PROVISIONAL +! +! PURPOSE +! This file contains Fortran 90 interfaces for H5F functions. It +! containsthe same functions as H5Fff_F03.f90, when applicable, +! but excludes the Fortran 2003 functions and the interface listings. +! This file will be compiled instead of H5Fff_F03.f90 if Fortran 2003 +! functions are not enabled. +! +! COPYRIGHT ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * @@ -13,37 +26,18 @@ ! access to either file, you may request a copy from help@hdfgroup.org. * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! +! NOTES +! *** IMPORTANT *** +! If you add a new H5F function you must add the function name to the +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. +! This is needed for Windows based operating systems. ! -! The following example demonstrates how to create and close an HDF5 file. -! It creates a file called 'file.h5', and then closes the file. -! - - PROGRAM FILEEXAMPLE - - USE HDF5 ! This module contains all necessary modules +!***** - IMPLICIT NONE - CHARACTER(LEN=8), PARAMETER :: filename = "filef.h5" ! File name - INTEGER(HID_T) :: file_id ! File identifier +MODULE H5F_PROVISIONAL - INTEGER :: error ! Error flag + USE H5GLOBAL + IMPLICIT NONE -! -! Initialize FORTRAN interface. -! - CALL h5open_f (error) - ! - ! Create a new file using default properties. - ! - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) - - ! - ! Terminate access to the file. - ! - CALL h5fclose_f(file_id, error) -! -! Close FORTRAN interface. -! - CALL h5close_f(error) - END PROGRAM FILEEXAMPLE +END MODULE H5F_PROVISIONAL diff --git a/fortran/src/H5Gff.f90 b/fortran/src/H5Gff.f90 index 6bcee7c..d4d7496 100644 --- a/fortran/src/H5Gff.f90 +++ b/fortran/src/H5Gff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5G function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** @@ -927,7 +927,7 @@ CONTAINS ! Buffer to hold a comment INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER :: namelen ! Lenghth of the current_name string + INTEGER :: namelen ! Length of the current_name string INTERFACE INTEGER FUNCTION h5gget_comment_c(loc_id, name, namelen, size, buffer) diff --git a/fortran/src/H5Iff.f90 b/fortran/src/H5Iff.f90 index 86e88b9..7c9a843 100644 --- a/fortran/src/H5Iff.f90 +++ b/fortran/src/H5Iff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5I function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Lf.c b/fortran/src/H5Lf.c index e5b01ed..c5138b6 100644 --- a/fortran/src/H5Lf.c +++ b/fortran/src/H5Lf.c @@ -725,7 +725,7 @@ nh5lget_name_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, if(NULL == (c_name = (char *)HDmalloc(c_size))) HGOTO_DONE(FAIL) - if((*size = (size_t)H5Lget_name_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_field, + if((*size = (size_t_f)H5Lget_name_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_field, (H5_iter_order_t)*order, (hsize_t)*n,c_name, c_size, (hid_t)*lapl_id)) < 0) HGOTO_DONE(FAIL) diff --git a/fortran/src/H5Lff.f90 b/fortran/src/H5Lff.f90 index 8043d74..4660e52 100644 --- a/fortran/src/H5Lff.f90 +++ b/fortran/src/H5Lff.f90 @@ -27,7 +27,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5L function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Lff_F03.f90 b/fortran/src/H5Lff_F03.f90 index 56062b2..7d8713e 100644 --- a/fortran/src/H5Lff_F03.f90 +++ b/fortran/src/H5Lff_F03.f90 @@ -32,7 +32,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5A function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Lff_F90.f90 b/fortran/src/H5Lff_F90.f90 index c802af7..dd62b7b 100644 --- a/fortran/src/H5Lff_F90.f90 +++ b/fortran/src/H5Lff_F90.f90 @@ -30,7 +30,7 @@ ! ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c index 4c77d3d..8e75989 100644 --- a/fortran/src/H5Of.c +++ b/fortran/src/H5Of.c @@ -24,6 +24,83 @@ #include "H5f90.h" #include "H5Eprivate.h" +int_f +fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info) { + + struct tm *ts; + + object_info->fileno = Oinfo.fileno; + object_info->addr = (haddr_t_f)Oinfo.addr; + + object_info->type = (int_f)Oinfo.type; + object_info->rc = (int_f)Oinfo.rc; + + ts = HDgmtime(&Oinfo.atime); + + object_info->atime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ + object_info->atime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ + object_info->atime[2] = (int_f)ts->tm_mday; + object_info->atime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ + object_info->atime[4] = (int_f)ts->tm_hour; + object_info->atime[5] = (int_f)ts->tm_min; + object_info->atime[6] = (int_f)ts->tm_sec; + object_info->atime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + + ts = HDgmtime(&Oinfo.btime); + + object_info->btime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ + object_info->btime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ + object_info->btime[2] = (int_f)ts->tm_mday; + object_info->btime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ + object_info->btime[4] = (int_f)ts->tm_hour; + object_info->btime[5] = (int_f)ts->tm_min; + object_info->btime[6] = (int_f)ts->tm_sec; + object_info->btime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + + ts = HDgmtime(&Oinfo.ctime); + + object_info->ctime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ + object_info->ctime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ + object_info->ctime[2] = (int_f)ts->tm_mday; + object_info->ctime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ + object_info->ctime[4] = (int_f)ts->tm_hour; + object_info->ctime[5] = (int_f)ts->tm_min; + object_info->ctime[6] = (int_f)ts->tm_sec; + object_info->ctime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + + ts = HDgmtime(&Oinfo.mtime); + + object_info->mtime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ + object_info->mtime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ + object_info->mtime[2] = (int_f)ts->tm_mday; + object_info->mtime[3] = 0; /* time is expressed as UTC (or GMT timezone) */ + object_info->mtime[4] = (int_f)ts->tm_hour; + object_info->mtime[5] = (int_f)ts->tm_min; + object_info->mtime[6] = (int_f)ts->tm_sec; + object_info->mtime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + + object_info->num_attrs = (hsize_t_f)Oinfo.num_attrs; + + object_info->hdr.version = (int_f)Oinfo.hdr.version; + object_info->hdr.nmesgs = (int_f)Oinfo.hdr.nmesgs; + object_info->hdr.nchunks = (int_f)Oinfo.hdr.nchunks; + object_info->hdr.flags = (int_f)Oinfo.hdr.flags; + + object_info->hdr.space.total = (hsize_t_f)Oinfo.hdr.space.total; + object_info->hdr.space.meta = (hsize_t_f)Oinfo.hdr.space.meta; + object_info->hdr.space.mesg = (hsize_t_f)Oinfo.hdr.space.mesg; + object_info->hdr.space.free = (hsize_t_f)Oinfo.hdr.space.free; + + object_info->hdr.mesg.present = Oinfo.hdr.mesg.present; + object_info->hdr.mesg.shared = Oinfo.hdr.mesg.shared; + + object_info->meta_size.obj.index_size = (hsize_t_f)Oinfo.meta_size.obj.index_size; + object_info->meta_size.obj.heap_size = (hsize_t_f)Oinfo.meta_size.obj.heap_size; + + return 0; + +} + /****if* H5Of/h5olink_c * NAME * h5olink_c @@ -215,7 +292,7 @@ nh5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id) return ret_value; } -/* ***if* H5Of/H5Oget_info_by_name_c +/****if* H5Of/H5Oget_info_by_name_c * NAME * H5Oget_info_by_name_c * PURPOSE @@ -226,10 +303,7 @@ nh5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id) * namelen - Name length. * lapl_id - Link access property list. * OUTPUTS - * corder_valid - Indicates whether the the creation order data is valid for this attribute. - * corder - Is a positive integer containing the creation order of the attribute. - * cset - Indicates the character set used for the attribute’s name. - * data_size - indicates the size, in the number of characters, of the attribute. + * object_info - Buffer in which to return object information. * * RETURNS * 0 on success, -1 on failure @@ -261,74 +335,100 @@ nh5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f * &Oinfo, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); - object_info->fileno = Oinfo.fileno; - object_info->addr = (haddr_t_f)Oinfo.addr; - - - object_info->type = (int_f)Oinfo.type; - object_info->rc = (int_f)Oinfo.rc; - - ts = gmtime(&Oinfo.atime); - - object_info->atime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ - object_info->atime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ - object_info->atime[2] = (int_f)ts->tm_mday; -/* object_info->atime[3] = (int_f)ts->tm_gmtoff; /\* convert from seconds to minutes *\/ */ - object_info->atime[4] = (int_f)ts->tm_hour; - object_info->atime[5] = (int_f)ts->tm_min; - object_info->atime[6] = (int_f)ts->tm_sec; - object_info->atime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ - - ts = gmtime(&Oinfo.btime); - - object_info->btime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ - object_info->btime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ - object_info->btime[2] = (int_f)ts->tm_mday; -/* object_info->btime[3] = (int_f)ts->tm_gmtoff/60; /\* convert from seconds to minutes *\/ */ - object_info->btime[4] = (int_f)ts->tm_hour; - object_info->btime[5] = (int_f)ts->tm_min; - object_info->btime[6] = (int_f)ts->tm_sec; - object_info->btime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ - - ts = gmtime(&Oinfo.ctime); + ret_value = fill_h5o_info_t_f(Oinfo,object_info); - object_info->ctime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ - object_info->ctime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ - object_info->ctime[2] = (int_f)ts->tm_mday; -/* object_info->ctime[3] = (int_f)ts->tm_gmtoff/60; /\* convert from seconds to minutes *\/ */ - object_info->ctime[4] = (int_f)ts->tm_hour; - object_info->ctime[5] = (int_f)ts->tm_min; - object_info->ctime[6] = (int_f)ts->tm_sec; - object_info->ctime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + done: + if(c_name) + HDfree(c_name); + return ret_value; +} - ts = gmtime(&Oinfo.mtime); +/****if* H5Of/H5Oget_info_by_idx_c + * NAME + * H5Oget_info_by_idx_c + * PURPOSE + * Calls H5Oget_info_by_idx + * INPUTS + * loc_id - File or group identifier specifying location of group in which object is located. + * name - Name of group, relative to loc_id. + * namelen - Name length. + * lapl_id - Link access property list. + * OUTPUTS + * object_info - Buffer in which to return object information. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * December 1, 2008 + * SOURCE +*/ +int_f +nh5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, + int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info) +/******/ +{ + char *c_group_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + H5O_info_t Oinfo; + H5_index_t c_index_field; + H5_iter_order_t c_order; + + /* + * Convert FORTRAN name to C name + */ + if((c_group_name = HD5f2cstring( group_name, (size_t)*namelen)) == NULL) + HGOTO_DONE(FAIL); - object_info->mtime[0] = (int_f)ts->tm_year+1900; /* year starts at 1900 */ - object_info->mtime[1] = (int_f)ts->tm_mon+1; /* month starts at 0 in C */ - object_info->mtime[2] = (int_f)ts->tm_mday; -/* object_info->mtime[3] = (int_f)ts->tm_gmtoff/60; /\* convert from seconds to minutes *\/ */ - object_info->mtime[4] = (int_f)ts->tm_hour; - object_info->mtime[5] = (int_f)ts->tm_min; - object_info->mtime[6] = (int_f)ts->tm_sec; - object_info->mtime[7] = -32767; /* millisecond is not available, assign it -HUGE(0) */ + c_index_field = (H5_index_t)*index_field; + c_order = (H5_iter_order_t)*order; - object_info->num_attrs = (hsize_t_f)Oinfo.num_attrs; + /* + * Call H5Oinfo_by_idx function. + */ + if(H5Oget_info_by_idx((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, + &Oinfo, (hid_t)*lapl_id) < 0) + HGOTO_DONE(FAIL); - object_info->hdr.version = (int_f)Oinfo.hdr.version; - object_info->hdr.nmesgs = (int_f)Oinfo.hdr.nmesgs; - object_info->hdr.nchunks = (int_f)Oinfo.hdr.nchunks; - object_info->hdr.flags = (int_f)Oinfo.hdr.flags; + ret_value = fill_h5o_info_t_f(Oinfo,object_info); - object_info->hdr.space.total = (hsize_t_f)Oinfo.hdr.space.total; - object_info->hdr.space.meta = (hsize_t_f)Oinfo.hdr.space.meta; - object_info->hdr.space.mesg = (hsize_t_f)Oinfo.hdr.space.mesg; - object_info->hdr.space.free = (hsize_t_f)Oinfo.hdr.space.free; + done: + if(c_group_name) + HDfree(c_group_name); + return ret_value; +} - object_info->hdr.mesg.present = Oinfo.hdr.mesg.present; - object_info->hdr.mesg.shared = Oinfo.hdr.mesg.shared; +/****if* H5Of/H5Oget_info_c + * NAME + * H5Oget_info_c + * PURPOSE + * Calls H5Oget_info + * INPUTS + * object_id - Identifier for target object. + * OUTPUTS + * object_info - Buffer in which to return object information. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 16, 2012 + * SOURCE +*/ +int_f +nh5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info) +/******/ +{ + int_f ret_value = 0; /* Return value */ + H5O_info_t Oinfo; + + /* + * Call H5Oinfo_by_name function. + */ + if(H5Oget_info((hid_t)*object_id, &Oinfo) < 0) + HGOTO_DONE(FAIL); - object_info->meta_size.obj.index_size = (hsize_t_f)Oinfo.meta_size.obj.index_size; - object_info->meta_size.obj.heap_size = (hsize_t_f)Oinfo.meta_size.obj.heap_size; + ret_value = fill_h5o_info_t_f(Oinfo,object_info); done: return ret_value; @@ -391,3 +491,428 @@ nh5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len, return ret_value; } + +/****if* H5Of/h5ovisit_by_name_c + * NAME + * h5ovisit_by_name_c + * PURPOSE + * Calls H5Ovisit_by_name + * INPUTS + * object_id - Identifier specifying subject group + * index_type - Type of index which determines the order + * order - Order within index + * idx - Iteration position at which to start + * op - Callback function passing data regarding the link to the calling application + * op_data - User-defined pointer to data required by the application for its processing of the link + * + * OUTPUTS + * idx - Position at which an interrupted iteration may be restarted + * + * RETURNS + * >0 on success, 0< on failure + * AUTHOR + * M. Scot Breitenfeld + * May 16, 2012 + * SOURCE +*/ +int_f +nh5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order, + H5O_iterate_t op, void *op_data, hid_t_f *lapl_id ) +/******/ +{ + int_f ret_value = -1; /* Return value */ + herr_t func_ret_value; /* H5Linterate return value */ + char *c_object_name = NULL; /* Buffer to hold C string */ + + + /* + * Convert FORTRAN name to C name + */ + if( (c_object_name = HD5f2cstring(object_name, (size_t)*namelen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Ovisit + */ + func_ret_value = H5Ovisit_by_name( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, + op, op_data, (hid_t)*lapl_id); + ret_value = (int_f)func_ret_value; + + done: + if(c_object_name) + HDfree(c_object_name); + return ret_value; + +} + +/****if* H5Of/h5odecr_refcount_c + * NAME + * h5odecr_refcount_c + * PURPOSE + * Calls H5Odecr_refcount + * INPUTS + * object_id - Object identifier. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 16, 2012 + * SOURCE +*/ +int_f +nh5odecr_refcount_c (hid_t_f *object_id) +/******/ +{ + int_f ret_value = 0; /* Return value */ + + /* + * Call H5Odecr_refcount function. + */ + if((hid_t_f)H5Odecr_refcount((hid_t)*object_id) < 0) + HGOTO_DONE(FAIL); + + done: + return ret_value; +} + +/****if* H5Of/h5oexists_by_name_c + * NAME + * h5oexists_by_name_c + * PURPOSE + * Calls H5Oexists_by_name + * INPUTS + * loc_id - File or group identifier + * name - Attribute access property list + * namelen - Size of name + * lapl_id - Link access property list + * + * RETURNS + * link status: 0 = false, 1 = true, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 17, 2012 + * SOURCE +*/ +int_f +nh5oexists_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id) +/******/ +{ + char *c_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + htri_t status = 0; + + /* + * Convert FORTRAN name to C name + */ + if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Oopen function. + */ + if((ret_value = (int_f)H5Oexists_by_name((hid_t)*loc_id, c_name, (hid_t)*lapl_id)) < 0) + HGOTO_DONE(FAIL); + + done: + if(c_name) + HDfree(c_name); + return ret_value; +} + +/****if* H5Of/h5oincr_refcount_c + * NAME + * h5oincr_refcount_c + * PURPOSE + * Calls H5Oincr_refcount + * INPUTS + * object_id - Object identifier. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 16, 2012 + * SOURCE +*/ +int_f +nh5oincr_refcount_c (hid_t_f *object_id) +/******/ +{ + int_f ret_value = 0; /* Return value */ + + /* + * Call H5Oincr_refcount function. + */ + if((hid_t_f)H5Oincr_refcount((hid_t)*object_id) < 0) + HGOTO_DONE(FAIL); + + done: + return ret_value; +} + +/****if* H5Of/h5oset_comment_c + * NAME + * h5oset_comment_c + * PURPOSE + * Calls H5Oset_comment + * INPUTS + * object_id - Identifier of the target object. + * comment - The new comment. + * commentlen - Length of the comment. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 17, 2012 + * SOURCE +*/ +int_f +nh5oset_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentlen) +/******/ +{ + char *c_comment = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + + /* + * Convert FORTRAN string to C string + */ + if((c_comment = HD5f2cstring(comment, (size_t)*commentlen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Oset_comment function. + */ + if((hid_t_f)H5Oset_comment((hid_t)*object_id, c_comment) < 0) + HGOTO_DONE(FAIL); + + done: + if(c_comment) + HDfree(c_comment); + return ret_value; +} + +/****if* H5Of/h5oset_comment_by_name_c + * NAME + * h5oset_comment_by_name_c + * PURPOSE + * Calls H5Oset_comment_by_name + * INPUTS + * object_id - Identifier of the target object. + * name - Name of the object whose comment is to be set or reset, + * specified as a path relative to loc_id. + * namelen - Length of the name. + * comment - The new comment. + * commentlen - Length of the comment. + * lapl_id - Link access property list identifier. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 17, 2012 + * SOURCE +*/ +int_f +nh5oset_comment_by_name_c (hid_t_f *object_id, _fcd name, size_t_f *namelen, _fcd comment, size_t_f *commentlen, hid_t_f *lapl_id) +/******/ +{ + char *c_comment = NULL; /* Buffer to hold C string */ + char *c_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + + /* + * Convert FORTRAN string to C string + */ + if((c_comment = HD5f2cstring(comment, (size_t)*commentlen)) == NULL) + HGOTO_DONE(FAIL); + /* + * Convert FORTRAN string to C string + */ + if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL) + HGOTO_DONE(FAIL); + + /* + * Call H5Oset_comment_by_name function. + */ + if((hid_t_f)H5Oset_comment_by_name((hid_t)*object_id, c_name, c_comment, (hid_t)*lapl_id) < 0) + HGOTO_DONE(FAIL); + + done: + if(c_name) + HDfree(c_name); + if(c_comment) + HDfree(c_comment); + return ret_value; +} +/****if* H5Of/h5oopen_by_idx_c + * NAME + * h5oopen_by_idx_c + * PURPOSE + * Calls H5Oopen_by_idx_c + * INPUTS + * loc_id - A file or group identifier. + * group_name - Name of group, relative to loc_id, in which object is located. + * group_namelen - Length of group_name + * index_type - Type of index by which objects are ordered. + * order - Order of iteration within index. + * n - Object to open. + * lapl_id - Link access property list. + * OUTPUTS + * obj_id - An object identifier for the opened object. + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * May 17, 2012 + * SOURCE +*/ +int_f +nh5oopen_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen, + int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id) +/******/ +{ + char *c_group_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; + H5_index_t c_index_type; + H5_iter_order_t c_order; + + /* + * Convert FORTRAN string to C string + */ + if((c_group_name = HD5f2cstring( group_name, (size_t)*group_namelen)) == NULL) + HGOTO_DONE(FAIL); + + c_index_type = (H5_index_t)*index_type; + c_order = (H5_iter_order_t)*order; + + /* + * Call H5Oopen_by_idx function. + */ + if((*obj_id =(hid_t_f)H5Oopen_by_idx((hid_t)*loc_id, c_group_name, c_index_type, c_order, (hsize_t)*n, (hid_t)*lapl_id)) < 0) + HGOTO_DONE(FAIL); + + done: + if(c_group_name) + HDfree(c_group_name); + return ret_value; +} + +/****if* H5Of/h5oget_comment_c + * NAME + * h5oget_comment_c + * PURPOSE + * Calls H5Oget_comment + * INPUTS + * object_id - Identifier for the target object. + * bufsize - Anticipated required size of the comment buffer. + * OUTPUTS + * comment - The comment. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * June 24, 2012 + * SOURCE +*/ +int_f +nh5oget_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssize_t_f *bufsize) +/******/ +{ + char *c_comment = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + size_t c_commentsize; + + c_commentsize = (size_t)*commentsize + 1; + + /* + * Allocate buffer to hold comment name + */ + + if(NULL == (c_comment = (char *)HDmalloc(c_commentsize))) + HGOTO_DONE(FAIL); + + /* + * Call H5Oget_comment function. + */ + + if((*bufsize = (hssize_t_f)H5Oget_comment((hid_t)*object_id, c_comment, (size_t)*commentsize)) < 0) + HGOTO_DONE(FAIL); + + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + if(c_comment) + HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1); + return ret_value; + + done: + if(c_comment) + HDfree(c_comment); + + return ret_value; +} + +/****if* H5Of/h5oget_comment_by_name_c + * NAME + * h5oget_comment_by_name_c + * PURPOSE + * Calls H5Oget_comment_by_name + * INPUTS + * object_id - Identifier for the target object. + * bufsize - Anticipated required size of the comment buffer. + * OUTPUTS + * comment - The comment. + * + * RETURNS + * 0 on success, -1 on failure + * AUTHOR + * M. Scot Breitenfeld + * July 6, 2012 + * SOURCE +*/ +int_f +nh5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size, + _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id) +/******/ +{ + char *c_comment = NULL; /* Buffer to hold C string */ + char *c_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ + size_t c_commentsize; + + /* + * Convert FORTRAN string to C string + */ + if((c_name = HD5f2cstring(name, (size_t)*name_size)) == NULL) + HGOTO_DONE(FAIL); + + c_commentsize = (size_t)*commentsize + 1; + + /* + * Allocate buffer to hold comment name + */ + + if(NULL == (c_comment = (char *)HDmalloc(c_commentsize))) + HGOTO_DONE(FAIL); + + /* + * Call H5Oget_comment_by_name function. + */ + + if((*bufsize = (size_t_f)H5Oget_comment_by_name((hid_t)*loc_id, c_name, c_comment, (size_t)*commentsize,(hid_t)*lapl_id )) < 0) + HGOTO_DONE(FAIL); + + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + if(c_comment) + HD5packFstring(c_comment, _fcdtocp(comment), c_commentsize - 1); + return ret_value; + + done: + if(c_comment) + HDfree(c_comment); + if(c_name) + HDfree(c_name); + + return ret_value; +} diff --git a/fortran/src/H5Off.f90 b/fortran/src/H5Off.f90 index 4f1ea18..1437e9f 100644 --- a/fortran/src/H5Off.f90 +++ b/fortran/src/H5Off.f90 @@ -31,7 +31,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5O function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** @@ -119,15 +119,15 @@ CONTAINS ! Opens an object in an HDF5 file by location identifier and path name. ! ! Inputs: -! loc_id - File or group identifier. -! name - Path to the object, relative to loc_id. +! loc_id - File or group identifier. +! name - Path to the object, relative to loc_id. ! ! Outputs: -! obj_id - Object identifier for the opened object. -! hdferr - Returns 0 if successful and -1 if fails. +! obj_id - Object identifier for the opened object. +! hdferr - Returns 0 if successful and -1 if fails. ! ! Optional parameters: -! lapl_id - Access property list identifier for the link pointing to the object. +! lapl_id - Access property list identifier for the link pointing to the object. ! ! AUTHOR ! M. Scot Breitenfeld @@ -215,12 +215,12 @@ CONTAINS ! Opens an object using its address within an HDF5 file. ! ! Inputs: -! loc_id - File or group identifier. -! addr - Object’s address in the file. +! loc_id - File or group identifier. +! addr - Object’s address in the file. ! ! Outputs: -! obj_id - Object identifier for the opened object. -! hdferr - Returns 0 if successful and -1 if fails. +! obj_id - Object identifier for the opened object. +! hdferr - Returns 0 if successful and -1 if fails. ! ! AUTHOR ! M. Scot Breitenfeld @@ -321,5 +321,455 @@ CONTAINS END SUBROUTINE h5ocopy_f +!****s* H5O/h5odecr_refcount_f +! NAME +! h5odecr_refcount_f +! +! PURPOSE +! Decrements an object reference count. +! +! Inputs: +! object_id - Object identifier. +! +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5odecr_refcount_f(object_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: object_id + INTEGER , INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION h5odecr_refcount_c(object_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5ODECR_REFCOUNT_C'::h5odecr_refcount_c + !DEC$ENDIF + INTEGER(HID_T) , INTENT(IN) :: object_id + END FUNCTION h5odecr_refcount_c + END INTERFACE + + hdferr = h5odecr_refcount_c(object_id) + + END SUBROUTINE h5odecr_refcount_f + +!****s* H5O/h5oexists_by_name_f +! NAME +! h5oexists_by_name_f +! +! PURPOSE +! Determines whether a link resolves to an actual object. +! +! Inputs: +! loc_id - Identifier of the file or group to query. +! name - The name of the link to check. +! +! +! Optional parameters: +! lapl_id - Link access property list identifier. +! +! Outputs: +! link_exists - Existing link resolves to an object. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oexists_by_name_f(loc_id, name, link_exists, hdferr, lapl_id) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + LOGICAL , INTENT(OUT) :: link_exists + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN), OPTIONAL :: lapl_id +!***** + + INTEGER(size_t) :: namelen + INTEGER :: status + INTEGER(HID_T) :: lapl_id_default + + INTERFACE + INTEGER FUNCTION h5oexists_by_name_c(loc_id, name, namelen, lapl_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OEXISTS_BY_NAME_C'::h5oexists_by_name_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(SIZE_T) , INTENT(IN) :: namelen + INTEGER(HID_T) , INTENT(IN) :: lapl_id + + END FUNCTION h5oexists_by_name_c + END INTERFACE + + namelen = LEN(name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + status = h5oexists_by_name_c(loc_id, name, namelen, lapl_id_default) + + link_exists = .FALSE. + IF(status.EQ.1)THEN + link_exists = .TRUE. + ENDIF + + hdferr = 0 + IF(status.LT.0)THEN + hdferr = -1 + ENDIF + + END SUBROUTINE h5oexists_by_name_f + +!****s* H5O/h5oget_comment_f +! NAME +! h5oget_comment_f +! +! PURPOSE +! Retrieves comment for specified object. +! +! Inputs: +! obj_id - Identifier for the target object. +! +! Optional parameters: +! bufsize - Size of the comment buffer. +! +! Outputs: +! comment - The comment. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oget_comment_f(obj_id, comment, hdferr, bufsize) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: obj_id + CHARACTER(LEN=*) , INTENT(OUT) :: comment + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HSSIZE_T), INTENT(OUT), OPTIONAL :: bufsize +!***** + + INTEGER(SIZE_T) :: commentsize_default + INTEGER(HSSIZE_T) :: bufsize_default + + INTERFACE + INTEGER FUNCTION h5oget_comment_c(obj_id, comment, commentsize_default, bufsize) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_COMMENT_C'::h5oget_comment_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: comment + INTEGER(HID_T) , INTENT(IN) :: obj_id + CHARACTER(LEN=*), INTENT(OUT) :: comment + INTEGER(SIZE_T) , INTENT(IN) :: commentsize_default + INTEGER(HSSIZE_T) , INTENT(OUT) :: bufsize + END FUNCTION h5oget_comment_c + END INTERFACE + + commentsize_default = LEN(comment) + + hdferr = h5oget_comment_c(obj_id, comment, commentsize_default, bufsize_default) + + IF(PRESENT(bufsize)) bufsize = bufsize_default + + END SUBROUTINE h5oget_comment_f + +!****s* H5O/h5oget_comment_by_name_f +! NAME +! h5oget_comment_by_name_f +! +! PURPOSE +! Retrieves comment for specified object. +! +! Inputs: +! loc_id - Identifier of a file, group, dataset, or named datatype. +! name - Name of the object whose comment is to be retrieved, +! specified as a path relative to loc_id. +! +! Optional parameters: +! bufsize - Size of the comment buffer. +! +! Outputs: +! comment - The comment. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! July 6, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oget_comment_by_name_f(loc_id, name, comment, hdferr, bufsize, lapl_id) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + CHARACTER(LEN=*), INTENT(OUT) :: comment + INTEGER , INTENT(OUT) :: hdferr + INTEGER(SIZE_T) , INTENT(OUT), OPTIONAL :: bufsize + INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id +!***** + + INTEGER(SIZE_T) :: commentsize_default + INTEGER(SIZE_T) :: name_size + INTEGER(SIZE_T) :: bufsize_default + INTEGER(HID_T) :: lapl_id_default + INTERFACE + INTEGER FUNCTION h5oget_comment_by_name_c(loc_id, name, name_size, & + comment, commentsize_default, bufsize_default, lapl_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_COMMENT_BY_NAME_C'::h5oget_comment_by_name_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: comment, name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(SIZE_T) , INTENT(IN) :: name_size + CHARACTER(LEN=*), INTENT(OUT) :: comment + INTEGER(SIZE_T) , INTENT(IN) :: commentsize_default + INTEGER(SIZE_T) , INTENT(OUT) :: bufsize_default + INTEGER(HID_T) , INTENT(IN) :: lapl_id + END FUNCTION h5oget_comment_by_name_c + END INTERFACE + + commentsize_default = LEN(comment) + name_size = LEN(name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + hdferr = h5oget_comment_by_name_c(loc_id, name, name_size, & + comment, commentsize_default, bufsize_default, lapl_id_default) + + IF(PRESENT(bufsize)) bufsize = bufsize_default + + END SUBROUTINE h5oget_comment_by_name_f + +!****s* H5O/h5oincr_refcount_f +! NAME +! h5oincr_refcount_f +! +! PURPOSE +! Increments an object reference count. +! +! Inputs: +! obj_id - Object identifier. +! +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 15, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oincr_refcount_f(obj_id, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: obj_id + INTEGER , INTENT(OUT) :: hdferr +!***** + + INTERFACE + INTEGER FUNCTION h5oincr_refcount_c(obj_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OINCR_REFCOUNT_C'::h5oincr_refcount_c + !DEC$ENDIF + INTEGER(HID_T) , INTENT(IN) :: obj_id + END FUNCTION h5oincr_refcount_c + END INTERFACE + + hdferr = h5oincr_refcount_c(obj_id) + + END SUBROUTINE h5oincr_refcount_f + +!****s* H5O/h5oopen_by_idx_f +! +! NAME +! h5oopen_by_idx_f +! +! PURPOSE +! Open the nth object in a group. +! +! Inputs: +! loc_id - A file or group identifier. +! group_name - Name of group, relative to loc_id, in which object is located. +! index_type - Type of index by which objects are ordered. +! order - Order of iteration within index, NOTE: zero-based. +! n - Object to open. +! +! Outputs: +! obj_id - An object identifier for the opened object. +! hdferr - Returns 0 if successful and -1 if fails. +! +! Optional parameters: +! lapl_id - Link access property list. +! +! AUTHOR +! M. Scot Breitenfeld +! May 17, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oopen_by_idx_f(loc_id, group_name, index_type, order, n, obj_id, & + hdferr, lapl_id) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: group_name + INTEGER , INTENT(IN) :: index_type + INTEGER , INTENT(IN) :: order + INTEGER(HSIZE_T), INTENT(IN) :: n + INTEGER(HID_T) , INTENT(OUT) :: obj_id + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id +!***** + INTEGER(SIZE_T) :: group_namelen + INTEGER(HID_T) :: lapl_id_default + + INTERFACE + INTEGER FUNCTION h5oopen_by_idx_c(loc_id, group_name, group_namelen, index_type, order, n, obj_id, lapl_id_default) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OOPEN_BY_IDX_C'::h5oopen_by_idx_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: group_name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: group_name + INTEGER(SIZE_T) , INTENT(IN) :: group_namelen + INTEGER , INTENT(IN) :: index_type + INTEGER , INTENT(IN) :: order + INTEGER(HSIZE_T), INTENT(IN) :: n + INTEGER(HID_T) , INTENT(OUT) :: obj_id + INTEGER(HID_T) , INTENT(IN) :: lapl_id_default + + END FUNCTION h5oopen_by_idx_c + END INTERFACE + + group_namelen = LEN(group_name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + hdferr = h5oopen_by_idx_c(loc_id, group_name, group_namelen, index_type, order, n, obj_id, lapl_id_default) + + END SUBROUTINE H5Oopen_by_idx_f + +!****s* H5O/h5oset_comment_f +! NAME +! h5oset_comment_f +! +! PURPOSE +! Sets comment for specified object. +! +! Inputs: +! obj_id - Identifier of the target object. +! comment - The new comment. +! +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 15, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oset_comment_f(obj_id, comment, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: obj_id + CHARACTER(LEN=*), INTENT(IN) :: comment + INTEGER , INTENT(OUT) :: hdferr +!***** + INTEGER(SIZE_T) :: commentlen + + INTERFACE + INTEGER FUNCTION h5oset_comment_c(obj_id, comment, commentlen) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OSET_COMMENT_C'::h5oset_comment_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: comment + INTEGER(HID_T) , INTENT(IN) :: obj_id + CHARACTER(LEN=*), INTENT(IN) :: comment + INTEGER(SIZE_T) , INTENT(IN) :: commentlen + + END FUNCTION h5oset_comment_c + END INTERFACE + + commentlen = LEN(comment) + + hdferr = h5oset_comment_c(obj_id, comment, commentlen) + + END SUBROUTINE h5oset_comment_f + +!****s* H5O/h5oset_comment_by_name_f +! NAME +! h5oset_comment_by_name_f +! +! PURPOSE +! Sets comment for specified object. +! +! Inputs: +! loc_id - Identifier of a file, group, dataset, or named datatype. +! name - Name of the object whose comment is to be set or reset, +! specified as a path relative to loc_id. +! comment - The new comment. +! +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails. +! +! Optional parameters: +! lapl_id - Link access property list identifier. +! +! AUTHOR +! M. Scot Breitenfeld +! May 15, 2012 +! +! Fortran90 Interface: + SUBROUTINE h5oset_comment_by_name_f(loc_id, name, comment, hdferr, lapl_id) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: name + CHARACTER(LEN=*), INTENT(IN) :: comment + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN), OPTIONAL :: lapl_id +!***** + INTEGER(SIZE_T) :: commentlen + INTEGER(SIZE_T) :: namelen + INTEGER(HID_T) :: lapl_id_default + + INTERFACE + INTEGER FUNCTION h5oset_comment_by_name_c(loc_id, name, namelen, comment, commentlen, lapl_id) + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OSET_COMMENT_BY_NAME_C'::h5oset_comment_by_name_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name, comment + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: comment + INTEGER(SIZE_T) , INTENT(IN) :: commentlen + CHARACTER(LEN=*), INTENT(IN) :: name + INTEGER(SIZE_T) , INTENT(IN) :: namelen + INTEGER(HID_T) , INTENT(IN) :: lapl_id + END FUNCTION h5oset_comment_by_name_c + END INTERFACE + + commentlen = LEN(comment) + namelen = LEN(name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + hdferr = h5oset_comment_by_name_c(loc_id, name, namelen, comment, commentlen, lapl_id_default) + + END SUBROUTINE h5oset_comment_by_name_f + END MODULE H5O diff --git a/fortran/src/H5Off_F03.f90 b/fortran/src/H5Off_F03.f90 index 8eb7a4b..0cf4d46 100644 --- a/fortran/src/H5Off_F03.f90 +++ b/fortran/src/H5Off_F03.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5P function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** @@ -82,9 +82,9 @@ MODULE H5O_PROVISIONAL ENDTYPE meta_size_t TYPE, BIND(C) :: h5o_info_t - INTEGER(c_long) :: fileno ! File number that object is located in + INTEGER(C_LONG) :: fileno ! File number that object is located in INTEGER(haddr_t) :: addr ! Object address in file - INTEGER :: type ! Basic object type (group, dataset, etc.) + INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.) INTEGER :: rc ! Reference count of object INTEGER, DIMENSION(8) :: atime ! Access time ! -- NOTE -- @@ -181,14 +181,14 @@ CONTAINS ! Inputs: ! loc_id - File or group identifier specifying location of group ! in which object is located. -! name - Name of group, relative to loc_id +! name - Name of group, relative to loc_id. ! ! Outputs: -! object_info - Buffer in which to return object information -! hdferr - Returns 0 if successful and -1 if fails +! object_info - Buffer in which to return object information. +! hdferr - Returns 0 if successful and -1 if fails. ! ! Optional parameters: -! lapl_id - Link access property list +! lapl_id - Link access property list. ! ! AUTHOR ! M. Scot Breitenfeld @@ -218,11 +218,12 @@ CONTAINS !DEC$IF DEFINED(HDF5F90_WINDOWS) !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_INFO_BY_NAME_C'::h5oget_info_by_name_c !DEC$ENDIF + !DEC$ATTRIBUTES reference :: name INTEGER(HID_T) , INTENT(IN) :: loc_id CHARACTER(LEN=*), INTENT(IN) :: name INTEGER(SIZE_T) , INTENT(IN) :: namelen INTEGER(HID_T) , INTENT(IN) :: lapl_id_default - TYPE(C_PTR),value :: object_info + TYPE(C_PTR),VALUE :: object_info END FUNCTION h5oget_info_by_name_c END INTERFACE @@ -238,5 +239,222 @@ CONTAINS END SUBROUTINE H5Oget_info_by_name_f +!****s* H5O (F03)/h5oget_info_f_F03 +! +! NAME +! h5oget_info_f +! +! PURPOSE +! Retrieves the metadata for an object specified by an identifier. +! +! Inputs: +! object_id - Identifier for target object. +! +! Outputs: +! object_info - Buffer in which to return object information. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran2003 Interface: + SUBROUTINE h5oget_info_f(object_id, object_info, hdferr) + + USE, INTRINSIC :: ISO_C_BINDING + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: object_id + TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info + INTEGER , INTENT(OUT) :: hdferr +!***** + TYPE(C_PTR) :: ptr + + INTERFACE + INTEGER FUNCTION h5oget_info_c(object_id, object_info) + USE H5GLOBAL + USE, INTRINSIC :: ISO_C_BINDING + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_INFO_C'::h5oget_info_c + !DEC$ENDIF + INTEGER(HID_T), INTENT(IN) :: object_id + TYPE(C_PTR), VALUE :: object_info + + END FUNCTION h5oget_info_c + END INTERFACE + + ptr = C_LOC(object_info) + hdferr = H5Oget_info_c(object_id, ptr) + + END SUBROUTINE H5Oget_info_f + +!****s* H5O (F03)/h5oget_info_by_idx_f_F03 +! +! NAME +! h5oget_info_by_idx_f +! +! PURPOSE +! Retrieves the metadata for an object, identifying the object by an index position. +! +! Inputs: +! loc_id - File or group identifier specifying location of group +! in which object is located. +! group_name - Name of group in which object is located. +! index_field - Index or field that determines the order. +! order - Order within field or index. +! n - Object for which information is to be returned +! +! Outputs: +! object_info - Buffer in which to return object information. +! hdferr - Returns 0 if successful and -1 if fails. +! +! Optional parameters: +! lapl_id - Link access property list. (Not currently used.) +! +! AUTHOR +! M. Scot Breitenfeld +! May 11, 2012 +! +! Fortran2003 Interface: + SUBROUTINE h5oget_info_by_idx_f(loc_id, group_name, index_field, order, n, & + object_info, hdferr, lapl_id) + + USE, INTRINSIC :: ISO_C_BINDING + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: group_name + INTEGER , INTENT(IN) :: index_field + INTEGER , INTENT(IN) :: order + INTEGER(HSIZE_T), INTENT(IN) :: n + TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id +!***** + INTEGER :: corder_valid + INTEGER(SIZE_T) :: namelen + INTEGER(HID_T) :: lapl_id_default + TYPE(C_PTR) :: ptr + + INTERFACE + INTEGER FUNCTION h5oget_info_by_idx_c(loc_id, group_name, namelen, & + index_field, order, n, lapl_id_default, object_info) + USE H5GLOBAL + USE, INTRINSIC :: ISO_C_BINDING + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OGET_INFO_BY_IDX_C'::h5oget_info_by_idx_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: group_name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: group_name + INTEGER(SIZE_T) , INTENT(IN) :: namelen + INTEGER , INTENT(IN) :: index_field + INTEGER , INTENT(IN) :: order + INTEGER(HSIZE_T), INTENT(IN) :: n + INTEGER(HID_T) , INTENT(IN) :: lapl_id_default + TYPE(C_PTR), VALUE :: object_info + + END FUNCTION h5oget_info_by_idx_c + END INTERFACE + + namelen = LEN(group_name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + ptr = C_LOC(object_info) + hdferr = H5Oget_info_by_idx_c(loc_id, group_name, namelen, index_field, order, n, lapl_id_default, ptr) + + END SUBROUTINE H5Oget_info_by_idx_f + + +!****s* H5O (F03)/h5ovisit_by_name_f_F03 +! +! NAME +! h5ovisit_by_name_f +! +! PURPOSE +! Recursively visits all objects starting from a specified object. +! +! Inputs: +! loc_id - Identifier of a file or group. +! object_name - Name of the object, generally relative to loc_id, that will serve as root of the iteration +! index_type - Type of index; valid values include: +! H5_INDEX_NAME_F +! H5_INDEX_CRT_ORDER_F +! order - Order in which index is traversed; valid values include: +! H5_ITER_DEC_F +! H5_ITER_INC_F +! H5_ITER_NATIVE_F +! op - Callback function passing data regarding the group to the calling application +! op_data - User-defined pointer to data required by the application for its processing of the group +! +! Outputs: +! return_value - Returns the return value of the first operator that returns a positive value, or +! zero if all members were processed with no operator returning non-zero. +! hdferr - Returns 0 if successful and -1 if fails +! +! Optional parameters: +! lapl_id - Link access property list identifier. +! +! AUTHOR +! M. Scot Breitenfeld +! November 19, 2008 +! +! Fortran2003 Interface: + SUBROUTINE h5ovisit_by_name_f(loc_id, object_name, index_type, order, op, op_data, & + return_value, hdferr, lapl_id) + USE, INTRINSIC :: ISO_C_BINDING + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: object_name + INTEGER , INTENT(IN) :: index_type + INTEGER , INTENT(IN) :: order + + TYPE(C_FUNPTR) :: op + TYPE(C_PTR) :: op_data + INTEGER , INTENT(OUT) :: return_value + INTEGER , INTENT(OUT) :: hdferr + INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id +!***** + + INTEGER(SIZE_T) :: namelen + INTEGER(HID_T) :: lapl_id_default + TYPE(C_PTR) :: ptr + + INTERFACE + INTEGER FUNCTION h5ovisit_by_name_c(loc_id, object_name, namelen, index_type, order, & + op, op_data, lapl_id) + USE, INTRINSIC :: ISO_C_BINDING + USE H5GLOBAL + !DEC$IF DEFINED(HDF5F90_WINDOWS) + !DEC$ATTRIBUTES C,reference,decorate,alias:'H5OVISIT_BY_NAME_C'::h5ovisit_by_name_c + !DEC$ENDIF + !DEC$ATTRIBUTES reference :: object_name + INTEGER(HID_T) , INTENT(IN) :: loc_id + CHARACTER(LEN=*), INTENT(IN) :: object_name + INTEGER(SIZE_T) :: namelen + INTEGER , INTENT(IN) :: index_type + INTEGER , INTENT(IN) :: order + TYPE(C_FUNPTR) , VALUE :: op + TYPE(C_PTR) , VALUE :: op_data + INTEGER(HID_T) , INTENT(IN) :: lapl_id + END FUNCTION h5ovisit_by_name_c + END INTERFACE + + namelen = LEN(object_name) + + lapl_id_default = H5P_DEFAULT_F + IF(PRESENT(lapl_id)) lapl_id_default = lapl_id + + return_value = h5ovisit_by_name_c(loc_id, object_name, namelen, index_type, order, & + op, op_data, lapl_id_default) + + IF(return_value.GE.0)THEN + hdferr = 0 + ELSE + hdferr = -1 + END IF + + END SUBROUTINE h5ovisit_by_name_f + END MODULE H5O_PROVISIONAL diff --git a/fortran/src/H5Off_F90.f90 b/fortran/src/H5Off_F90.f90 index 53553d6..5688c5d 100644 --- a/fortran/src/H5Off_F90.f90 +++ b/fortran/src/H5Off_F90.f90 @@ -30,7 +30,7 @@ ! ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5Pff.f90 b/fortran/src/H5Pff.f90 index 587f6f9..a3c9a60 100644 --- a/fortran/src/H5Pff.f90 +++ b/fortran/src/H5Pff.f90 @@ -27,7 +27,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5P function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** @@ -85,7 +85,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pcreate_f(class, prp_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: class @@ -140,7 +140,7 @@ CONTAINS ! Datatype of the flag parameter is changed from ! INTEGER to LOGICAL June 4, 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_preserve_f(prp_id, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -198,7 +198,7 @@ CONTAINS ! INTEGER to LOGICAL ! June 4, 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_preserve_f(prp_id, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -262,7 +262,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_class_f(prp_id, classtype, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -320,7 +320,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pcopy_f(prp_id, new_prp_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -370,7 +370,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pclose_f(prp_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -420,7 +420,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_chunk_f(prp_id, ndims, dims, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -476,7 +476,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_chunk_f(prp_id, ndims, dims, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -532,7 +532,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_deflate_f(prp_id, level, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -586,7 +586,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_version_f(prp_id, boot, freelist, & stab, shhdr, hdferr) IMPLICIT NONE @@ -649,7 +649,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_userblock_f (prp_id, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -701,7 +701,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_userblock_f(prp_id, block_size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -753,7 +753,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_sizes_f (prp_id, sizeof_addr, sizeof_size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -809,7 +809,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_sizes_f(prp_id, sizeof_addr, sizeof_size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -866,7 +866,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_sym_k_f (prp_id, ik, lk, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -921,7 +921,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_sym_k_f(prp_id, ik, lk, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -975,7 +975,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_istore_k_f (prp_id, ik, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1027,7 +1027,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_istore_k_f(prp_id, ik, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1080,7 +1080,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_driver_f(prp_id, driver, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1130,7 +1130,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_fapl_stdio_f (prp_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1218,7 +1218,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_fapl_sec2_f (prp_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1306,7 +1306,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_alignment_f(prp_id, threshold, alignment, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1361,7 +1361,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_alignment_f(prp_id, threshold, alignment, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1415,7 +1415,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_fapl_core_f(prp_id, increment, backing_store, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1474,7 +1474,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_fapl_core_f(prp_id, increment, backing_store, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1533,7 +1533,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_fapl_family_f(prp_id, memb_size, memb_plist , hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1589,7 +1589,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_fapl_family_f(prp_id, memb_size, memb_plist , hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1652,7 +1652,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_cache_f(prp_id, mdc_nelmts,rdcc_nelmts, rdcc_nbytes, rdcc_w0, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1721,7 +1721,7 @@ CONTAINS ! Bug fix: type of the rdcc_nelmts parameter should be INTEGER ! instead of INTEGER(SIZE_T) October 10, 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_cache_f(prp_id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1787,7 +1787,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_fapl_split_f(prp_id, meta_ext, meta_plist, raw_ext, raw_plist, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1907,7 +1907,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_gc_references_f (prp_id, gc_reference, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -1961,7 +1961,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_gc_references_f(prp_id, gc_reference, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -2019,7 +2019,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_layout_f (prp_id, layout, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -2079,7 +2079,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_layout_f (prp_id, layout, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -2135,7 +2135,7 @@ CONTAINS ! Elena Pourmal ! February, 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_filter_f(prp_id, filter, flags, cd_nelmts, cd_values, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -2195,7 +2195,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_nfilters_f (prp_id, nfilters, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -2257,7 +2257,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_filter_f(prp_id, filter_number, flags, cd_nelmts, cd_values, namelen, name, filter_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -2333,7 +2333,7 @@ CONTAINS ! ! Changed type of 'offset' from integer to off_t -- MSB January 9, 2012 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_external_f(prp_id, name, offset, bytes, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -2395,7 +2395,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_external_count_f (prp_id, count, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -2456,7 +2456,7 @@ CONTAINS ! ! Changed type of 'offset' from integer to off_t -- MSB January 9, 2012 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_external_f(prp_id, idx, name_size, name, offset,bytes, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -2523,7 +2523,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_btree_ratios_f(prp_id, left, middle, right, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -2583,7 +2583,7 @@ CONTAINS ! called C functions (it is needed for Windows ! port). March 14, 2001 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_btree_ratios_f(prp_id, left, middle, right, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -2643,7 +2643,7 @@ CONTAINS ! HISTORY ! ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_fclose_degree_f(fapl_id, degree, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: fapl_id ! File Access Property list identifier @@ -2697,7 +2697,7 @@ CONTAINS ! Elena Pourmal ! September 26, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_fclose_degree_f(fapl_id, degree, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: fapl_id ! File Access Property list identifier @@ -2747,7 +2747,7 @@ CONTAINS ! Elena Pourmal ! September 30, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pequal_f(plist1_id, plist2_id, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist1_id ! Property list identifier @@ -2795,7 +2795,7 @@ CONTAINS ! Elena Pourmal ! October 2, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_buffer_f(plist_id, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Data transfer property list identifier @@ -2841,7 +2841,7 @@ CONTAINS ! Elena Pourmal ! October 2, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_buffer_f(plist_id, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Data transfer property list identifier @@ -2892,7 +2892,7 @@ CONTAINS ! Elena Pourmal ! October 4, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pfill_value_defined_f(plist_id, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Dataset creation property list identifier @@ -2944,7 +2944,7 @@ CONTAINS ! Elena Pourmal ! October 4, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_alloc_time_f(plist_id, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Dataset creation property list identifier @@ -2998,7 +2998,7 @@ CONTAINS ! Elena Pourmal ! October 4, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_alloc_time_f(plist_id, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Dataset creation property list identifier @@ -3050,7 +3050,7 @@ CONTAINS ! Elena Pourmal ! October 4, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_fill_time_f(plist_id, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Dataset creation property list identifier @@ -3101,7 +3101,7 @@ CONTAINS ! Elena Pourmal ! October 4, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_fill_time_f(plist_id, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Dataset creation property list identifier @@ -3148,7 +3148,7 @@ CONTAINS ! Elena Pourmal ! October 7, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_meta_block_size_f(plist_id, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! File access property list identifier @@ -3191,7 +3191,7 @@ CONTAINS ! Elena Pourmal ! October 7, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_meta_block_size_f(plist_id, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! File access property list identifier @@ -3234,7 +3234,7 @@ CONTAINS ! Elena Pourmal ! October 7, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_sieve_buf_size_f(plist_id, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! File access property list identifier @@ -3278,7 +3278,7 @@ CONTAINS ! Elena Pourmal ! October 7, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_sieve_buf_size_f(plist_id, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! File access property list identifier @@ -3322,7 +3322,7 @@ CONTAINS ! Elena Pourmal ! October 7, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_small_data_block_size_f(plist_id, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! File access property list identifier @@ -3366,7 +3366,7 @@ CONTAINS ! Elena Pourmal ! October 7, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_small_data_block_size_f(plist_id, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! File access property list identifier @@ -3410,7 +3410,7 @@ CONTAINS ! Elena Pourmal ! October 7, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_hyper_vector_size_f(plist_id, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Dataset transfer property list identifier @@ -3454,7 +3454,7 @@ CONTAINS ! Elena Pourmal ! October 7, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_hyper_vector_size_f(plist_id, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Dataset transfer property list identifier @@ -3499,7 +3499,7 @@ CONTAINS ! Elena Pourmal ! October 9, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pexist_f(prp_id, name, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -3557,7 +3557,7 @@ CONTAINS ! HISTORY ! ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_size_f(prp_id, name, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -3606,7 +3606,7 @@ CONTAINS ! Elena Pourmal ! October 9, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_nprops_f(prp_id, nprops, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -3656,7 +3656,7 @@ CONTAINS ! HISTORY ! Returned the size of name as an argument ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_class_name_f(prp_id, name, size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -3709,7 +3709,7 @@ CONTAINS ! Elena Pourmal ! October 9, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_class_parent_f(prp_id, parent_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -3754,7 +3754,7 @@ CONTAINS ! Elena Pourmal ! October 9, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pisa_class_f(plist, pclass, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist ! Property list identifier @@ -3803,7 +3803,7 @@ CONTAINS ! Elena Pourmal ! October 9, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pcopy_prop_f(dst_id, src_id, name, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: dst_id ! Destination property list @@ -3854,7 +3854,7 @@ CONTAINS ! Elena Pourmal ! October 9, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5premove_f(plid, name, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plid ! Property list identifier @@ -3901,7 +3901,7 @@ CONTAINS ! Elena Pourmal ! October 9, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5punregister_f(class, name, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: class ! property list class identifier @@ -3947,7 +3947,7 @@ CONTAINS ! Elena Pourmal ! October 9, 2002 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pclose_class_f(class, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: class ! Property list class identifier @@ -3984,7 +3984,7 @@ CONTAINS ! Elena Pourmal ! March 12, 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_shuffle_f(prp_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -4030,7 +4030,7 @@ CONTAINS ! Elena Pourmal ! March 13, 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_edc_check_f(prp_id, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -4075,7 +4075,7 @@ CONTAINS ! Elena Pourmal ! March 13, 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_edc_check_f(prp_id, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Dataset transfer property list identifier @@ -4126,7 +4126,7 @@ CONTAINS ! Elena Pourmal ! March 13, 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_fletcher32_f(prp_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -4170,7 +4170,7 @@ CONTAINS ! Elena Pourmal ! 19 March 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_family_offset_f(prp_id, offset, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -4219,7 +4219,7 @@ CONTAINS ! Elena Pourmal ! 20 March 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_fapl_multi_l(prp_id, memb_map, memb_fapl, memb_name, memb_addr, relax, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! File creation property list identifier @@ -4287,7 +4287,7 @@ CONTAINS ! Elena Pourmal ! 31 March 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_fapl_multi_s(prp_id, relax, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! File creation property list identifier @@ -4342,7 +4342,7 @@ CONTAINS ! Elena Pourmal ! 24 March 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_fapl_multi_f(prp_id, memb_map, memb_fapl, memb_name, memb_addr, relax, hdferr, maxlen_out) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! File creation property list identifier @@ -4417,7 +4417,7 @@ CONTAINS ! Elena Pourmal ! April 10 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_szip_f(prp_id, options_mask, pixels_per_block, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Dataset creation property @@ -4474,7 +4474,7 @@ CONTAINS ! Elena Pourmal ! April 10 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pall_filters_avail_f(prp_id, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Dataset creation property @@ -4533,7 +4533,7 @@ CONTAINS ! Elena Pourmal ! April 10 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_filter_by_id_f(prp_id, filter_id, flags, cd_nelmts, cd_values, namelen, name, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -4599,7 +4599,7 @@ CONTAINS ! Elena Pourmal ! April 10 2003 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pmodify_filter_f(prp_id, filter, flags, cd_nelmts, cd_values, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -4653,7 +4653,7 @@ CONTAINS ! Quincey Koziol ! January 27 2004 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5premove_filter_f(prp_id, filter, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Dataset creation property list @@ -4704,7 +4704,7 @@ CONTAINS ! M. Scot Breitenfeld ! January, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: ocpl_id ! Object (dataset or group) creation property list identifier @@ -4755,7 +4755,7 @@ CONTAINS ! M. Scot Breitenfeld ! January, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_attr_creation_order_f(ocpl_id, crt_order_flags , hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: ocpl_id ! Object (dataset or group) creation property list identifier @@ -4802,7 +4802,7 @@ CONTAINS ! M. Scot Breitenfeld ! January, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_shared_mesg_nindexes_f( plist_id, nindexes, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! File creation property list @@ -4855,7 +4855,7 @@ CONTAINS ! M. Scot Breitenfeld ! January, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_shared_mesg_index_f(fcpl_id, index_num, mesg_type_flags, min_mesg_size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: fcpl_id ! file creation property list @@ -4910,7 +4910,7 @@ CONTAINS ! M. Scot Breitenfeld ! February, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_attr_creation_order_f(ocpl_id, crt_order_flags, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: ocpl_id ! Object (group or dataset) creation property list identifier @@ -4961,7 +4961,7 @@ CONTAINS ! M. Scot Breitenfeld ! February 18, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_libver_bounds_f(fapl_id, low, high, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: fapl_id ! File access property list identifier @@ -5018,7 +5018,7 @@ CONTAINS ! M. Scot Breitenfeld ! February 18, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_link_creation_order_f(gcpl_id, crt_order_flags, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: gcpl_id ! File access property list identifier @@ -5068,7 +5068,7 @@ CONTAINS ! M. Scot Breitenfeld ! February 20, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_link_phase_change_f(gcpl_id, max_compact, min_dense, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: gcpl_id ! Group creation property list identifier @@ -5118,7 +5118,7 @@ CONTAINS ! M. Scot Breitenfeld ! February 22, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_obj_track_times_f(plist_id, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Dataset creation property @@ -5184,7 +5184,7 @@ CONTAINS ! February 22, 2008 ! ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_obj_track_times_f(plist_id, flag, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Dataset creation property @@ -5241,7 +5241,7 @@ CONTAINS ! HISTORY ! The long subroutine name (>31) on older f90 compilers causes problems ! so had to shorten the name -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_create_inter_group_f(lcpl_id, crt_intermed_group, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: lcpl_id ! Link creation property list identifier @@ -5290,7 +5290,7 @@ CONTAINS ! M. Scot Breitenfeld ! March 3, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_link_creation_order_f(gcpl_id, crt_order_flags, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: gcpl_id ! Group creation property list identifier @@ -5341,7 +5341,7 @@ CONTAINS ! M. Scot Breitenfeld ! March 3, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_char_encoding_f(plist_id, encoding, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Property list identifier @@ -5395,7 +5395,7 @@ CONTAINS ! M. Scot Breitenfeld ! March 3, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_char_encoding_f(plist_id, encoding, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Property list identifier @@ -5450,7 +5450,7 @@ CONTAINS ! HISTORY ! ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_copy_object_f(ocp_plist_id, copy_options, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: ocp_plist_id ! Object copy property list identifier @@ -5503,7 +5503,7 @@ CONTAINS ! HISTORY ! ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_copy_object_f(ocp_plist_id, copy_options, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: ocp_plist_id ! Object copy property list identifier @@ -5560,7 +5560,7 @@ CONTAINS ! HISTORY ! ! Should hdferr return just 0 or 1 and add another arguement for the size? -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_data_transform_f(plist_id, expression, hdferr, size) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Identifier of the property list or class @@ -5619,7 +5619,7 @@ SUBROUTINE h5pget_data_transform_f(plist_id, expression, hdferr, size) ! M. Scot Breitenfeld ! March 19, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_data_transform_f(plist_id, expression, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: plist_id ! Identifier of the property list or class @@ -5670,7 +5670,7 @@ SUBROUTINE h5pget_data_transform_f(plist_id, expression, hdferr, size) ! M. Scot Breitenfeld ! March 21, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_local_heap_size_hint_f(gcpl_id, size_hint, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: gcpl_id ! Group creation property list identifier @@ -5721,7 +5721,7 @@ SUBROUTINE h5pget_data_transform_f(plist_id, expression, hdferr, size) ! HISTORY ! ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_est_link_info_f(gcpl_id, est_num_entries, est_name_len, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: gcpl_id ! Group creation property list identifier @@ -5770,7 +5770,7 @@ SUBROUTINE h5pget_data_transform_f(plist_id, expression, hdferr, size) ! M. Scot Breitenfeld ! March 21, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_local_heap_size_hint_f(gcpl_id, size_hint, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: gcpl_id ! Group creation property list identifier @@ -5818,7 +5818,7 @@ SUBROUTINE h5pget_data_transform_f(plist_id, expression, hdferr, size) ! M. Scot Breitenfeld ! March 21, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_est_link_info_f(gcpl_id, est_num_entries, est_name_len, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: gcpl_id ! Group creation property list identifier @@ -5868,7 +5868,7 @@ SUBROUTINE h5pget_data_transform_f(plist_id, expression, hdferr, size) ! M. Scot Breitenfeld ! March 21, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_link_phase_change_f(gcpl_id, max_compact, min_dense, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: gcpl_id ! Group creation property list identifier @@ -5919,7 +5919,7 @@ SUBROUTINE h5pset_link_phase_change_f(gcpl_id, max_compact, min_dense, hdferr) ! M. Scot Breitenfeld ! March 21, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_fapl_direct_f(fapl_id, alignment, block_size, cbuf_size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: fapl_id ! File access property list identifier @@ -5971,7 +5971,7 @@ SUBROUTINE h5pset_fapl_direct_f(fapl_id, alignment, block_size, cbuf_size, hdfer ! M. Scot Breitenfeld ! March 21, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_fapl_direct_f(fapl_id, alignment, block_size, cbuf_size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: fapl_id ! File access property list identifier @@ -6024,7 +6024,7 @@ SUBROUTINE h5pset_fapl_direct_f(fapl_id, alignment, block_size, cbuf_size, hdfer ! M. Scot Breitenfeld ! January, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: ocpl_id ! Object (dataset or group) creation property list identifier @@ -6063,31 +6063,22 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) ! PURPOSE ! Sets up the use of the N-Bit filter. ! -! INPUTS -! +! Inputs: ! plist_id - Dataset creation property list identifier. -! OUTPUTS ! -! hdferr - Error code -! Success: 0 -! Failure: -1 +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails ! ! AUTHOR ! M. Scot Breitenfeld ! March 21, 2008 ! -! HISTORY -! -! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_nbit_f(plist_id, hdferr) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: plist_id ! Dataset creation property list identifier - INTEGER, INTENT(OUT) :: hdferr ! Error code - ! 0 on success and -1 on failure -!***** -! MS FORTRAN needs explicit interface for C functions called here. -! + INTEGER(HID_T), INTENT(IN) :: plist_id + INTEGER , INTENT(OUT) :: hdferr +!***** INTERFACE INTEGER FUNCTION H5Pset_nbit_c(plist_id) USE H5GLOBAL @@ -6107,37 +6098,33 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) ! h5pset_scaleoffset_f ! ! PURPOSE -! Sets up the use of the Scale-Offset filter. +! Sets up the use of the scale-offset filter. ! -! INPUTS -! +! Inputs: ! plist_id - Dataset creation property list identifier. -! scale_type - Flag indicating compression method. +! scale_type - Flag indicating compression method. Valid values: +! H5Z_SO_FLOAT_DSCALE_F +! H5Z_SO_FLOAT_ESCALE_F +! H5Z_SO_INT_F +! ! scale_factor - Parameter related to scale. -! OUTPUTS ! -! hdferr - Error code -! Success: 0 -! Failure: -1 +! Outputs: +! hdferr - Returns 0 if successful and -1 if fails ! ! AUTHOR ! M. Scot Breitenfeld ! March 21, 2008 ! -! HISTORY -! -! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_scaleoffset_f(plist_id, scale_type, scale_factor, hdferr) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: plist_id ! Dataset creation property list identifier - INTEGER, INTENT(IN) :: scale_type ! Flag indicating compression method. - INTEGER, INTENT(IN) :: scale_factor ! Parameter related to scale. - INTEGER, INTENT(OUT) :: hdferr ! Error code - ! 0 on success and -1 on failure + INTEGER(HID_T), INTENT(IN) :: plist_id + INTEGER , INTENT(IN) :: scale_type + INTEGER , INTENT(IN) :: scale_factor + INTEGER , INTENT(OUT) :: hdferr !***** -! MS FORTRAN needs explicit interface for C functions called here. -! + INTERFACE INTEGER FUNCTION h5pset_scaleoffset_c(plist_id, scale_type, scale_factor) USE H5GLOBAL @@ -6179,7 +6166,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) ! HISTORY ! ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_nlinks_f(lapl_id, nlinks, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: lapl_id ! File access property list identifier @@ -6227,7 +6214,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) ! M. Scot Breitenfeld ! March 24, 2008 ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_nlinks_f(lapl_id, nlinks, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: lapl_id ! File access property list identifier @@ -6278,7 +6265,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) ! ! The long subroutine name (>31) on older f90 compilers causes problems ! so the name was shortened -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_create_inter_group_f(lcpl_id, crt_intermed_group, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: lcpl_id ! Link creation property list identifier @@ -6343,7 +6330,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) ! ! HISTORY ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pset_chunk_cache_f(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: dapl_id ! Dataset access property list identifier. @@ -6404,7 +6391,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) ! ! HISTORY ! -! SOURCE +! Fortran90 Interface: SUBROUTINE h5pget_chunk_cache_f(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: dapl_id ! Dataset access property list identifier. @@ -6433,3 +6420,5 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END MODULE H5P + + diff --git a/fortran/src/H5Pff_F03.f90 b/fortran/src/H5Pff_F03.f90 index b601e69..7fb6ff9 100644 --- a/fortran/src/H5Pff_F03.f90 +++ b/fortran/src/H5Pff_F03.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5P function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Pff_F90.f90 b/fortran/src/H5Pff_F90.f90 index ebdd185..5b75643 100644 --- a/fortran/src/H5Pff_F90.f90 +++ b/fortran/src/H5Pff_F90.f90 @@ -29,7 +29,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5P function you must add the function name to the -! Windows dll file '*hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5Rff.f90 b/fortran/src/H5Rff.f90 index 89ffc10..64f1365 100644 --- a/fortran/src/H5Rff.f90 +++ b/fortran/src/H5Rff.f90 @@ -31,7 +31,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5R function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Rff_F03.f90 b/fortran/src/H5Rff_F03.f90 index 88ec8cf..7a9b080 100644 --- a/fortran/src/H5Rff_F03.f90 +++ b/fortran/src/H5Rff_F03.f90 @@ -31,7 +31,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5R function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** @@ -258,9 +258,7 @@ CONTAINS ! name - name of the object at the specified location ! Outputs: ! ref - reference to the specified object -! hdferr: - error code -! Success: 0 -! Failure: -1 +! hdferr - returns 0 if successful and -1 if fails ! AUTHOR ! Elena Pourmal ! August 12, 1999 @@ -309,9 +307,7 @@ CONTAINS ! space_id - dataspace identifier that describes selected region ! OUTPUTS ! ref - reference to the dataset region -! hdferr: - error code -! Success: 0 -! Failure: -1 +! hdferr - returns 0 if successful and -1 if fails ! AUTHOR ! Elena Pourmal ! August 12, 1999 @@ -376,9 +372,7 @@ CONTAINS ! H5T_STD_REF_DSETREG ! Outputs: ! ref - reference created by the function call. -! hdferr - error code -! Success: 0 -! Failure: -1 +! hdferr - returns 0 if successful and -1 if fails. ! OPTIONAL ! space_id - dataspace identifier that describes selected region ! @@ -425,9 +419,7 @@ CONTAINS ! ref - reference to open ! Outputs: ! obj_id - object_identifier -! hdferr: - error code -! Success: 0 -! Failure: -1 +! hdferr - returns 0 if successful and -1 if fails ! AUTHOR ! Elena Pourmal ! August 12, 1999 @@ -465,14 +457,12 @@ CONTAINS ! Opens the dataset region ! ! Inputs: -! dset_id - identifier of the dataset containing -! reference to teh regions -! ref - reference to open +! dset_id - identifier of the dataset containing +! reference to teh regions +! ref - reference to open ! Outputs: -! obj_id - dataspace identifier -! hdferr: - error code -! Success: 0 -! Failure: -1 +! obj_id - dataspace identifier +! hdferr - returns 0 if successful and -1 if fails ! ! AUTHOR ! Elena Pourmal @@ -517,9 +507,8 @@ CONTAINS ! ref - Reference to open. ! Outputs: ! ref_obj_id - identifier of referenced object -! hdferr - error code -! Success: 0 -! Failure: -1 +! hdferr - returns 0 if successful and -1 if fails +! ! AUTHOR ! M. Scot Breitenfeld ! June 20, 2008 @@ -553,37 +542,32 @@ CONTAINS ! Retrieves a name of a referenced object. ! ! Inputs: -! loc_id - Identifier for the dataset containing the reference or for the group that dataset is in. +! loc_id - Identifier for the file containing the reference or for any object in that file. ! ref - An object or dataset region reference. ! ! Outputs: ! name - A name associated with the referenced object or dataset region. -! -! hdferr: - error code -! Success: 0 -! Failure: -1 +! hdferr - Returns 0 if successful and -1 if fails. ! ! Optional parameters: -! size - The size of the name buffer. +! size - The size of the name buffer, returning 0 (zero) if no name is associated +! with the identifier. ! ! AUTHOR ! M. Scot Breitenfeld ! March 28, 2008 ! -! Signature:S +! Signature: SUBROUTINE h5rget_name_object_f(loc_id, ref, name, hdferr, size) USE, INTRINSIC :: ISO_C_BINDING IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for the dataset containing the reference - ! or for the group that dataset is in. - TYPE(hobj_ref_t_f), INTENT(IN), TARGET :: ref ! Object reference - INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size ! The size of the name buffer, - ! returning 0 (zero) if no name is associated - ! with the identifier - CHARACTER(LEN=*), INTENT(OUT) :: name ! A name associated with the referenced object or dataset region. - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: loc_id + TYPE(hobj_ref_t_f), INTENT(IN), TARGET :: ref + INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr !***** - INTEGER(HADDR_T) :: ref_f ! Local buffer to pass reference + INTEGER(HADDR_T) :: ref_f ! Local buffer to pass reference INTEGER(SIZE_T) :: size_default INTEGER(SIZE_T) :: name_len @@ -595,7 +579,6 @@ CONTAINS hdferr = h5rget_name_ptr_c(loc_id, 0, f_ptr, name, name_len, size_default) - IF(PRESENT(size)) size = size_default END SUBROUTINE h5rget_name_object_f @@ -608,18 +591,15 @@ CONTAINS ! Retrieves a name of a dataset region. ! ! Inputs: -! loc_id - Identifier for the dataset containing the reference or -! for the group that dataset is in. +! loc_id - Identifier for the file containing the reference or for any object in that file. ! ref - An object or dataset region reference. ! ! Outputs: ! name - A name associated with the referenced object or dataset region. -! hdferr - error code -! Success: 0 -! Failure: -1 +! hdferr - Returns 0 if successful and -1 if fails. ! ! Optional parameters: -! size - The size of the name buffer. +! size - The size of the name buffer, returning 0 (zero) if no name is associated with the identifier ! ! AUTHOR ! M. Scot Breitenfeld @@ -629,13 +609,11 @@ CONTAINS SUBROUTINE h5rget_name_region_f(loc_id, ref, name, hdferr, size) USE, INTRINSIC :: ISO_C_BINDING IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for the dataset containing the reference - ! or for the group that dataset is in. - TYPE(hdset_reg_ref_t_f), INTENT(IN), TARGET :: ref ! Object reference - INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size ! The size of the name buffer, - ! returning 0 (zero) if no name is associated with the identifier - CHARACTER(LEN=*), INTENT(OUT) :: name ! A name associated with the referenced object or dataset region. - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: loc_id + TYPE(hdset_reg_ref_t_f), INTENT(IN), TARGET :: ref + INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr !***** INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference INTEGER(SIZE_T) :: size_default @@ -661,20 +639,17 @@ CONTAINS ! Retrieves a name of a referenced object. ! ! Inputs: - ! loc_id - Identifier for the dataset containing the reference or - ! for the group that dataset is in. + ! loc_id - Identifier for the file containing the reference or for any object in that file. ! ref_type - Type of reference. ! ref - An object or dataset region reference. ! ! Outputs: ! name - A name associated with the referenced object or dataset ptr. - ! - ! hdferr - error code - ! Success: 0 - ! Failure: -1 + ! hdferr - Returns 0 if successful and -1 if fails. ! ! Optional parameters: - ! size - The size of the name buffer. + ! size - The size of the name buffer, returning 0 (zero) if no name is associated + ! with the identifier ! ! AUTHOR ! M. Scot Breitenfeld @@ -684,15 +659,12 @@ CONTAINS SUBROUTINE h5rget_name_ptr_f(loc_id, ref_type, ref, name, hdferr, size) USE, INTRINSIC :: ISO_C_BINDING IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for the dataset containing the reference - ! or for the group that dataset is in. - INTEGER, INTENT(IN) :: ref_type ! Type of reference. - TYPE(C_PTR), INTENT(IN) :: ref ! An object or dataset region reference. - CHARACTER(LEN=*), INTENT(OUT) :: name ! A name associated with the referenced object or dataset ptr. - INTEGER, INTENT(OUT) :: hdferr ! Error code - INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size ! The size of the name buffer, - ! returning 0 (zero) if no name is associated - ! with the identifier + INTEGER(HID_T), INTENT(IN) :: loc_id + INTEGER, INTENT(IN) :: ref_type + TYPE(C_PTR), INTENT(IN) :: ref + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr + INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size !***** INTEGER(SIZE_T) :: size_default INTEGER(SIZE_T) :: name_len @@ -727,9 +699,7 @@ CONTAINS ! H5G_DATASET_F 2 ! H5G_TYPE_F 3 ! - ! hdferr - error code - ! Success: 0 - ! Failure: -1 + ! hdferr - Returns 0 if successful and -1 if fails. ! ! AUTHOR ! M. Scot Breitenfeld diff --git a/fortran/src/H5Rff_F90.f90 b/fortran/src/H5Rff_F90.f90 index 0190e57..3871d99 100644 --- a/fortran/src/H5Rff_F90.f90 +++ b/fortran/src/H5Rff_F90.f90 @@ -31,7 +31,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5R function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** @@ -386,7 +386,7 @@ CONTAINS ! Retrieves a name of a referenced object. ! ! INPUTS -! loc_id - Identifier for the dataset containing the reference or for the group that dataset is in. +! loc_id - Identifier for the file containing the reference or for any object in that file. ! ref - An object or dataset region reference. ! ! OUTPUTS @@ -397,7 +397,8 @@ CONTAINS ! Failure: -1 ! ! OPTIONAL PARAMETERS -! size - The size of the name buffer. +! size - The size of the name buffer, returning 0 (zero) if +! no name is associated with the identifier ! ! AUTHOR ! M. Scot Breitenfeld @@ -406,7 +407,8 @@ CONTAINS ! SOURCES SUBROUTINE h5rget_name_object_f(loc_id, ref, name, hdferr, size) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for the dataset containing the reference + INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for the file containing the reference or + ! for any object in that file. ! or for the group that dataset is in. TYPE(hobj_ref_t_f), INTENT(IN) :: ref ! Object reference INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size ! The size of the name buffer, @@ -453,8 +455,8 @@ CONTAINS ! Retrieves a name of a dataset region. ! ! INPUTS -! loc_id - Identifier for the dataset containing the reference or -! for the group that dataset is in. +! loc_id - Identifier for the file containing the reference or +! for any object in that file. ! ref - An object or dataset region reference. ! ! OUTPUTS @@ -464,7 +466,8 @@ CONTAINS ! Failure: -1 ! ! OPTIONAL PARAMETERS -! size - The size of the name buffer. +! size - The size of the name buffer, returning 0 (zero) if no +! name is associated with the identifier ! ! AUTHOR ! M. Scot Breitenfeld @@ -473,14 +476,11 @@ CONTAINS ! SOURCE SUBROUTINE h5rget_name_region_f(loc_id, ref, name, hdferr, size) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: loc_id ! Identifier for the dataset containing the reference - ! or for the group that dataset is in. - TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Object reference - INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size ! The size of the name buffer, - ! returning 0 (zero) if no name is associated - ! with the identifier - CHARACTER(LEN=*), INTENT(OUT) :: name ! A name associated with the referenced object or dataset region. - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: loc_id + TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref + INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr !***** INTEGER :: ref_f(REF_REG_BUF_LEN) ! Local buffer to pass reference INTEGER(SIZE_T) :: size_default diff --git a/fortran/src/H5Sff.f90 b/fortran/src/H5Sff.f90 index 9ef8ca8..1bae584 100644 --- a/fortran/src/H5Sff.f90 +++ b/fortran/src/H5Sff.f90 @@ -31,7 +31,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5S function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Tff.f90 b/fortran/src/H5Tff.f90 index fd857a8..89bd972 100644 --- a/fortran/src/H5Tff.f90 +++ b/fortran/src/H5Tff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5T function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Tff_F03.f90 b/fortran/src/H5Tff_F03.f90 index 902e2ac..d16553a 100644 --- a/fortran/src/H5Tff_F03.f90 +++ b/fortran/src/H5Tff_F03.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5T function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5Tff_F90.f90 b/fortran/src/H5Tff_F90.f90 index 021773d..a95b31f 100644 --- a/fortran/src/H5Tff_F90.f90 +++ b/fortran/src/H5Tff_F90.f90 @@ -30,7 +30,7 @@ ! ! *** IMPORTANT *** ! If you add a new H5D function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5Zff.f90 b/fortran/src/H5Zff.f90 index ec68286..7b67b5b 100644 --- a/fortran/src/H5Zff.f90 +++ b/fortran/src/H5Zff.f90 @@ -28,7 +28,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new H5Z function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5_ff.f90 b/fortran/src/H5_ff.f90 index 4000ba1..510beaa 100644 --- a/fortran/src/H5_ff.f90 +++ b/fortran/src/H5_ff.f90 @@ -30,7 +30,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. ! !***** diff --git a/fortran/src/H5_ff_F03.f90 b/fortran/src/H5_ff_F03.f90 index f3e7098..d418ed5 100644 --- a/fortran/src/H5_ff_F03.f90 +++ b/fortran/src/H5_ff_F03.f90 @@ -27,7 +27,7 @@ ! NOTES ! *** IMPORTANT *** ! If you add a new function you must add the function name to the -! Windows dll file 'hdf5_fortrandll.def' in the fortran/src directory. +! Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory. ! This is needed for Windows based operating systems. !***** diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 61c5db4..4b02b6c 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -61,7 +61,7 @@ typedef struct H5O_hdr_info_t_f { typedef struct H5O_info_t_f { unsigned long fileno; /* File number that object is located in */ haddr_t_f addr; /* Object address in file */ - int_f type; /* Basic object type (group, dataset, etc.) */ + int type; /* Basic object type (group, dataset, etc.) */ int_f rc; /* Reference count of object */ int_f atime[8]; /* Access time */ int_f mtime[8]; /* Modification time */ @@ -93,6 +93,7 @@ typedef struct H5O_info_t_f { #define nh5fget_obj_count_c H5_FC_FUNC_(h5fget_obj_count_c, H5FGET_OBJ_COUNT_C) #define nh5fget_obj_ids_c H5_FC_FUNC_(h5fget_obj_ids_c, H5FGET_OBJ_IDS_C) #define nh5fget_freespace_c H5_FC_FUNC_(h5fget_freespace_c, H5FGET_FREESPACE_C) +#define nh5fget_file_image_c H5_FC_FUNC_(h5fget_file_image_c, H5FGET_FILE_IMAGE_C) #define nh5fget_name_c H5_FC_FUNC_(h5fget_name_c, H5FGET_NAME_C) #define nh5fget_filesize_c H5_FC_FUNC_(h5fget_filesize_c, H5FGET_FILESIZE_C) @@ -108,6 +109,7 @@ H5_FCDLL int_f nh5fget_access_plist_c (hid_t_f *file_id, hid_t_f *access_id); H5_FCDLL int_f nh5fget_obj_count_c (hid_t_f *file_id, int_f *obj_type, size_t_f *obj_count); H5_FCDLL int_f nh5fget_obj_ids_c (hid_t_f *file_id, int_f *obj_type, size_t_f *max_objs, hid_t_f *obj_ids, size_t_f *num_objs); H5_FCDLL int_f nh5fget_freespace_c (hid_t_f *file_id, hssize_t_f *free_space); +H5_FCDLL int_f nh5fget_file_image_c(hid_t_f *file_id, void *buf_ptr, size_t_f *buf_len, size_t_f *buf_req); H5_FCDLL int_f nh5fflush_c (hid_t_f *obj_id, int_f *scope); H5_FCDLL int_f nh5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen); H5_FCDLL int_f nh5fget_filesize_c(hid_t_f *file_id, hsize_t_f *size); diff --git a/fortran/src/H5test_kind_SIZEOF.f90 b/fortran/src/H5test_kind_SIZEOF.f90 index ba982ee..867ec1e 100644 --- a/fortran/src/H5test_kind_SIZEOF.f90 +++ b/fortran/src/H5test_kind_SIZEOF.f90 @@ -15,7 +15,9 @@ ! NOTES ! This program is used in place of H5test_kind.f90 when the Fortran intrinsic ! function SIZEOF is available. It generates code that makes use of SIZEOF in -! H5fortran_detect.f90 which is a portable solution. +! H5fortran_detect.f90 which is a portable solution but is not standard +! compliant. The program H5test_kind_C_SIZEOF uses F2008 standard intrinsic +! function instead, which is the preferred method. ! ! The availability of SIZEOF is checked at configure time and the TRUE/FALSE ! condition is set in the configure variable "FORTRAN_HAVE_SIZEOF". diff --git a/fortran/src/HDF5.f90 b/fortran/src/HDF5.f90 index cb3d8bf..75af333 100644 --- a/fortran/src/HDF5.f90 +++ b/fortran/src/HDF5.f90 @@ -30,6 +30,7 @@ MODULE HDF5 USE H5GLOBAL USE H5F + USE H5F_PROVISIONAL USE H5G USE H5E USE H5E_PROVISIONAL diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index e6ef610..12c38e2 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -76,7 +76,7 @@ libhdf5_fortran_la_SOURCES=H5f90global.f90 \ H5_DBLE_Interface$(F_DBLE).f90 \ H5f90kit.c H5_f.c H5Af.c H5Df.c H5Ef.c H5Ff.c H5Gf.c \ H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c \ - H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ + H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Fff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ H5Off$(F_STATUS).f90 H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 H5Tff$(F_STATUS).f90 $(PARALLEL_COND_SRC) # HDF5 Fortran library depends on HDF5 Library. @@ -201,6 +201,7 @@ H5Dff.lo: $(srcdir)/H5Dff.f90 H5f90global.lo H5Aff$(F_STATUS).lo: $(srcdir)/H5Aff$(F_STATUS).f90 H5f90global.lo H5Dff$(F_STATUS).lo: $(srcdir)/H5Dff$(F_STATUS).f90 H5f90global.lo H5Eff$(F_STATUS).lo: $(srcdir)/H5Eff$(F_STATUS).f90 H5f90global.lo +H5Fff$(F_STATUS).lo: $(srcdir)/H5Fff$(F_STATUS).f90 H5f90global.lo H5Lff$(F_STATUS).lo: $(srcdir)/H5Lff$(F_STATUS).f90 H5f90global.lo H5Off$(F_STATUS).lo: $(srcdir)/H5Off$(F_STATUS).f90 H5f90global.lo H5Pff$(F_STATUS).lo: $(srcdir)/H5Pff$(F_STATUS).f90 H5f90global.lo @@ -217,11 +218,11 @@ H5Rff.lo: $(srcdir)/H5Rff.f90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.f90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.f90 H5f90global.lo H5Zff.lo: $(srcdir)/H5Zff.f90 H5f90global.lo -H5_DBLE_Interface$(F_DBLE).lo: $(srcdir)/H5_DBLE_Interface$(F_DBLE).f90 H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo H5Eff$(F_STATUS).lo H5Pff$(F_STATUS).lo +H5_DBLE_Interface$(F_DBLE).lo: $(srcdir)/H5_DBLE_Interface$(F_DBLE).f90 H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo H5Fff$(F_STATUS).lo H5Eff$(F_STATUS).lo H5Pff$(F_STATUS).lo HDF5.lo: $(srcdir)/HDF5.f90 H5f90global.lo H5_ff$(F_STATUS).lo H5_ff.lo H5Aff.lo H5Aff$(F_STATUS).lo \ H5Dff.lo H5Dff$(F_STATUS).lo \ H5Eff.lo H5Eff$(F_STATUS).lo \ - H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ + H5Fff.lo H5Fff$(F_STATUS).lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ H5Off.lo H5Off$(F_STATUS).lo H5Pff.lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Tff$(F_STATUS).lo H5Zff.lo \ H5_DBLE_Interface$(F_DBLE).lo @@ -230,7 +231,7 @@ HDF5mpio.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo H5_ff$(F_STATUS).lo H5Aff.lo H5Aff$(F_STATUS).lo \ H5Dff.lo H5Dff$(F_STATUS).lo \ H5Eff.lo H5Eff$(F_STATUS).lo \ - H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ + H5Fff.lo H5Fff$(F_STATUS).lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ H5Off.lo H5Off$(F_STATUS).lo H5Pff.lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Tff$(F_STATUS).lo H5Zff.lo \ H5_DBLE_Interface$(F_DBLE).lo H5FDmpioff.lo diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 0d291e3..bb6ff74 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -128,9 +128,10 @@ am__libhdf5_fortran_la_SOURCES_DIST = H5f90global.f90 \ H5_DBLE_Interface$(F_DBLE).f90 H5f90kit.c H5_f.c H5Af.c H5Df.c \ H5Ef.c H5Ff.c H5Gf.c H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c \ H5Tf.c H5Zf.c H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 \ - H5Eff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 H5Off$(F_STATUS).f90 \ - H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 H5Tff$(F_STATUS).f90 \ - HDF5.f90 H5FDmpiof.c HDF5mpio.f90 H5FDmpioff.f90 + H5Eff$(F_STATUS).f90 H5Fff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ + H5Off$(F_STATUS).f90 H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 \ + H5Tff$(F_STATUS).f90 HDF5.f90 H5FDmpiof.c HDF5mpio.f90 \ + H5FDmpioff.f90 @BUILD_PARALLEL_CONDITIONAL_FALSE@am__objects_1 = HDF5.lo @BUILD_PARALLEL_CONDITIONAL_TRUE@am__objects_1 = H5FDmpiof.lo \ @BUILD_PARALLEL_CONDITIONAL_TRUE@ HDF5mpio.lo H5FDmpioff.lo @@ -141,9 +142,9 @@ am_libhdf5_fortran_la_OBJECTS = H5f90global.lo H5fortran_types.lo \ H5f90kit.lo H5_f.lo H5Af.lo H5Df.lo H5Ef.lo H5Ff.lo H5Gf.lo \ H5If.lo H5Lf.lo H5Of.lo H5Pf.lo H5Rf.lo H5Sf.lo H5Tf.lo \ H5Zf.lo H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo \ - H5Eff$(F_STATUS).lo H5Lff$(F_STATUS).lo H5Off$(F_STATUS).lo \ - H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Tff$(F_STATUS).lo \ - $(am__objects_1) + H5Eff$(F_STATUS).lo H5Fff$(F_STATUS).lo H5Lff$(F_STATUS).lo \ + H5Off$(F_STATUS).lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo \ + H5Tff$(F_STATUS).lo $(am__objects_1) libhdf5_fortran_la_OBJECTS = $(am_libhdf5_fortran_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -556,7 +557,7 @@ libhdf5_fortran_la_SOURCES = H5f90global.f90 \ H5_DBLE_Interface$(F_DBLE).f90 \ H5f90kit.c H5_f.c H5Af.c H5Df.c H5Ef.c H5Ff.c H5Gf.c \ H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c \ - H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ + H5Aff$(F_STATUS).f90 H5Dff$(F_STATUS).f90 H5Eff$(F_STATUS).f90 H5Fff$(F_STATUS).f90 H5Lff$(F_STATUS).f90 \ H5Off$(F_STATUS).f90 H5Pff$(F_STATUS).f90 H5Rff$(F_STATUS).f90 H5Tff$(F_STATUS).f90 $(PARALLEL_COND_SRC) @@ -1101,6 +1102,7 @@ H5Dff.lo: $(srcdir)/H5Dff.f90 H5f90global.lo H5Aff$(F_STATUS).lo: $(srcdir)/H5Aff$(F_STATUS).f90 H5f90global.lo H5Dff$(F_STATUS).lo: $(srcdir)/H5Dff$(F_STATUS).f90 H5f90global.lo H5Eff$(F_STATUS).lo: $(srcdir)/H5Eff$(F_STATUS).f90 H5f90global.lo +H5Fff$(F_STATUS).lo: $(srcdir)/H5Fff$(F_STATUS).f90 H5f90global.lo H5Lff$(F_STATUS).lo: $(srcdir)/H5Lff$(F_STATUS).f90 H5f90global.lo H5Off$(F_STATUS).lo: $(srcdir)/H5Off$(F_STATUS).f90 H5f90global.lo H5Pff$(F_STATUS).lo: $(srcdir)/H5Pff$(F_STATUS).f90 H5f90global.lo @@ -1117,11 +1119,11 @@ H5Rff.lo: $(srcdir)/H5Rff.f90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.f90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.f90 H5f90global.lo H5Zff.lo: $(srcdir)/H5Zff.f90 H5f90global.lo -H5_DBLE_Interface$(F_DBLE).lo: $(srcdir)/H5_DBLE_Interface$(F_DBLE).f90 H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo H5Eff$(F_STATUS).lo H5Pff$(F_STATUS).lo +H5_DBLE_Interface$(F_DBLE).lo: $(srcdir)/H5_DBLE_Interface$(F_DBLE).f90 H5Aff$(F_STATUS).lo H5Dff$(F_STATUS).lo H5Fff$(F_STATUS).lo H5Eff$(F_STATUS).lo H5Pff$(F_STATUS).lo HDF5.lo: $(srcdir)/HDF5.f90 H5f90global.lo H5_ff$(F_STATUS).lo H5_ff.lo H5Aff.lo H5Aff$(F_STATUS).lo \ H5Dff.lo H5Dff$(F_STATUS).lo \ H5Eff.lo H5Eff$(F_STATUS).lo \ - H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ + H5Fff.lo H5Fff$(F_STATUS).lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ H5Off.lo H5Off$(F_STATUS).lo H5Pff.lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Tff$(F_STATUS).lo H5Zff.lo \ H5_DBLE_Interface$(F_DBLE).lo @@ -1130,7 +1132,7 @@ HDF5mpio.lo: $(srcdir)/H5FDmpioff.f90 H5f90global.lo H5_ff$(F_STATUS).lo H5Aff.lo H5Aff$(F_STATUS).lo \ H5Dff.lo H5Dff$(F_STATUS).lo \ H5Eff.lo H5Eff$(F_STATUS).lo \ - H5Fff.lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ + H5Fff.lo H5Fff$(F_STATUS).lo H5Gff.lo H5Iff.lo H5Lff.lo H5Lff$(F_STATUS).lo \ H5Off.lo H5Off$(F_STATUS).lo H5Pff.lo H5Pff$(F_STATUS).lo H5Rff$(F_STATUS).lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Tff$(F_STATUS).lo H5Zff.lo \ H5_DBLE_Interface$(F_DBLE).lo H5FDmpioff.lo diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 08e2c87..4ce185b 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -228,6 +228,7 @@ H5F_mp_H5FGET_ACCESS_PLIST_F H5F_mp_H5FIS_HDF5_F
H5F_mp_H5FGET_NAME_F
H5F_mp_H5FGET_FILESIZE_F
+@H5_NOF03EXP@H5F_PROVISIONAL_mp_H5FGET_FILE_IMAGE_F
; H5G
H5G_mp_H5GOPEN_F
H5G_mp_H5GCREATE_F
@@ -292,19 +293,19 @@ H5L_mp_H5LGET_NAME_BY_IDX_F @H5_NOF03EXP@H5L_PROVISIONAL_mp_H5LITERATE_F
@H5_NOF03EXP@H5L_PROVISIONAL_mp_H5LITERATE_BY_NAME_F
; H5O
-;H5O_mp_H5OCLOSE_F
+H5O_mp_H5OCLOSE_F
H5O_mp_H5OCOPY_F
-;H5O_mp_H5ODECR_REFCOUNT_F
-;H5O_mp_H5OEXISTS_BY_NAME_F
-;H5O_mp_H5OGET_COMMENT_F
-;H5O_mp_H5OGET_COMMENT_BY_NAME_F
-;H5O_mp_H5OINCR_REFCOUNT_F
+H5O_mp_H5ODECR_REFCOUNT_F
+H5O_mp_H5OEXISTS_BY_NAME_F
+H5O_mp_H5OGET_COMMENT_F
+H5O_mp_H5OGET_COMMENT_BY_NAME_F
+H5O_mp_H5OINCR_REFCOUNT_F
H5O_mp_H5OLINK_F
H5O_mp_H5OOPEN_BY_ADDR_F
-;H5O_mp_H5OOPEN_BY_IDX_F
+H5O_mp_H5OOPEN_BY_IDX_F
H5O_mp_H5OOPEN_F
-;H5O_mp_H5OSET_COMMENT_F
-;H5O_mp_H5OSET_COMMENT_BY_NAME_F
+H5O_mp_H5OSET_COMMENT_F
+H5O_mp_H5OSET_COMMENT_BY_NAME_F
@H5_NOF03EXP@H5O_PROVISIONAL_mp_H5OGET_INFO_BY_IDX_F
@H5_NOF03EXP@H5O_PROVISIONAL_mp_H5OGET_INFO_BY_NAME_F
@H5_NOF03EXP@H5O_PROVISIONAL_mp_H5OGET_INFO_F
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 3911bb9..5b9ca11 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -100,12 +100,14 @@ ADD_TEST (NAME testhdf5_fortran_1_8 COMMAND $<TARGET_FILE:testhdf5_fortran_1_8>) SET_TESTS_PROPERTIES(testhdf5_fortran_1_8 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") #-- Adding test for fortranlib_test_F03 -IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +IF (HDF5_ENABLE_F2003) ADD_EXECUTABLE (fortranlib_test_F03 fortranlib_test_F03.f90 tH5F.f90 tH5E_F03.f90 + tH5F_F03.f90 tH5L_F03.f90 + tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 ) @@ -124,7 +126,7 @@ IF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) ADD_TEST (NAME fortranlib_test_F03 COMMAND $<TARGET_FILE:fortranlib_test_F03>) SET_TESTS_PROPERTIES(fortranlib_test_F03 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") -ENDIF (FORTRAN_HAVE_ISO_C_BINDING AND HDF5_ENABLE_F2003) +ENDIF (HDF5_ENABLE_F2003) #-- Adding test for fflush1 ADD_EXECUTABLE (fflush1 fflush1.f90) diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index b261785..84f55e5 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -68,7 +68,7 @@ fortranlib_test_1_8_SOURCES = fortranlib_test_1_8.f90 \ if FORTRAN_2003_CONDITIONAL_F fortranlib_test_F03_SOURCES = fortranlib_test_F03.f90 \ - tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5P_F03.f90 tH5T_F03.f90 + tH5F.f90 tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 endif diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in index d287e5b..6c226bc 100644 --- a/fortran/test/Makefile.in +++ b/fortran/test/Makefile.in @@ -136,11 +136,14 @@ fortranlib_test_1_8_LDADD = $(LDADD) fortranlib_test_1_8_DEPENDENCIES = libh5test_fortran.la $(LIBH5TEST) \ $(LIBH5F) $(LIBHDF5) am__fortranlib_test_F03_SOURCES_DIST = fortranlib_test_F03.f90 \ - tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5P_F03.f90 tH5T_F03.f90 + tH5F.f90 tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 tH5O_F03.f90 \ + tH5P_F03.f90 tH5T_F03.f90 @FORTRAN_2003_CONDITIONAL_F_TRUE@am_fortranlib_test_F03_OBJECTS = fortranlib_test_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5E_F03.$(OBJEXT) \ +@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5L_F03.$(OBJEXT) \ +@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5O_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5P_F03.$(OBJEXT) \ @FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5T_F03.$(OBJEXT) fortranlib_test_F03_OBJECTS = $(am_fortranlib_test_F03_OBJECTS) @@ -525,7 +528,7 @@ fortranlib_test_1_8_SOURCES = fortranlib_test_1_8.f90 \ tH5F.f90 tH5O.f90 tH5A_1_8.f90 tH5G_1_8.f90 @FORTRAN_2003_CONDITIONAL_F_TRUE@fortranlib_test_F03_SOURCES = fortranlib_test_F03.f90 \ -@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.f90 tH5E_F03.f90 tH5L_F03.f90 tH5P_F03.f90 tH5T_F03.f90 +@FORTRAN_2003_CONDITIONAL_F_TRUE@ tH5F.f90 tH5E_F03.f90 tH5F_F03.f90 tH5L_F03.f90 tH5O_F03.f90 tH5P_F03.f90 tH5T_F03.f90 fflush1_SOURCES = fflush1.f90 fflush2_SOURCES = fflush2.f90 diff --git a/fortran/test/fortranlib_test_F03.f90 b/fortran/test/fortranlib_test_F03.f90 index 9dfd06a..939435b 100644 --- a/fortran/test/fortranlib_test_F03.f90 +++ b/fortran/test/fortranlib_test_F03.f90 @@ -59,10 +59,7 @@ PROGRAM fortranlibtest_F03 ENDIF WRITE(*,*) -! write(*,*) -! write(*,*) '=========================================' -! write(*,*) 'Testing DATATYPE interface ' -! write(*,*) '=========================================' + ret_total_error = 0 CALL test_array_compound_atomic(ret_total_error) CALL write_test_status(ret_total_error, ' Testing 1-D Array of Compound Datatypes Functionality', total_error) @@ -80,6 +77,10 @@ PROGRAM fortranlibtest_F03 CALL write_test_status(ret_total_error, ' Testing writing/reading enum dataset, using C_LOC', total_error) ret_total_error = 0 + CALL t_enum_conv(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing enumeration conversions', total_error) + + ret_total_error = 0 CALL t_bit(ret_total_error) CALL write_test_status(ret_total_error, ' Testing writing/reading bitfield dataset, using C_LOC', total_error) @@ -117,15 +118,11 @@ PROGRAM fortranlibtest_F03 ret_total_error = 0 CALL test_create(ret_total_error) - CALL write_test_status(ret_total_error, & - ' Testing filling functions', & - total_error) + CALL write_test_status(ret_total_error, ' Testing filling functions', total_error) ret_total_error = 0 CALL test_h5kind_to_type(total_error) - CALL write_test_status(ret_total_error, & - ' Test function h5kind_to_type', & - total_error) + CALL write_test_status(ret_total_error, ' Test function h5kind_to_type', total_error) ret_total_error = 0 CALL test_array_bkg(ret_total_error) @@ -137,7 +134,7 @@ PROGRAM fortranlibtest_F03 ret_total_error = 0 CALL test_iter_group(ret_total_error) - CALL write_test_status(ret_total_error, ' Testing Group Iteration Functionality', total_error) + CALL write_test_status(ret_total_error, ' Testing group iteration functionality', total_error) ret_total_error = 0 CALL test_nbit(ret_total_error) @@ -152,7 +149,23 @@ PROGRAM fortranlibtest_F03 ! write(*,*) 'Testing GROUP interface ' ! write(*,*) '=========================================' - + ret_total_error = 0 + CALL test_h5o_refcount(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing object functions ', total_error) + + ret_total_error = 0 + CALL obj_visit(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing object visiting functions ', total_error) + + ret_total_error = 0 + CALL obj_info(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing object info functions ', total_error) + + ret_total_error = 0 + CALL test_get_file_image(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing get file image ', total_error) + + WRITE(*,*) WRITE(*,*) ' ============================================ ' diff --git a/fortran/test/tH5F_F03.f90 b/fortran/test/tH5F_F03.f90 new file mode 100644 index 0000000..dea9a5d --- /dev/null +++ b/fortran/test/tH5F_F03.f90 @@ -0,0 +1,175 @@ +!****h* root/fortran/test/tH5F_F03.f90 +! +! NAME +! tH5F_F03.f90 +! +! FUNCTION +! Test FORTRAN HDF5 H5F APIs which are dependent on FORTRAN 2003 +! features. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +! NOTES +! Tests the H5F APIs functionalities of: +! h5fget_file_image_f +! +! CONTAINS SUBROUTINES +! test_get_file_image +! +!***** + +! ***************************************** +! *** H 5 F T E S T S +! ***************************************** + +SUBROUTINE test_get_file_image(total_error) + ! + ! Tests the wrapper for h5fget_file_image + ! + USE HDF5 + USE ISO_C_BINDING + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error ! returns error + + CHARACTER(kind=c_char), ALLOCATABLE, DIMENSION(:), TARGET :: file_image_ptr ! Image from file + CHARACTER(kind=c_char), ALLOCATABLE, DIMENSION(:), TARGET :: image_ptr ! Image from h5fget_file_image_f + + INTEGER, DIMENSION(1:100), TARGET :: data ! Write data + INTEGER :: i, file_sz + INTEGER(hid_t) :: file_id = -1 ! File identifier + INTEGER(hid_t) :: dset_id = -1 ! Dataset identifier + INTEGER(hid_t) :: space_id = -1 ! Dataspace identifier + INTEGER(hsize_t), DIMENSION(1:2) :: dims ! Dataset dimensions + INTEGER(size_t) :: itmp_a, itmp_b ! General purpose integers + INTEGER(size_t) :: image_size ! Size of image + TYPE(C_PTR) :: f_ptr ! Pointer + INTEGER(hid_t) :: fapl ! File access property + INTEGER :: error ! Error flag + + + RETURN ! DEBUG, PGI COMPILERS seem to have a bug in the INQUIRE functions, + ! waiting for an answer from PGI how to resolve the problem. + + ! Create new properties for file access + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl, error) + CALL check("h5pcreate_f", error, total_error) + + ! Set standard I/O driver + CALL h5pset_fapl_stdio_f(fapl, error) + CALL check("h5pset_fapl_stdio_f", error, total_error) + + ! Create the file + CALL h5fcreate_f("tget_file_image.h5", H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl) + CALL check("h5fcreate_f", error, total_error) + + ! Set up data space for new data set + dims(1:2) = (/10,10/) + + CALL h5screate_simple_f(2, dims, space_id, error) + CALL check("h5screate_simple_f", error, total_error) + + ! Create a dataset + CALL h5dcreate_f(file_id, "dset 0", H5T_NATIVE_INTEGER, space_id, dset_id, error) + CALL check("h5dcreate_f", error, total_error) + + ! Write some data to the data set + DO i = 1, 100 + data(i) = i + ENDDO + + f_ptr = C_LOC(data(1)) + CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, f_ptr, error) + CALL check("h5dwrite_f",error, total_error) + + ! Flush the file + CALL h5fflush_f(file_id, H5F_SCOPE_GLOBAL_F, error) + CALL check("h5fflush_f",error, total_error) + + ! Open the test file using standard I/O calls + OPEN(UNIT=10,FILE='tget_file_image.h5', ACCESS='STREAM') + ! Get the size of the test file + ! + ! Since we use the eoa to calculate the image size, the file size + ! may be larger. This is OK, as long as (in this specialized instance) + ! the remainder of the file is all '\0's. + ! + ! With latest mods to truncate call in core file drive, + ! file size should match image size; get the file size + INQUIRE(UNIT=10, SIZE=file_sz) + CLOSE(UNIT=10) + + ! I. Get buffer size needed to hold the buffer + + ! A. Preferred way to get the size + f_ptr = C_NULL_PTR + CALL h5fget_file_image_f(file_id, f_ptr, INT(0, size_t), error, image_size) + CALL check("h5fget_file_image_f",error, total_error) + CALL verify("h5fget_file_image_f", file_sz, INT(image_size), total_error) + + ! B. f_ptr set to point to an incorrect buffer, should pass anyway + f_ptr = C_LOC(data(1)) + itmp_a = 1 + CALL h5fget_file_image_f(file_id, f_ptr, itmp_a, error, image_size) + CALL check("h5fget_file_image_f",error, total_error) + CALL VERIFY("h5fget_file_image_f", INT(itmp_a), 1, total_error) ! Routine should not change the value + CALL VERIFY("h5fget_file_image_f", file_sz, INT(image_size), total_error) + + ! Allocate a buffer of the appropriate size + ALLOCATE(image_ptr(1:image_size)) + + ! Load the image of the file into the buffer + f_ptr = C_LOC(image_ptr(1)(1:1)) + CALL h5fget_file_image_f(file_id, f_ptr, image_size, error) + CALL check("h5fget_file_image_f",error, total_error) + + ! Close dset and space + CALL h5dclose_f(dset_id, error) + CALL check("h5dclose_f", error, total_error) + CALL h5sclose_f(space_id, error) + CALL check("h5sclose_f", error, total_error) + ! Close the test file + CALL h5fclose_f(file_id, error) + CALL check("h5fclose_f",error, total_error) + + ! Allocate a buffer for the test file image + ALLOCATE(file_image_ptr(1:image_size)) + + ! Open the test file using standard I/O calls + OPEN(UNIT=10,FILE='tget_file_image.h5', ACCESS='STREAM') + + ! Read the test file from disk into the buffer + DO i = 1, image_size + READ(10) file_image_ptr(i) + ENDDO + + CLOSE(10) + + ! verify the file and the image contain the same data + DO i = 1, image_size + ! convert one byte to an unsigned integer + IF( ICHAR(file_image_ptr(i)) .NE. ICHAR(image_ptr(i)))THEN + total_error = total_error + 1 + EXIT + ENDIF + ENDDO + + ! release resources + DEALLOCATE(file_image_ptr,image_ptr) + +END SUBROUTINE test_get_file_image diff --git a/fortran/test/tH5O.f90 b/fortran/test/tH5O.f90 index 247d1d0..b68e7ca 100644 --- a/fortran/test/tH5O.f90 +++ b/fortran/test/tH5O.f90 @@ -35,15 +35,8 @@ SUBROUTINE test_h5o(cleanup, total_error) INTEGER, INTENT(OUT) :: total_error INTEGER :: error - ! /* Output message about test being performed */ - ! WRITE(*,*) "Testing Objects" - -!!$ test_h5o_open(); /* Test generic OPEN FUNCTION */ -!!$ test_h5o_open_by_addr(); /* Test opening objects by address */ -!!$ test_h5o_close(); /* Test generic CLOSE FUNCTION */ -!!$ test_h5o_refcount(); /* Test incrementing and decrementing reference count */ - CALL test_h5o_plist(total_error) ! /* Test object creation properties */ - CALL test_h5o_link(total_error) ! /* Test object link routine */ + CALL test_h5o_plist(total_error) ! Test object creation properties + CALL test_h5o_link(total_error) ! Test object link routine IF(cleanup) CALL h5_cleanup_f("TestFile", H5P_DEFAULT_F, error) CALL check("h5_cleanup_f", error, total_error) @@ -100,6 +93,19 @@ SUBROUTINE test_h5o_link(total_error) INTEGER(HSIZE_T), DIMENSION(1:1) :: dims2 = (/dim0/) ! size read/write buffer INTEGER , DIMENSION(1:dim0) :: wdata2, & ! Write buffer rdata2 ! Read buffer + LOGICAL :: link_exists + CHARACTER(LEN=8) :: chr_exact + CHARACTER(LEN=10) :: chr_lg + INTEGER(size_t) :: nlinks + INTEGER(HID_T) :: plist = -1 + + CHARACTER(LEN=20) :: dset_comment = "dataset comment" + CHARACTER(LEN=13) :: grp_comment = "group comment" + CHARACTER(LEN=10) :: comment_sm ! to small comment sized buffer + CHARACTER(LEN=15) :: comment ! exact comment sized buffer + CHARACTER(LEN=20) :: comment_lg ! large comment sized buffer + INTEGER(HSSIZE_T) :: comment_size + INTEGER(SIZE_T) :: comment_size2 ! Initialize the raw data DO i = 1, TEST6_DIM1 @@ -131,8 +137,6 @@ SUBROUTINE test_h5o_link(total_error) CALL H5Pset_libver_bounds_f(fapl_id, H5F_LIBVER_LATEST_F, H5F_LIBVER_LATEST_F, error) CALL check("H5Pset_libver_bounds_f",error, total_error) -!!$ ret = H5Pset_libver_bounds(fapl_id, (new_format ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST); - ! Create a new HDF5 file CALL H5Fcreate_f(TEST_FILENAME, H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl_id) CALL check("H5Fcreate_f", error, total_error) @@ -155,10 +159,9 @@ SUBROUTINE test_h5o_link(total_error) ! Create a dataset with no name using the committed datatype CALL H5Dcreate_anon_f(file_id, type_id, space_id, dset_id, error ) ! using no optional parameters CALL check("H5Dcreate_anon_f",error,total_error) - - + ! ! Verify that we can write to and read from the dataset - + ! ! Write the data to the dataset !EP CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, wdata, dims, error, & @@ -199,7 +202,6 @@ SUBROUTINE test_h5o_link(total_error) CALL h5tclose_f(type_id, error) CALL check("h5tclose_f", error, total_error) - ! Re-open datatype using new link CALL H5Topen_f(group_id, "datatype", type_id, error) CALL check("h5topen_f", error, total_error) @@ -208,12 +210,10 @@ SUBROUTINE test_h5o_link(total_error) CALL H5Olink_f(group_id, file_id, "/group", error) CALL check("H5Olink_f", error, total_error) - CALL h5gclose_f(group_id, error) CALL check("h5gclose_f",error,total_error) ! Open dataset through root group and verify its data - CALL H5Dopen_f(file_id, "/group/inter_group/dataset", dset_id, error) CALL check("test_lcpl.h5dopen_f", error, total_error) @@ -236,7 +236,6 @@ SUBROUTINE test_h5o_link(total_error) CALL h5tclose_f(type_id, error) CALL check("h5tclose_f",error,total_error) - ! Close remaining IDs CALL h5sclose_f(space_id, error) CALL check("h5sclose_f",error,total_error) @@ -264,16 +263,214 @@ SUBROUTINE test_h5o_link(total_error) CALL check("h5gcreate_f", error, total_error) CALL h5gcreate_f(file_id,"/G1/G2/G3",group_id,error) CALL check("h5gcreate_f", error, total_error) + + ! Try putting a comment on the group /G1/G2/G3 by name + CALL h5oset_comment_by_name_f(file_id, "/G1/G2/G3", grp_comment, error) + CALL check("h5oset_comment_by_name_f", error, total_error) + + comment_lg = ' ' + + CALL h5oget_comment_by_name_f(file_id, "/G1/G2/G3", comment_lg, error) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF(comment_lg(1:13).NE.grp_comment)THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + IF(comment_lg(14:20).NE.' ')THEN ! make sure no NULL terminator + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + + ! Try putting a comment on the group /G1/G2/G3 by name with trailing blanks + + CALL h5oset_comment_by_name_f(file_id, "/G1/G2/G3"//' ', grp_comment, error) + CALL check("h5oset_comment_by_name_f", error, total_error) + + comment_lg = ' ' + + CALL h5oget_comment_by_name_f(file_id, "/G1/G2/G3"//' ', comment_lg, error) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF(comment_lg(1:13).NE.grp_comment)THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + IF(comment_lg(14:20).NE.' ')THEN ! make sure no NULL terminator + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + ! ! Create the dataset ! CALL h5dcreate_f(group_id, dataset, H5T_STD_I32LE, space_id, dset_id, error) CALL check("h5dcreate_f", error, total_error) + + ! Putting a comment on the dataset + CALL h5oset_comment_f(dset_id, dset_comment, error) + CALL check("h5oset_comment_f", error, total_error) + + ! Try reading into a buffer that is the correct size + + CALL h5oget_comment_f(dset_id, comment, error) + CALL check("h5oget_comment_f", error, total_error) + + IF(comment(1:15).NE.dset_comment(1:15))THEN + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + + ! Try reading into a buffer that is to small + + CALL h5oget_comment_f(dset_id, comment_sm, error) + CALL check("h5oget_comment_f", error, total_error) + + IF(comment_sm(1:10).NE.dset_comment(1:10))THEN + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + + ! Try reading into a buffer that is larger then needed + + comment_lg = ' ' + + CALL h5oget_comment_f(dset_id, comment_lg, error) + CALL check("h5oget_comment_f", error, total_error) + + IF(comment_lg(1:15).NE.dset_comment)THEN + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + IF(comment_lg(16:20).NE.' ')THEN ! make sure no NULL terminator + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + ! + ! Check optional parameter + ! + CALL h5oget_comment_f(dset_id, comment_lg, error, comment_size) + CALL check("h5oget_comment_f", error, total_error) + + IF( comment_size.NE.15)THEN + CALL check("h5oget_comment_f", -1, total_error) + ENDIF + + ! CHECK h5oget_comment_by_name_f + + ! Try reading into a buffer that is the correct size + + CALL h5oget_comment_by_name_f(dset_id, ".", comment, error) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF(comment(1:15).NE.dset_comment(1:15))THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + + ! Try with trailing blanks in the name + + CALL h5oget_comment_by_name_f(dset_id, ". ", comment, error) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF(comment(1:15).NE.dset_comment(1:15))THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + + ! + ! Check optional parameter + ! + CALL h5oget_comment_by_name_f(dset_id, ". ", comment_lg, error, comment_size2) + CALL check("h5oget_comment_by_name_f", error, total_error) + + IF( comment_size2.NE.15)THEN + CALL check("h5oget_comment_by_name_f", -1, total_error) + ENDIF + ! ! Write the data to the dataset. ! CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, wdata2, dims2, error) CALL check("h5dwrite_f", error, total_error) + + ! ************************* + ! CHECK H5OEXISTS_BY_NAME_F + ! ************************* + + ! Create a soft link to /G1 + CALL h5lcreate_soft_f("/G1", file_id, "/G1_LINK", error) + CALL check("h5lcreate_soft_f", error, total_error) + + + ! Create a soft link to /G1000, does not exist + CALL h5lcreate_soft_f("/G1000", file_id, "/G1_FALSE", error) + CALL check("h5lcreate_soft_f", error, total_error) + + ! Create a soft link to /G1_LINK + CALL h5lcreate_soft_f("/G1_FALSE", file_id, "/G2_FALSE", error) + CALL check("h5lcreate_soft_f", error, total_error) + + ! See if the link exists + CALL h5oexists_by_name_f(file_id,"/G1_LINK", link_exists, error) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.NOT.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + chr_exact = "/G1_LINK" + ! See if the link exists + CALL h5oexists_by_name_f(file_id,chr_exact, link_exists, error, H5P_DEFAULT_F) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.NOT.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + chr_lg = "/G1_LINK" + ! See if the link exists + CALL h5oexists_by_name_f(file_id,chr_lg, link_exists, error, H5P_DEFAULT_F) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.NOT.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + chr_lg = "/G1_LINK " + ! See if the link exists + CALL h5oexists_by_name_f(file_id,chr_lg, link_exists, error, H5P_DEFAULT_F) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.NOT.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + ! See if the link exists + CALL h5oexists_by_name_f(file_id,"/G1_FALSE", link_exists, error) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should not exist + IF(link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF + + ! Check optional parameter + + CALL h5pcreate_f(H5P_LINK_ACCESS_F,plist,error) + CALL check("h5pcreate_f",error,total_error) + + nlinks = 2 + CALL h5pset_nlinks_f(plist, nlinks, error) + CALL check("h5pset_nlinks_f", error, total_error) + ! Ensure that nlinks was set successfully + nlinks = 0 + CALL h5pget_nlinks_f(plist, nlinks, error) + CALL check("h5pget_nlinks_f",error,total_error) + CALL VERIFY("h5pget_nlinks_f", INT(nlinks), 2, total_error) + + ! See if the link exists + CALL h5oexists_by_name_f(file_id,"/G1_LINK", link_exists, error, plist) + CALL check("h5oexists_by_name_f", error, total_error) + + ! Object should exist + IF(.not.link_exists)THEN + CALL check("h5oexists_by_name_f", -1, total_error) + ENDIF ! ! Close and release resources. ! @@ -283,6 +480,14 @@ SUBROUTINE test_h5o_link(total_error) CALL check("h5sclose_f", error, total_error) CALL h5gclose_f(group_id, error) CALL check("h5gclose_f", error, total_error) + + ! Test opening an object by index, note + CALL h5oopen_by_idx_f(file_id, "/G1/G2/G3", H5_INDEX_NAME_F, H5_ITER_INC_F, 0_hsize_t, group_id, error) + CALL check("h5oopen_by_idx_f", error, total_error) + + CALL h5oclose_f(group_id, error) + CALL check("h5gclose_f", error, total_error) + ! ! create property to pass copy options ! @@ -324,7 +529,7 @@ SUBROUTINE test_h5o_link(total_error) CALL h5tcopy_f(H5T_NATIVE_INTEGER, tid, error) CALL check("h5tcopy_f", error, total_error) - ! create named datatype + ! create named datatype CALL h5tcommit_f(file_id, NAME_DATATYPE_SIMPLE, tid, error) CALL check("h5tcommit_f", error, total_error) @@ -346,8 +551,7 @@ SUBROUTINE test_h5o_link(total_error) ! Compare the datatypes CALL h5tequal_f(tid, tid2, flag, error) IF(.NOT.flag)THEN - WRITE(*,*) "h5ocopy_f FAILED" - total_error = total_error + 1 + CALL check("h5ocopy_f FAILED", -1, total_error) ENDIF ! close the destination datatype @@ -436,7 +640,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL VERIFY("H5Pget_attr_phase_change_f", max_compact, (def_max_compact + 1), total_error) CALL VERIFY("H5Pget_attr_phase_change_f", min_dense, (def_min_dense - 1), total_error) - ! Create a group, dataset, and committed datatype within the file, ! using the respective type of creation property lists. ! @@ -472,7 +675,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL h5sclose_f(dspace, error) CALL check("h5sclose_f",error,total_error) - ! Close current creation property lists CALL h5pclose_f(gcpl,error) CALL check("h5pclose_f", error, total_error) @@ -482,7 +684,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL check("h5pclose_f", error, total_error) ! Retrieve each object's creation property list - CALL H5Gget_create_plist_f(grp, gcpl, error) CALL check("H5Gget_create_plist", error, total_error) @@ -492,7 +693,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL H5Dget_create_plist_f(dset, dcpl, error) CALL check("H5Dget_create_plist_f", error, total_error) - ! Retrieve attribute phase change values on each creation property list and verify CALL H5Pget_attr_phase_change_f(gcpl, max_compact, min_dense, error) CALL check("H5Pget_attr_phase_change_f", error, total_error) @@ -509,9 +709,7 @@ SUBROUTINE test_h5o_plist(total_error) CALL VERIFY("H5Pget_attr_phase_change_f", max_compact, (def_max_compact + 1), total_error) CALL VERIFY("H5Pget_attr_phase_change_f", min_dense, (def_min_dense - 1), total_error) - ! Close current objects - CALL h5pclose_f(gcpl,error) CALL check("h5pclose_f", error, total_error) CALL h5pclose_f(dcpl,error) @@ -552,7 +750,6 @@ SUBROUTINE test_h5o_plist(total_error) CALL H5Dget_create_plist_f(dset, dcpl, error) CALL check("H5Dget_create_plist_f", error, total_error) - ! Retrieve attribute phase change values on each creation property list and verify CALL H5Pget_attr_phase_change_f(gcpl, max_compact, min_dense, error) CALL check("H5Pget_attr_phase_change_f", error, total_error) @@ -569,9 +766,7 @@ SUBROUTINE test_h5o_plist(total_error) CALL VERIFY("H5Pget_attr_phase_change_f", max_compact, (def_max_compact + 1), total_error) CALL VERIFY("H5Pget_attr_phase_change_f", min_dense, (def_min_dense - 1), total_error) - ! Close current objects - CALL h5pclose_f(gcpl,error) CALL check("h5pclose_f", error, total_error) CALL h5pclose_f(dcpl,error) diff --git a/fortran/test/tH5O_F03.f90 b/fortran/test/tH5O_F03.f90 new file mode 100644 index 0000000..f060a7d --- /dev/null +++ b/fortran/test/tH5O_F03.f90 @@ -0,0 +1,547 @@ +!****h* root/fortran/test/tH5O_F03.f90 +! +! NAME +! tH5O_F03.f90 +! +! FUNCTION +! Test FORTRAN HDF5 H5O APIs which are dependent on FORTRAN 2003 +! features. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +!***** + +! ***************************************** +! *** H 5 O T E S T S +! ***************************************** +MODULE visit_cb + + USE HDF5 + USE ISO_C_BINDING + + IMPLICIT NONE + + INTEGER, PARAMETER :: info_size = 9 + + !------------------------------------------------------------------------- + ! Function: visit_obj_cb + ! + ! Purpose: Callback routine for visiting objects in a file + ! + ! Return: Success: 0 + ! Failure: -1 + ! + ! Programmer: M.S. Breitenfeld + ! July 12, 2012 + ! Adopted from C test. + ! + !------------------------------------------------------------------------- + ! + ! Object visit structs + TYPE, bind(c) :: obj_visit_t + CHARACTER(LEN=1), DIMENSION(1:180) :: path ! Path to object + INTEGER :: type_obj ! type of object + END TYPE obj_visit_t + + TYPE, bind(c) :: ovisit_ud_t + INTEGER :: idx ! Index in object visit structure + TYPE(obj_visit_t), DIMENSION(1:info_size) :: info ! Pointer to the object visit structure to use + END TYPE ovisit_ud_t + +CONTAINS + + INTEGER FUNCTION visit_obj_cb( group_id, name, oinfo, op_data) bind(C) + + IMPLICIT NONE + + INTEGER(HID_T) :: group_id + CHARACTER(LEN=1), DIMENSION(1:180) :: name + TYPE(h5o_info_t) :: oinfo + TYPE(ovisit_ud_t) :: op_data + + INTEGER :: len, i + INTEGER :: idx + + visit_obj_cb = 0 + + ! Since the name is generated in C and passed to a Fortran string, it + ! will be NULL terminated, so we need to find the end of the string. + + len = 1 + DO len = 1, 180 + IF(name(len) .EQ. C_NULL_CHAR) EXIT + ENDDO + + len = len - 1 + + ! Check for correct object information + + idx = op_data%idx + + DO i = 1, len + IF(op_data%info(idx)%path(i)(1:1) .NE. name(i)(1:1))THEN + visit_obj_cb = -1 + RETURN + ENDIF + + IF(op_data%info(idx)%type_obj .NE. oinfo%type)THEN + visit_obj_cb = -1 + RETURN + ENDIF + + ENDDO + + ! Advance to next location in expected output + op_data%idx = op_data%idx + 1 + + END FUNCTION visit_obj_cb + +END MODULE visit_cb + +!/**************************************************************** +!** +!** test_h5o_refcount(): Test H5O refcounting functions. +!** +!****************************************************************/ + +SUBROUTINE test_h5o_refcount(total_error) + + USE HDF5 + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + CHARACTER(LEN=11), PARAMETER :: FILENAME = "th5o_ref.h5" + INTEGER, PARAMETER :: DIM0 = 5 + INTEGER, PARAMETER :: DIM1 = 10 + INTEGER(hid_t) :: fid ! HDF5 File ID + INTEGER(hid_t) :: grp, dset, dtype, dspace ! Object identifiers + TYPE(h5o_info_t) :: oinfo ! Object info struct + INTEGER(hsize_t), DIMENSION(1:2) :: dims + INTEGER :: error ! Value returned from API calls + + ! Create a new HDF5 file + CALL h5fcreate_f(FILENAME,H5F_ACC_TRUNC_F,fid,error) + CALL check("h5fcreate_f", error, total_error) + + ! Create a group, dataset, and committed datatype within the file + ! Create the group + CALL h5gcreate_f(fid, "group", grp, error) + CALL check("h5gcreate_f",error, total_error) + + ! Commit the type inside the group + CALL h5tcopy_f(H5T_NATIVE_INTEGER, dtype, error) + CALL check("H5Tcopy_f",error, total_error) + CALL h5tcommit_f(fid, "datatype", dtype, error) + CALL check("h5tcommit_f", error, total_error) + + ! Create the data space for the dataset. + dims(1) = DIM0 + dims(2) = DIM1 + + CALL h5screate_simple_f(2, dims, dspace, error) + CALL check("h5screate_simple_f", error, total_error) + + ! Create the dataset. + CALL h5dcreate_f(fid, "dataset", H5T_NATIVE_INTEGER, dspace, dset, error) + CALL check("h5dcreate_f", error, total_error) + CALL h5sclose_f(dspace, error) + CALL check("h5sclose_f", error, total_error) + + ! Get ref counts for each object. They should all be 1, since each object has a hard link. + CALL h5oget_info_by_name_f(fid, "group", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "datatype", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "dataset", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + + ! Check h5oget_info + CALL h5oget_info_f(grp, oinfo, error) + CALL check("h5oget_info_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_f", -1, total_error) + ENDIF + IF(oinfo%type.NE.H5O_TYPE_GROUP_F)THEN + CALL check("h5oget_info_f", -1, total_error) + ENDIF + + ! Increment each object's reference count. + CALL h5oincr_refcount_f(grp, error) + CALL check("h5oincr_refcount_f", error, total_error) + CALL h5oincr_refcount_f(dtype, error) + CALL check("h5oincr_refcount_f", error, total_error) + CALL h5oincr_refcount_f(dset, error) + CALL check("h5oincr_refcount_f", error, total_error) + + ! Get ref counts for each object. They should all be 2 now. + CALL h5oget_info_by_name_f(fid, "group", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.2)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "datatype", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.2)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "dataset", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.2)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + + ! Decrement the reference counts and check that they decrease back to 1. + CALL h5odecr_refcount_f(grp, error) + CALL check("h5oincr_refcount_f", error, total_error) + CALL h5odecr_refcount_f(dtype, error) + CALL check("h5oincr_refcount_f", error, total_error) + CALL h5odecr_refcount_f(dset, error) + CALL check("h5oincr_refcount_f", error, total_error) + + CALL h5oget_info_by_name_f(fid, "group", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "datatype", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + CALL h5oget_info_by_name_f(fid, "dataset", oinfo, error) + CALL check("h5oget_info_by_name_f", error, total_error) + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_name_f", -1, total_error) + ENDIF + + CALL h5gclose_f(grp, error) + CALL check("h5gclose_f",error, total_error) + CALL h5tclose_f(dtype, error) + CALL check("h5tclose_f",error, total_error) + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f",error, total_error) + CALL h5fclose_f(fid, error) + CALL check("h5fclose_f",error, total_error) + +END SUBROUTINE test_h5o_refcount + +!**************************************************************** +!** +!** test_h5o_refcount(): Test H5O visit functions. +!** +!**************************************************************** + +SUBROUTINE obj_visit(total_error) + + USE HDF5 + + USE visit_cb + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + TYPE(ovisit_ud_t), TARGET :: udata ! User-data for visiting + INTEGER(hid_t) :: fid = -1 + INTEGER(hid_t) :: gid = -1 ! Group ID + TYPE(C_PTR) :: f_ptr + TYPE(C_FUNPTR) :: fun_ptr + CHARACTER(LEN=180) :: object_name + INTEGER :: ret_val + INTEGER :: error + + ! Construct "interesting" file to visit + CALL build_visit_file(fid) + + ! Inialize udata for testing purposes + udata%info(1)%path(1:1) ="." + udata%info(1)%type_obj = H5O_TYPE_GROUP_F + udata%info(2)%path(1:12) = & + (/"D","a","t","a","s","e","t","_","z","e","r","o"/) + udata%info(2)%type_obj =H5O_TYPE_DATASET_F + udata%info(3)%path(1:6) = & + (/"G","r","o","u","p","1"/) + udata%info(3)%type_obj = H5O_TYPE_GROUP_F + udata%info(4)%path(1:18) =& + (/"G","r","o","u","p","1","/","D","a","t","a","s","e","t","_","o","n","e"/) + udata%info(4)%type_obj = H5O_TYPE_DATASET_F + udata%info(5)%path(1:13) =& + (/"G","r","o","u","p","1","/","G","r","o","u","p","2"/) + udata%info(5)%type_obj = H5O_TYPE_GROUP_F + udata%info(6)%path(1:25) =& + (/"G","r","o","u","p","1","/","G","r","o","u","p","2","/","D","a","t","a","s","e","t","_","t","w","o"/) + udata%info(6)%type_obj = H5O_TYPE_DATASET_F + udata%info(7)%path(1:22) =& + (/"G","r","o","u","p","1","/","G","r","o","u","p","2","/","T","y","p","e","_","t","w","o"/) + udata%info(7)%type_obj = H5O_TYPE_NAMED_DATATYPE_F + udata%info(8)%path(1:15) =& + (/"G","r","o","u","p","1","/","T","y","p","e","_","o","n","e"/) + udata%info(8)%type_obj = H5O_TYPE_NAMED_DATATYPE_F + udata%info(9)%path(1:9) =& + (/"T","y","p","e","_","z","e","r","o"/) + udata%info(9)%type_obj = H5O_TYPE_NAMED_DATATYPE_F + + ! Visit all the objects reachable from the root group (with file ID) + udata%idx = 1 + + fun_ptr = C_FUNLOC(visit_obj_cb) + f_ptr = C_LOC(udata) + + ! Test h5ovisit_f + CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error) + CALL check("h5ovisit_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_f", -1, total_error) + ENDIF + + ! Test h5ovisit_by_name_f + + object_name = "/" + udata%idx = 1 + + CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error) + CALL check("h5ovisit_by_name_f", error, total_error) + IF(ret_val.LT.0)THEN + CALL check("h5ovisit_by_name_f", -1, total_error) + ENDIF + + CALL h5fclose_f(fid, error) + CALL check("h5fclose_f",error, total_error) + +END SUBROUTINE obj_visit + +!**************************************************************** +!** +!** test_h5o_refcount(): Test H5O info functions. +!** +!**************************************************************** + +SUBROUTINE obj_info(total_error) + + USE HDF5 + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + INTEGER(hid_t) :: fid = -1 ! File ID + INTEGER(hid_t) :: gid = -1, gid2 = -1 ! Group IDs + INTEGER(hid_t) :: did ! Dataset ID + INTEGER(hid_t) :: sid ! Dataspace ID + TYPE(hobj_ref_t_f), TARGET :: wref ! Reference to write + TYPE(hobj_ref_t_f), TARGET :: rref ! Reference to read + TYPE(H5O_info_t) :: oinfo ! Object info struct + INTEGER :: count = 0 ! Count within iterated group + INTEGER :: error + TYPE(C_PTR) :: f_ptr + + CHARACTER(LEN=6) :: GROUPNAME = "/group" + CHARACTER(LEN=6) :: GROUPNAME2 = "group2" + CHARACTER(LEN=6) :: GROUPNAME3 = "group3" + CHARACTER(LEN=5) :: DSETNAME = "/dset" + CHARACTER(LEN=5) :: DSETNAME2 = "dset2" + + ! Create file with a group and a dataset containing an object reference to the group + CALL h5fcreate_f("get_info.h5", H5F_ACC_TRUNC_F, fid, error) + CALL check("h5fcreate_f",error, total_error) + + ! Create dataspace to use for dataset + CALL h5screate_f(H5S_SCALAR_F, sid, error) + CALL check("h5screate_f",error,total_error) + + ! Create group to refer to + CALL h5gcreate_f(fid, GROUPNAME, gid, error) + CALL check("h5gcreate_f",error,total_error) + + ! Create nested groups + CALL h5gcreate_f(gid, GROUPNAME2, gid2, error) + CALL check("h5gcreate_f",error,total_error) + CALL h5gclose_f(gid2, error) + CALL check("h5gclose_f",error,total_error) + + CALL h5gcreate_f(gid, GROUPNAME3, gid2, error) + CALL check("h5gcreate_f",error,total_error) + CALL h5gclose_f(gid2, error) + CALL check("h5gclose_f",error,total_error) + + ! Create bottom dataset + CALL h5dcreate_f(gid, DSETNAME2, H5T_NATIVE_INTEGER, sid, did, error) + CALL check("h5dcreate_f",error, total_error) + + CALL h5dclose_f(did, error) + CALL check("h5dclose_f", error, total_error) + + CALL h5gclose_f(gid, error) + CALL check("h5gclose_f",error,total_error) + + ! Create dataset + CALL h5dcreate_f(fid, DSETNAME, H5T_STD_REF_OBJ, sid, did, error) + CALL check("h5dcreate_f",error, total_error) + + f_ptr = C_LOC(wref) + + ! Create reference to group + CALL h5rcreate_f(fid, GROUPNAME, H5R_OBJECT_F, f_ptr, error) + CALL check("h5rcreate_f",error, total_error) + + ! Write reference to disk + CALL h5dwrite_f(did, H5T_STD_REF_OBJ, f_ptr, error) + CALL check("h5dwrite_f",error, total_error) + + ! Close objects + CALL h5dclose_f(did, error) + CALL check("h5dclose_f", error, total_error) + CALL h5sclose_f(sid, error) + CALL check("h5sclose_f", error, total_error) + CALL h5fclose_f(fid, error) + CALL check("h5fclose_f", error, total_error) + + ! Re-open file + CALL h5fopen_f("get_info.h5", H5F_ACC_RDWR_F, fid, error) + CALL check("h5fopen_f", error, total_error) + + ! Re-open dataset + CALL h5dopen_f(fid, DSETNAME, did, error) + CALL check("h5dopen_f", error, total_error) + + ! Read in the reference + + f_ptr = C_LOC(rref) + + CALL h5dread_f(did, H5T_STD_REF_OBJ, f_ptr, error) + CALL check("H5Dread_f",error, total_error) + + ! Dereference to get the group + + CALL h5rdereference_f(did, H5R_OBJECT_F, f_ptr, gid, error) + CALL check("h5rdereference_f", error, total_error) + + CALL h5oget_info_by_idx_f(gid, ".", H5_INDEX_NAME_F, H5_ITER_INC_F, 0_hsize_t, oinfo, error) + CALL check("h5oget_info_by_idx_f", error, total_error) + + IF(oinfo%rc.NE.1)THEN + CALL check("h5oget_info_by_idx_f", -1, total_error) + ENDIF + + IF(oinfo%type.NE.H5O_TYPE_DATASET_F)THEN + CALL check("h5oget_info_by_idx_f", -1, total_error) + ENDIF + + ! Close objects + CALL h5dclose_f(did, error) + CALL check("h5dclose_f", error, total_error) + CALL h5gclose_f(gid, error) + CALL check("h5sclose_f", error, total_error) + CALL h5fclose_f(fid, error) + CALL check("h5fclose_f", error, total_error) + +END SUBROUTINE obj_info + +!------------------------------------------------------------------------- +! Function: build_visit_file +! +! Purpose: Build an "interesting" file to use for visiting links & objects +! +! Programmer: M. Scot Breitenfeld +! July 12, 2012 +! NOTE: Adapted from C test. +! +!------------------------------------------------------------------------- +! + +SUBROUTINE build_visit_file(fid) + + USE HDF5 + IMPLICIT NONE + + INTEGER(hid_t) :: fid ! File ID + INTEGER(hid_t) :: gid = -1, gid2 = -1 ! Group IDs + INTEGER(hid_t) :: sid = -1 ! Dataspace ID + INTEGER(hid_t) :: did = -1 ! Dataset ID + INTEGER(hid_t) :: tid = -1 ! Datatype ID + CHARACTER(LEN=20) :: filename = 'visit.h5' + INTEGER :: error + + ! Create file for visiting + CALL H5Fcreate_f(filename, H5F_ACC_TRUNC_F, fid, error) + + ! Create group + CALL H5Gcreate_f(fid, "/Group1", gid, error) + + ! Create nested group + CALL H5Gcreate_f(gid, "Group2", gid2, error) + + ! Close groups + CALL h5gclose_f(gid2, error) + CALL h5gclose_f(gid, error) + + ! Create soft links to groups created + CALL H5Lcreate_soft_f("/Group1", fid, "/soft_one", error) + CALL H5Lcreate_soft_f("/Group1/Group2", fid, "/soft_two", error) + + ! Create dangling soft link + CALL H5Lcreate_soft_f("nowhere", fid, "/soft_dangle", error) + + ! Create hard links to all groups + CALL H5Lcreate_hard_f(fid, "/", fid, "hard_zero", error) + CALL H5Lcreate_hard_f(fid, "/Group1", fid, "hard_one", error) + CALL H5Lcreate_hard_f(fid, "/Group1/Group2", fid, "hard_two", error) + + ! Create loops w/hard links + CALL H5Lcreate_hard_f(fid, "/Group1", fid, "/Group1/hard_one", error) + CALL H5Lcreate_hard_f(fid, "/", fid, "/Group1/Group2/hard_zero", error) + + ! Create dataset in each group + CALL H5Screate_f(H5S_SCALAR_F, sid, error) + + CALL H5Dcreate_f(fid, "/Dataset_zero", H5T_NATIVE_INTEGER, sid, did, error) + CALL H5Dclose_f(did, error) + + CALL H5Dcreate_f(fid, "/Group1/Dataset_one", H5T_NATIVE_INTEGER, sid, did, error) + CALL H5Dclose_f(did, error) + + CALL H5Dcreate_f(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INTEGER, sid, did, error) + CALL H5Dclose_f(did, error) + + CALL H5Sclose_f(sid, error) + + ! Create named datatype in each group + CALL H5Tcopy_f(H5T_NATIVE_INTEGER, tid, error) + + CALL H5Tcommit_f(fid, "/Type_zero", tid, error) + CALL H5Tclose_f(tid, error) + + CALL H5Tcopy_f(H5T_NATIVE_INTEGER, tid, error) + CALL H5Tcommit_f(fid, "/Group1/Type_one", tid, error) + CALL H5Tclose_f(tid, error) + + CALL H5Tcopy_f(H5T_NATIVE_INTEGER, tid, error) + CALL H5Tcommit_f(fid, "/Group1/Group2/Type_two", tid, error) + CALL H5Tclose_f(tid, error) + +END SUBROUTINE build_visit_file diff --git a/fortran/test/tH5T_F03.f90 b/fortran/test/tH5T_F03.f90 index dbd8b0a..f7efcc4 100644 --- a/fortran/test/tH5T_F03.f90 +++ b/fortran/test/tH5T_F03.f90 @@ -405,7 +405,7 @@ END SUBROUTINE test_array_compound_atomic CALL check("h5tarray_create_f", error, total_error) ! Insert character array field - CALL h5tinsert_f(tid2, "c", H5OFFSETOF(C_LOC(wdata(1,1)),C_LOC(wdata(1,1)%c(1))), tid4, error) + CALL h5tinsert_f(tid2, "c", H5OFFSETOF(C_LOC(wdata(1,1)),C_LOC(wdata(1,1)%c(1)(1:1))), tid4, error) CALL check("h5tinsert2_f", error, total_error) ! Close array of floats field datatype @@ -551,7 +551,7 @@ END SUBROUTINE test_array_compound_atomic CALL H5Tget_member_offset_f(tid2, 2, off, error) CALL check("H5Tget_member_offset_f", error, total_error) CALL VERIFY("H5Tget_member_offset_f",INT(off),& - INT(H5OFFSETOF(C_LOC(wdata(1,1)),C_LOC(wdata(1,1)%c(1)))), total_error) + INT(H5OFFSETOF(C_LOC(wdata(1,1)),C_LOC(wdata(1,1)%c(1)(1:1)))), total_error) ! Check the 3rd field's datatype CALL H5Tget_member_type_f(tid2, 2, mtid2, error) @@ -1028,8 +1028,8 @@ END SUBROUTINE test_array_compound_atomic 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 :: 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(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 CHARACTER(LEN=12), PARAMETER :: filename = "dsetf_F03.h5" ! File name CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name @@ -1710,7 +1710,7 @@ SUBROUTINE t_opaque(total_error) ! CALL h5dcreate_f(file, dataset, dtype, space, dset, error) CALL check("h5dcreate_f",error, total_error) - f_ptr = C_LOC(wdata(1)) + f_ptr = C_LOC(wdata(1)(1:1)) CALL h5dwrite_f(dset, dtype, f_ptr, error) CALL check("h5dwrite_f",error, total_error) ! @@ -1774,7 +1774,7 @@ SUBROUTINE t_opaque(total_error) ! ! Read the data. ! - f_ptr = C_LOC(rdata(1)) + f_ptr = C_LOC(rdata(1)(1:1)) CALL h5dread_f(dset, dtype, f_ptr, error) CALL check("H5Dread_f",error, total_error) ! @@ -2123,7 +2123,7 @@ SUBROUTINE t_regref(total_error) CALL h5screate_simple_f(1, dims3, memspace, error) CALL check("h5screate_simple_f",error, total_error) - f_ptr = C_LOC(rdata2(1)) + f_ptr = C_LOC(rdata2(1)(1:1)) CALL h5dread_f( dset2, H5T_NATIVE_INTEGER_1, f_ptr, error, memspace, space) CALL check("H5Dread_f",error, total_error) CALL verifystring("h5dread_f",rdata2(1)(1:npoints),TRIM(chrref_correct(i)), total_error) @@ -2473,24 +2473,24 @@ SUBROUTINE t_vlstring_readwrite(total_error) ! Initialize array of C pointers - wdata(1) = C_LOC(A(1)) - wdata(2) = C_LOC(B(1)) - wdata(3) = C_LOC(C(1)) - wdata(4) = C_LOC(D(1)) + wdata(1) = C_LOC(A(1)(1:1)) + wdata(2) = C_LOC(B(1)(1:1)) + wdata(3) = C_LOC(C(1)(1:1)) + wdata(4) = C_LOC(D(1)(1:1)) data_w(1) = A(1) data_w(2) = B(1) data_w(3) = C(1) data_w(4) = D(1) - wdata2D(1,1) = C_LOC(A11(1)) - wdata2D(1,2) = C_LOC(A12(1)) - wdata2D(1,3) = C_LOC(A13(1)) - wdata2D(1,4) = C_LOC(A14(1)) - wdata2D(2,1) = C_LOC(A21(1)) - wdata2D(2,2) = C_LOC(A22(1)) - wdata2D(2,3) = C_LOC(A23(1)) - wdata2D(2,4) = C_LOC(A24(1)) + wdata2D(1,1) = C_LOC(A11(1)(1:1)) + wdata2D(1,2) = C_LOC(A12(1)(1:1)) + wdata2D(1,3) = C_LOC(A13(1)(1:1)) + wdata2D(1,4) = C_LOC(A14(1)(1:1)) + wdata2D(2,1) = C_LOC(A21(1)(1:1)) + wdata2D(2,2) = C_LOC(A22(1)(1:1)) + wdata2D(2,3) = C_LOC(A23(1)(1:1)) + wdata2D(2,4) = C_LOC(A24(1)(1:1)) data2D_w(1,1) = A11(1) data2D_w(1,2) = A12(1) @@ -2918,8 +2918,9 @@ SUBROUTINE setup_buffer(data_in, line_lengths, char_type) INTEGER, DIMENSION(1:3) :: letters CHARACTER(LEN=3) :: lets CHARACTER(KIND=C_CHAR,LEN=*) :: char_type + CHARACTER(KIND=C_CHAR,LEN=1) :: char_tmp INTEGER :: i, j, n, ff - + ! Convert the letters and special character to integers lets = 'abc' @@ -2929,15 +2930,18 @@ SUBROUTINE setup_buffer(data_in, line_lengths, char_type) j = 1 DO i=1,n-1 IF( j .EQ. 4 )THEN - WRITE(data_in(i:i),'(A1)') ff + WRITE(char_tmp,'(A1)') ff + data_in(i:i) = char_tmp ELSE - WRITE(data_in(i:i),'(A1)') letters(j) + WRITE(char_tmp,'(A1)') letters(j) + data_in(i:i) = char_tmp ENDIF line_lengths(i) = LEN_TRIM(data_in(i)) j = j + 1 IF( j .EQ. 5 ) j = 1 END DO - WRITE(data_in(n:n),'(A1)') ff + WRITE(char_tmp,'(A1)') ff + data_in(n:n) = char_tmp line_lengths(n) = 1 END SUBROUTINE setup_buffer @@ -3088,3 +3092,350 @@ SUBROUTINE test_nbit(cleanup, total_error ) END SUBROUTINE test_nbit +SUBROUTINE t_enum_conv(total_error) + +!------------------------------------------------------------------------- +! Subroutine: t_enum_conv +! +! Purpose: Tests converting data from enumeration datatype +! to numeric (integer or floating-point number) +! datatype. Tests various KINDs of INTEGERs +! and REALs. Checks reading enum data into +! INTEGER and REAL KINDs. +! +! Return: Success: 0 +! Failure: number of errors +! +! Programmer: M. Scot Breitenfeld +! October 27, 2012 +! +! Note: Adapted from C test (enum.c -- test_conv) +! No reliance on C tests. +!------------------------------------------------------------------------- +! + USE HDF5 + USE ISO_C_BINDING + + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + 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 :: real_kind_7 = SELECTED_REAL_KIND(Fortran_REAL_4) !should map to REAL*4 on most modern processors + + INTEGER(hid_t) :: cwg=-1, dtype=-1, space=-1, dset=-1, memtype ! Handles + INTEGER(hid_t) :: file ! Handles + + ! Enumerated type + ENUM, BIND(C) + ENUMERATOR :: E1_RED, E1_GREEN, E1_BLUE, E1_WHITE, E1_BLACK + END ENUM + + INTEGER :: val + + ! Enumerated data array + ! Some values are out of range for testing. The library should accept them + INTEGER(KIND(E1_RED)), DIMENSION(1:20), TARGET :: data1 = (/E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,& + E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED,& + E1_RED, E1_BLUE, E1_GREEN, E1_BLACK, E1_WHITE,& + E1_RED, E1_WHITE, INT(0,KIND(E1_RED)), INT(-1,KIND(E1_RED)), INT(-2,KIND(E1_RED))/) + + ! Reading array for enum data + INTEGER(KIND(E1_RED)), DIMENSION(1:20), TARGET :: data2 + + ! Reading array's for converted enum data + INTEGER(C_SHORT), DIMENSION(1:20), TARGET :: data_short + INTEGER(C_INT), DIMENSION(1:20), TARGET :: data_int + REAL(C_DOUBLE), DIMENSION(1:20), TARGET :: data_double + + INTEGER(int_kind_8), DIMENSION(1:20), TARGET :: data_i8 + INTEGER(int_kind_16), DIMENSION(1:20), TARGET :: data_i16 + REAL(real_kind_7), DIMENSION(1:20), TARGET :: data_r7 + + INTEGER(hsize_t), DIMENSION(1:1) :: ds_size = (/20/) + INTEGER(size_t) :: i + INTEGER :: error + TYPE(C_PTR) :: f_ptr + INTEGER(HID_T) :: m_baset ! Memory base type + ! + ! Create a new file using the default properties. + ! + CALL h5fcreate_f("enum1.h5", H5F_ACC_TRUNC_F, file, error) + CALL check("h5fcreate_f", error, total_error) + ! + ! Create a new group using the default properties. + ! + CALL h5gcreate_f(file, "test_conv", cwg, error) + CALL check("h5gcreate_f",error, total_error) + ! + ! Create a enum type + ! + CALL H5Tcreate_f(H5T_ENUM_F, H5OFFSETOF(C_LOC(data1(1)), C_LOC(data1(2))), dtype, error) + CALL check("h5tcreate_f",error, total_error) + ! + ! Initialize enum data. + ! + val = E1_RED + CALL H5Tenum_insert_f(dtype, "RED", val, error) + CALL check("h5tenum_insert_f",error, total_error) + val = E1_GREEN + CALL H5Tenum_insert_f(dtype, "GREEN", val, error) + CALL check("h5tenum_insert_f",error, total_error) + val = E1_BLUE + CALL H5Tenum_insert_f(dtype, "BLUE", val, error) + CALL check("h5tenum_insert_f",error, total_error) + val = E1_WHITE + CALL H5Tenum_insert_f(dtype, "WHITE", val, error) + CALL check("h5tenum_insert_f",error, total_error) + val = E1_BLACK + CALL H5Tenum_insert_f(dtype, "BLACK", val, error) + CALL check("h5tenum_insert_f",error, total_error) + ! + ! Create dataspace. Setting maximum size to be the current size. + ! + CALL h5screate_simple_f(1, ds_size, space, error) + CALL check("h5screate_simple_f", error, total_error) + + ! *************************************** + ! * Dataset of enumeration type + ! *************************************** + ! + ! Create a dataset of enum type and write enum data to it + + CALL h5dcreate_f(cwg, "color_table1", dtype, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check(" h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + + f_ptr = C_LOC(data2(1)) + CALL h5dread_f(dset, dtype, f_ptr, error, space, space) + CALL check(" h5dread_f", error, total_error) + + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. data2(i))THEN + total_error = total_error + 1 + WRITE(*,'(" 1. data1(",I0,")=",I0," .NE. data2(",I0,")=",I0)') i, data1(i),i,data2(i) + EXIT + ENDIF + ENDDO + + ! Test converting the data to integer (KIND=C_SHORT). Read enum data back as integer + m_baset = h5kind_to_type(KIND(data_short(1)), H5_INTEGER_KIND) ! Memory base type + f_ptr = C_LOC(data_short(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. data_short(i))THEN + total_error = total_error + 1 + WRITE(*,'(" 2. data1(",I0,")=",I0," .NE. data_short(",I0,")=",I0)') i, data1(i),i,data_short(i) + EXIT + ENDIF + ENDDO + + ! Test converting the data to (KIND=C_double) number. + ! Read enum data back as (KIND=C_double) number + + m_baset = h5kind_to_type(KIND(data_double(1)), H5_REAL_KIND) ! Memory base type + f_ptr = C_LOC(data_double(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_double(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 3. data_double(",I0,")=",I0," .NE. data_double(",I0,")=",I0)') & + i, INT(data1(i)), i, INT(data_double(i)) + EXIT + ENDIF + ENDDO + + ! Test converting the data to (SELECTED_INT_KIND(Fortran_INTEGER_4)) number. + ! Read enum data back as (SELECTED_INT_KIND(Fortran_INTEGER_4)) number + + m_baset = h5kind_to_type(int_kind_8, H5_INTEGER_KIND) ! Memory base type + f_ptr = C_LOC(data_i8(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_i8(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 4. data_i8(",I0,")=",I0," .NE. data_i8(",I0,")=",I0)') & + i, INT(data1(i)), i, INT(data_i8(i)) + EXIT + ENDIF + ENDDO + + ! Test converting the data to (SELECTED_INT_KIND(Fortran_INTEGER_8)) number. + ! Read enum data back as (SELECTED_INT_KIND(Fortran_INTEGER_8)) number + + m_baset = h5kind_to_type(int_kind_16, H5_INTEGER_KIND) ! Memory base type + f_ptr = C_LOC(data_i16(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_i16(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 5. data_i16(",I0,")=",I0," .NE. data_i16(",I0,")=",I0)') & + i, INT(data1(i)), i, INT(data_i16(i)) + EXIT + ENDIF + ENDDO + + ! Test converting the data to SELECTED_REAL_KIND(Fortran_REAL_4) number. + ! Read enum data back as SELECTED_REAL_KIND(Fortran_REAL_4) number + + m_baset = h5kind_to_type(KIND(data_r7(1)), H5_REAL_KIND) ! Memory base type + f_ptr = C_LOC(data_r7(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + ! Check values + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_r7(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 6. data_r7(",I0,")=",I0," .NE. data_r7(",I0,")=",I0)') & + i, INT(data1(i)), i, INT(data_r7(i)) + EXIT + ENDIF + ENDDO + + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + ! *************************************** + ! * Dataset of C_int type + ! *************************************** + + ! Create a integer dataset of KIND=C_INT and write enum data to it + m_baset = h5kind_to_type(KIND(data_int(1)), H5_INTEGER_KIND) ! Memory base type + CALL h5dcreate_f(cwg, "color_table2", m_baset, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + ! Write the enum data + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check("h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + f_ptr = C_LOC(data_int(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, ds_size(1) + IF(data1(i) .NE. data_int(i))THEN + total_error = total_error + 1 + WRITE(*,'(" 7. data1(",I0,")=",I0," .NE. data_int(",I0,")=",I0)') i, data1(i),i,data_int(i) + EXIT + ENDIF + ENDDO + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + !************************************** + !* Dataset of C_double type + !************************************** + + ! Create a dataset of KIND=C_DOUBLE and write enum data to it + m_baset = h5kind_to_type(KIND(data_double(1)), H5_REAL_KIND) ! Memory base type + CALL h5dcreate_f(cwg, "color_table3", m_baset, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check("h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + f_ptr = C_LOC(data_double(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_double(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 8. data1(",I0,")=",I0," .NE. data_double(",I0,")=",I0)') i, data1(i),i,INT(data_double(i)) + EXIT + ENDIF + ENDDO + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + !********************************************************* + !* Dataset of real SELECTED_REAL_KIND(Fortran_REAL_4) type + !********************************************************* + + ! Create a dataset of SELECTED_REAL_KIND(Fortran_REAL_4) and write enum data to it + m_baset = h5kind_to_type(KIND(data_r7(1)), H5_REAL_KIND) ! Memory base type + CALL h5dcreate_f(cwg, "color_table4", m_baset, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check("h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + f_ptr = C_LOC(data_r7(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, ds_size(1) + IF(data1(i) .NE. INT(data_r7(i)))THEN + total_error = total_error + 1 + WRITE(*,'(" 9. data1(",I0,")=",I0," .NE. data_r7(",I0,")=",I0)') i, data1(i),i,INT(data_r7(i)) + EXIT + ENDIF + ENDDO + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + ! ***************************************************************** + ! * Dataset of integer SELECTED_INT_KIND(Fortran_INTEGER_8) type + ! ***************************************************************** + + ! Create a integer dataset of (SELECTED_INT_KIND(Fortran_INTEGER_8)) and write enum data to it + m_baset = h5kind_to_type(KIND(data_i16(1)), H5_INTEGER_KIND) ! Memory base type + CALL h5dcreate_f(cwg, "color_table5", m_baset, space, dset, error) + CALL check("h5dcreate_f", error, total_error) + + ! Write the enum data + f_ptr = C_LOC(data1(1)) + CALL h5dwrite_f(dset, dtype, f_ptr, error, space, space) + CALL check("h5dwrite_f", error, total_error) + + ! Test reading back the data with no conversion + f_ptr = C_LOC(data_i16(1)) + CALL h5dread_f(dset, m_baset, f_ptr, error, space, space) + CALL check("h5dread_f", error, total_error) + + DO i = 1, ds_size(1) + IF(data1(i) .NE. data_i16(i))THEN + total_error = total_error + 1 + WRITE(*,'(" 10. data1(",I0,")=",I0," .NE. data_i16(",I0,")=",I0)') i, data1(i),i,data_i16(i) + EXIT + ENDIF + ENDDO + CALL h5dclose_f(dset, error) + CALL check("h5dclose_f", error, total_error) + + ! + ! Close and release resources. + ! + CALL h5sclose_f(space, error) + CALL check("H5Sclose_f", error, total_error) + CALL h5tclose_f(dtype, error) + CALL check("H5Tclose_f", error, total_error) + CALL h5gclose_f(cwg, error) + CALL check("h5gclose_f",error, total_error) + CALL h5fclose_f(file, error) + CALL check("H5Fclose_f", error, total_error) + +END SUBROUTINE t_enum_conv + |