diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-05-12 20:45:22 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-05-12 20:45:22 (GMT) |
commit | 415647d63a0783a566402d98baad2b65677ab812 (patch) | |
tree | aaeb7234705bc5c8197e4f17e83ff8603479c05d /fortran/examples/h5_subset.f90 | |
parent | 5b441f84c9a09d216a018c34eb488c241db0a060 (diff) | |
download | hdf5-415647d63a0783a566402d98baad2b65677ab812.zip hdf5-415647d63a0783a566402d98baad2b65677ab812.tar.gz hdf5-415647d63a0783a566402d98baad2b65677ab812.tar.bz2 |
Whitespace cleanup
Diffstat (limited to 'fortran/examples/h5_subset.f90')
-rw-r--r-- | fortran/examples/h5_subset.f90 | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/fortran/examples/h5_subset.f90 b/fortran/examples/h5_subset.f90 index ab33c86..9bebce5 100644 --- a/fortran/examples/h5_subset.f90 +++ b/fortran/examples/h5_subset.f90 @@ -11,23 +11,23 @@ ! help@hdfgroup.org. * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! -! This example shows how to write and read a hyperslab. +! This example shows how to write and read a hyperslab. ! It is used in the HDF5 Tutorial. ! -PROGRAM H5_SUBSET +PROGRAM H5_SUBSET - USE HDF5 ! This module contains all necessary modules + 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 + 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, @@ -35,57 +35,57 @@ PROGRAM H5_SUBSET ! 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 :: 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) :: 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, 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 :: dim1 = 8 - INTEGER :: i, j + INTEGER :: i, j INTEGER :: error ! Error flag INTEGER(HSIZE_T), DIMENSION(2) :: data_dims ! - ! Write data to the HDF5 file. + ! Write data to the HDF5 file. ! ! - ! Data initialization. + ! Data initialization. ! - DO i = 1, dim0 + DO i = 1, dim0 DO j = 1, dim1 IF (i .LE. (dim0 / 2)) THEN - data(i,j) = 1 - ELSE - data(i,j) = 2 + data(i,j) = 1 + ELSE + data(i,j) = 2 END IF END DO END DO ! - ! 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(rank, dimsf, dataspace, error) @@ -98,12 +98,12 @@ PROGRAM H5_SUBSET ! ! Write the dataset. ! - data_dims(1) = dim0 - data_dims(2) = dim1 + data_dims(1) = dim0 + data_dims(2) = dim1 CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, data_dims, error) ! - ! Data Written to File + ! Data Written to File ! WRITE(*,'(/,A)') "Original Data Written to File:" DO i = 1, dim0 @@ -138,7 +138,7 @@ PROGRAM H5_SUBSET ! CALL h5dget_space_f(dset_id, dataspace, error) CALL h5sselect_hyperslab_f(dataspace, H5S_SELECT_SET_F, & - offset, count, error, stride, BLOCK) + offset, count, error, stride, BLOCK) ! ! Create memory dataspace. ! @@ -148,9 +148,9 @@ PROGRAM H5_SUBSET WRITE(*,'(A,/)') " offset=2x1 stride=1x1 count=4x3 block=1x1" ! - ! Write subset to dataset + ! Write subset to dataset ! - data_dims(1:2) = (/dim0_sub, dim1_sub/) + data_dims(1:2) = (/dim0_sub, dim1_sub/) CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, sdata, data_dims, error, & memspace, dataspace) @@ -158,10 +158,10 @@ PROGRAM H5_SUBSET CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, rdata, data_dims, error) ! - ! Read entire dataset back + ! Read entire dataset back ! WRITE(*,'(A)') "Data in File after Subset Written:" - DO i = 1, dim0 + DO i = 1, dim0 WRITE(*,'(100(1X,I0,1X))') rdata(i,1:dim1) END DO PRINT *, " " |