summaryrefslogtreecommitdiffstats
path: root/src/H5Dchunk.c
diff options
context:
space:
mode:
authorMark Kittisopikul <mkitti@users.noreply.github.com>2022-08-07 04:57:41 (GMT)
committerGitHub <noreply@github.com>2022-08-07 04:57:41 (GMT)
commit7127d8912c8fa601d59b4e8ce522eaf149c02344 (patch)
treeb83c86f9c7af27893d30469d117eeeed8b7756ee /src/H5Dchunk.c
parent043f66afd22c329104813b61a789af862e5349ac (diff)
downloadhdf5-7127d8912c8fa601d59b4e8ce522eaf149c02344.zip
hdf5-7127d8912c8fa601d59b4e8ce522eaf149c02344.tar.gz
hdf5-7127d8912c8fa601d59b4e8ce522eaf149c02344.tar.bz2
H5Dchunk_iter now passes offsets in units of dataset elements, fix #1419 (#1969)
* H5Dchunk_iter now passes chunk dimension scaled offsets, fix #1419 * Update docs for H5Dchunk_iter, H5Dget_chunk_info* Modified description for `H5Dchunk_iter`, `H5Dget_chunk_info`, and `H5Dget_chunk_info_by_coord` to the following * offset Logical position of the chunk’s first element in units of dataset elements * filter_mask Bitmask indicating the filters used when the chunk was written * size Chunk size in bytes, 0 if the chunk does not exist
Diffstat (limited to 'src/H5Dchunk.c')
-rw-r--r--src/H5Dchunk.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 4f628a7..925bf58 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -254,6 +254,7 @@ typedef struct H5D_chunk_coll_fill_info_t {
typedef struct H5D_chunk_iter_ud_t {
H5D_chunk_iter_op_t op; /* User defined callback */
void *op_data; /* User data for user defined callback */
+ H5O_layout_chunk_t *chunk; /* Chunk layout */
} H5D_chunk_iter_ud_t;
/********************/
@@ -8066,13 +8067,20 @@ static int
H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata)
{
const H5D_chunk_iter_ud_t *data = (H5D_chunk_iter_ud_t *)udata;
+ const H5O_layout_chunk_t *chunk = data->chunk;
int ret_value = H5_ITER_CONT;
+ hsize_t offset[H5O_LAYOUT_NDIMS];
+ unsigned ii; /* Match H5O_layout_chunk_t.ndims */
+
+ /* Similar to H5D__get_chunk_info */
+ for (ii = 0; ii < chunk->ndims; ii++)
+ offset[ii] = chunk_rec->scaled[ii] * chunk->dim[ii];
FUNC_ENTER_PACKAGE_NOERR
/* Check for callback failure and pass along return value */
- if ((ret_value = (data->op)(chunk_rec->scaled, chunk_rec->filter_mask, chunk_rec->chunk_addr,
- chunk_rec->nbytes, data->op_data)) < 0)
+ if ((ret_value = (data->op)(offset, chunk_rec->filter_mask, chunk_rec->chunk_addr, chunk_rec->nbytes,
+ data->op_data)) < 0)
HERROR(H5E_DATASET, H5E_CANTNEXT, "iteration operator failed");
FUNC_LEAVE_NOAPI(ret_value)
@@ -8132,6 +8140,7 @@ H5D__chunk_iter(H5D_t *dset, H5D_chunk_iter_op_t op, void *op_data)
/* Set up info for iteration callback */
ud.op = op;
ud.op_data = op_data;
+ ud.chunk = &dset->shared->layout.u.chunk;
/* Iterate over the allocated chunks calling the iterator callback */
if ((ret_value = (layout->storage.u.chunk.ops->iterate)(&idx_info, H5D__chunk_iter_cb, &ud)) < 0)