summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2013-01-18 22:02:21 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2013-01-18 22:02:21 (GMT)
commitc7f53746db178306cf650637d344acc40dc9f472 (patch)
tree79285fb18ad59eb9c2eedfd00af9db8959ec86ed /fortran
parent7093f8a38b5570568cc8e03b299514760fda5f64 (diff)
parent3ddf8006a1ff2b4527b2c330c49a2bde58b16150 (diff)
downloadhdf5-c7f53746db178306cf650637d344acc40dc9f472.zip
hdf5-c7f53746db178306cf650637d344acc40dc9f472.tar.gz
hdf5-c7f53746db178306cf650637d344acc40dc9f472.tar.bz2
[svn-r23179] trunk merge
Diffstat (limited to 'fortran')
-rw-r--r--fortran/CMakeLists.txt2
-rw-r--r--fortran/examples/CMakeLists.txt22
-rw-r--r--fortran/examples/Makefile.am40
-rw-r--r--fortran/examples/Makefile.in40
-rw-r--r--fortran/examples/attrexample.f90117
-rw-r--r--fortran/examples/dsetexample.f9085
-rw-r--r--fortran/examples/fileexample.f9049
-rw-r--r--fortran/examples/grpdsetexample.f90156
-rw-r--r--fortran/examples/grpsexample.f9083
-rw-r--r--fortran/examples/h5_cmprss.f90131
-rw-r--r--fortran/examples/h5_crtatt.f90106
-rw-r--r--fortran/examples/h5_crtdat.f9086
-rw-r--r--fortran/examples/h5_crtgrp.f90 (renamed from fortran/examples/groupexample.f90)68
-rw-r--r--fortran/examples/h5_crtgrpar.f9083
-rw-r--r--fortran/examples/h5_crtgrpd.f90155
-rw-r--r--fortran/examples/h5_extend.f90233
-rw-r--r--fortran/examples/h5_rdwt.f9096
-rw-r--r--fortran/examples/h5_subset.f90184
-rw-r--r--fortran/examples/run-fortran-ex.sh.in32
-rw-r--r--fortran/examples/rwdsetexample.f9096
-rw-r--r--fortran/src/CMakeLists.txt11
-rw-r--r--fortran/src/H5test_kind_SIZEOF.f904
-rw-r--r--fortran/src/Makefile.in2
-rw-r--r--fortran/src/hdf5_fortrandll.def.in34
-rw-r--r--fortran/test/CMakeLists.txt6
-rw-r--r--fortran/testpar/CMakeLists.txt2
26 files changed, 1222 insertions, 701 deletions
diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt
index d18cdb4..9dbe8ca 100644
--- a/fortran/CMakeLists.txt
+++ b/fortran/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8.6)
+cmake_minimum_required (VERSION 2.8.10)
PROJECT (HDF5_F90 C CXX Fortran)
IF (H5_HAVE_PARALLEL)
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
index 4bd236e..0536183 100644
--- a/fortran/examples/CMakeLists.txt
+++ b/fortran/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8.6)
+cmake_minimum_required (VERSION 2.8.10)
PROJECT (HDF5_F90_EXAMPLES C CXX Fortran)
# --------------------------------------------------------------------
# Notes: When creating examples they should be prefixed
@@ -14,13 +14,15 @@ 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
refobjexample
@@ -63,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})
@@ -88,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 310c4e2..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 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 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,13 +84,15 @@ 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
refobjexample: refobjexample.f90
diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in
index ac2314f..0978ac5 100644
--- a/fortran/examples/Makefile.in
+++ b/fortran/examples/Makefile.in
@@ -400,17 +400,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 \
+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 \
- 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
@@ -663,12 +663,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
@@ -683,13 +683,15 @@ 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
refobjexample: refobjexample.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/fileexample.f90 b/fortran/examples/fileexample.f90
deleted file mode 100644
index 87119d2..0000000
--- a/fortran/examples/fileexample.f90
+++ /dev/null
@@ -1,49 +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 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
-
- 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)
-
- !
- ! Terminate access to the file.
- !
- CALL h5fclose_f(file_id, error)
-!
-! Close FORTRAN interface.
-!
- CALL h5close_f(error)
- END PROGRAM FILEEXAMPLE
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/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/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index 7cde8df..765bb65 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8.6)
+cmake_minimum_required (VERSION 2.8.10)
PROJECT (HDF5_F90_SRC C CXX Fortran)
#-----------------------------------------------------------------------------
@@ -9,6 +9,9 @@ IF (WIN32 AND NOT CYGWIN)
IF (NOT H5_HAVE_PARALLEL)
SET (H5_NOPAREXP ";")
ENDIF (NOT H5_HAVE_PARALLEL)
+ IF (NOT HDF5_ENABLE_F2003)
+ SET (H5_NOF03EXP ";")
+ ENDIF (NOT HDF5_ENABLE_F2003)
CONFIGURE_FILE (${HDF5_F90_SRC_SOURCE_DIR}/hdf5_fortrandll.def.in ${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def @ONLY)
ENDIF (MSVC)
ENDIF (BUILD_SHARED_LIBS)
@@ -139,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
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/Makefile.in b/fortran/src/Makefile.in
index d9ed42d..070e366 100644
--- a/fortran/src/Makefile.in
+++ b/fortran/src/Makefile.in
@@ -507,7 +507,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 125
+LT_VERS_REVISION = 131
LT_VERS_AGE = 0
# Include src directory in both Fortran and C flags (C compiler is used
diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in
index 9e53ee3..bf7596d 100644
--- a/fortran/src/hdf5_fortrandll.def.in
+++ b/fortran/src/hdf5_fortrandll.def.in
@@ -6,6 +6,7 @@ H5LIB_mp_H5GET_LIBVERSION_F
H5LIB_mp_H5CHECK_VERSION_F
H5LIB_mp_H5GARBAGE_COLLECT_F
H5LIB_mp_H5DONT_ATEXIT_F
+@H5_NOF03EXP@H5LIB_PROVISIONAL_mp_H5OFFSETOF
; H5_DBLE_INTERFACE
H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_SCALAR
H5_DBLE_INTERFACE_mp_H5AREAD_DOUBLE_1
@@ -120,6 +121,8 @@ H5A_mp_H5AEXISTS_F
H5A_mp_H5AEXISTS_BY_NAME_F
H5A_mp_H5AOPEN_BY_NAME_F
H5A_mp_H5ARENAME_F
+@H5_NOF03EXP@H5A_PROVISIONAL_mp_H5AWRITE_PTR
+@H5_NOF03EXP@H5A_PROVISIONAL_mp_H5AREAD_PTR
; H5D
H5D_mp_H5DCREATE_F
H5D_mp_H5DOPEN_F
@@ -200,6 +203,9 @@ H5D_mp_H5DGET_CREATE_PLIST_F
H5D_mp_H5DGET_STORAGE_SIZE_F
H5D_mp_H5DVLEN_GET_MAX_LEN_F
H5D_mp_H5DGET_ACCESS_PLIST_F
+@H5_NOF03EXP@H5D_PROVISIONAL_mp_H5DWRITE_PTR
+@H5_NOF03EXP@H5D_PROVISIONAL_mp_H5DREAD_PTR
+@H5_NOF03EXP@H5D_PROVISIONAL_mp_H5DVLEN_RECLAIM_F
; H5E
H5E_mp_H5ECLEAR_F
H5E_mp_H5EPRINT_F
@@ -283,6 +289,8 @@ H5L_mp_H5LGET_INFO_BY_IDX_F
H5L_mp_H5LIS_REGISTERED_F
H5L_mp_H5LMOVE_F
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_H5OCOPY_F
@@ -297,12 +305,11 @@ H5O_mp_H5OOPEN_BY_IDX_F
H5O_mp_H5OOPEN_F
H5O_mp_H5OSET_COMMENT_F
H5O_mp_H5OSET_COMMENT_BY_NAME_F
-; These should only get compiled with option --enable-fortran2003
-;H5O_PROVISIONAL_mp_H5OGET_INFO_BY_IDX_F
-;H5O_PROVISIONAL_mp_H5OGET_INFO_BY_NAME_F
-;H5O_PROVISIONAL_mp_H5OGET_INFO_F
-;H5O_PROVISIONAL_mp_H5OVISIT_BY_NAME_F
-;H5O_PROVISIONAL_mp_H5OVISIT_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
+@H5_NOF03EXP@H5O_PROVISIONAL_mp_H5OVISIT_BY_NAME_F
+@H5_NOF03EXP@H5O_PROVISIONAL_mp_H5OVISIT_F
; H5P
H5P_mp_H5PCREATE_F
H5P_mp_H5PSET_PRESERVE_F
@@ -439,16 +446,26 @@ H5P_mp_H5PGET_NLINKS_F
H5P_mp_H5PGET_CREATE_INTER_GROUP_F
H5P_mp_H5PSET_CHUNK_CACHE_F
H5P_mp_H5PGET_CHUNK_CACHE_F
+@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PSET_FILL_VALUE_PTR
+@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PGET_FILL_VALUE_PTR
+@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PSET_PTR
+@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PGET_PTR
+@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PREGISTER_PTR
+@H5_NOF03EXP@H5P_PROVISIONAL_mp_H5PINSERT_PTR
; H5R
H5R_PROVISIONAL_mp_H5RCREATE_OBJECT_F
H5R_PROVISIONAL_mp_H5RCREATE_REGION_F
H5R_PROVISIONAL_mp_H5RDEREFERENCE_OBJECT_F
H5R_PROVISIONAL_mp_H5RDEREFERENCE_REGION_F
H5R_PROVISIONAL_mp_H5RGET_REGION_REGION_F
-
H5R_mp_H5RGET_OBJECT_TYPE_OBJ_F
H5R_PROVISIONAL_mp_H5RGET_NAME_OBJECT_F
H5R_PROVISIONAL_mp_H5RGET_NAME_REGION_F
+@H5_NOF03EXP@H5R_PROVISIONAL_mp_H5RGET_REGION_PTR_F
+@H5_NOF03EXP@H5R_PROVISIONAL_mp_H5RCREATE_PTR_F
+@H5_NOF03EXP@H5R_PROVISIONAL_mp_H5RDEREFERENCE_PTR_F
+@H5_NOF03EXP@H5R_PROVISIONAL_mp_H5RGET_NAME_PTR_F
+@H5_NOF03EXP@H5R_PROVISIONAL_mp_H5RGET_OBJ_TYPE_F
; H5S
H5S_mp_H5SCREATE_SIMPLE_F
H5S_mp_H5SCLOSE_F
@@ -538,6 +555,7 @@ H5T_mp_H5TENCODE_F
H5T_mp_H5TGET_CREATE_PLIST_F
H5T_mp_H5TCOMPILER_CONV_F
H5T_mp_H5TGET_NATIVE_TYPE_F
+@H5_NOF03EXP@H5T_PROVISIONAL_mp_H5TCONVERT_F
; H5Z
H5Z_mp_H5ZUNREGISTER_F
H5Z_mp_H5ZFILTER_AVAIL_F
@@ -549,4 +567,4 @@ H5Z_mp_H5ZGET_FILTER_INFO_F
@H5_NOPAREXP@H5FDMPIO_mp_H5PGET_DXPL_MPIO_F
@H5_NOPAREXP@H5FDMPIO_mp_H5PSET_FAPL_MPIPOSIX_F
@H5_NOPAREXP@H5FDMPIO_mp_H5PGET_FAPL_MPIPOSIX_F
-@H5_NOPAREXP@H5FDMPIO_mp_H5PGET_MPIO_ACTUAL_IO_MODE_F \ No newline at end of file
+@H5_NOPAREXP@H5FDMPIO_mp_H5PGET_MPIO_ACTUAL_IO_MODE_F
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt
index 3a3d084..5b41a32 100644
--- a/fortran/test/CMakeLists.txt
+++ b/fortran/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8.6)
+cmake_minimum_required (VERSION 2.8.10)
PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran)
#-----------------------------------------------------------------------------
@@ -100,7 +100,7 @@ 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
@@ -125,7 +125,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/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt
index b112db3..1c7248c 100644
--- a/fortran/testpar/CMakeLists.txt
+++ b/fortran/testpar/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8.6)
+cmake_minimum_required (VERSION 2.8.10)
PROJECT (HDF5_FORTRAN_TESTPAR C CXX Fortran)
#-----------------------------------------------------------------------------