diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-30 04:29:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-30 04:29:13 (GMT) |
commit | fd70b2afa883f94718ffb7f4f33d104d76e3fe0a (patch) | |
tree | c1add8db2a4848202d86a9b274bfaf8c7b80e961 /fortran/examples | |
parent | 35b0159a0a5f1f4b80e305204ea51a742b052403 (diff) | |
download | hdf5-fd70b2afa883f94718ffb7f4f33d104d76e3fe0a.zip hdf5-fd70b2afa883f94718ffb7f4f33d104d76e3fe0a.tar.gz hdf5-fd70b2afa883f94718ffb7f4f33d104d76e3fe0a.tar.bz2 |
[svn-r18197] Description:
Trim trailing whitespace from source code files with this command:
find . \( -name "*.[ch]" -or -name "*.cpp" -or -name "*.f90" \) -print |xargs -n 1 sed -i "" 's/[[:blank:]]*$//'
Tested on:
None - eyeballed only
Diffstat (limited to 'fortran/examples')
-rw-r--r-- | fortran/examples/attrexample.f90 | 58 | ||||
-rw-r--r-- | fortran/examples/compound.f90 | 44 | ||||
-rw-r--r-- | fortran/examples/dsetexample.f90 | 30 | ||||
-rw-r--r-- | fortran/examples/fileexample.f90 | 16 | ||||
-rw-r--r-- | fortran/examples/groupexample.f90 | 22 | ||||
-rw-r--r-- | fortran/examples/grpdsetexample.f90 | 32 | ||||
-rw-r--r-- | fortran/examples/grpit.f90 | 38 | ||||
-rw-r--r-- | fortran/examples/grpsexample.f90 | 32 | ||||
-rw-r--r-- | fortran/examples/hyperslab.f90 | 68 | ||||
-rw-r--r-- | fortran/examples/mountexample.f90 | 80 | ||||
-rw-r--r-- | fortran/examples/ph5example.f90 | 42 | ||||
-rw-r--r-- | fortran/examples/refobjexample.f90 | 58 | ||||
-rw-r--r-- | fortran/examples/refregexample.f90 | 88 | ||||
-rw-r--r-- | fortran/examples/rwdsetexample.f90 | 34 | ||||
-rw-r--r-- | fortran/examples/selectele.f90 | 96 |
15 files changed, 369 insertions, 369 deletions
diff --git a/fortran/examples/attrexample.f90 b/fortran/examples/attrexample.f90 index 9cf96dc..ffbeabe 100644 --- a/fortran/examples/attrexample.f90 +++ b/fortran/examples/attrexample.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,30 +11,30 @@ ! 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. +! 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, +! the dataset "/dset", defines attribute's dataspace, ! creates dataset attribute, writes the attribute, and then closes -! the attribute's dataspace, attribute, dataset, and file. +! the attribute's dataspace, attribute, dataset, and file. PROGRAM ATTREXAMPLE - - USE HDF5 ! This module contains all necessary modules - + + 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(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 @@ -43,31 +43,31 @@ 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 + attrlen = 80 ! ! Initialize FORTRAN interface. ! - CALL h5open_f(error) - + CALL h5open_f(error) + ! ! Open an existing file. ! CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) ! - ! Open an existing dataset. + ! Open an existing dataset. ! CALL h5dopen_f(file_id, dsetname, dset_id, error) ! - ! Create scalar data space for the attribute. + ! Create scalar data space for the attribute. ! CALL h5screate_simple_f(arank, adims, aspace_id, error) ! @@ -75,35 +75,35 @@ ! 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. + ! 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) @@ -113,5 +113,5 @@ ! CALL h5close_f(error) - END PROGRAM ATTREXAMPLE - + END PROGRAM ATTREXAMPLE + diff --git a/fortran/examples/compound.f90 b/fortran/examples/compound.f90 index a315fb0..2005f41 100644 --- a/fortran/examples/compound.f90 +++ b/fortran/examples/compound.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,7 +11,7 @@ ! 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 program creates a dataset that is one dimensional array of @@ -26,23 +26,23 @@ PROGRAM COMPOUNDEXAMPLE - USE HDF5 ! This module contains all necessary modules - + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE CHARACTER(LEN=11), PARAMETER :: filename = "compound.h5" ! File name CHARACTER(LEN=8), PARAMETER :: dsetname = "Compound" ! Dataset name INTEGER, PARAMETER :: dimsize = 6 ! Size of the dataset - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier INTEGER(HID_T) :: dspace_id ! Dataspace identifier INTEGER(HID_T) :: dtype_id ! Compound datatype identifier INTEGER(HID_T) :: dt1_id ! Memory datatype identifier (for character field) INTEGER(HID_T) :: dt2_id ! Memory datatype identifier (for integer field) INTEGER(HID_T) :: dt3_id ! Memory datatype identifier (for double precision field) INTEGER(HID_T) :: dt4_id ! Memory datatype identifier (for real field) - INTEGER(HID_T) :: dt5_id ! Memory datatype identifier + INTEGER(HID_T) :: dt5_id ! Memory datatype identifier INTEGER(HID_T) :: plist_id ! Dataset trasfer property INTEGER(SIZE_T) :: typesize @@ -52,7 +52,7 @@ INTEGER :: error ! Error flag INTEGER(SIZE_T) :: type_size ! Size of the datatype - INTEGER(SIZE_T) :: type_sizec ! Size of the character datatype + INTEGER(SIZE_T) :: type_sizec ! Size of the character datatype INTEGER(SIZE_T) :: type_sizei ! Size of the integer datatype INTEGER(SIZE_T) :: type_sized ! Size of the double precision datatype INTEGER(SIZE_T) :: type_sizer ! Size of the real datatype @@ -63,7 +63,7 @@ DOUBLE PRECISION, DIMENSION(dimsize) :: double_member REAL, DIMENSION(dimsize) :: real_member INTEGER :: i - INTEGER(HSIZE_T), DIMENSION(1) :: data_dims + INTEGER(HSIZE_T), DIMENSION(1) :: data_dims data_dims(1) = dimsize ! ! Initialize data buffer. @@ -71,8 +71,8 @@ do i = 1, dimsize char_member(i)(1:1) = char(65+i) char_member(i)(2:2) = char(65+i) - char_member_out(i)(1:1) = char(65) - char_member_out(i)(2:2) = char(65) + char_member_out(i)(1:1) = char(65) + char_member_out(i)(2:2) = char(65) int_member(i) = i double_member(i) = 2.* i real_member(i) = 3. * i @@ -91,10 +91,10 @@ ! ! 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) @@ -141,8 +141,8 @@ CALL h5dcreate_f(file_id, dsetname, dtype_id, dspace_id, & dset_id, error) ! - ! Create memory types. We have to create a compound datatype - ! for each member we want to write. + ! Create memory types. We have to create a compound datatype + ! for each member we want to write. ! CALL h5tcreate_f(H5T_COMPOUND_F, type_sizec, dt1_id, error) offset = 0 @@ -167,9 +167,9 @@ CALL h5dwrite_f(dset_id, dt3_id, double_member, data_dims, error, xfer_prp = plist_id) CALL h5dwrite_f(dset_id, dt2_id, int_member, data_dims, error, xfer_prp = plist_id) - ! + ! ! End access to the dataset and release resources used by it. - ! + ! CALL h5dclose_f(dset_id, error) ! @@ -186,11 +186,11 @@ CALL h5tclose_f(dt4_id, error) CALL h5tclose_f(dt5_id, error) - ! + ! ! Close the file. ! CALL h5fclose_f(file_id, error) - + ! ! Open the file. ! @@ -227,6 +227,6 @@ ! CALL h5close_f(error) - END PROGRAM COMPOUNDEXAMPLE - - + END PROGRAM COMPOUNDEXAMPLE + + diff --git a/fortran/examples/dsetexample.f90 b/fortran/examples/dsetexample.f90 index 69609b4..209a516 100644 --- a/fortran/examples/dsetexample.f90 +++ b/fortran/examples/dsetexample.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,10 +11,10 @@ ! 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. +! 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. @@ -22,15 +22,15 @@ PROGRAM DSETEXAMPLE - USE HDF5 ! This module contains all necessary modules - + 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) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier INTEGER(HID_T) :: dspace_id ! Dataspace identifier @@ -46,10 +46,10 @@ ! ! 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) @@ -60,9 +60,9 @@ 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) ! @@ -70,7 +70,7 @@ ! CALL h5sclose_f(dspace_id, error) - ! + ! ! Close the file. ! CALL h5fclose_f(file_id, error) @@ -80,6 +80,6 @@ ! CALL h5close_f(error) - END PROGRAM DSETEXAMPLE - - + END PROGRAM DSETEXAMPLE + + diff --git a/fortran/examples/fileexample.f90 b/fortran/examples/fileexample.f90 index c25bfef..87119d2 100644 --- a/fortran/examples/fileexample.f90 +++ b/fortran/examples/fileexample.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,7 +11,7 @@ ! 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. @@ -20,22 +20,22 @@ PROGRAM FILEEXAMPLE - USE HDF5 ! This module contains all necessary modules - + 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) ! @@ -46,4 +46,4 @@ ! Close FORTRAN interface. ! CALL h5close_f(error) - END PROGRAM FILEEXAMPLE + END PROGRAM FILEEXAMPLE diff --git a/fortran/examples/groupexample.f90 b/fortran/examples/groupexample.f90 index cb069df..91ebc50 100644 --- a/fortran/examples/groupexample.f90 +++ b/fortran/examples/groupexample.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,35 +11,35 @@ ! 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 and close a group. +! The following example shows how to create and close a group. ! It creates a file called 'group.h5', creates a group ! called MyGroup in the root group, and then closes the group and file. -! +! PROGRAM GROUPEXAMPLE - USE HDF5 ! This module contains all necessary modules - + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE 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) + CALL h5open_f(error) ! ! Create a new file using default properties. - ! + ! CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) ! @@ -61,4 +61,4 @@ ! CALL h5close_f(error) - END PROGRAM GROUPEXAMPLE + END PROGRAM GROUPEXAMPLE diff --git a/fortran/examples/grpdsetexample.f90 b/fortran/examples/grpdsetexample.f90 index ce89304..19fc660 100644 --- a/fortran/examples/grpdsetexample.f90 +++ b/fortran/examples/grpdsetexample.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,7 +11,7 @@ ! 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. @@ -22,8 +22,8 @@ PROGRAM GRPDSETEXAMPLE - USE HDF5 ! This module contains all necessary modules - + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE CHARACTER(LEN=10), PARAMETER :: filename = "groupsf.h5" ! File name @@ -31,17 +31,17 @@ 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(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 :: i, j INTEGER :: error ! Error flag - INTEGER, DIMENSION(3,3) :: dset1_data ! Data arrays + 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 @@ -70,7 +70,7 @@ ! ! Initialize FORTRAN interface. ! - CALL h5open_f(error) + CALL h5open_f(error) ! ! Open an existing file. @@ -78,7 +78,7 @@ CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) ! - ! Create the data space for the first dataset. + ! Create the data space for the first dataset. ! CALL h5screate_simple_f(rank, dims1, dataspace_id, error) @@ -111,7 +111,7 @@ CALL h5gopen_f(file_id, groupname, group_id, error) ! - !Create the data space for the second dataset. + !Create the data space for the second dataset. ! CALL h5screate_simple_f(rank, dims2, dataspace_id, error) @@ -125,7 +125,7 @@ ! Write the second dataset. ! data_dims(1) = 2 - data_dims(1) = 10 + data_dims(1) = 10 CALL h5dwrite_f(dataset_id, H5T_NATIVE_INTEGER, dset2_data, data_dims, error) ! @@ -153,4 +153,4 @@ ! CALL h5close_f(error) - END PROGRAM GRPDSETEXAMPLE + END PROGRAM GRPDSETEXAMPLE diff --git a/fortran/examples/grpit.f90 b/fortran/examples/grpit.f90 index 86a87b1..9361b17 100644 --- a/fortran/examples/grpit.f90 +++ b/fortran/examples/grpit.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,7 +11,7 @@ ! 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. @@ -20,8 +20,8 @@ PROGRAM GRPITEXAMPLE - USE HDF5 ! This module contains all necessary modules - + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE CHARACTER(LEN=11), PARAMETER :: filename = "iteratef.h5" ! File name @@ -34,12 +34,12 @@ 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(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 @@ -47,11 +47,11 @@ 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 :: rank = 2 ! Datasets rank INTEGER(HSIZE_T), DIMENSION(2) :: data_dims ! @@ -76,11 +76,11 @@ ! ! Initialize FORTRAN interface. ! - CALL h5open_f(error) + CALL h5open_f(error) ! ! Create a new file using default properties. - ! + ! CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) ! @@ -94,7 +94,7 @@ CALL h5gcreate_f(group1_id, groupname2, group2_id, error) ! - ! Create the data space for the first dataset. + ! Create the data space for the first dataset. ! CALL h5screate_simple_f(rank, dims1, dataspace1_id, error) @@ -112,7 +112,7 @@ CALL h5dwrite_f(dataset1_id, H5T_NATIVE_INTEGER, dset1_data, data_dims, error) ! - ! Create the data space for the second dataset. + ! Create the data space for the second dataset. ! CALL h5screate_simple_f(rank, dims2, dataspace2_id, error) @@ -206,10 +206,10 @@ ! Close the file. ! CALL h5fclose_f(file_id, error) - + ! ! Close FORTRAN interface. ! CALL h5close_f(error) - END PROGRAM GRPITEXAMPLE + END PROGRAM GRPITEXAMPLE diff --git a/fortran/examples/grpsexample.f90 b/fortran/examples/grpsexample.f90 index 3a6efac..0f694e9 100644 --- a/fortran/examples/grpsexample.f90 +++ b/fortran/examples/grpsexample.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,41 +11,41 @@ ! 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 +! 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 +! 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 - + 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" + 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(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) - + CALL h5open_f(error) + ! ! Create a new file using default properties. - ! + ! CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) ! @@ -62,7 +62,7 @@ ! Create group "Group_B" in group "MyGroup" using relative name. ! CALL h5gcreate_f(group1_id, groupname3, group3_id, error) - + ! ! Close the groups. ! @@ -78,6 +78,6 @@ ! ! Close FORTRAN interface. ! - CALL h5close_f(error) + CALL h5close_f(error) - END PROGRAM GRPSEXAMPLE + END PROGRAM GRPSEXAMPLE diff --git a/fortran/examples/hyperslab.f90 b/fortran/examples/hyperslab.f90 index 151ecf3..ca27f35 100644 --- a/fortran/examples/hyperslab.f90 +++ b/fortran/examples/hyperslab.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,57 +11,57 @@ ! 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. +! This example shows how to write and read a hyperslab. ! PROGRAM SELECTEXAMPLE - USE HDF5 ! This module contains all necessary modules - + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE CHARACTER(LEN=7), PARAMETER :: filename = "sdsf.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 + 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 INTEGER(HSIZE_T), DIMENSION(3) :: dimsm = (/7,7,3/) ! Dataset dimensions ! in memory - INTEGER(HSIZE_T), DIMENSION(2) :: dims_out ! Buffer to read in dataset + INTEGER(HSIZE_T), DIMENSION(2) :: dims_out ! Buffer to read in dataset ! dimesions INTEGER(HSIZE_T), DIMENSION(2) :: dimsf = (/5,6/) ! Dataset dimensions. - INTEGER(HSIZE_T), DIMENSION(2) :: count = (/3,4/) + INTEGER(HSIZE_T), DIMENSION(2) :: count = (/3,4/) ! Size of the hyperslab in the file INTEGER(HSIZE_T), DIMENSION(2) :: offset = (/1,2/) - !hyperslab offset in the file + !hyperslab offset in the file INTEGER(HSIZE_T), DIMENSION(3) :: count_out = (/3,4,1/) - !Size of the hyperslab in memory + !Size of the hyperslab in memory INTEGER(HSIZE_T), DIMENSION(3) :: offset_out = (/3,0,0/) - !hyperslab offset in memory + !hyperslab offset in memory INTEGER, DIMENSION(5,6) :: data ! Data to write INTEGER, DIMENSION(7,7,3) :: data_out ! Output buffer INTEGER :: dsetrank = 2 ! Dataset rank ( in file ) INTEGER :: memrank = 3 ! Dataset rank ( in memory ) - INTEGER :: rank - INTEGER :: i, j, k + INTEGER :: rank + INTEGER :: i, j, k INTEGER :: error, error_n ! Error flags INTEGER(HSIZE_T), DIMENSION(3) :: data_dims ! - ! Write data to the HDF5 file. + ! Write data to the HDF5 file. ! ! - ! Data initialization. + ! Data initialization. ! do i = 1, 5 do j = 1, 6 @@ -75,19 +75,19 @@ ! 3, 4, 5, 6, 7, 8 ! 4, 5, 6, 7, 8, 9 ! - + ! - ! Initialize FORTRAN interface. + ! Initialize FORTRAN interface. ! - CALL h5open_f(error) + 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. + ! Create the data space for the dataset. ! CALL h5screate_simple_f(dsetrank, dimsf, dataspace, error) @@ -101,7 +101,7 @@ ! Write the dataset. ! data_dims(1) = 5 - data_dims(2) = 6 + data_dims(2) = 6 CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, data_dims, error) ! @@ -120,14 +120,14 @@ CALL h5fclose_f(file_id, error) ! - ! This part of the code reads the hyperslab from the sds.h5 file just + ! This part of the code reads the hyperslab from the sds.h5 file just ! created, into a 2-dimensional plane of the 3-dimensional dataset. ! ! ! Initialize data_out array. ! - do k = 1, 3 + do k = 1, 3 do j = 1, 7 do i = 1, 7 data_out(i,j,k) = 0; @@ -141,7 +141,7 @@ ! CALL h5fopen_f (filename, H5F_ACC_RDONLY_F, file_id, error) CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) write(*,*) error - + ! ! Open the dataset. ! @@ -156,7 +156,7 @@ ! Select hyperslab in the dataset. ! CALL h5sselect_hyperslab_f(dataspace, H5S_SELECT_SET_F, & - offset, count, error) + offset, count, error) ! ! Create memory dataspace. ! @@ -166,18 +166,18 @@ ! Select hyperslab in memory. ! CALL h5sselect_hyperslab_f(memspace, H5S_SELECT_SET_F, & - offset_out, count_out, error) + offset_out, count_out, error) ! - ! Read data from hyperslab in the file into the hyperslab in + ! Read data from hyperslab in the file into the hyperslab in ! memory and display. ! data_dims(1) = 7 data_dims(2) = 7 - data_dims(3) = 3 + data_dims(3) = 3 CALL H5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, data_dims, error, & memspace, dataspace) - + ! ! Display data_out array ! @@ -188,7 +188,7 @@ ! 0 0 0 0 0 0 0 ! 0 0 0 0 0 0 0 ! 0 0 0 0 0 0 0 - ! 3 4 5 6 0 0 0 + ! 3 4 5 6 0 0 0 ! 4 5 6 7 0 0 0 ! 5 6 7 8 0 0 0 ! 0 0 0 0 0 0 0 @@ -219,4 +219,4 @@ ! CALL h5close_f(error) - END PROGRAM SELECTEXAMPLE + END PROGRAM SELECTEXAMPLE diff --git a/fortran/examples/mountexample.f90 b/fortran/examples/mountexample.f90 index fe9eb7e..5bdec2a 100644 --- a/fortran/examples/mountexample.f90 +++ b/fortran/examples/mountexample.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,19 +11,19 @@ ! 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 the following example we create one file with a group in it, +!In the following example we create one file with a group in it, !and another file with a dataset. Mounting is used to -!access the dataset from the second file as a member of a group -!in the first file. +!access the dataset from the second file as a member of a group +!in the first file. ! PROGRAM MOUNTEXAMPLE - USE HDF5 ! This module contains all necessary modules - + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE ! @@ -42,53 +42,53 @@ ! ! File identifiers ! - INTEGER(HID_T) :: file1_id, file2_id - + INTEGER(HID_T) :: file1_id, file2_id + ! ! Group identifier ! - INTEGER(HID_T) :: gid + INTEGER(HID_T) :: gid ! ! Dataset identifier ! INTEGER(HID_T) :: dset_id - + ! ! Data space identifier ! INTEGER(HID_T) :: dataspace - + ! ! Data type identifier ! INTEGER(HID_T) :: dtype_id - ! + ! ! The dimensions for the dataset. ! INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/NX,NY/) ! - ! Flag to check operation success - ! + ! Flag to check operation success + ! INTEGER :: error ! - ! General purpose integer - ! + ! General purpose integer + ! INTEGER :: i, j ! - ! Data buffers - ! + ! Data buffers + ! INTEGER, DIMENSION(NX,NY) :: data_in, data_out INTEGER(HSIZE_T), DIMENSION(2) :: data_dims ! - ! Initialize FORTRAN interface. + ! Initialize FORTRAN interface. ! - CALL h5open_f(error) + CALL h5open_f(error) ! ! Initialize data_in buffer @@ -101,36 +101,36 @@ ! ! Create first file "mount1.h5" using default properties. - ! + ! CALL h5fcreate_f(filename1, H5F_ACC_TRUNC_F, file1_id, error) ! ! Create group "/G" inside file "mount1.h5". - ! + ! CALL h5gcreate_f(file1_id, "/G", gid, error) ! ! Close file and group identifiers. - ! + ! CALL h5gclose_f(gid, error) CALL h5fclose_f(file1_id, error) ! ! Create second file "mount2.h5" using default properties. - ! + ! CALL h5fcreate_f(filename2, H5F_ACC_TRUNC_F, file2_id, error) ! - ! Create data space for the dataset. + ! Create data space for the dataset. ! CALL h5screate_simple_f(RANK, dims, dataspace, error) ! ! Create dataset "/D" inside file "mount2.h5". - ! + ! CALL h5dcreate_f(file2_id, "/D", H5T_NATIVE_INTEGER, dataspace, & dset_id, error) - + ! ! Write data_in to the dataset ! @@ -140,41 +140,41 @@ ! ! Close file, dataset and dataspace identifiers. - ! + ! CALL h5sclose_f(dataspace, error) CALL h5dclose_f(dset_id, error) CALL h5fclose_f(file2_id, error) ! ! Reopen both files. - ! + ! CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) CALL h5fopen_f (filename2, H5F_ACC_RDWR_F, file2_id, error) ! ! Mount the second file under the first file's "/G" group. - ! + ! CALL h5fmount_f (file1_id, "/G", file2_id, error) ! ! Access dataset D in the first file under /G/D name. - ! + ! CALL h5dopen_f(file1_id, "/G/D", dset_id, error) ! ! Get dataset's data type. - ! + ! CALL h5dget_type_f(dset_id, dtype_id, error) ! ! Read the dataset. - ! + ! CALL h5dread_f(dset_id, dtype_id, data_out, data_dims, error) ! ! Print out the data. - ! + ! do i = 1, NX print *, (data_out(i,j), j = 1, NY) end do @@ -182,24 +182,24 @@ ! !Close dset_id and dtype_id. - ! + ! CALL h5dclose_f(dset_id, error) CALL h5tclose_f(dtype_id, error) ! ! Unmount the second file. - ! + ! CALL h5funmount_f(file1_id, "/G", error); ! ! Close both files. - ! + ! CALL h5fclose_f(file1_id, error) CALL h5fclose_f(file2_id, error) ! - ! Close FORTRAN interface. + ! Close FORTRAN interface. ! - CALL h5close_f(error) + CALL h5close_f(error) END PROGRAM MOUNTEXAMPLE diff --git a/fortran/examples/ph5example.f90 b/fortran/examples/ph5example.f90 index 208ebc7..a0db200 100644 --- a/fortran/examples/ph5example.f90 +++ b/fortran/examples/ph5example.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,15 +11,15 @@ ! 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. * -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! ! Fortran parallel example. Copied from Tutorial's example program of ! dataset.f90. PROGRAM DATASET - USE HDF5 ! This module contains all necessary modules - + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE INCLUDE 'mpif.h' @@ -28,18 +28,18 @@ CHARACTER(LEN=100) :: filename ! File name INTEGER :: fnamelen ! File name length - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: dset_id ! Dataset identifier - INTEGER(HID_T) :: filespace ! Dataspace identifier in file - INTEGER(HID_T) :: plist_id ! Property list identifier + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: dset_id ! Dataset identifier + INTEGER(HID_T) :: filespace ! Dataspace identifier in file + INTEGER(HID_T) :: plist_id ! Property list identifier INTEGER(HSIZE_T), DIMENSION(2) :: dimsf = (/5,8/) ! Dataset dimensions. -! INTEGER, DIMENSION(7) :: dimsfi = (/5,8,0,0,0,0,0/) +! INTEGER, DIMENSION(7) :: dimsfi = (/5,8,0,0,0,0,0/) ! INTEGER(HSIZE_T), DIMENSION(2) :: dimsfi = (/5,8/) INTEGER(HSIZE_T), DIMENSION(2) :: dimsfi INTEGER, ALLOCATABLE :: data(:,:) ! Data to write - INTEGER :: rank = 2 ! Dataset rank + INTEGER :: rank = 2 ! Dataset rank INTEGER :: error, error_n ! Error flags INTEGER :: i, j @@ -53,22 +53,22 @@ info = MPI_INFO_NULL CALL MPI_INIT(mpierror) CALL MPI_COMM_SIZE(comm, mpi_size, mpierror) - CALL MPI_COMM_RANK(comm, mpi_rank, mpierror) - ! + CALL MPI_COMM_RANK(comm, mpi_rank, mpierror) + ! ! Initialize data buffer with trivial data. ! ALLOCATE ( data(dimsf(1),dimsf(2))) do i = 1, dimsf(2) do j = 1, dimsf(1) - data(j,i) = j - 1 + (i-1)*dimsf(1) + data(j,i) = j - 1 + (i-1)*dimsf(1) enddo enddo ! ! Initialize FORTRAN interface ! - CALL h5open_f(error) + CALL h5open_f(error) - ! + ! ! Setup file access property list with parallel I/O access. ! CALL h5pcreate_f(H5P_FILE_ACCESS_F, plist_id, error) @@ -89,11 +89,11 @@ ! ! Create the file collectively. - ! + ! CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, access_prp = plist_id) CALL h5pclose_f(plist_id, error) ! - ! Create the data space for the dataset. + ! Create the data space for the dataset. ! CALL h5screate_simple_f(rank, dimsf, filespace, error) @@ -105,15 +105,15 @@ ! ! Create property list for collective dataset write ! - CALL h5pcreate_f(H5P_DATASET_XFER_F, plist_id, error) + CALL h5pcreate_f(H5P_DATASET_XFER_F, plist_id, error) CALL h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_COLLECTIVE_F, error) ! - ! For independent write use + ! For independent write use ! CALL h5pset_dxpl_mpio_f(plist_id, H5FD_MPIO_INDEPENDENT_F, error) ! - + ! - ! Write the dataset collectively. + ! Write the dataset collectively. ! CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, dimsfi, error, & xfer_prp = plist_id) diff --git a/fortran/examples/refobjexample.f90 b/fortran/examples/refobjexample.f90 index 1889b8b..c8622a7 100644 --- a/fortran/examples/refobjexample.f90 +++ b/fortran/examples/refobjexample.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,49 +11,49 @@ ! 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 program shows how to create and store references to the objects. -! Program creates a file, two groups, a dataset to store integer data and -! a dataset to store references to the objects. +! Program creates a file, two groups, a dataset to store integer data and +! a dataset to store references to the objects. ! Stored references are used to open the objects they are point to. ! Data is written to the dereferenced dataset, and class type is displayed for ! the shared datatype. ! - PROGRAM OBJ_REFERENCES + PROGRAM OBJ_REFERENCES + + USE HDF5 ! This module contains all necessary modules - USE HDF5 ! This module contains all necessary modules - IMPLICIT NONE - CHARACTER(LEN=10), PARAMETER :: filename = "FORTRAN.h5" ! File + CHARACTER(LEN=10), PARAMETER :: filename = "FORTRAN.h5" ! File CHARACTER(LEN=8), PARAMETER :: dsetnamei = "INTEGERS" ! Dataset with the integer data CHARACTER(LEN=17), PARAMETER :: dsetnamer = "OBJECT_REFERENCES" ! Dataset wtih object ! references CHARACTER(LEN=6), PARAMETER :: groupname1 = "GROUP1" ! Groups in the file CHARACTER(LEN=6), PARAMETER :: groupname2 = "GROUP2" ! - - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: grp1_id ! Group identifiers - INTEGER(HID_T) :: grp2_id ! - INTEGER(HID_T) :: dset_id ! Dataset identifiers - INTEGER(HID_T) :: dsetr_id ! - INTEGER(HID_T) :: type_id ! Type identifier - INTEGER(HID_T) :: space_id ! Dataspace identifiers - INTEGER(HID_T) :: spacer_id ! + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: grp1_id ! Group identifiers + INTEGER(HID_T) :: grp2_id ! + INTEGER(HID_T) :: dset_id ! Dataset identifiers + INTEGER(HID_T) :: dsetr_id ! + INTEGER(HID_T) :: type_id ! Type identifier + INTEGER(HID_T) :: space_id ! Dataspace identifiers + INTEGER(HID_T) :: spacer_id ! INTEGER :: error INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/5/) INTEGER(HSIZE_T), DIMENSION(1) :: dimsr= (/4/) INTEGER(HSIZE_T), DIMENSION(1) :: my_maxdims = (/5/) - INTEGER :: rank = 1 - INTEGER :: rankr = 1 + INTEGER :: rank = 1 + INTEGER :: rankr = 1 TYPE(hobj_ref_t_f), DIMENSION(4) :: ref TYPE(hobj_ref_t_f), DIMENSION(4) :: ref_out INTEGER, DIMENSION(5) :: data = (/1, 2, 3, 4, 5/) INTEGER :: class INTEGER(HSIZE_T), DIMENSION(2) :: data_dims, ref_size ! - ! Initialize FORTRAN interface. + ! Initialize FORTRAN interface. ! CALL h5open_f(error) ! @@ -61,17 +61,17 @@ ! CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) ! Default file access and file creation - ! properties are used. + ! properties are used. ! ! Create a group in the file ! CALL h5gcreate_f(file_id, groupname1, grp1_id, error) ! - ! Create a group inside the created gorup + ! Create a group inside the created gorup ! CALL h5gcreate_f(grp1_id, groupname2, grp2_id, error) - ! - ! Create dataspaces for datasets + ! + ! Create dataspaces for datasets ! CALL h5screate_simple_f(rank, dims, space_id, error, maxdims=my_maxdims) CALL h5screate_simple_f(rankr, dimsr, spacer_id, error) @@ -92,7 +92,7 @@ CALL h5tcommit_f(file_id, "MyType", type_id, error) ! ! Close dataspaces, groups and integer dataset - ! + ! CALL h5sclose_f(space_id, error) CALL h5sclose_f(spacer_id, error) CALL h5tclose_f(type_id, error) @@ -113,7 +113,7 @@ ! Close the dataset ! CALL h5dclose_f(dsetr_id, error) - ! + ! ! Reopen the dataset with object references and read references to the buffer ! CALL h5dopen_f(file_id, dsetnamer,dsetr_id,error) @@ -141,7 +141,7 @@ ! Get datatype class and display it if it is of a FLOAT class. ! CALL h5tget_class_f(type_id, class, error) - if(class .eq. H5T_FLOAT_F) write(*,*) "Stored datatype is of a FLOAT class" + if(class .eq. H5T_FLOAT_F) write(*,*) "Stored datatype is of a FLOAT class" ! ! Close all objects. ! @@ -150,10 +150,10 @@ CALL h5dclose_f(dsetr_id, error) CALL h5fclose_f(file_id, error) ! - ! Close FORTRAN interface. + ! Close FORTRAN interface. ! CALL h5close_f(error) - END PROGRAM OBJ_REFERENCES + END PROGRAM OBJ_REFERENCES diff --git a/fortran/examples/refregexample.f90 b/fortran/examples/refregexample.f90 index e7728bb..68fbd24 100644 --- a/fortran/examples/refregexample.f90 +++ b/fortran/examples/refregexample.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,43 +11,43 @@ ! 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 program shows how to create, store and dereference references +! This program shows how to create, store and dereference references ! to the dataset regions. ! Program creates a file and writes two dimensional integer dataset ! to it. Then program creates and stores references to the hyperslab -! and 3 points selected in the integer dataset, in the second dataset. +! and 3 points selected in the integer dataset, in the second dataset. ! Program reopens the second dataset, reads and dereferences region -! references, and then reads and displays selected data from the +! references, and then reads and displays selected data from the ! integer dataset. -! +! PROGRAM REG_REFERENCE - USE HDF5 ! This module contains all necessary modules - + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE CHARACTER(LEN=10), PARAMETER :: filename = "FORTRAN.h5" CHARACTER(LEN=6), PARAMETER :: dsetnamev = "MATRIX" CHARACTER(LEN=17), PARAMETER :: dsetnamer = "REGION_REFERENCES" - - INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: space_id ! Dataspace identifier - INTEGER(HID_T) :: spacer_id ! Dataspace identifier - INTEGER(HID_T) :: dsetv_id ! Dataset identifier - INTEGER(HID_T) :: dsetr_id ! Dataset identifier + + INTEGER(HID_T) :: file_id ! File identifier + INTEGER(HID_T) :: space_id ! Dataspace identifier + INTEGER(HID_T) :: spacer_id ! Dataspace identifier + INTEGER(HID_T) :: dsetv_id ! Dataset identifier + INTEGER(HID_T) :: dsetr_id ! Dataset identifier INTEGER :: error TYPE(hdset_reg_ref_t_f) , DIMENSION(2) :: ref ! Buffers to store references TYPE(hdset_reg_ref_t_f) , DIMENSION(2) :: ref_out ! INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/2,9/) ! Datasets dimensions - INTEGER(HSIZE_T), DIMENSION(1) :: dimsr = (/2/) ! + INTEGER(HSIZE_T), DIMENSION(1) :: dimsr = (/2/) ! INTEGER(HSIZE_T), DIMENSION(2) :: start INTEGER(HSIZE_T), DIMENSION(2) :: count - INTEGER :: rankr = 1 + INTEGER :: rankr = 1 INTEGER :: rank = 2 - INTEGER , DIMENSION(2,9) :: data - INTEGER , DIMENSION(2,9) :: data_out = 0 + INTEGER , DIMENSION(2,9) :: data + INTEGER , DIMENSION(2,9) :: data_out = 0 INTEGER(HSIZE_T) , DIMENSION(2,3) :: coord INTEGER(SIZE_T) ::num_points = 3 ! Number of selected points INTEGER :: i, j @@ -64,26 +64,26 @@ ! CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) ! Default file access and file creation - ! properties are used. - ! + ! properties are used. + ! ! Create dataspaces: - ! - ! for dataset with references to dataset regions + ! + ! for dataset with references to dataset regions ! CALL h5screate_simple_f(rankr, dimsr, spacer_id, error) ! - ! for integer dataset + ! for integer dataset ! CALL h5screate_simple_f(rank, dims, space_id, error) ! ! Create and write datasets: ! - ! Integer dataset + ! Integer dataset ! CALL h5dcreate_f(file_id, dsetnamev, H5T_NATIVE_INTEGER, space_id, & dsetv_id, error) data_dims(1) = 2 - data_dims(2) = 9 + data_dims(2) = 9 CALL h5dwrite_f(dsetv_id, H5T_NATIVE_INTEGER, data, data_dims, error) CALL h5dclose_f(dsetv_id, error) ! @@ -94,25 +94,25 @@ ! ! Create a reference to the hyperslab selection. ! - start(1) = 0 - start(2) = 3 + start(1) = 0 + start(2) = 3 count(1) = 2 count(2) = 3 CALL h5sselect_hyperslab_f(space_id, H5S_SELECT_SET_F, & - start, count, error) - CALL h5rcreate_f(file_id, dsetnamev, space_id, ref(1), error) + start, count, error) + CALL h5rcreate_f(file_id, dsetnamev, space_id, ref(1), error) ! ! Create a reference to elements selection. ! CALL h5sselect_none_f(space_id, error) CALL h5sselect_elements_f(space_id, H5S_SELECT_SET_F, rank, num_points,& - coord, error) - CALL h5rcreate_f(file_id, dsetnamev, space_id, ref(2), error) + coord, error) + CALL h5rcreate_f(file_id, dsetnamev, space_id, ref(2), error) ! - ! Write dataset with the references. + ! Write dataset with the references. ! ref_size(1) = size(ref) - CALL h5dwrite_f(dsetr_id, H5T_STD_REF_DSETREG, ref, ref_size, error) + CALL h5dwrite_f(dsetr_id, H5T_STD_REF_DSETREG, ref, ref_size, error) ! ! Close all objects. ! @@ -129,12 +129,12 @@ ! Read references to the dataset regions. ! ref_size(1) = size(ref_out) - CALL h5dread_f(dsetr_id, H5T_STD_REF_DSETREG, ref_out, ref_size, error) - ! + CALL h5dread_f(dsetr_id, H5T_STD_REF_DSETREG, ref_out, ref_size, error) + ! ! Dereference the first reference. - ! + ! CALL H5rdereference_f(dsetr_id, ref_out(1), dsetv_id, error) - CALL H5rget_region_f(dsetr_id, ref_out(1), space_id, error) + CALL H5rget_region_f(dsetr_id, ref_out(1), space_id, error) ! ! Read selected data from the dataset. ! @@ -142,18 +142,18 @@ mem_space_id = space_id, file_space_id = space_id) write(*,*) "Hypeslab selection" write(*,*) - do i = 1,2 + do i = 1,2 write(*,*) (data_out (i,j), j = 1,9) enddo write(*,*) CALL h5sclose_f(space_id, error) CALL h5dclose_f(dsetv_id, error) data_out = 0 - ! + ! ! Dereference the second reference. - ! + ! CALL H5rdereference_f(dsetr_id, ref_out(2), dsetv_id, error) - CALL H5rget_region_f(dsetr_id, ref_out(2), space_id, error) + CALL H5rget_region_f(dsetr_id, ref_out(2), space_id, error) ! ! Read selected data from the dataset. ! @@ -161,7 +161,7 @@ mem_space_id = space_id, file_space_id = space_id) write(*,*) "Point selection" write(*,*) - do i = 1,2 + do i = 1,2 write(*,*) (data_out (i,j), j = 1,9) enddo ! @@ -173,8 +173,8 @@ ! ! Close FORTRAN interface. ! - CALL h5close_f(error) + CALL h5close_f(error) - END PROGRAM REG_REFERENCE + END PROGRAM REG_REFERENCE diff --git a/fortran/examples/rwdsetexample.f90 b/fortran/examples/rwdsetexample.f90 index 37ee282..1e84e23 100644 --- a/fortran/examples/rwdsetexample.f90 +++ b/fortran/examples/rwdsetexample.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,34 +11,34 @@ ! 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. +! 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 - + 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) :: 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. ! @@ -51,7 +51,7 @@ ! ! Initialize FORTRAN interface. ! - CALL h5open_f(error) + CALL h5open_f(error) ! ! Open an existing file. @@ -59,7 +59,7 @@ CALL h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) ! - ! Open an existing dataset. + ! Open an existing dataset. ! CALL h5dopen_f(file_id, dsetname, dset_id, error) @@ -67,7 +67,7 @@ ! Write the dataset. ! data_dims(1) = 4 - data_dims(2) = 6 + data_dims(2) = 6 CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, data_dims, error) ! @@ -84,13 +84,13 @@ ! Close the file. ! CALL h5fclose_f(file_id, error) - + ! ! Close FORTRAN interface. ! CALL h5close_f(error) - END PROGRAM RWDSETEXAMPLE + END PROGRAM RWDSETEXAMPLE + - diff --git a/fortran/examples/selectele.f90 b/fortran/examples/selectele.f90 index 461fd0b..3ab7ebc 100644 --- a/fortran/examples/selectele.f90 +++ b/fortran/examples/selectele.f90 @@ -1,4 +1,4 @@ -! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! Copyright by The HDF Group. * ! Copyright by the Board of Trustees of the University of Illinois. * ! All rights reserved. * @@ -11,25 +11,25 @@ ! 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 program creates two files, copy1.h5, and copy2.h5. -! In copy1.h5, it creates a 3x4 dataset called 'Copy1', -! and write 0's to this dataset. -! In copy2.h5, it create a 3x4 dataset called 'Copy2', -! and write 1's to this dataset. -! It closes both files, reopens both files, selects two -! points in copy1.h5 and writes values to them. Then it -! uses an H5Scopy to write the same selection to copy2.h5. -! Program reopens the files, and reads and prints the contents of -! the two datasets. -! +! This program creates two files, copy1.h5, and copy2.h5. +! In copy1.h5, it creates a 3x4 dataset called 'Copy1', +! and write 0's to this dataset. +! In copy2.h5, it create a 3x4 dataset called 'Copy2', +! and write 1's to this dataset. +! It closes both files, reopens both files, selects two +! points in copy1.h5 and writes values to them. Then it +! uses an H5Scopy to write the same selection to copy2.h5. +! Program reopens the files, and reads and prints the contents of +! the two datasets. +! PROGRAM SELECTEXAMPLE - USE HDF5 ! This module contains all necessary modules - + USE HDF5 ! This module contains all necessary modules + IMPLICIT NONE CHARACTER(LEN=8), PARAMETER :: filename1 = "copy1.h5" ! File name @@ -41,27 +41,27 @@ INTEGER(SIZE_T), PARAMETER :: NUMP = 2 ! Number of points selected - INTEGER(HID_T) :: file1_id ! File1 identifier - INTEGER(HID_T) :: file2_id ! File2 identifier - INTEGER(HID_T) :: dset1_id ! Dataset1 identifier - INTEGER(HID_T) :: dset2_id ! Dataset2 identifier - INTEGER(HID_T) :: dataspace1 ! Dataspace identifier - INTEGER(HID_T) :: dataspace2 ! Dataspace identifier - INTEGER(HID_T) :: memspace ! memspace identifier + INTEGER(HID_T) :: file1_id ! File1 identifier + INTEGER(HID_T) :: file2_id ! File2 identifier + INTEGER(HID_T) :: dset1_id ! Dataset1 identifier + INTEGER(HID_T) :: dset2_id ! Dataset2 identifier + INTEGER(HID_T) :: dataspace1 ! Dataspace identifier + INTEGER(HID_T) :: dataspace2 ! Dataspace identifier + INTEGER(HID_T) :: memspace ! memspace identifier - INTEGER(HSIZE_T), DIMENSION(1) :: dimsm = (/2/) - ! Memory dataspace dimensions + INTEGER(HSIZE_T), DIMENSION(1) :: dimsm = (/2/) + ! Memory dataspace dimensions INTEGER(HSIZE_T), DIMENSION(2) :: dimsf = (/3,4/) ! File dataspace dimensions INTEGER(HSIZE_T), DIMENSION(RANK,NUMP) :: coord ! Elements coordinates - ! in the file + ! in the file INTEGER, DIMENSION(3,4) :: buf1, buf2, bufnew ! Data buffers INTEGER, DIMENSION(2) :: val = (/53, 59/) ! Values to write - + INTEGER :: memrank = 1 ! Rank of the dataset in memory - INTEGER :: i, j + INTEGER :: i, j INTEGER :: error ! Error flag LOGICAL :: status @@ -70,11 +70,11 @@ ! ! Create two files containing identical datasets. Write 0's to one - ! and 1's to the other. + ! and 1's to the other. ! ! - ! Data initialization. + ! Data initialization. ! do i = 1, 3 do j = 1, 4 @@ -87,21 +87,21 @@ buf2(i,j) = 1; end do end do - + ! - ! Initialize FORTRAN interface. + ! Initialize FORTRAN interface. ! - CALL h5open_f(error) + CALL h5open_f(error) ! ! Create file1, file2 using default properties. - ! + ! CALL h5fcreate_f(filename1, H5F_ACC_TRUNC_F, file1_id, error) CALL h5fcreate_f(filename2, H5F_ACC_TRUNC_F, file2_id, error) ! - ! Create the data space for the datasets. + ! Create the data space for the datasets. ! CALL h5screate_simple_f(RANK, dimsf, dataspace1, error) @@ -120,7 +120,7 @@ ! Write the datasets. ! data_dims(1) = 3 - data_dims(2) = 4 + data_dims(2) = 4 CALL h5dwrite_f(dset1_id, H5T_NATIVE_INTEGER, buf1, data_dims, error) CALL h5dwrite_f(dset2_id, H5T_NATIVE_INTEGER, buf2, data_dims, error) @@ -147,8 +147,8 @@ CALL h5fclose_f(file2_id, error) ! - ! Open the two files. Select two points in one file, write values to - ! those point locations, then do H5Scopy and write the values to the + ! Open the two files. Select two points in one file, write values to + ! those point locations, then do H5Scopy and write the values to the ! other file. Close files. ! @@ -156,7 +156,7 @@ ! Open the files. ! CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) - + CALL h5fopen_f (filename2, H5F_ACC_RDWR_F, file2_id, error) ! @@ -170,19 +170,19 @@ ! Get dataset1's dataspace identifier. ! CALL h5dget_space_f(dset1_id, dataspace1, error) - + ! ! Create memory dataspace. ! CALL h5screate_simple_f(memrank, dimsm, memspace, error) - + ! - ! Set the selected point positions. Because Fortran array index starts + ! Set the selected point positions. Because Fortran array index starts ! from 1, so add one to the actual select points in C. ! - coord(1,1) = 1 - coord(2,1) = 2 - coord(1,2) = 1 + coord(1,1) = 1 + coord(2,1) = 2 + coord(1,2) = 1 coord(2,2) = 4 ! @@ -201,7 +201,7 @@ ! ! Copy the daspace1 into dataspace2. ! - CALL h5scopy_f(dataspace1, dataspace2, error) + CALL h5scopy_f(dataspace1, dataspace2, error) ! ! Write value into the selected points in dataset2. @@ -244,7 +244,7 @@ ! Open the files. ! CALL h5fopen_f (filename1, H5F_ACC_RDWR_F, file1_id, error) - + CALL h5fopen_f (filename2, H5F_ACC_RDWR_F, file2_id, error) ! @@ -257,8 +257,8 @@ ! ! Read dataset from the first file. ! - data_dims(1) = 3 - data_dims(2) = 4 + data_dims(1) = 3 + data_dims(2) = 4 CALL h5dread_f(dset1_id, H5T_NATIVE_INTEGER, bufnew, data_dims, error) ! |