summaryrefslogtreecommitdiffstats
path: root/fortran/test/tH5Z.f90
blob: 921bbd100819362be3f82abfe0838b7a3e509966 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

    SUBROUTINE filters_test(cleanup, total_error)

!   This subroutine tests following functionalities: h5zfilter_avail_f, h5zunregister_f

   USE HDF5 ! This module contains all necessary modules 

     IMPLICIT NONE
     LOGICAL, INTENT(IN)  :: cleanup
     INTEGER, INTENT(OUT) :: total_error 
     LOGICAL :: status, status1
     INTEGER(HID_T)    :: crtpr_id, xfer_id
     INTEGER           :: error
     INTEGER(HSIZE_T)  :: ch_dims(2)
     INTEGER           :: RANK = 2
     INTEGER           :: dlevel = 6
     INTEGER           :: tsize = 4
     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)
              CALL check("h5pset_deflate_f", error, total_error) 
        CALL h5pclose_f(crtpr_id,error)
              CALL check("h5pclose_f", error, total_error)
     endif
        
!
! 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)
        CALL h5pset_shuffle_f(crtpr_id, tsize, error)
              CALL check("h5pset_shuffle_f", error, total_error) 
        CALL h5pclose_f(crtpr_id,error)
              CALL check("h5pclose_f", error, total_error)
     endif
        
!
! 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)
              CALL check("h5pset_fletcher32_f", error, total_error) 
        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

     RETURN
     END SUBROUTINE filters_test