diff options
Diffstat (limited to 'tools/h5dump/h5dumpgentest.c')
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 193 |
1 files changed, 111 insertions, 82 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index dcb491e..b42b675 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -93,7 +93,8 @@ #define FILE63 "textlinkfar.h5" #define FILE64 "tarray8.h5" #define FILE65 "tattrreg.h5" -#define FILE66 "tdset_idx.h5" +#define FILE66 "file_space.h5" +#define FILE67 "tdset_idx.h5" @@ -247,6 +248,10 @@ typedef struct s1_t { #define F64_ARRAY_BUF_LEN (4*1024) #define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1) +/* File 65 macros */ +#define STRATEGY H5F_FILE_SPACE_AGGR_VFD /* File space handling strategy */ +#define THRESHOLD10 10 /* Free space section threshold */ + /* Declarations for gent_dataset_idx() for "FILE66" */ #define DSET_FIXED "dset_fixed" #define DSET_FIXED_FILTER "dset_filter" @@ -390,85 +395,6 @@ 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) { @@ -3043,7 +2969,6 @@ static void gent_array8(void) hsize_t sdims[] = {F64_DIM0}; hsize_t tdims[] = {F64_DIM1}; int wdata[(F64_DIM1) * sizeof(int)]; /* Write buffer */ - int ndims; int i; /* @@ -6534,7 +6459,111 @@ gent_extlinks(void) H5Fclose(far_fid); } +/*------------------------------------------------------------------------- + * Function: gent_fs_strategy_threshold + * + * Purpose: Generate a file with non-default file space strategy and + * non-default free-space section threshold. + *------------------------------------------------------------------------- + */ +static void +gent_fs_strategy_threshold(void) +{ + hid_t fid; /* File id */ + hid_t fcpl; /* File creation property */ + + /* Create file-creation template */ + fcpl = H5Pcreate(H5P_FILE_CREATE); + + /* Set file space information */ + H5Pset_file_space(fcpl, STRATEGY, (hsize_t)THRESHOLD10); + + /* Create the file with the specified strategy and threshold */ + fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); + + /* close */ + H5Fclose(fid); + H5Pclose(fcpl); +} + +/* + * 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(FILE67, 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); +} /*------------------------------------------------------------------------- * Function: main @@ -6607,7 +6636,7 @@ int main(void) gent_attr_creation_order(); gent_fpformat(); gent_extlinks(); - + gent_fs_strategy_threshold(); gent_dataset_idx(); return 0; |