summaryrefslogtreecommitdiffstats
path: root/fortran/examples/mountexample.f90
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-01-30 04:29:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-01-30 04:29:13 (GMT)
commitfd70b2afa883f94718ffb7f4f33d104d76e3fe0a (patch)
treec1add8db2a4848202d86a9b274bfaf8c7b80e961 /fortran/examples/mountexample.f90
parent35b0159a0a5f1f4b80e305204ea51a742b052403 (diff)
downloadhdf5-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/mountexample.f90')
-rw-r--r--fortran/examples/mountexample.f9080
1 files changed, 40 insertions, 40 deletions
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