summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/testh5repack_make.c
diff options
context:
space:
mode:
authorRobert E. McGrath <mcgrath@ncsa.uiuc.edu>2005-02-23 17:52:03 (GMT)
committerRobert E. McGrath <mcgrath@ncsa.uiuc.edu>2005-02-23 17:52:03 (GMT)
commitfedd036348a6fa1f60bc1af3760ff34e2a47adaa (patch)
tree646943e0abeb7d66f44431cb07a9c2d6f6059e6b /tools/h5repack/testh5repack_make.c
parent0b83fea12571ae1f05e6465d4afc09948486e17f (diff)
downloadhdf5-fedd036348a6fa1f60bc1af3760ff34e2a47adaa.zip
hdf5-fedd036348a6fa1f60bc1af3760ff34e2a47adaa.tar.gz
hdf5-fedd036348a6fa1f60bc1af3760ff34e2a47adaa.tar.bz2
[svn-r10067] Purpose:
feature Description: h5repack support for scaleoffset compression Checking in early to help debug the filter. Solution: Added messages and command line to handle new scale offset filter. Note: TESTS ARE DISABLED FOR NOW. The filter is not complete, repack tests may fail due to know problems. PLEASE DO NOT MESS WITH THE SCALEOFFSET TESTS AT THIS TIME. They will be enabled when the filter is ready. Platforms tested: verbena,copper,shanti Misc. update: MANIFEST
Diffstat (limited to 'tools/h5repack/testh5repack_make.c')
-rw-r--r--tools/h5repack/testh5repack_make.c102
1 files changed, 102 insertions, 0 deletions
diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c
index 4245bec..9ae625d 100644
--- a/tools/h5repack/testh5repack_make.c
+++ b/tools/h5repack/testh5repack_make.c
@@ -34,6 +34,7 @@ int make_deflate(hid_t loc_id);
int make_shuffle(hid_t loc_id);
int make_fletcher32(hid_t loc_id);
int make_nbit(hid_t loc_id);
+int make_scaleoffset(hid_t loc_id);
int make_all(hid_t loc_id);
int make_fill(hid_t loc_id);
@@ -168,6 +169,15 @@ int make_testfiles(void)
goto out;
/*-------------------------------------------------------------------------
+ * create a file with the scaleoffset filter
+ *-------------------------------------------------------------------------
+ */
+ if((loc_id = H5Fcreate(FNAME13,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
+ return -1;
+ if (make_scaleoffset(loc_id)<0)
+ goto out;
+
+/*-------------------------------------------------------------------------
* create a file with the all filters
*-------------------------------------------------------------------------
*/
@@ -735,6 +745,98 @@ out:
/*-------------------------------------------------------------------------
+ * Function: make_scaleoffset
+ *
+ * Purpose: make a dataset with the scaleoffset filter
+ *
+ *-------------------------------------------------------------------------
+ */
+int make_scaleoffset(hid_t loc_id)
+{
+ hid_t dcpl; /* dataset creation property list */
+ hid_t sid; /* dataspace ID */
+ hid_t dtid;
+ hid_t dsid;
+ hsize_t dims[RANK]={DIM1,DIM2};
+ hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
+ int buf[DIM1][DIM2];
+ int i, j, n;
+
+ for (i=n=0; i<DIM1; i++){
+ for (j=0; j<DIM2; j++){
+ buf[i][j]=n++;
+ }
+ }
+ /* create a space */
+ if((sid = H5Screate_simple(RANK, dims, NULL))<0)
+ return -1;
+ /* create a dataset creation property list; the same DCPL is used for all dsets */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0)
+ goto out;
+ /* set up chunk */
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims)<0)
+ goto out;
+
+ dtid = H5Tcopy(H5T_NATIVE_INT);
+
+#if defined (H5_HAVE_FILTER_NBIT)
+ /* remove the filters from the dcpl */
+ if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0)
+ {
+ H5Tclose(dtid);
+ goto out;
+ }
+ if (H5Pset_scaleoffset(dcpl,31)<0)
+ {
+ H5Tclose(dtid);
+ goto out;
+ }
+ if((dsid = H5Dcreate (loc_id,"dset_scaleoffset",dtid,sid,dcpl))<0)
+ {
+ H5Tclose(dtid);
+ goto out;
+ }
+ if(H5Dwrite(dsid,dtid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
+ {
+ H5Tclose(dtid);
+ goto out;
+ }
+ H5Dclose(dsid);
+ if((dsid = H5Dcreate (loc_id,"dset_none",dtid,sid,H5P_DEFAULT))<0)
+ {
+ H5Tclose(dtid);
+ goto out;
+ }
+ if(H5Dwrite(dsid,dtid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
+ {
+ H5Tclose(dtid);
+ goto out;
+ }
+ H5Tclose(dtid);
+ H5Dclose(dsid);
+#endif
+
+/*-------------------------------------------------------------------------
+ * close space and dcpl
+ *-------------------------------------------------------------------------
+ */
+ if(H5Sclose(sid)<0)
+ goto out;
+ if(H5Pclose(dcpl)<0)
+ goto out;
+
+ return 0;
+
+out:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
* Function: make_all
*
* Purpose: make a file with all filters