diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-09-24 22:14:50 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-09-24 22:14:50 (GMT) |
commit | 426a3c1204fdcd1a999a966958a2edecc99b2d3b (patch) | |
tree | a786821d8e38f98f8977c30bf91c14b6d3267fd9 /tools/h5dump | |
parent | a2a61197aa18fcafef35ecc4aaef268b2e4731d5 (diff) | |
download | hdf5-426a3c1204fdcd1a999a966958a2edecc99b2d3b.zip hdf5-426a3c1204fdcd1a999a966958a2edecc99b2d3b.tar.gz hdf5-426a3c1204fdcd1a999a966958a2edecc99b2d3b.tar.bz2 |
[svn-r17522] Description:
Bring in the rest of Vailin's changes for testing fixed array chunk
indices, across the range of range of all the tools and the appropriate dataset
tests.
Tested on:
Mac OS X/32 10.5.8 (amazon) w/debug & production
(h5committest not required for this branch)
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 92 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 4 |
2 files changed, 94 insertions, 2 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index b8ed41d..dcb491e 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -93,6 +93,7 @@ #define FILE63 "textlinkfar.h5" #define FILE64 "tarray8.h5" #define FILE65 "tattrreg.h5" +#define FILE66 "tdset_idx.h5" @@ -104,6 +105,8 @@ /* utility functions */ static int +make_dset(hid_t loc_id, const char *name, hid_t sid, hid_t tid, hid_t dcpl, void *buf); +static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, hid_t tid, void *buf); static int @@ -244,6 +247,16 @@ typedef struct s1_t { #define F64_ARRAY_BUF_LEN (4*1024) #define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1) +/* Declarations for gent_dataset_idx() for "FILE66" */ +#define DSET_FIXED "dset_fixed" +#define DSET_FIXED_FILTER "dset_filter" +#define DSET_BTREE "dset_btree" +#define DIM200 200 +#define DIM100 100 +#define DIM20 20 +#define DIM10 10 +#define CHUNK 5 + static void gent_group(void) { @@ -377,6 +390,84 @@ gent_dataset2(void) H5Fclose(fid); } +/* + * Create a file with new format. + * Create one dataset with (set_chunk, fixed dimension) + * so that Fixed Array indexing will be used. + * Create one dataset with (set_chunk, fixed dimension, filter) + * so that Fixed Array indexing will be used. + * Create one dataset with (set_chunk, non-fixed dimension) + * so that B-tree indexing will be used. + */ +static void +gent_dataset_idx(void) +{ + hid_t fid, space, dcpl, fapl; + hsize_t dims[2]; + hsize_t maxdims[2]; + int buf[20][10]; + int i, j, ret; + + /* Get a copy of the file aaccess property */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + + /* Set the "use the latest version of the format" bounds for creating objects in the file */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + assert(ret >= 0); + + fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + dcpl = H5Pcreate(H5P_DATASET_CREATE); + + dims[0] = CHUNK; + dims[1] = CHUNK; + + /* set chunk */ + ret = H5Pset_chunk(dcpl, RANK, dims); + assert(ret >= 0); + + /* dataset with fixed dimensions */ + dims[0] = DIM20; + dims[1] = DIM10; + space = H5Screate_simple(RANK, dims, NULL); + + for(i = 0; i < DIM20; i++) + for(j = 0; j < DIM10; j++) + buf[i][j] = j; + + ret = make_dset(fid, DSET_FIXED, space, H5T_NATIVE_INT, dcpl, buf); + assert(ret >= 0); + H5Sclose(space); + + /* dataset with non-fixed dimensions */ + maxdims[0] = DIM200; + maxdims[1] = DIM100; + space = H5Screate_simple(RANK, dims, maxdims); + + ret = make_dset(fid, DSET_BTREE, space, H5T_NATIVE_INT, dcpl, buf); + assert(ret >= 0); + H5Sclose(space); + +#if defined (H5_HAVE_FILTER_DEFLATE) + + /* dataset with fixed dimensions and filters */ + /* remove the filters from the dcpl */ + ret = H5Premove_filter(dcpl, H5Z_FILTER_ALL); + assert(ret >= 0); + + /* set deflate data */ + ret = H5Pset_deflate(dcpl, 9); + assert(ret >= 0); + + space = H5Screate_simple(RANK, dims, NULL); + ret = make_dset(fid, DSET_FIXED_FILTER, space, H5T_NATIVE_INT, dcpl, buf); + assert(ret >= 0); + + H5Sclose(space); +#endif + + H5Pclose(dcpl); + H5Fclose(fid); +} static void gent_attribute(void) @@ -6517,6 +6608,7 @@ int main(void) gent_fpformat(); gent_extlinks(); + gent_dataset_idx(); return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 3ffff50..6d2f273 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -515,8 +515,8 @@ TOOLTEST tfpformat.ddl -m %.7f tfpformat.h5 TOOLTEST textlinksrc.ddl textlinksrc.h5 TOOLTEST textlinkfar.ddl textlinkfar.h5 - - +# tests for Fixed Array chunk indices +TOOLTEST tdset_idx.ddl -p -H tdset_idx.h5 if test $nerrors -eq 0 ; then echo "All $DUMPER tests passed." |