summaryrefslogtreecommitdiffstats
path: root/fortran/examples/hyperslab.f90
diff options
context:
space:
mode:
Diffstat (limited to 'fortran/examples/hyperslab.f90')
-rw-r--r--fortran/examples/hyperslab.f9068
1 files changed, 34 insertions, 34 deletions
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