summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2019-01-02 20:28:40 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2019-01-02 20:28:40 (GMT)
commit2713fb12b12c7d9c9a418494ac8c8c2b4ce93b88 (patch)
tree0521ea7663998496259b38c68cabd5bd0af9f34e
parent600d44292bfbce3f6d6226260a654555278ef24b (diff)
parent74a3710a996fca5ed7fcb4dd8919a7a8521de1de (diff)
downloadhdf5-2713fb12b12c7d9c9a418494ac8c8c2b4ce93b88.zip
hdf5-2713fb12b12c7d9c9a418494ac8c8c2b4ce93b88.tar.gz
hdf5-2713fb12b12c7d9c9a418494ac8c8c2b4ce93b88.tar.bz2
Merge pull request #1380 in HDFFV/hdf5 from ~BMRIBLER/hdf5_1_10_bmr:hdf5_1_10 to hdf5_1_10
This is merged now so it can be tested. * commit '74a3710a996fca5ed7fcb4dd8919a7a8521de1de': Revised per review. Description: Changed H5EA_iterate and H5FA_iterate as suggested. Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1010test) Addressed HDFFV-10661 Description: - Fixed a bug triggered by tests in chunk_info.c. The returned value from a callback function was not checked in H5EA_iterate(), H5FA_iterate(), and H5D__none_idx_iterate(). This oversight caused a callback function to continue iterating even though it's supposed to stop. Vailin confirmed. - Addressed review comments and made various improvements on the tests. Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1010test)
-rw-r--r--src/H5D.c10
-rw-r--r--src/H5Dnone.c4
-rw-r--r--src/H5Dpkg.h2
-rw-r--r--src/H5Dpublic.h2
-rw-r--r--src/H5EA.c18
-rw-r--r--src/H5FA.c14
-rw-r--r--test/chunk_info.c1531
7 files changed, 1384 insertions, 197 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 5605395..c02959a 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1190,7 +1190,7 @@ done:
* Parameters:
* hid_t dset_id; IN: Chunked dataset ID
* hid_t fspace_id; IN: File dataspace ID
- * hsize_t index; IN: Index of written chunk
+ * hsize_t chk_idx; IN: Index of allocated/written chunk
* hsize_t *offset OUT: Offset coordinates of the chunk
* unsigned *filter_mask OUT: Filter mask
* haddr_t *addr OUT: Address of the chunk
@@ -1204,14 +1204,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t index, hsize_t *offset, unsigned *filter_mask, haddr_t *addr, hsize_t *size)
+H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_idx, hsize_t *offset, unsigned *filter_mask, haddr_t *addr, hsize_t *size)
{
H5D_t *dset = NULL;
const H5S_t *space; /* Dataspace for dataset */
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "iih*h*Iu*a*h", dset_id, fspace_id, index, offset, filter_mask,
+ H5TRACE7("e", "iih*h*Iu*a*h", dset_id, fspace_id, chk_idx, offset, filter_mask,
addr, size);
/* Check arguments */
@@ -1226,7 +1226,7 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t index, hsize_t *offset
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
/* Call private function to get the chunk info given the chunk's index */
- if(H5D__get_chunk_info(dset, space, index, offset, filter_mask, addr, size) < 0)
+ if(H5D__get_chunk_info(dset, space, chk_idx, offset, filter_mask, addr, size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info")
done:
@@ -1242,7 +1242,7 @@ done:
*
* Parameters:
* hid_t dset_id IN: Chunked dataset ID
- * hsize_t *offset IN: Coordinates of the chunk
+ * hsize_t *offset IN: Offset coordinates of the chunk
* unsigned *filter_mask OUT: Filter mask
* haddr_t *addr OUT: Address of the chunk
* hsize_t *size OUT: Size of the chunk
diff --git a/src/H5Dnone.c b/src/H5Dnone.c
index be421b6..09e781e 100644
--- a/src/H5Dnone.c
+++ b/src/H5Dnone.c
@@ -242,7 +242,7 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
unsigned u; /* Local index variable */
int curr_dim; /* Current rank */
hsize_t idx; /* Array index of chunk */
- int ret_value = -1; /* Return value */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -266,7 +266,7 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
HDassert(ndims > 0);
/* Iterate over all the chunks in the dataset's dataspace */
- for(u = 0; u < idx_info->layout->nchunks; u++) {
+ for(u = 0; u < idx_info->layout->nchunks && ret_value == H5_ITER_CONT; u++) {
/* Calculate the index of this chunk */
idx = H5VM_array_offset_pre(ndims, idx_info->layout->max_down_chunks, chunk_rec.scaled);
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 4409142..da74d11 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -565,7 +565,7 @@ H5_DLL herr_t H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size);
H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset,
hsize_t *storage_size);
H5_DLL herr_t H5D__get_num_chunks(const H5D_t *dset, const H5S_t *space, hsize_t *nchunks);
-H5_DLL herr_t H5D__get_chunk_info(const H5D_t *dset, const H5S_t *space, hsize_t index, hsize_t *coord, unsigned *filter_mask, haddr_t *offset, hsize_t *size);
+H5_DLL herr_t H5D__get_chunk_info(const H5D_t *dset, const H5S_t *space, hsize_t chk_idx, hsize_t *coord, unsigned *filter_mask, haddr_t *offset, hsize_t *size);
H5_DLL herr_t H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size);
H5_DLL haddr_t H5D__get_offset(const H5D_t *dset);
H5_DLL void *H5D__vlen_get_buf_size_alloc(size_t size, void *info);
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index fcc76ee..2dcbeae 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -143,7 +143,7 @@ H5_DLL hsize_t H5Dget_storage_size(hid_t dset_id);
H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes);
H5_DLL herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks);
H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size);
-H5_DLL herr_t H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t index, hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size);
+H5_DLL herr_t H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_idx, hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size);
H5_DLL haddr_t H5Dget_offset(hid_t dset_id);
H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, void *buf/*out*/);
diff --git a/src/H5EA.c b/src/H5EA.c
index 9ceb144..0b340a7 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -986,23 +986,27 @@ END_FUNC(PRIV) /* end H5EA_delete() */
* Purpose: Iterate over the elements of an extensible array
* (copied and modified from FA_iterate() in H5FA.c)
*
- * Return: SUCCEED/FAIL
+ * Return: H5_ITER_CONT/H5_ITER_ERROR
*
* Programmer: Vailin Choi; Feb 2015
*
+ * Modification:
+ * Prototype changed (HDFFV-10661)
+ * - herr_t to int
+ * - SUCCEED/FAIL to H5_ITER_CONT/H5_ITER_ERROR
+ * December 24, 2018 -BMR
*-------------------------------------------------------------------------
*/
BEGIN_FUNC(PRIV, ERR,
-herr_t, SUCCEED, FAIL,
+int, H5_ITER_CONT, H5_ITER_ERROR,
H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata))
/* Local variables */
uint8_t *elmt = NULL;
hsize_t u;
+ int cb_ret = H5_ITER_CONT; /* Return value from callback */
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(op);
HDassert(udata);
@@ -1012,9 +1016,7 @@ H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element")
/* Iterate over all elements in array */
- for(u = 0; u < ea->hdr->stats.stored.max_idx_set; u++) {
- int cb_ret; /* Return value from callback */
-
+ for(u = 0; u < ea->hdr->stats.stored.max_idx_set && cb_ret == H5_ITER_CONT; u++) {
/* Get array element */
if(H5EA_get(ea, u, elmt) < 0)
H5E_THROW(H5E_CANTGET, "unable to delete fixed array")
diff --git a/src/H5FA.c b/src/H5FA.c
index 61aaa53..e579e4f 100644
--- a/src/H5FA.c
+++ b/src/H5FA.c
@@ -685,20 +685,26 @@ END_FUNC(PRIV) /* end H5FA_delete() */
* Note: This is not very efficient, we should be iterating directly
* over the fixed array's direct block [pages].
*
- * Return: SUCCEED/FAIL
+ * Return: H5_ITER_CONT/H5_ITER_ERROR
*
* Programmer: Vailin Choi
* Thursday, April 30, 2009
*
+ * Modification:
+ * Prototype changed (HDFFV-10661)
+ * - herr_t to int
+ * - SUCCEED/FAIL to H5_ITER_CONT/H5_ITER_ERROR
+ * December 24, 2018 -BMR
*-------------------------------------------------------------------------
*/
BEGIN_FUNC(PRIV, ERR,
-herr_t, SUCCEED, FAIL,
+int, H5_ITER_CONT, H5_ITER_ERROR,
H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata))
/* Local variables */
uint8_t *elmt = NULL;
hsize_t u;
+ int cb_ret = H5_ITER_CONT; /* Return value from callback */
/*
* Check arguments.
@@ -712,9 +718,7 @@ H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array element")
/* Iterate over all elements in array */
- for(u = 0; u < fa->hdr->stats.nelmts; u++) {
- int cb_ret; /* Return value from callback */
-
+ for(u = 0; u < fa->hdr->stats.nelmts && cb_ret == H5_ITER_CONT; u++) {
/* Get array element */
if(H5FA_get(fa, u, elmt) < 0)
H5E_THROW(H5E_CANTGET, "unable to delete fixed array")
diff --git a/test/chunk_info.c b/test/chunk_info.c
index 9c84953..f5a6fdc 100644
--- a/test/chunk_info.c
+++ b/test/chunk_info.c
@@ -16,29 +16,63 @@
* April 7, 2008
*
* Purpose: Tests chunk query API functions
+ *
+ * Modification:
+ * Many tests were added for HDFFV-10615. -BMR, October 2018
+ *
+ * Test structure:
+ * main()
+ * test_get_chunk_info_highest18()
+ * test_get_chunk_info_110()
+ * test_chunk_info_single_chunk()
+ * test_chunk_info_implicit()
+ * test_chunk_info_fixed_array()
+ * test_chunk_info_extensible_array()
+ * test_chunk_info_version2_btrees()
+ *
*/
+#define H5D_FRIEND
+#define H5D_TESTING /* to use H5D__ functions */
+#include "H5Dpkg.h"
-#include "h5test.h"
+#include "testhdf5.h"
- /* #define PRINT_DATA
- */
-#define H5FILE_NAME "chunk_info.h5"
+/* Test file names */
+const char *FILENAME[] = {
+ "tchunk_info_18",
+ "tchunk_info_110",
+ "chunk_info",
+ NULL
+};
+
+/* From original test */
#define DATASETNAME "2d"
-#define RANK 2
-#define FILENAME_BUF_SIZE 1024
/* Parameters for testing chunk querying */
-#define FILENAME "tchunk_info"
+#define RANK 2
+#define FILENAME_BUF_SIZE 1024
#define DSET_SIMPLE_CHUNKED "Chunked Dataset"
#define DSET_EMPTY "Empty Dataset"
-#define NX 16
-#define NY 16
-#define CHUNK_NX 4
-#define CHUNK_NY 4
-#define CHUNK_SIZE 64
-#define NUM_CHUNKS_WRITTEN 4
-
-void reinit_vars(unsigned *read_filter_mask, haddr_t *addr, hsize_t *size);
+#define DSET_EMPTY_ALLOC "Empty Dataset with ALLOC_TIME_EARLY"
+#define DSET_SINGLE_CHUNK "Single Chunk Index Dataset"
+#define DSET_IMPLICIT_INDEX "Implicit Index Dataset"
+#define DSET_FIXED_ARR_INDEX "Fixed Array Index Dataset"
+#define DSET_EXT_ARR_INDEX "Extensible Array Index Dataset"
+#define DSET_V2_BTREE_INDEX "Version 2 B-Tree Index Dataset"
+#define NX 24
+#define NY 16
+#define CHUNK_NX 6
+#define CHUNK_NY 4
+#define SINGLE_CHUNK_SIZE (NX*NY*sizeof(int))
+#define CHUNK_SIZE 96
+#define NUM_CHUNKS 16
+#define NUM_CHUNKS_WRITTEN 4
+
+/* Artifact of original file, maybe removed */
+/* #define PRINT_DATA */
+
+/* Utility function to initialize arguments */
+void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size);
/*-------------------------------------------------------------------------
* Function: read_each_chunk (helper function)
@@ -54,21 +88,23 @@ void reinit_vars(unsigned *read_filter_mask, haddr_t *addr, hsize_t *size);
*
*-------------------------------------------------------------------------
*/
+//EIP - May be this function should take a pointer to an array of chunk dimensions
+//EIP and its size, so it is not restricted to 2 dims only?
static herr_t read_each_chunk(hid_t dset_id, hsize_t offset1, hsize_t offset2, void *direct_buf)
{
int read_buf[CHUNK_NX][CHUNK_NY];
hsize_t offset[2] = {offset1, offset2};
- unsigned read_filter_mask = 0;
+ unsigned read_flt_msk = 0;
+ herr_t ret; /* Return value */
- /* Read the raw chunk back */
HDmemset(&read_buf, 0, sizeof(read_buf));
/* Read the chunk specified by its offset */
- if (H5Dread_chunk(dset_id, H5P_DEFAULT, offset, &read_filter_mask, read_buf) < 0)
- return(FAIL);
+ ret = H5Dread_chunk(dset_id, H5P_DEFAULT, offset, &read_flt_msk, read_buf);
+ if(ret < 0) return(FAIL);
/* Verify that read chunk is the same as the corresponding written one */
- if (HDmemcmp(direct_buf, read_buf, CHUNK_NX*CHUNK_NY) != 0)
+ if(HDmemcmp(direct_buf, read_buf, CHUNK_NX*CHUNK_NY) != 0)
{
HDfprintf(stderr, "Read chunk differs from written chunk at offset (%d,%d)\n", offset1, offset2);
return(FAIL);
@@ -89,18 +125,18 @@ static herr_t read_each_chunk(hid_t dset_id, hsize_t offset1, hsize_t offset2, v
*
*-------------------------------------------------------------------------
*/
-void reinit_vars(unsigned *read_filter_mask, haddr_t *addr, hsize_t *size)
+void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size)
{
- if (read_filter_mask)
- *read_filter_mask = 0;
- if (addr)
+ if(read_flt_msk)
+ *read_flt_msk = 0;
+ if(addr)
*addr = 0;
- if (size)
+ if(size)
*size = 0;
}
/*-------------------------------------------------------------------------
- * Function: test_get_chunk_info
+ * Function: test_get_chunk_info_highest18
*
* Purpose: Test getting various chunk information
*
@@ -112,226 +148,1277 @@ void reinit_vars(unsigned *read_filter_mask, haddr_t *addr, hsize_t *size)
* will be implemented in the next version.
*
* Description:
- * This function tests the new API functions added for HDFFV-10615:
- * H5Dget_num_chunks, H5Dget_chunk_info, and H5Dget_chunk_info_by_coord.
+ * This function tests the new API functions added for EED-343:
+ * H5Dget_num_chunks, H5Dget_chunk_info, and
+ * H5Dget_chunk_info_by_coord for high bound up to 1.8.
*
* Date: September 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
-test_get_chunk_info(void)
+test_get_chunk_info_highest18(hid_t fapl)
{
- hid_t chunkfile = -1, fapl = -1;
- hid_t fspace = -1, dset = -1;
- hid_t mspace = -1;
- hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
- int fillvalue = -1;
- char filename[FILENAME_BUF_SIZE];
- unsigned filter_mask = 0;
- int direct_buf[16][CHUNK_NX][CHUNK_NY];
- int out_buf[NX][NY];
- size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
- int aggression = 9; /* Compression aggression setting */
- unsigned read_filter_mask = 0; /* filter mask after direct read */
- H5F_libver_t low, high; /* File format bounds */
- hsize_t offset[2];
- hsize_t out_offset[2] = {0, 0};
- hsize_t size = 0;
- hsize_t nchunks = 0;
- haddr_t addr = 0;
- hsize_t index = 0;
- hsize_t i, j;
- int n; /* for use on buffer, to avoid conversion warning */
+ char filename[FILENAME_BUF_SIZE];
+ hid_t chunkfile = -1; /* File ID */
+ hid_t dspace = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t cparms = -1; /* Creation plist */
+ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */
+ int out_buf[NX][NY]; /* Buffer to read data in */
+ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */
+ unsigned filter_mask = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ int fillvalue = -1; /* Fill value */
+ int aggression = 9; /* Compression aggression setting */
+ H5F_libver_t low, high; /* File format bounds */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t index = 0; /* Index of a chunk */
+ int n; /* Used on buffer, to avoid conversion warning */
+ hsize_t i, j;
+ herr_t ret;
+
+ TESTING("getting chunk information in file with version prior to 1.10");
+
+ /* Create the file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ /* Set high bound to V18 to test chunked dataset that use B-tree v1
+ structures to index chunks */
+ high = H5F_LIBVER_V18;
+
+ /* Low bound can be anything below 1.10, which was when the new chunk storage
+ was introduced */
+ low = H5F_LIBVER_EARLIEST;
+
+ /* Set version bounds for creating the file */
+ if(H5Pset_libver_bounds(fapl, low, high) < 0)
+ TEST_ERROR
+
+ chunkfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ if(chunkfile < 0)
+ TEST_ERROR
+
+ /* Create the file and memory dataspaces */
+ if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ TEST_ERROR
+
+ /* Set dset creation properties with chunking, compression, and fillvalue */
+ if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0) TEST_ERROR
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+ if(H5Pset_deflate(cparms, (unsigned)aggression) < 0) TEST_ERROR
+#endif /* end H5_HAVE_FILTER_DEFLATE */
+
+ /* Set fill value */
+ if(H5Pset_fill_value(cparms, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR
+
+ /* Create a new dataset using cparms creation properties */
+ dset = H5Dcreate2(chunkfile, DSET_SIMPLE_CHUNKED, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+
+ /* Indicate skipping the compression filter */
+ filter_mask = 0x00000001;
+
+ /* Initialize the array of chunk data for all NUM_CHUNKS chunks */
+ for(n = 0; n < NUM_CHUNKS; n++)
+ for(i = 0; i < CHUNK_NX; i++)
+ for(j = 0; j < CHUNK_NY; j++)
+ direct_buf[n][i][j] = n + 1;
+
+ /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords:
+ (0,2) (0,3) (1,2) (1,3) */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ {
+ offset[0] = i * CHUNK_NX;
+ offset[1] = j * CHUNK_NY;
+ ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]);
+ if(ret < 0) TEST_ERROR
+ }
+
+ if(H5Fflush(dset, H5F_SCOPE_LOCAL) < 0)
+ goto error;
+
+ /* Close the dataset then... */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* ...open it again to test the chunk query functions */
+ if((dset = H5Dopen2(chunkfile, DSET_SIMPLE_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Get and verify the number of chunks written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR
+
+ /* Read the entire dataset back */
+ ret = H5Dread(dset, H5T_NATIVE_INT, dspace, dspace, H5P_DEFAULT, out_buf);
+ if(ret < 0) TEST_ERROR
+
+ /* Get and verify info of the first chunk */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the second chunk */
+ index = 1;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 12) TEST_ERROR
+
+ /* Get and verify info of the third chunk */
+ index = 2;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the last chunk */
+ index = 3;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 12) TEST_ERROR
+
+ /* Attempt to get info of empty chunk and verify the returned address and size */
+ index = 5;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (0,2) */
+ offset[0] = 0;
+ offset[1] = 2 * CHUNK_NY;
+ ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (1,3) */
+ offset[0] = 1 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Attempt to get info of empty chunks, verify the returned addr and size */
+ offset[0] = 0;
+ offset[1] = 0;
+ ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
- TESTING("getting chunk information");
+ offset[0] = 3 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Read each chunk and verify the values */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ if(read_each_chunk(dset, i*CHUNK_NX, j*CHUNK_NY, (void*)direct_buf[n]) < 0)
+ TEST_ERROR
+
+ /* Close the first dataset */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* Create an empty dataset and close it */
+ dset = H5Dcreate2(chunkfile, DSET_EMPTY, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* Reopen the empty dataset to verify the chunk query functions on it */
+ if((dset = H5Dopen2(chunkfile, DSET_EMPTY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Verify that the number of chunks is 0 */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != 0) TEST_ERROR
- /* Create a file */
- h5_fixname(FILENAME, H5P_DEFAULT, filename, sizeof filename);
- if((chunkfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ /* Attempt to get info of a chunk from an empty dataset, verify the
+ returned address and size */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Attempt to get info of a chunk given its coords from an empty dataset,
+ verify the returned address and size */
+ offset[0] = 0;
+ offset[1] = 0;
+ ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /************************************************************************
+ * Test empty dataset with H5P_ALLOC_TIME_EARLY *
+ ************************************************************************/
+
+ /* Set space allocation to early so that chunk query functions will
+ retrieve chunk information even though the dataset is empty */
+ if(H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0)
TEST_ERROR
- /* Create the data space */
- if((fspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ /* Create an empty dataset and close it */
+ dset = H5Dcreate2(chunkfile, DSET_EMPTY_ALLOC, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* Reopen the empty dataset to verify the chunk query functions on it */
+ if((dset = H5Dopen2(chunkfile, DSET_EMPTY_ALLOC, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Verify that the number of chunks is NUM_CHUNKS */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != NUM_CHUNKS) TEST_ERROR
+
+ /* Attempt to get info of a chunk from an empty dataset, verify the
+ returned address and size */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+
+ /* Because of H5P_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */
+ if(addr == HADDR_UNDEF) TEST_ERROR
+ if(size == 0) TEST_ERROR
+
+ index = 10;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+
+ /* Because of H5P_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */
+ if(addr == HADDR_UNDEF) TEST_ERROR
+ if(size == 0) TEST_ERROR
+
+ /* Attempt to get info of a chunk given its coords from an empty dataset,
+ verify the returned address and size */
+ offset[0] = 0;
+ offset[1] = 0;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
TEST_ERROR
+ /* Because of H5P_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */
+ if(addr == HADDR_UNDEF) TEST_ERROR
+ if(size == 0) TEST_ERROR
+
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* Close/release resources. */
+ if(H5Sclose(dspace) < 0) TEST_ERROR
+ if(H5Pclose(cparms) < 0) TEST_ERROR
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
- if((mspace = H5Screate_simple(RANK, chunk_dims, NULL)) < 0)
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(dspace);
+ H5Pclose(cparms);
+ H5Fclose(chunkfile);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+ return FAIL;
+} /* test_get_chunk_info_highest18() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_chunk_info_single_chunk
+ *
+ * Purpose: Test getting various chunk information when Single Chunk
+ * index type is used
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Note: Note that the dataspace argument in these new functions are
+ * currently not used. The functionality involved the dataspace
+ * will be implemented in the next version.
+ *
+ * Date: November 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_chunk_info_single_chunk(char *filename, hid_t fapl)
+{
+ hid_t chunkfile = -1; /* File ID */
+ hid_t dspace = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t cparms = -1; /* Creation plist */
+ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
+ hsize_t chunk_dims[2] = {NX, NY}; /* Chunk dimensions */
+ int in_buf[NX][NY]; /* Input buffer */
+ unsigned filter_mask = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t index = 0; /* Index of a chunk */
+ int i, j;
+
+ TESTING(" Single Chunk index");
+
+ /* Open the file for reading/writing */
+ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create dataspace */
+ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
TEST_ERROR
- /* Modify dataset creation properties, i.e. enable chunking and compression */
+ /* Enable chunking */
if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
TEST_ERROR
- if(H5Pset_deflate(cparms, (unsigned ) aggression) < 0)
+ /* Create a new dataset using cparms creation properties */
+ dset = H5Dcreate2(chunkfile, DSET_SINGLE_CHUNK, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+
+ /* Ensure we're using the correct chunk indexing scheme */
+ if(H5D__layout_idx_type_test(dset, &idx_type) < 0)
+ TEST_ERROR
+ if(idx_type != H5D_CHUNK_IDX_SINGLE)
+ FAIL_PUTS_ERROR("should be using Single Chunk index type");
+
+ /* Close the dataset then... */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* ...open it again to test the chunk query functions on a single empty
+ chunk */
+ if((dset = H5Dopen2(chunkfile, DSET_SINGLE_CHUNK, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Get the number of chunks and verify that no chunk has been written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != 0) TEST_ERROR
+
+ /* Initialize the array of chunk data for the single chunk */
+ for(i = 0; i < NX; i++)
+ for(j = 0; j < NY; j++)
+ in_buf[i][j] = (i*j);
+
+ /* Write the chunk */
+ if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, in_buf) < 0)
+ TEST_ERROR
+
+ /* Get and verify that one chunk had been written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != 1) TEST_ERROR
+
+ /* Get and verify info of the first and only chunk */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != SINGLE_CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 0) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (0,0) */
+ offset[0] = 0;
+ offset[1] = 0;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if (read_flt_msk != filter_mask) TEST_ERROR
+ if (size != SINGLE_CHUNK_SIZE) TEST_ERROR
+
+ /* Release resourse */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+ if(H5Sclose(dspace) < 0) TEST_ERROR
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(dspace);
+ H5Pclose(cparms);
+ H5Fclose(chunkfile);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+ return FAIL;
+} /* test_chunk_info_single_chunk() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_chunk_info_implicit
+ *
+ * Purpose: Test getting various chunk information when Implicit
+ * index type is used
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Note: Note that the dataspace argument in these new functions are
+ * currently not used. The functionality involved the dataspace
+ * will be implemented in the next version.
+ *
+ * Date: November 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_chunk_info_implicit(char *filename, hid_t fapl)
+{
+ hid_t chunkfile = -1; /* File ID */
+ hid_t dspace = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t cparms = -1; /* Creation plist */
+ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */
+ int out_buf[NX][NY]; /* Buffer to read data in */
+ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */
+ unsigned filter_mask = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t index = 0; /* Index of a chunk */
+ int n; /* Used on buffer, to avoid conversion warning */
+ hsize_t i, j;
+ herr_t ret;
+
+ TESTING(" Implicit index");
+
+ /* Open the file for reading/writing */
+ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create dataspace */
+ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Enable chunking */
+ if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
TEST_ERROR
- if (H5Pset_fill_value(cparms, H5T_NATIVE_INT, &fillvalue) < 0)
- TEST_ERROR;
+ if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ TEST_ERROR
+
+ if(H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
/* Create a new dataset using cparms creation properties */
- if((dset = H5Dcreate2(chunkfile, DSET_SIMPLE_CHUNKED, H5T_NATIVE_INT, fspace,
- H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) TEST_ERROR
+ dset = H5Dcreate2(chunkfile, DSET_IMPLICIT_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
- if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ /* Ensure we're using the correct chunk indexing scheme */
+ if(H5D__layout_idx_type_test(dset, &idx_type) < 0)
TEST_ERROR
+ if(idx_type != H5D_CHUNK_IDX_NONE) /* Implicit: No Index */
+ FAIL_PUTS_ERROR("should be using Implicit index type");
- /* Indicate skipping the compression filter. */
- filter_mask = 0x00000001;
+ /* Close the dataset then... */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* ...open it again to test the chunk query functions */
+ if((dset = H5Dopen2(chunkfile, DSET_IMPLICIT_INDEX, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Get and verify the number of chunks */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
- /* Initialize the array of chunk data, that is for all 16 chunks */
- for(n = 0; n < 16; n++)
+ /* All chunks because of H5D_ALLOC_TIME_EARLY */
+ if(nchunks != NUM_CHUNKS) TEST_ERROR
+
+ /* Initialize the array of chunk data for all NUM_CHUNKS chunks */
+ for(n = 0; n < NUM_CHUNKS; n++)
for(i = 0; i < CHUNK_NX; i++)
for(j = 0; j < CHUNK_NY; j++)
direct_buf[n][i][j] = n + 1;
- /* Write NUM_CHUNKS_WRITTEN chunks: (0,2) (0,3) (1,2) (1,3) */
+ /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords:
+ (0,2) (0,3) (1,2) (1,3) */
n = 0;
for (i = 0; i < 2; i++)
for (j = 2; j < 4; j++, n++)
{
offset[0] = i * CHUNK_NX;
offset[1] = j * CHUNK_NY;
- if (H5Dwrite_chunk(dset, dxpl, filter_mask, offset, buf_size, (void*)direct_buf[n]) < 0)
- TEST_ERROR
+ ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]);
+ if(ret < 0) TEST_ERROR
}
+ /* Get and verify the number of chunks written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+
+ /* Should still be all chunks, because of H5D_ALLOC_TIME_EARLY */
+ if(nchunks != NUM_CHUNKS) TEST_ERROR
+
+ /* Read the entire dataset back */
+ if(H5Dread(dset, H5T_NATIVE_INT, dspace, dspace, H5P_DEFAULT, out_buf) < 0)
+ TEST_ERROR
+
+ /* Get and verify info of the first chunk */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 0) TEST_ERROR
+
+ /* Get and verify info of the second chunk */
+ index = 1;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 4) TEST_ERROR
+
+ /* Get and verify info of the third chunk */
+ index = 2;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the last chunk */
+ index = 3;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 12) TEST_ERROR
+
+ /* Attempt to get info of empty chunk and verify the returned address and size */
+ index = 5;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(addr == HADDR_UNDEF) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 4) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (0,2) */
+ offset[0] = 0;
+ offset[1] = 2 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (1,3) */
+ offset[0] = 1 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+
+ /* Attempt to get info of empty chunks, verify the returned address and size */
+ offset[0] = 0;
+ offset[1] = 0;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ /* Because of H5P_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF */
+ if(addr == HADDR_UNDEF) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ offset[0] = 3 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ /* Because of H5P_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF */
+ if(addr == HADDR_UNDEF) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Read each chunk and verify the values */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ if(read_each_chunk(dset, i*CHUNK_NX, j*CHUNK_NY, (void*)direct_buf[n]) < 0)
+ TEST_ERROR
+
+ /* Release resourse */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+ if(H5Sclose(dspace) < 0) TEST_ERROR
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(dspace);
+ H5Pclose(cparms);
+ H5Fclose(chunkfile);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+ return FAIL;
+} /* test_chunk_info_implicit() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_chunk_info_fixed_array
+ *
+ * Purpose: Test getting various chunk information when Fixed Array
+ * index type is used
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Note: Note that the dataspace argument in these new functions are
+ * currently not used. The functionality involved the dataspace
+ * will be implemented in the next version.
+ *
+ * Date: November 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_chunk_info_fixed_array(char *filename, hid_t fapl)
+{
+ hid_t chunkfile = -1; /* File ID */
+ hid_t dspace = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t cparms = -1; /* Creation plist */
+ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */
+ int out_buf[NX][NY]; /* Buffer to read data in */
+ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */
+ unsigned filter_mask = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t index = 0; /* Index of a chunk */
+ int n; /* Used on buffer, to avoid conversion warning */
+ hsize_t i, j;
+ herr_t ret;
+
+ TESTING(" Fixed Array index");
+
+ /* Open the file for reading/writing */
+ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create dataspace */
+ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Enable chunking */
+ if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+
+ if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ TEST_ERROR
+
+ /* Create a new dataset using cparms creation properties */
+ dset = H5Dcreate2(chunkfile, DSET_FIXED_ARR_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+
+ /* Ensure we're using the correct chunk indexing scheme */
+ if(H5D__layout_idx_type_test(dset, &idx_type) < 0)
+ TEST_ERROR
+ if(idx_type != H5D_CHUNK_IDX_FARRAY)
+ FAIL_PUTS_ERROR("should be using Fixed Array index type");
+
/* Close the dataset then... */
if(H5Dclose(dset) < 0) TEST_ERROR
/* ...open it again to test the chunk query functions */
- if((dset = H5Dopen2(chunkfile, DSET_SIMPLE_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset = H5Dopen2(chunkfile, DSET_FIXED_ARR_INDEX, H5P_DEFAULT)) < 0)
+ TEST_ERROR
- /* Get and verify the number of chunks written */
- if (H5Dget_num_chunks(dset, mspace, &nchunks) < 0) TEST_ERROR;
- if (nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR;
+ /* Get the number of chunks and verify that no chunk has been written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != 0) TEST_ERROR
+
+ /* Initialize the array of chunk data for all NUM_CHUNKS chunks */
+ for(n = 0; n < NUM_CHUNKS; n++)
+ for(i = 0; i < CHUNK_NX; i++)
+ for(j = 0; j < CHUNK_NY; j++)
+ direct_buf[n][i][j] = n + 1;
+
+ /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords:
+ (0,2) (0,3) (1,2) (1,3) */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ {
+ offset[0] = i * CHUNK_NX;
+ offset[1] = j * CHUNK_NY;
+ ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]);
+ if(ret < 0) TEST_ERROR
+ }
/* Read the entire dataset back */
- if(H5Dread(dset, H5T_NATIVE_INT, fspace, fspace, H5P_DEFAULT, out_buf) < 0)
+ if(H5Dread(dset, H5T_NATIVE_INT, dspace, dspace, H5P_DEFAULT, out_buf) < 0)
+ TEST_ERROR
+
+ /* Get and verify the number of chunks written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR
+
+ /* Get and verify info of the first chunk */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the second chunk */
+ index = 1;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 12) TEST_ERROR
+
+ /* Get and verify info of the third chunk */
+ index = 2;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the last chunk */
+ index = 3;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 12) TEST_ERROR
+
+ /* Attempt to get info of empty chunk and verify the returned address and size */
+ index = 5;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (0,2) */
+ offset[0] = 0;
+ offset[1] = 2 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (1,3) */
+ offset[0] = 1 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Attempt to get info of empty chunks, verify the returned address and size */
+ offset[0] = 0;
+ offset[1] = 0;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ offset[0] = 3 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Read each chunk and verify the values */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ if(read_each_chunk(dset, i*CHUNK_NX, j*CHUNK_NY, (void*)direct_buf[n]) < 0)
+ TEST_ERROR
+
+ /* Release resourse */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+ if(H5Sclose(dspace) < 0) TEST_ERROR
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(dspace);
+ H5Pclose(cparms);
+ H5Fclose(chunkfile);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+ return FAIL;
+} /* test_chunk_info_fixed_array() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_chunk_info_extensible_array
+ *
+ * Purpose: Test getting various chunk information when Extensible Array
+ * index type is used
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Note: Note that the dataspace argument in these new functions are
+ * currently not used. The functionality involved the dataspace
+ * will be implemented in the next version.
+ *
+ * Date: November 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_chunk_info_extensible_array(char *filename, hid_t fapl)
+{
+ hid_t chunkfile = -1; /* File ID */
+ hid_t dspace = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t cparms = -1; /* Creation plist */
+ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, NY}; /* One unlimited dimension */
+ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */
+ int out_buf[NX][NY]; /* Buffer to read data in */
+ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */
+ unsigned filter_mask = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t index = 0; /* Index of a chunk */
+ int n; /* Used on buffer, to avoid conversion warning */
+ hsize_t i, j;
+ herr_t ret;
+
+ TESTING(" Extensible Array index");
+
+ /* Open the file for reading/writing */
+ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create dataspace */
+ if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ TEST_ERROR
+
+ /* Enable chunking */
+ if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+
+ if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ TEST_ERROR
+
+ /* Create a new dataset using cparms creation properties */
+ dset = H5Dcreate2(chunkfile, DSET_EXT_ARR_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+
+ /* Ensure we're using the correct chunk indexing scheme */
+ if(H5D__layout_idx_type_test(dset, &idx_type) < 0)
TEST_ERROR
+ if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ FAIL_PUTS_ERROR("should be using Extensible Array index type");
+
+ /* Close the dataset then... */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* ...open it again to test the chunk query functions */
+ if((dset = H5Dopen2(chunkfile, DSET_EXT_ARR_INDEX, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Get the number of chunks and verify that no chunk has been written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != 0) TEST_ERROR
+
+ /* Initialize the array of chunk data for all NUM_CHUNKS chunks */
+ for(n = 0; n < NUM_CHUNKS; n++)
+ for(i = 0; i < CHUNK_NX; i++)
+ for(j = 0; j < CHUNK_NY; j++)
+ direct_buf[n][i][j] = n + 1;
+
+ /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords:
+ (0,2) (0,3) (1,2) (1,3) */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ {
+ offset[0] = i * CHUNK_NX;
+ offset[1] = j * CHUNK_NY;
+ ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]);
+ if(ret < 0) TEST_ERROR
+ }
+
+ /* Get and verify the number of chunks written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR
/* Get and verify info of the first chunk */
index = 0;
- reinit_vars(&read_filter_mask, &addr, &size);
- if (H5Dget_chunk_info(dset, fspace, index, out_offset, &read_filter_mask, &addr, &size) < 0)
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
TEST_ERROR
- if (read_filter_mask != filter_mask) TEST_ERROR;
- if (size != CHUNK_SIZE) TEST_ERROR;
- if (out_offset[0] != 0 || out_offset[1] != 8) TEST_ERROR;
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 8) TEST_ERROR
/* Get and verify info of the second chunk */
index = 1;
- reinit_vars(&read_filter_mask, &addr, &size);
- if (H5Dget_chunk_info(dset, fspace, index, out_offset, &read_filter_mask, &addr, &size) < 0)
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
TEST_ERROR
- if (read_filter_mask != filter_mask) TEST_ERROR;
- if (size != CHUNK_SIZE) TEST_ERROR;
- if (out_offset[0] != 0 || out_offset[1] != 12) TEST_ERROR;
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 12) TEST_ERROR
/* Get and verify info of the third chunk */
index = 2;
- reinit_vars(&read_filter_mask, &addr, &size);
- if (H5Dget_chunk_info(dset, fspace, index, out_offset, &read_filter_mask, &addr, &size) < 0)
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
TEST_ERROR
- if (read_filter_mask != filter_mask) TEST_ERROR;
- if (size != CHUNK_SIZE) TEST_ERROR;
- if (out_offset[0] != 4 || out_offset[1] != 8) TEST_ERROR;
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 8) TEST_ERROR
/* Get and verify info of the last chunk */
index = 3;
- reinit_vars(&read_filter_mask, &addr, &size);
- if (H5Dget_chunk_info(dset, fspace, index, out_offset, &read_filter_mask, &addr, &size) < 0)
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
TEST_ERROR
- if (read_filter_mask != filter_mask) TEST_ERROR;
- if (size != CHUNK_SIZE) TEST_ERROR;
- if (out_offset[0] != 4 || out_offset[1] != 12) TEST_ERROR;
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 12) TEST_ERROR
/* Attempt to get info of empty chunk and verify the returned address and size */
index = 5;
- reinit_vars(&read_filter_mask, &addr, &size);
- if (H5Dget_chunk_info(dset, fspace, index, out_offset, &read_filter_mask, &addr, &size) < 0)
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
TEST_ERROR
- if (addr != HADDR_UNDEF) TEST_ERROR;
- if (size != 0) TEST_ERROR;
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
/* Get info of the chunk at logical coordinates (0,2) */
offset[0] = 0;
offset[1] = 2 * CHUNK_NY;
- if (H5Dget_chunk_info_by_coord(dset, offset, &read_filter_mask, &addr, &size) < 0) TEST_ERROR;
- if (read_filter_mask != filter_mask) TEST_ERROR;
- if (size != CHUNK_SIZE) TEST_ERROR;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
/* Get info of the chunk at logical coordinates (1,3) */
offset[0] = 1 * CHUNK_NX;
offset[1] = 3 * CHUNK_NY;
- if (H5Dget_chunk_info_by_coord(dset, offset, &read_filter_mask, &addr, &size) < 0) TEST_ERROR;
- if (read_filter_mask != filter_mask) TEST_ERROR;
- if (size != CHUNK_SIZE) TEST_ERROR;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
/* Attempt to get info of empty chunks, verify the returned address and size */
offset[0] = 0;
offset[1] = 0;
- if (H5Dget_chunk_info_by_coord(dset, offset, &read_filter_mask, &addr, &size) < 0) TEST_ERROR;
- if (addr != HADDR_UNDEF) TEST_ERROR;
- if (size != 0) TEST_ERROR;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
offset[0] = 3 * CHUNK_NX;
offset[1] = 3 * CHUNK_NY;
- if (H5Dget_chunk_info_by_coord(dset, offset, &read_filter_mask, &addr, &size) < 0) TEST_ERROR;
- if (addr != HADDR_UNDEF) TEST_ERROR;
- if (size != 0) TEST_ERROR;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
/* Read each chunk and verify the values */
n = 0;
for (i = 0; i < 2; i++)
for (j = 2; j < 4; j++, n++)
- if (read_each_chunk(dset, i*CHUNK_NX, j*CHUNK_NY, (void*)direct_buf[n]) < 0)
+ if(read_each_chunk(dset, i*CHUNK_NX, j*CHUNK_NY, (void*)direct_buf[n]) < 0)
TEST_ERROR
- /* Close the first dataset */
- if (H5Dclose(dset) < 0) TEST_ERROR
+ /* Release resourse */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+ if(H5Sclose(dspace) < 0) TEST_ERROR
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
- /* Create an empty dataset */
- if((dset = H5Dcreate2(chunkfile, DSET_EMPTY, H5T_NATIVE_INT, fspace,
- H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Dclose(dset) < 0) TEST_ERROR
+ PASSED();
+ return SUCCEED;
- /* Reopen the empty dataset to verify the chunk query functions on it */
- if((dset = H5Dopen2(chunkfile, DSET_EMPTY, H5P_DEFAULT)) < 0) TEST_ERROR
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(dspace);
+ H5Pclose(cparms);
+ H5Fclose(chunkfile);
+ } H5E_END_TRY;
- /* Verify that the number of chunks is 0 */
- if (H5Dget_num_chunks(dset, mspace, &nchunks) < 0) TEST_ERROR;
- if (nchunks != 0) TEST_ERROR;
+ H5_FAILED();
+ return FAIL;
+} /* test_chunk_info_extensible_array() */
- /* Attempt to get info of a chunk from an empty dataset, verify the
- returned address and size */
+/*-------------------------------------------------------------------------
+ * Function: test_chunk_info_version2_btrees
+ *
+ * Purpose: Test getting various chunk information when Version 2 B-trees
+ * index type is used
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Note: Note that the dataspace argument in these new functions are
+ * currently not used. The functionality involved the dataspace
+ * will be implemented in the next version.
+ *
+ * Date: November 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_chunk_info_version2_btrees(char *filename, hid_t fapl)
+{
+ hid_t chunkfile = -1; /* File ID */
+ hid_t dspace = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t cparms = -1; /* Creation plist */
+ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Two unlimited dims */
+ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */
+ int out_buf[NX][NY]; /* Buffer to read data in */
+ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */
+ unsigned filter_mask = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t index = 0; /* Index of a chunk */
+ int n; /* Used on buffer, to avoid conversion warning */
+ hsize_t i, j;
+ herr_t ret;
+
+ TESTING(" Version 2 B-trees index");
+
+ /* Open the file for reading/writing */
+ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create dataspace */
+ if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ TEST_ERROR
+
+ /* Enable chunking */
+ if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+
+ if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ TEST_ERROR
+
+ /* Create a new dataset using cparms creation properties */
+ dset = H5Dcreate2(chunkfile, DSET_V2_BTREE_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+
+ /* Ensure we're using the correct chunk indexing scheme */
+ if(H5D__layout_idx_type_test(dset, &idx_type) < 0)
+ TEST_ERROR
+ if(idx_type != H5D_CHUNK_IDX_BT2)
+ FAIL_PUTS_ERROR("should be using Version 2 B-tree index type");
+
+ /* Close the dataset then... */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* ...open it again to test the chunk query functions */
+ if((dset = H5Dopen2(chunkfile, DSET_V2_BTREE_INDEX, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Get the number of chunks and verify that no chunk has been written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != 0) TEST_ERROR
+
+ /* Initialize the array of chunk data for all NUM_CHUNKS chunks */
+ for(n = 0; n < NUM_CHUNKS; n++)
+ for(i = 0; i < CHUNK_NX; i++)
+ for(j = 0; j < CHUNK_NY; j++)
+ direct_buf[n][i][j] = n + 1;
+
+ /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords:
+ (0,2) (0,3) (1,2) (1,3) */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ {
+ offset[0] = i * CHUNK_NX;
+ offset[1] = j * CHUNK_NY;
+ ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]);
+ if(ret < 0) TEST_ERROR
+ }
+
+ /* Get and verify the number of chunks written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR
+
+ /* Get and verify info of the first chunk */
index = 0;
- reinit_vars(&read_filter_mask, &addr, &size);
- if (H5Dget_chunk_info(dset, fspace, index, out_offset, &read_filter_mask, &addr, &size) < 0)
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
TEST_ERROR
- if (addr != HADDR_UNDEF) TEST_ERROR;
- if (size != 0) TEST_ERROR;
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 8) TEST_ERROR
- /* Attempt to get info of a chunk given its coords from an empty dataset,
- verify the returned address and size */
+ /* Get and verify info of the second chunk */
+ index = 1;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 12) TEST_ERROR
+
+ /* Get and verify info of the third chunk */
+ index = 2;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the last chunk */
+ index = 3;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 12) TEST_ERROR
+
+ /* Attempt to get info of empty chunk and verify the returned address and size */
+ index = 5;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (0,2) */
+ offset[0] = 0;
+ offset[1] = 2 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (1,3) */
+ offset[0] = 1 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Attempt to get info of empty chunks, verify the returned address and size */
offset[0] = 0;
offset[1] = 0;
- if (H5Dget_chunk_info_by_coord(dset, offset, &read_filter_mask, &addr, &size) < 0) TEST_ERROR;
- if (addr != HADDR_UNDEF) TEST_ERROR;
- if (size != 0) TEST_ERROR;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
- /* Close/release resources. */
- if (H5Sclose(mspace) < 0) TEST_ERROR
- if (H5Sclose(fspace) < 0) TEST_ERROR
- if (H5Pclose(cparms) < 0) TEST_ERROR
- if (H5Pclose(dxpl) < 0) TEST_ERROR
- if (H5Fclose(chunkfile) < 0) TEST_ERROR
+ offset[0] = 3 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Read each chunk and verify the values */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ if(read_each_chunk(dset, i*CHUNK_NX, j*CHUNK_NY, (void*)direct_buf[n]) < 0)
+ TEST_ERROR
+
+ /* Release resourse */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+ if(H5Sclose(dspace) < 0) TEST_ERROR
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
PASSED();
return SUCCEED;
@@ -339,16 +1426,92 @@ test_get_chunk_info(void)
error:
H5E_BEGIN_TRY {
H5Dclose(dset);
- H5Sclose(mspace);
- H5Sclose(fspace);
+ H5Sclose(dspace);
H5Pclose(cparms);
- H5Pclose(dxpl);
H5Fclose(chunkfile);
} H5E_END_TRY;
H5_FAILED();
return FAIL;
-} /* test_get_chunk_info() */
+} /* test_chunk_info_version2_btrees() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_get_chunk_info_110
+ *
+ * Purpose: Test getting various chunk information in version 1.10.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Note: Note that the dataspace argument in these new functions are
+ * currently not used. The functionality involved the dataspace
+ * will be implemented in the next version.
+ *
+ * Description:
+ * This function tests the new API functions added for EED-343:
+ * H5Dget_num_chunks, H5Dget_chunk_info, and H5Dget_chunk_info_by_coord
+ * for high bound beyond 1.8.
+ *
+ * Date: October 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_get_chunk_info_110(hid_t fapl)
+{
+ hid_t chunkfile = -1; /* File ID */
+ char filename[FILENAME_BUF_SIZE];
+ H5F_libver_t low, high; /* File format bounds */
+
+ TESTING("getting chunk information in file with versions 1.10");
+ HDprintf("\n"); /* to list sub-tests */
+
+ /* Create the file */
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+ chunkfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if(chunkfile < 0) TEST_ERROR
+
+ /* Close the file, individual tests will re-open the file with different
+ libvers via the fapl */
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
+
+ /* Set high bound to the current latest version */
+ high = H5F_LIBVER_LATEST;
+
+ /* Test getting info of chunked datasets in version combo up to 1.10 */
+ for (low = H5F_LIBVER_V110; low <= H5F_LIBVER_LATEST; low++) {
+ /* Set version bounds for creating file */
+ if(H5Pset_libver_bounds(fapl, low, high) < 0)
+ TEST_ERROR
+
+ /* Test getting chunk info when Single Chunk index type is used */
+ if(test_chunk_info_single_chunk(filename, fapl) < 0)
+ TEST_ERROR
+
+ /* Test getting chunk info when Implicit index type is used */
+ if(test_chunk_info_implicit(filename, fapl) < 0)
+ TEST_ERROR
+
+ /* Test getting chunk info when Fixed Array index type is used */
+ if(test_chunk_info_fixed_array(filename, fapl) < 0)
+ TEST_ERROR
+
+ /* Test getting chunk info when Extensible Array index type is used */
+ if(test_chunk_info_extensible_array(filename, fapl) < 0)
+ TEST_ERROR
+
+ /* Test getting chunk info when Version 2 B-trees index type is used */
+ if(test_chunk_info_version2_btrees(filename, fapl) < 0)
+ TEST_ERROR
+ } /* for low libver bound */
+
+ return SUCCEED;
+
+error:
+ H5_FAILED();
+ return FAIL;
+} /* test_get_chunk_info_110() */
/*-------------------------------------------------------------------------
* Function: create_4x4_dset
@@ -375,8 +1538,8 @@ error:
*
*-------------------------------------------------------------------------
*/
-int
-create_4x4_dset(void)
+static int
+create_4x4_dset(hid_t fapl)
{
hid_t fid; /* file ID */
hid_t did; /* dataset ID */
@@ -389,19 +1552,21 @@ create_4x4_dset(void)
int chunk_data[2][2] = { {1, 1}, {1, 1} };
int buf[4][4];
int fillvalue = 0;
+ char filename[FILENAME_BUF_SIZE];
hsize_t i, j;
/* create a new file using default properties. */
- if ((fid = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* create the file space */
- if ((f_sid = H5Screate_simple(RANK, dims, dims)) < 0) TEST_ERROR;
+ if((f_sid = H5Screate_simple(RANK, dims, dims)) < 0) TEST_ERROR
/* create the memory space with chunk dimensions */
- if ((m_sid = H5Screate_simple(RANK, chunk_dims, chunk_dims)) < 0) TEST_ERROR;
+ if((m_sid = H5Screate_simple(RANK, chunk_dims, chunk_dims)) < 0) TEST_ERROR
start[0] = 0;
start[1] = 0;
- if (H5Sselect_hyperslab(m_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR;
+ if(H5Sselect_hyperslab(m_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR
/*-------------------------------------------------------------------------
* create a dataset
@@ -409,13 +1574,13 @@ create_4x4_dset(void)
*/
/* modify dataset creation properties, i.e. enable chunking. */
- if ((pid = H5Pcreate (H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if (H5Pset_chunk(pid, RANK, chunk_dims) < 0) TEST_ERROR;
- if (H5Pset_fill_value(pid, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR;
+ if((pid = H5Pcreate (H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, RANK, chunk_dims) < 0) TEST_ERROR
+ if(H5Pset_fill_value(pid, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR
/* create a new dataset */
- if((did = H5Dcreate2(fid , DATASETNAME, H5T_NATIVE_INT, f_sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR;
-
+ did = H5Dcreate2(fid , DATASETNAME, H5T_NATIVE_INT, f_sid, H5P_DEFAULT, pid, H5P_DEFAULT);
+ if(did < 0) TEST_ERROR
/*-------------------------------------------------------------------------
* write the dataset in 2x2 chunks
@@ -430,13 +1595,13 @@ create_4x4_dset(void)
/* iterate in dim 1 */
for (i = 0; i < chunk_dims[1]; i++) {
/* select file hyperslab to save a 2x2 chunk */
- if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR;
+ if(H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR
/* write the data to the hyperslab. */
- if (H5Dwrite(did, H5T_NATIVE_INT, m_sid, f_sid, H5P_DEFAULT, chunk_data) < 0) TEST_ERROR;
+ if(H5Dwrite(did, H5T_NATIVE_INT, m_sid, f_sid, H5P_DEFAULT, chunk_data) < 0) TEST_ERROR
/* read back and display complete dataset 4x4 */
- if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
#if defined (PRINT_DATA)
printf("\n");
@@ -457,11 +1622,11 @@ create_4x4_dset(void)
* close
*-------------------------------------------------------------------------
*/
- if (H5Dclose(did) < 0) TEST_ERROR
- if (H5Sclose(f_sid) < 0) TEST_ERROR
- if (H5Sclose(m_sid) < 0) TEST_ERROR
- if (H5Pclose(pid) < 0) TEST_ERROR
- if (H5Fclose(fid) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+ if(H5Sclose(f_sid) < 0) TEST_ERROR
+ if(H5Sclose(m_sid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
return SUCCEED;
@@ -491,22 +1656,31 @@ error:
int
main(void)
{
- int nerrors = 0;
+ hid_t fapl = -1; /* File access property list */
+ int nerrors = 0; /* Number of errors so far */
+
+ h5_reset();
+
+ /* Create a copy of file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR
- /* Tests getting chunk information */
- nerrors += (test_get_chunk_info() < 0 ? 1 : 0);
+ /* Tests getting chunk information of version 1.8 and prior */
+ nerrors += test_get_chunk_info_highest18(fapl) < 0 ? 1 : 0;
+
+ /* Tests getting chunk information of version 1.10 */
+ nerrors += test_get_chunk_info_110(fapl) < 0 ? 1 : 0;
/* Create a 4x4 dataset (using the existing code to avoid compilation
warnings for now) */
- nerrors += (create_4x4_dset() < 0 ? 1 : 0);
+ nerrors += create_4x4_dset(fapl) < 0 ? 1 : 0;
- if(nerrors) {
+ if(nerrors)
goto error;
- } /* end if */
-
HDprintf("All chunk query tests passed.\n");
+ h5_cleanup(FILENAME, fapl);
+
return SUCCEED;
error:
@@ -516,5 +1690,12 @@ error:
return FAIL;
}
+/****************************************************************************
+ Additional tests to be added:
+- create/write to a dataset, do the query before closing the dataset
+- do the query when extending the dataset (shrink or expand)
+- verify that invalid input parameters are handled properly
+- do the query on a non-chunked dataset...
+- test for filter or non-filter
-
+****************************************************************************/