HDFGroup / hdf5

Official HDF5® Library Repository
https://www.hdfgroup.org/
Other
588 stars 243 forks source link

[Feature Request] expose `ndims` in `H5Dchunk_iter` callback #2437

Open ZhaoMJ opened 1 year ago

ZhaoMJ commented 1 year ago

Is your feature request related to a problem? Please describe. It's hard to work with the offset array in H5Dchunk_iter callback because we don't know the size of the array. It would be too expensive to call H5Sget_simple_extent_ndims each time.

Describe the solution you'd like I propose that we should pass ndims to the callback. I.e.

typedef int (*H5D_chunk_iter_op_t)(const hsize_t *offset, unsigned ndims, unsigned filter_mask, haddr_t addr, hsize_t size, void *op_data);

Describe alternatives you've considered Call H5Sget_simple_extent_ndims in the callback.

Additional context I'm working on implementing Java binding for H5Dchunk_iter. I don't see there's an easy workaround. I can upload my patch if needed.

mkitti commented 1 year ago

Why not query the number of dimensions once and embed this in the op_data structure? That is a user defined structure meant for exactly this purpose.