diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-01-27 20:39:20 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-01-27 20:39:20 (GMT) |
commit | 61a451f89ea2015eac08e361e6ad244bd4af5f25 (patch) | |
tree | 0f2dccdca39001329f6004a149e8384fa4e4433f /fortran | |
parent | 6042adf10b2c00796c52dec2a1f97a4989c42cfd (diff) | |
download | hdf5-61a451f89ea2015eac08e361e6ad244bd4af5f25.zip hdf5-61a451f89ea2015eac08e361e6ad244bd4af5f25.tar.gz hdf5-61a451f89ea2015eac08e361e6ad244bd4af5f25.tar.bz2 |
[svn-r8117] Purpose:
Code cleanup
Description:
Add C++ and FORTRAN wrappers for new H5Pdelete_filter routine, along with
documentation and a note in the release notes.
Platforms tested:
FreeBSD 4.9 (sleipnir)
Linux 2.4 (verbena) w/ C++ and FORTRAN
Too minor for full h5committest
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/src/H5Pf.c | 33 | ||||
-rw-r--r-- | fortran/src/H5Pff.f90 | 54 | ||||
-rw-r--r-- | fortran/src/H5f90proto.h | 4 | ||||
-rw-r--r-- | fortran/test/tH5Z.f90 | 54 |
4 files changed, 145 insertions, 0 deletions
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 14c8b45..f9ad983 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -3237,3 +3237,36 @@ DONE: return ret_value; } +/*---------------------------------------------------------------------------- + * Name: h5pdelete_filter_c + * Purpose: Call H5Pdelete_filter to delete one or more filters + * Inputs: prp_id - property list identifier + * filter - Filter to be deleted + * Returns: 0 on success, -1 on failure + * Programmer: Quincey Koziol + * January 27 2004 + * Modifications: + *---------------------------------------------------------------------------*/ +int_f +nh5pdelete_filter_c (hid_t_f *prp_id, int_f* filter) +{ + int ret_value = -1; + hid_t c_prp_id; + herr_t ret; + H5Z_filter_t c_filter; + + c_filter = (H5Z_filter_t)*filter; + c_prp_id = (hid_t)*prp_id; + + /* + * Call H5Pdelety_filter function. + */ + ret = H5Pdelete_filter(c_prp_id, c_filter); + + if (ret < 0) goto DONE; + ret_value = 0; + +DONE: + return ret_value; +} + diff --git a/fortran/src/H5Pff.f90 b/fortran/src/H5Pff.f90 index 5715514..a49b602 100644 --- a/fortran/src/H5Pff.f90 +++ b/fortran/src/H5Pff.f90 @@ -6332,4 +6332,58 @@ hdferr = h5pmodify_filter_c(prp_id, filter, flags, cd_nelmts, cd_values ) END SUBROUTINE h5pmodify_filter_f +!---------------------------------------------------------------------- +! Name: h5pdelete_filter_f +! +! Purpose: Delete one or more filters from the filter pipeline. +! +! Inputs: +! prp_id - data creation or transfer property list +! identifier +! filter - filter to be deleted +! Outputs: +! hdferr: - error code +! Success: 0 +! Failure: -1 +! Optional parameters: +! NONE +! +! Programmer: Quincey Koziol +! January 27 2004 +! +! Modifications: +! +! Comment: +!---------------------------------------------------------------------- + + SUBROUTINE h5pdelete_filter_f(prp_id, filter, hdferr) +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5pdelete_filter_f +!DEC$endif +! + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier + INTEGER, INTENT(IN) :: filter !Filter to be modified + + INTEGER, INTENT(OUT) :: hdferr ! Error code + +! INTEGER, EXTERNAL :: h5pdelete_filter_c +! MS FORTRAN needs explicit interface for C functions called here. +! + INTERFACE + INTEGER FUNCTION h5pdelete_filter_c(prp_id, filter) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5PMODIFY_FILTER_C'::h5pdelete_filter_c + !DEC$ ENDIF + INTEGER(HID_T), INTENT(IN) :: prp_id + INTEGER, INTENT(IN) :: filter + END FUNCTION h5pdelete_filter_c + END INTERFACE + + hdferr = h5pdelete_filter_c(prp_id, filter) + END SUBROUTINE h5pdelete_filter_f + END MODULE H5P diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 5b7c180..e42b59a 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -770,6 +770,7 @@ H5_DLL int_f nh5tis_variable_str_c ( hid_t_f *type_id , int_f *flag ); # define nh5pset_layout_c FNAME(H5PSET_LAYOUT_C) # define nh5pget_layout_c FNAME(H5PGET_LAYOUT_C) # define nh5pset_filter_c FNAME(H5PSET_FILTER_C) +# define nh5pdelete_filter_c FNAME(H5PDELETE_FILTER_C) # define nh5pmodify_filter_c FNAME(H5PMODIFY_FILTER_C) # define nh5pget_nfilters_c FNAME(H5PGET_NFILTERS_C) # define nh5pget_filter_c FNAME(H5PGET_FILTER_C) @@ -876,6 +877,7 @@ H5_DLL int_f nh5tis_variable_str_c ( hid_t_f *type_id , int_f *flag ); # define nh5pset_layout_c FNAME(h5pset_layout_c) # define nh5pget_layout_c FNAME(h5pget_layout_c) # define nh5pset_filter_c FNAME(h5pset_filter_c) +# define nh5pdelete_filter_c FNAME(h5pdelete_filter_c) # define nh5pmodify_filter_c FNAME(h5pmodify_filter_c) # define nh5pget_nfilters_c FNAME(h5pget_nfilters_c) # define nh5pget_filter_c FNAME(h5pget_filter_c) @@ -1034,6 +1036,8 @@ nh5pget_layout_c (hid_t_f *prp_id, int_f* layout); H5_DLL int_f nh5pset_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values ); H5_DLL int_f +nh5pdelete_filter_c (hid_t_f *prp_id, int_f* filter); +H5_DLL int_f nh5pmodify_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values ); H5_DLL int_f nh5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters); diff --git a/fortran/test/tH5Z.f90 b/fortran/test/tH5Z.f90 index 7425f14..6d84139 100644 --- a/fortran/test/tH5Z.f90 +++ b/fortran/test/tH5Z.f90 @@ -23,6 +23,7 @@ INTEGER, INTENT(OUT) :: total_error LOGICAL :: status, status1 INTEGER(HID_T) :: crtpr_id, xfer_id + INTEGER :: nfilters INTEGER :: error INTEGER(HSIZE_T) :: ch_dims(2) INTEGER :: RANK = 2 @@ -92,6 +93,59 @@ endif +! +! Verify h5pdelete_filter_f +! + 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) + CALL check("h5pset_fletcher32_f", error, total_error) + CALL h5pset_shuffle_f(crtpr_id, error) + CALL check("h5pset_shuffle_f", error, total_error) + CALL h5pget_nfilters_f(crtpr_id, nfilters, error) + CALL check("h5pget_nfilters_f", error, total_error) + + ! 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 + CALL h5pdelete_filter_f(crtpr_id, H5Z_FILTER_SHUFFLE_F, error) + CALL check("h5pset_shuffle_f", error, total_error) + + ! Verify the correct number of filters now + CALL h5pget_nfilters_f(crtpr_id, nfilters, error) + CALL check("h5pget_nfilters_f", error, total_error) + if (nfilters .ne. 1) then + write(*,*) "number of filters is wrong" + total_error = total_error + 1 + endif + + ! Delete all filters + CALL h5pdelete_filter_f(crtpr_id, H5Z_FILTER_NONE_F, error) + CALL check("h5pdelete_filter_f", error, total_error) + + ! Verify the correct number of filters now + CALL h5pget_nfilters_f(crtpr_id, nfilters, error) + CALL check("h5pget_nfilters_f", error, total_error) + 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 + + RETURN END SUBROUTINE filters_test |