2011-08-18 22:32:47 +08:00
|
|
|
!****h* root/fortran/test/tH5Z.f90
|
|
|
|
!
|
|
|
|
! NAME
|
|
|
|
! tH5Z.f90
|
|
|
|
!
|
|
|
|
! FUNCTION
|
|
|
|
! Basic testing of Fortran H5Z szip APIs.
|
|
|
|
!
|
|
|
|
! COPYRIGHT
|
2010-01-30 12:29:13 +08:00
|
|
|
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-08 01:55:01 +08:00
|
|
|
! Copyright by The HDF Group. *
|
2003-04-16 06:34:43 +08:00
|
|
|
! All rights reserved. *
|
|
|
|
! *
|
|
|
|
! This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
! terms governing use, modification, and redistribution, is contained in *
|
2017-04-18 03:32:16 +08:00
|
|
|
! the COPYING file, which can be found at the root of the source code *
|
2021-02-17 22:52:36 +08:00
|
|
|
! distribution tree, or in https://www.hdfgroup.org/licenses. *
|
2017-04-18 03:32:16 +08:00
|
|
|
! If you do not have access to either file, you may request a copy from *
|
|
|
|
! help@hdfgroup.org. *
|
2010-01-30 12:29:13 +08:00
|
|
|
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2003-04-16 06:34:43 +08:00
|
|
|
!
|
2011-08-18 22:32:47 +08:00
|
|
|
! CONTAINS SUBROUTINES
|
|
|
|
! filters_test, szip_test
|
|
|
|
!
|
|
|
|
!*****
|
2014-04-06 23:56:21 +08:00
|
|
|
MODULE TH5Z
|
2011-08-18 22:32:47 +08:00
|
|
|
|
2023-10-20 05:40:08 +08:00
|
|
|
USE HDF5 ! This module contains all necessary modules
|
|
|
|
USE TH5_MISC
|
|
|
|
|
2014-04-06 23:56:21 +08:00
|
|
|
CONTAINS
|
|
|
|
|
|
|
|
SUBROUTINE filters_test(total_error)
|
2003-03-20 00:13:57 +08:00
|
|
|
|
|
|
|
! This subroutine tests following functionalities: h5zfilter_avail_f, h5zunregister_f
|
|
|
|
|
|
|
|
IMPLICIT NONE
|
2010-01-30 12:29:13 +08:00
|
|
|
INTEGER, INTENT(OUT) :: total_error
|
2008-05-04 07:39:37 +08:00
|
|
|
LOGICAL :: status
|
2003-03-20 00:13:57 +08:00
|
|
|
INTEGER(HID_T) :: crtpr_id, xfer_id
|
2004-01-28 04:39:20 +08:00
|
|
|
INTEGER :: nfilters
|
2003-03-20 00:13:57 +08:00
|
|
|
INTEGER :: error
|
|
|
|
INTEGER(HSIZE_T) :: ch_dims(2)
|
|
|
|
INTEGER :: RANK = 2
|
|
|
|
INTEGER :: dlevel = 6
|
|
|
|
INTEGER :: edc_flag
|
|
|
|
|
|
|
|
ch_dims(1) = 10
|
|
|
|
ch_dims(2) = 3
|
|
|
|
!
|
|
|
|
! Deflate filter
|
|
|
|
!
|
|
|
|
CALL h5zfilter_avail_f(H5Z_FILTER_DEFLATE_F, status, error)
|
|
|
|
CALL check("h5zfilter_avail_f", error, total_error)
|
|
|
|
if(status) then
|
|
|
|
CALL h5pcreate_f(H5P_DATASET_CREATE_F, crtpr_id, error)
|
|
|
|
CALL check("h5pcreate_f", error, total_error)
|
|
|
|
CALL h5pset_chunk_f(crtpr_id, RANK, ch_dims, error)
|
|
|
|
CALL check("h5pset_chunk_f",error, total_error)
|
|
|
|
CALL h5pset_deflate_f(crtpr_id, dlevel, error)
|
2010-01-30 12:29:13 +08:00
|
|
|
CALL check("h5pset_deflate_f", error, total_error)
|
2003-03-20 00:13:57 +08:00
|
|
|
CALL h5pclose_f(crtpr_id,error)
|
|
|
|
CALL check("h5pclose_f", error, total_error)
|
|
|
|
endif
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2003-03-20 00:13:57 +08:00
|
|
|
!
|
|
|
|
! Shuffle filter
|
|
|
|
!
|
|
|
|
CALL h5zfilter_avail_f(H5Z_FILTER_SHUFFLE_F, status, error)
|
|
|
|
CALL check("h5zfilter_avail_f", error, total_error)
|
|
|
|
if(status) then
|
|
|
|
CALL h5pcreate_f(H5P_DATASET_CREATE_F, crtpr_id, error)
|
|
|
|
CALL check("h5pcreate_f", error, total_error)
|
|
|
|
CALL h5pset_chunk_f(crtpr_id, RANK, ch_dims, error)
|
|
|
|
CALL check("h5pset_chunk_f",error, total_error)
|
2003-04-09 09:47:03 +08:00
|
|
|
CALL h5pset_shuffle_f(crtpr_id, error)
|
2010-01-30 12:29:13 +08:00
|
|
|
CALL check("h5pset_shuffle_f", error, total_error)
|
2003-03-20 00:13:57 +08:00
|
|
|
CALL h5pclose_f(crtpr_id,error)
|
|
|
|
CALL check("h5pclose_f", error, total_error)
|
|
|
|
endif
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2003-03-20 00:13:57 +08:00
|
|
|
!
|
|
|
|
! Checksum filter
|
|
|
|
!
|
|
|
|
CALL h5zfilter_avail_f(H5Z_FILTER_FLETCHER32_F, status, error)
|
|
|
|
CALL check("h5zfilter_avail_f", error, total_error)
|
|
|
|
if(status) then
|
|
|
|
CALL h5pcreate_f(H5P_DATASET_CREATE_F, crtpr_id, error)
|
|
|
|
CALL check("h5pcreate_f", error, total_error)
|
|
|
|
CALL h5pset_chunk_f(crtpr_id, RANK, ch_dims, error)
|
|
|
|
CALL check("h5pset_chunk_f",error, total_error)
|
|
|
|
CALL h5pset_fletcher32_f(crtpr_id, error)
|
2010-01-30 12:29:13 +08:00
|
|
|
CALL check("h5pset_fletcher32_f", error, total_error)
|
2003-03-20 00:13:57 +08:00
|
|
|
CALL h5pclose_f(crtpr_id,error)
|
|
|
|
CALL check("h5pclose_f", error, total_error)
|
|
|
|
CALL h5pcreate_f(H5P_DATASET_XFER_F, xfer_id, error)
|
|
|
|
CALL check("h5pcreate_f", error, total_error)
|
|
|
|
CALL h5pset_edc_check_f( xfer_id, H5Z_DISABLE_EDC_F, error)
|
|
|
|
CALL check("h5pset_edc_check_f", error, total_error)
|
|
|
|
CALL h5pget_edc_check_f( xfer_id, edc_flag, error)
|
|
|
|
CALL check("h5pget_edc_check_f", error, total_error)
|
|
|
|
if (edc_flag .ne. H5Z_DISABLE_EDC_F) then
|
|
|
|
write(*,*) "EDC status is wrong"
|
|
|
|
total_error = total_error + 1
|
|
|
|
endif
|
|
|
|
CALL h5pclose_f(xfer_id, error)
|
|
|
|
CALL check("h5pclose_f", error, total_error)
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2004-01-28 04:39:20 +08:00
|
|
|
!
|
2004-02-05 03:36:12 +08:00
|
|
|
! Verify h5premove_filter_f
|
2004-01-28 04:39:20 +08:00
|
|
|
!
|
|
|
|
CALL h5zfilter_avail_f(H5Z_FILTER_FLETCHER32_F, status, error)
|
|
|
|
CALL check("h5zfilter_avail_f", error, total_error)
|
|
|
|
if(status) then
|
|
|
|
CALL h5zfilter_avail_f(H5Z_FILTER_SHUFFLE_F, status, error)
|
|
|
|
CALL check("h5zfilter_avail_f", error, total_error)
|
|
|
|
if(status) then
|
|
|
|
CALL h5pcreate_f(H5P_DATASET_CREATE_F, crtpr_id, error)
|
|
|
|
CALL check("h5pcreate_f", error, total_error)
|
|
|
|
CALL h5pset_fletcher32_f(crtpr_id, error)
|
2010-01-30 12:29:13 +08:00
|
|
|
CALL check("h5pset_fletcher32_f", error, total_error)
|
2004-01-28 04:39:20 +08:00
|
|
|
CALL h5pset_shuffle_f(crtpr_id, error)
|
2010-01-30 12:29:13 +08:00
|
|
|
CALL check("h5pset_shuffle_f", error, total_error)
|
2004-01-28 04:39:20 +08:00
|
|
|
CALL h5pget_nfilters_f(crtpr_id, nfilters, error)
|
2010-01-30 12:29:13 +08:00
|
|
|
CALL check("h5pget_nfilters_f", error, total_error)
|
2004-01-28 04:39:20 +08:00
|
|
|
|
|
|
|
! Verify the correct number of filters
|
|
|
|
if (nfilters .ne. 2) then
|
|
|
|
write(*,*) "number of filters is wrong"
|
|
|
|
total_error = total_error + 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
! Delete a single filter
|
2004-02-05 03:36:12 +08:00
|
|
|
CALL h5premove_filter_f(crtpr_id, H5Z_FILTER_SHUFFLE_F, error)
|
2010-01-30 12:29:13 +08:00
|
|
|
CALL check("h5pset_shuffle_f", error, total_error)
|
2004-01-28 04:39:20 +08:00
|
|
|
|
|
|
|
! Verify the correct number of filters now
|
|
|
|
CALL h5pget_nfilters_f(crtpr_id, nfilters, error)
|
2010-01-30 12:29:13 +08:00
|
|
|
CALL check("h5pget_nfilters_f", error, total_error)
|
2004-01-28 04:39:20 +08:00
|
|
|
if (nfilters .ne. 1) then
|
|
|
|
write(*,*) "number of filters is wrong"
|
|
|
|
total_error = total_error + 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
! Delete all filters
|
2004-02-05 04:35:37 +08:00
|
|
|
CALL h5premove_filter_f(crtpr_id, H5Z_FILTER_ALL_F, error)
|
2010-01-30 12:29:13 +08:00
|
|
|
CALL check("h5premove_filter_f", error, total_error)
|
2004-01-28 04:39:20 +08:00
|
|
|
|
|
|
|
! Verify the correct number of filters now
|
|
|
|
CALL h5pget_nfilters_f(crtpr_id, nfilters, error)
|
2010-01-30 12:29:13 +08:00
|
|
|
CALL check("h5pget_nfilters_f", error, total_error)
|
2004-01-28 04:39:20 +08:00
|
|
|
if (nfilters .ne. 0) then
|
|
|
|
write(*,*) "number of filters is wrong"
|
|
|
|
total_error = total_error + 1
|
|
|
|
endif
|
|
|
|
CALL h5pclose_f(crtpr_id,error)
|
|
|
|
CALL check("h5pclose_f", error, total_error)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2003-03-20 00:13:57 +08:00
|
|
|
RETURN
|
|
|
|
END SUBROUTINE filters_test
|
2003-04-12 12:11:30 +08:00
|
|
|
|
|
|
|
SUBROUTINE szip_test(szip_flag, cleanup, total_error)
|
|
|
|
|
|
|
|
IMPLICIT NONE
|
|
|
|
LOGICAL, INTENT(OUT) :: szip_flag
|
|
|
|
LOGICAL, INTENT(IN) :: cleanup
|
2010-01-30 12:29:13 +08:00
|
|
|
INTEGER, INTENT(OUT) :: total_error
|
|
|
|
|
2003-04-12 12:11:30 +08:00
|
|
|
|
|
|
|
CHARACTER(LEN=4), PARAMETER :: filename = "szip" ! File name
|
2010-01-30 12:29:13 +08:00
|
|
|
CHARACTER(LEN=80) :: fix_filename
|
2003-04-12 12:11:30 +08:00
|
|
|
CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name
|
|
|
|
INTEGER, PARAMETER :: N = 1024
|
2004-01-02 13:05:23 +08:00
|
|
|
INTEGER, PARAMETER :: NN = 64
|
2003-04-12 12:11:30 +08:00
|
|
|
INTEGER, PARAMETER :: M = 512
|
2004-01-02 13:05:23 +08:00
|
|
|
INTEGER, PARAMETER :: MM = 32
|
2003-04-12 12:11:30 +08:00
|
|
|
|
2010-01-30 12:29:13 +08:00
|
|
|
INTEGER(HID_T) :: file_id ! File identifier
|
|
|
|
INTEGER(HID_T) :: dset_id ! Dataset identifier
|
2003-04-12 12:11:30 +08:00
|
|
|
INTEGER(HID_T) :: dspace_id ! Dataspace identifier
|
|
|
|
INTEGER(HID_T) :: dtype_id ! Datatype identifier
|
|
|
|
|
|
|
|
|
|
|
|
INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/N,M/) ! Dataset dimensions
|
|
|
|
INTEGER(HSIZE_T), DIMENSION(2) :: chunk_dims = (/NN, MM/)
|
|
|
|
INTEGER :: rank = 2 ! Dataset rank
|
|
|
|
|
2022-08-22 23:28:48 +08:00
|
|
|
INTEGER, DIMENSION(:,:), ALLOCATABLE :: dset_data ! Data buffers
|
|
|
|
INTEGER, DIMENSION(:,:), ALLOCATABLE :: data_out ! Data buffers
|
2003-04-12 12:11:30 +08:00
|
|
|
INTEGER :: error ! Error flag
|
2004-01-02 13:05:23 +08:00
|
|
|
INTEGER :: num_errors = 0 ! Number of data errors
|
2003-04-12 12:11:30 +08:00
|
|
|
|
|
|
|
INTEGER :: i, j !general purpose integers
|
2004-04-23 01:18:46 +08:00
|
|
|
INTEGER(HSIZE_T), DIMENSION(2) :: data_dims
|
2003-04-12 12:11:30 +08:00
|
|
|
INTEGER(HID_T) :: crp_list
|
2010-01-30 12:29:13 +08:00
|
|
|
INTEGER :: options_mask, pix_per_block
|
2003-04-12 12:11:30 +08:00
|
|
|
LOGICAL :: flag
|
2010-01-30 12:29:13 +08:00
|
|
|
CHARACTER(LEN=4) filter_name
|
2004-07-02 01:38:04 +08:00
|
|
|
|
2003-04-12 12:11:30 +08:00
|
|
|
INTEGER :: filter_flag = -1
|
|
|
|
INTEGER(SIZE_T) :: cd_nelemnts = 4
|
|
|
|
INTEGER(SIZE_T) :: filter_name_len = 4
|
2004-12-29 22:26:20 +08:00
|
|
|
INTEGER, DIMENSION(4) :: cd_values
|
|
|
|
INTEGER :: config_flag = 0 ! for h5zget_filter_info_f
|
2005-01-14 11:06:07 +08:00
|
|
|
INTEGER :: config_flag_both = 0 ! for h5zget_filter_info_f
|
2003-04-12 12:11:30 +08:00
|
|
|
|
2004-07-02 01:38:04 +08:00
|
|
|
!
|
|
|
|
! Verify that SZIP exists and has an encoder
|
|
|
|
!
|
2005-01-11 09:37:00 +08:00
|
|
|
CALL h5zfilter_avail_f(H5Z_FILTER_SZIP_F, szip_flag, error)
|
2004-12-29 22:26:20 +08:00
|
|
|
CALL check("h5zfilter_avail", error, total_error)
|
2004-07-02 01:38:04 +08:00
|
|
|
|
2005-01-11 09:37:00 +08:00
|
|
|
! Quit if failed
|
|
|
|
if (error .ne. 0) return
|
|
|
|
|
|
|
|
! Skip if no SZIP available
|
|
|
|
if (.NOT. szip_flag)then
|
|
|
|
return
|
|
|
|
|
|
|
|
else !SZIP available
|
|
|
|
|
|
|
|
! Continue
|
|
|
|
CALL h5zget_filter_info_f(H5Z_FILTER_SZIP_F, config_flag, error)
|
|
|
|
CALL check("h5zget_filter_info_f", error, total_error)
|
|
|
|
! Quit if failed
|
2010-01-30 12:29:13 +08:00
|
|
|
if (error .ne. 0) return
|
2004-12-29 22:26:20 +08:00
|
|
|
!
|
|
|
|
! Make sure h5zget_filter_info_f returns the right flag
|
|
|
|
!
|
2005-01-14 11:06:07 +08:00
|
|
|
config_flag_both=IOR(H5Z_FILTER_ENCODE_ENABLED_F,H5Z_FILTER_DECODE_ENABLED_F)
|
2005-01-11 09:37:00 +08:00
|
|
|
if( szip_flag ) then
|
2005-01-14 11:06:07 +08:00
|
|
|
if (config_flag .NE. config_flag_both) then
|
|
|
|
if(config_flag .NE. H5Z_FILTER_DECODE_ENABLED_F) then
|
|
|
|
error = -1
|
|
|
|
CALL check("h5zget_filter_info_f config_flag", error, total_error)
|
|
|
|
endif
|
2004-12-29 22:26:20 +08:00
|
|
|
endif
|
2010-01-30 12:29:13 +08:00
|
|
|
endif
|
2004-07-02 01:38:04 +08:00
|
|
|
|
2005-01-11 09:37:00 +08:00
|
|
|
! Continue only when encoder is available
|
2010-01-30 12:29:13 +08:00
|
|
|
if ( IAND(config_flag, H5Z_FILTER_ENCODE_ENABLED_F) .EQ. 0 ) return
|
2005-01-11 09:37:00 +08:00
|
|
|
|
2004-07-03 10:39:24 +08:00
|
|
|
options_mask = H5_SZIP_NN_OM_F
|
2003-04-12 12:11:30 +08:00
|
|
|
pix_per_block = 32
|
|
|
|
!
|
|
|
|
! Initialize the dset_data array.
|
|
|
|
!
|
2022-08-22 23:28:48 +08:00
|
|
|
ALLOCATE(dset_data(1:N,1:M))
|
2003-04-12 12:11:30 +08:00
|
|
|
do i = 1, N
|
|
|
|
do j = 1, M
|
|
|
|
dset_data(i,j) = (i-1)*6 + j;
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
|
|
|
|
!
|
|
|
|
! Create a new file using default properties.
|
2010-01-30 12:29:13 +08:00
|
|
|
!
|
2003-04-12 12:11:30 +08:00
|
|
|
CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error)
|
|
|
|
if (error .ne. 0) then
|
|
|
|
write(*,*) "Cannot modify filename"
|
|
|
|
stop
|
|
|
|
endif
|
|
|
|
CALL h5fcreate_f(fix_filename, H5F_ACC_TRUNC_F, file_id, error)
|
|
|
|
CALL check("h5fcreate_f", error, total_error)
|
|
|
|
|
|
|
|
|
2010-01-30 12:29:13 +08:00
|
|
|
!
|
2003-04-12 12:11:30 +08:00
|
|
|
! Create the dataspace.
|
|
|
|
!
|
|
|
|
CALL h5screate_simple_f(rank, dims, dspace_id, error)
|
|
|
|
CALL check("h5screate_simple_f", error, total_error)
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2003-04-12 12:11:30 +08:00
|
|
|
CALL h5pcreate_f(H5P_DATASET_CREATE_F, crp_list, error)
|
|
|
|
CALL check("h5pcreat_f",error,total_error)
|
|
|
|
|
|
|
|
CALL h5pset_chunk_f(crp_list, rank, chunk_dims, error)
|
|
|
|
CALL check("h5pset_chunk_f",error,total_error)
|
|
|
|
CALL h5pset_szip_f(crp_list, options_mask, pix_per_block, error)
|
|
|
|
CALL check("h5pset_szip_f",error,total_error)
|
|
|
|
CALL h5pall_filters_avail_f(crp_list, flag, error)
|
|
|
|
CALL check("h5pall_filters_avail_f",error,total_error)
|
|
|
|
if (.NOT. flag) then
|
|
|
|
CALL h5pclose_f(crp_list, error)
|
|
|
|
CALL h5sclose_f(dspace_id, error)
|
|
|
|
CALL h5fclose_f(file_id, error)
|
2004-12-29 22:26:20 +08:00
|
|
|
szip_flag = .FALSE.
|
|
|
|
total_error = -1
|
2003-04-12 12:11:30 +08:00
|
|
|
return
|
|
|
|
endif
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2003-04-12 12:11:30 +08:00
|
|
|
CALL h5pget_filter_by_id_f(crp_list, H5Z_FILTER_SZIP_F, filter_flag, &
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2003-04-12 12:11:30 +08:00
|
|
|
cd_nelemnts, cd_values,&
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2003-04-12 12:11:30 +08:00
|
|
|
filter_name_len, filter_name, error)
|
|
|
|
CALL check("h5pget_filter_by_id_f",error,total_error)
|
|
|
|
!
|
|
|
|
! Create the dataset with default properties.
|
|
|
|
!
|
|
|
|
CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, &
|
|
|
|
dset_id, error, crp_list)
|
|
|
|
CALL check("h5dcreate_f", error, total_error)
|
|
|
|
|
|
|
|
!
|
|
|
|
! Write the dataset.
|
|
|
|
!
|
2004-04-23 01:18:46 +08:00
|
|
|
data_dims(1) = N
|
|
|
|
data_dims(2) = M
|
|
|
|
CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, data_dims, error)
|
2003-04-12 12:11:30 +08:00
|
|
|
CALL check("h5dwrite_f", error, total_error)
|
|
|
|
|
|
|
|
|
2010-01-30 12:29:13 +08:00
|
|
|
!
|
2003-04-12 12:11:30 +08:00
|
|
|
! End access to the dataset and release resources used by it.
|
2010-01-30 12:29:13 +08:00
|
|
|
!
|
2003-04-12 12:11:30 +08:00
|
|
|
CALL h5dclose_f(dset_id, error)
|
|
|
|
CALL check("h5dclose_f", error, total_error)
|
|
|
|
|
|
|
|
!
|
|
|
|
! Terminate access to the data space.
|
|
|
|
!
|
|
|
|
CALL h5sclose_f(dspace_id, error)
|
|
|
|
CALL check("h5sclose_f", error, total_error)
|
|
|
|
|
2010-01-30 12:29:13 +08:00
|
|
|
!
|
2003-04-12 12:11:30 +08:00
|
|
|
! Close the file.
|
|
|
|
!
|
|
|
|
CALL h5pclose_f(crp_list, error)
|
|
|
|
CALL h5fclose_f(file_id, error)
|
|
|
|
CALL check("h5fclose_f", error, total_error)
|
|
|
|
|
|
|
|
!
|
|
|
|
! Open the existing file.
|
|
|
|
!
|
|
|
|
CALL h5fopen_f (fix_filename, H5F_ACC_RDWR_F, file_id, error)
|
|
|
|
CALL check("h5fopen_f", error, total_error)
|
|
|
|
|
|
|
|
!
|
2010-01-30 12:29:13 +08:00
|
|
|
! Open the existing dataset.
|
2003-04-12 12:11:30 +08:00
|
|
|
!
|
|
|
|
CALL h5dopen_f(file_id, dsetname, dset_id, error)
|
|
|
|
CALL check("h5dopen_f", error, total_error)
|
|
|
|
CALL check("h5pget_filter_by_id_f",error,total_error)
|
|
|
|
|
|
|
|
!
|
2010-01-30 12:29:13 +08:00
|
|
|
! Get the dataset type.
|
2003-04-12 12:11:30 +08:00
|
|
|
!
|
|
|
|
CALL h5dget_type_f(dset_id, dtype_id, error)
|
|
|
|
CALL check("h5dget_type_f", error, total_error)
|
|
|
|
|
|
|
|
!
|
2010-01-30 12:29:13 +08:00
|
|
|
! Get the data space.
|
2003-04-12 12:11:30 +08:00
|
|
|
!
|
|
|
|
CALL h5dget_space_f(dset_id, dspace_id, error)
|
|
|
|
CALL check("h5dget_space_f", error, total_error)
|
|
|
|
|
|
|
|
!
|
|
|
|
! Read the dataset.
|
|
|
|
!
|
2021-08-30 22:09:06 +08:00
|
|
|
ALLOCATE(data_out(1:N,1:M))
|
2004-04-23 01:18:46 +08:00
|
|
|
CALL h5dread_f (dset_id, H5T_NATIVE_INTEGER, data_out, data_dims, error)
|
2021-08-30 22:09:06 +08:00
|
|
|
CALL check("h5dread_f", error, total_error)
|
2003-04-12 12:11:30 +08:00
|
|
|
|
|
|
|
!
|
|
|
|
!Compare the data.
|
2010-01-30 12:29:13 +08:00
|
|
|
!
|
2003-04-12 12:11:30 +08:00
|
|
|
do i = 1, N
|
|
|
|
do j = 1, M
|
2010-01-30 12:29:13 +08:00
|
|
|
IF (data_out(i,j) .NE. dset_data(i, j)) THEN
|
2021-12-07 22:27:29 +08:00
|
|
|
write(*, *) "dataset test error occurred"
|
2004-01-02 13:05:23 +08:00
|
|
|
write(*,*) "data read is not the same as the data written"
|
|
|
|
num_errors = num_errors + 1
|
|
|
|
IF (num_errors .GE. 512) THEN
|
|
|
|
write(*, *) "maximum data errors reached"
|
|
|
|
goto 100
|
|
|
|
END IF
|
2003-04-12 12:11:30 +08:00
|
|
|
END IF
|
2010-01-30 12:29:13 +08:00
|
|
|
end do
|
2003-04-12 12:11:30 +08:00
|
|
|
end do
|
2004-01-02 13:05:23 +08:00
|
|
|
100 IF (num_errors .GT. 0) THEN
|
|
|
|
total_error=total_error + 1
|
|
|
|
END IF
|
2022-08-22 23:28:48 +08:00
|
|
|
DEALLOCATE(dset_data)
|
2021-08-30 22:09:06 +08:00
|
|
|
DEALLOCATE(data_out)
|
2003-04-12 12:11:30 +08:00
|
|
|
|
2010-01-30 12:29:13 +08:00
|
|
|
!
|
2003-04-12 12:11:30 +08:00
|
|
|
! End access to the dataset and release resources used by it.
|
2010-01-30 12:29:13 +08:00
|
|
|
!
|
2003-04-12 12:11:30 +08:00
|
|
|
CALL h5dclose_f(dset_id, error)
|
|
|
|
CALL check("h5dclose_f", error, total_error)
|
|
|
|
|
|
|
|
!
|
|
|
|
! Terminate access to the data space.
|
|
|
|
!
|
|
|
|
CALL h5sclose_f(dspace_id, error)
|
|
|
|
CALL check("h5sclose_f", error, total_error)
|
|
|
|
|
|
|
|
!
|
|
|
|
! Terminate access to the data type.
|
|
|
|
!
|
|
|
|
CALL h5tclose_f(dtype_id, error)
|
|
|
|
CALL check("h5tclose_f", error, total_error)
|
2010-01-30 12:29:13 +08:00
|
|
|
!
|
2003-04-12 12:11:30 +08:00
|
|
|
! Close the file.
|
|
|
|
!
|
|
|
|
CALL h5fclose_f(file_id, error)
|
|
|
|
CALL check("h5fclose_f", error, total_error)
|
|
|
|
if(cleanup) CALL h5_cleanup_f(filename, H5P_DEFAULT_F, error)
|
|
|
|
CALL check("h5_cleanup_f", error, total_error)
|
2005-01-11 09:37:00 +08:00
|
|
|
endif ! SZIP available
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2003-04-12 12:11:30 +08:00
|
|
|
RETURN
|
|
|
|
END SUBROUTINE szip_test
|
2014-04-06 23:56:21 +08:00
|
|
|
END MODULE TH5Z
|