summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2004-07-01 17:38:04 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2004-07-01 17:38:04 (GMT)
commiteab58732d86e9219fa9f41f9ab2e30fae94e4a7d (patch)
tree333b5f2c50c267c14611e042724a7f28d5156ab7 /fortran
parent3f500747fa0f4379e8e03b82f6d679628d55a8c3 (diff)
downloadhdf5-eab58732d86e9219fa9f41f9ab2e30fae94e4a7d.zip
hdf5-eab58732d86e9219fa9f41f9ab2e30fae94e4a7d.tar.gz
hdf5-eab58732d86e9219fa9f41f9ab2e30fae94e4a7d.tar.bz2
[svn-r8781]
Purpose: HDF5 now supports SZIP with no encoder. Description: SZIP can be configured to have both encoder and decoder or just to have the decoder. HDF5 can now query the configuration of any filter, and will throw errors if users try to write using a filter with encoding disabled. Solution: Added H5Zget_filter_info function, changed API for H5Pget_filter and H5P_get_filter_by_id. See SZIP RFC. Platforms tested: Copper (fortran, C++, parallel), Sleipnir (C++), Arabica (fortran, C++), Verbena (fortran, C++) Misc. update:
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/H5Pf.c4
-rw-r--r--fortran/src/H5Zf.c26
-rw-r--r--fortran/src/H5Zff.f9062
-rw-r--r--fortran/src/H5_f.c3
-rw-r--r--fortran/src/H5f90global.f9010
-rw-r--r--fortran/src/H5f90proto.h2
-rw-r--r--fortran/test/tH5Z.f9024
7 files changed, 123 insertions, 8 deletions
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c
index fb175b4..0ae0a19 100644
--- a/fortran/src/H5Pf.c
+++ b/fortran/src/H5Pf.c
@@ -1516,7 +1516,7 @@ nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f*
*/
c_prp_id = (hid_t)*prp_id;
c_filter_number = (int)*filter_number;
- c_filter = H5Pget_filter(c_prp_id, c_filter_number, &c_flags, &c_cd_nelmts, c_cd_values, c_namelen, c_name);
+ c_filter = H5Pget_filter(c_prp_id, c_filter_number, &c_flags, &c_cd_nelmts, c_cd_values, c_namelen, c_name, NULL);
if (c_filter < 0) goto DONE;
@@ -3171,7 +3171,7 @@ nh5pget_filter_by_id_c(hid_t_f *prp_id, int_f* filter_id, int_f* flags, size_t_f
*/
c_prp_id = (hid_t)*prp_id;
c_filter_id = (H5Z_filter_t)*filter_id;
- status = H5Pget_filter_by_id(c_prp_id, c_filter_id, &c_flags, &c_cd_nelmts, c_cd_values, c_namelen, c_name);
+ status = H5Pget_filter_by_id(c_prp_id, c_filter_id, &c_flags, &c_cd_nelmts, c_cd_values, c_namelen, c_name, NULL);
if (status < 0) goto DONE;
*cd_nelmts = (size_t_f)c_cd_nelmts;
diff --git a/fortran/src/H5Zf.c b/fortran/src/H5Zf.c
index 70e0dee..8c2b6b6 100644
--- a/fortran/src/H5Zf.c
+++ b/fortran/src/H5Zf.c
@@ -67,3 +67,29 @@ nh5zfilter_avail_c ( int_f *filter , int_f *flag )
if ( status < 0 ) ret_value = -1;
return ret_value;
}
+
+/*----------------------------------------------------------------------------
+ * Name: h5zget_filter_info_c
+ * Purpose: Call H5Zget_filter_info to find if filter has its encoder
+ * and/or its decoder available
+ * Inputs: filter - filter identifier
+ * Outputs: flag - status flag
+ * Returns: 0 on success, -1 on failure
+ * Programmer: Nat Furrer and James Laird
+ * Wednesday, June 16, 2004
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+
+int_f
+nh5zget_filter_info_c ( int_f *filter , int_f *flag )
+{
+ int ret_value = 0;
+ H5Z_filter_t c_filter;
+ unsigned int c_flag;
+
+ c_filter = (H5Z_filter_t)*filter;
+ ret_value = H5Zget_filter_info(c_filter, &c_flag);
+ *flag = (int_f)c_flag;
+
+ return ret_value;
+}
diff --git a/fortran/src/H5Zff.f90 b/fortran/src/H5Zff.f90
index 839ab6f..a7f0494 100644
--- a/fortran/src/H5Zff.f90
+++ b/fortran/src/H5Zff.f90
@@ -130,6 +130,68 @@
END SUBROUTINE h5zfilter_avail_f
+!----------------------------------------------------------------------
+! Name: h5zfilter_avail_f
+!
+! Purpose: Queries if filter has its encoder and/or decoder
+! available
+!
+! Inputs:
+! filter - filter
+! Outputs:
+! config_flags - Bit vector possibly containing the
+! following values:
+! H5Z_FILTER_ENCODE_ENABLED_F
+! H5Z_FILTER_DECODE_ENABLED_F
+! hdferr: - error code
+! Success: 0
+! Failure: -1
+! Optional parameters:
+! NONE
+!
+! Programmer: Nat Furrer and James Laird
+! June 16, 2004
+!
+! Modifications:
+!
+!----------------------------------------------------------------------
+ SUBROUTINE h5zget_filter_info_f(filter, config_flags, hdferr)
+!
+!This definition is needed for Windows DLLs
+!DEC$if defined(BUILD_HDF5_DLL)
+!DEC$attributes dllexport :: h5zget_filter_info_f
+!DEC$endif
+!
+
+ IMPLICIT NONE
+ INTEGER, INTENT(IN) :: filter ! Filter; may be one of the following:
+ ! H5Z_FILTER_DEFLATE_F
+ ! H5Z_FILTER_SHUFFLE_F
+ ! H5Z_FILTER_FLETCHER32_F
+ ! H5Z_FILTER_SZIP_F
+ INTEGER, INTENT(OUT) :: config_flags! Flag, indicates if filter
+ ! has its encoder and/or decoder
+ ! available
+ INTEGER, INTENT(OUT) :: hdferr ! Error code
+
+! INTEGER, EXTERNAL :: h5zget_filter_info_c
+! MS FORTRAN needs explicit interface for C functions called here.
+!
+ INTERFACE
+ INTEGER FUNCTION h5zget_filter_info_c(filter, config_flags)
+ USE H5GLOBAL
+ !DEC$ IF DEFINED(HDF5F90_WINDOWS)
+ !MS$ATTRIBUTES C,reference,alias:'_H5ZGET_FILTER_INFO_C'::h5zget_filter_info_c
+ !DEC$ ENDIF
+ INTEGER, INTENT(IN) :: filter
+ INTEGER, INTENT(OUT) :: config_flags
+ END FUNCTION h5zget_filter_info_c
+ END INTERFACE
+
+ hdferr = h5zget_filter_info_c(filter, config_flags)
+
+ END SUBROUTINE h5zget_filter_info_f
+
END MODULE H5Z
diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c
index 9813a4f..d740d29 100644
--- a/fortran/src/H5_f.c
+++ b/fortran/src/H5_f.c
@@ -369,6 +369,9 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags,
h5z_flags[8] = H5Z_NO_EDC;
h5z_flags[9] = H5Z_FILTER_SZIP;
h5z_flags[10] = H5Z_FLAG_OPTIONAL;
+ h5z_flags[11] = H5Z_FILTER_CONFIG_ENCODE_ENABLED;
+ h5z_flags[12] = H5Z_FILTER_CONFIG_DECODE_ENABLED;
+
ret_value = 0;
return ret_value;
diff --git a/fortran/src/H5f90global.f90 b/fortran/src/H5f90global.f90
index 0a43523..7eb5732 100644
--- a/fortran/src/H5f90global.f90
+++ b/fortran/src/H5f90global.f90
@@ -514,7 +514,7 @@
!
! H5Z flags declaration
!
- INTEGER, PARAMETER :: H5Z_FLAGS_LEN = 11
+ INTEGER, PARAMETER :: H5Z_FLAGS_LEN = 13
INTEGER H5Z_flags(H5Z_FLAGS_LEN)
!DEC$if defined(BUILD_HDF5_DLL)
!DEC$ ATTRIBUTES DLLEXPORT :: /H5Z_FLAGS/
@@ -523,7 +523,7 @@
INTEGER :: H5Z_FILTER_ERROR_F
INTEGER :: H5Z_FILTER_NONE_F
- INTEGER :: H5Z_FILTER_ALL_F
+ INTEGER :: H5Z_FILTER_ALL_F
INTEGER :: H5Z_FILTER_DEFLATE_F
INTEGER :: H5Z_FILTER_SHUFFLE_F
INTEGER :: H5Z_FILTER_FLETCHER32_F
@@ -533,10 +533,12 @@
INTEGER :: H5Z_ENABLE_EDC_F
INTEGER :: H5Z_NO_EDC_F
INTEGER :: H5Z_FLAG_OPTIONAL_F
+ INTEGER :: H5Z_FILTER_ENCODE_ENABLED_F
+ INTEGER :: H5Z_FILTER_DECODE_ENABLED_F
EQUIVALENCE(H5Z_flags(1), H5Z_FILTER_ERROR_F)
EQUIVALENCE(H5Z_flags(2), H5Z_FILTER_NONE_F)
- EQUIVALENCE(H5Z_flags(2), H5Z_FILTER_ALL_F)
+ EQUIVALENCE(H5Z_flags(2), H5Z_FILTER_ALL_F)
EQUIVALENCE(H5Z_flags(3), H5Z_FILTER_DEFLATE_F)
EQUIVALENCE(H5Z_flags(4), H5Z_FILTER_SHUFFLE_F)
EQUIVALENCE(H5Z_flags(5), H5Z_FILTER_FLETCHER32_F)
@@ -546,6 +548,8 @@
EQUIVALENCE(H5Z_flags(9), H5Z_NO_EDC_F)
EQUIVALENCE(H5Z_flags(10), H5Z_FILTER_SZIP_F)
EQUIVALENCE(H5Z_flags(11), H5Z_FLAG_OPTIONAL_F)
+ EQUIVALENCE(H5Z_flags(12), H5Z_FILTER_ENCODE_ENABLED_F)
+ EQUIVALENCE(H5Z_flags(13), H5Z_FILTER_DECODE_ENABLED_F)
!
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index 439bac6..d5bc6b9 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -1250,9 +1250,11 @@ H5_FCDLL int_f nh5dont_atexit_c(void);
#ifdef DF_CAPFNAMES
# define nh5zunregister_c FNAME(H5ZUNREGISTER_C)
# define nh5zfilter_avail_c FNAME(H5ZFILTER_AVAIL_C)
+# define nh5zget_filter_info_c FNAME(H5ZGET_FILTER_INFO_C)
#else
# define nh5zunregister_c FNAME(h5zunregister_c)
# define nh5zfilter_avail_c FNAME(h5zfilter_avail_c)
+# define nh5zget_filter_info_c FNAME(h5zget_filter_info_c)
#endif
#endif
H5_FCDLL int_f nh5zunregister_c (int_f *filter);
diff --git a/fortran/test/tH5Z.f90 b/fortran/test/tH5Z.f90
index f6291a2..cb50909 100644
--- a/fortran/test/tH5Z.f90
+++ b/fortran/test/tH5Z.f90
@@ -181,17 +181,37 @@
INTEGER :: num_errors = 0 ! Number of data errors
INTEGER :: i, j !general purpose integers
+ INTEGER :: config_flags ! for h5zget_filter_info_f
INTEGER(HSIZE_T), DIMENSION(2) :: data_dims
INTEGER(HID_T) :: crp_list
INTEGER :: options_mask, pix_per_block
LOGICAL :: flag
CHARACTER(LEN=4) filter_name
-
+
INTEGER :: filter_flag = -1
INTEGER(SIZE_T) :: cd_nelemnts = 4
INTEGER(SIZE_T) :: filter_name_len = 4
INTEGER, DIMENSION(4) :: cd_values
+ !
+ ! Verify that SZIP exists and has an encoder
+ !
+ CALL h5zfilter_avail_f(H5Z_FILTER_SZIP_F, flag, error)
+ CALL check("h5zfilter_avail_f", error, total_error)
+ if(.NOT. flag) then
+ szip_flag = .FALSE.
+ total_error = -1
+ return
+ endif
+
+ CALL h5zget_filter_info_f(H5Z_FILTER_SZIP_F, config_flags, error)
+ CALL check("h5zget_filter_info_f", error, total_error)
+ if(.NOT. (IAND(config_flags, H5Z_FILTER_ENCODE_ENABLED_F) .eq. 1) ) then
+ szip_flag = .FALSE.
+ total_error = -1
+ return
+ endif
+
options_mask = H5_SZIP_NN_OM_F + H5_SZIP_CHIP_OM_F
pix_per_block = 32
!
@@ -235,8 +255,6 @@
CALL h5pclose_f(crp_list, error)
CALL h5sclose_f(dspace_id, error)
CALL h5fclose_f(file_id, error)
- szip_flag = .FALSE.
- total_error = -1
return
endif