conduit icon indicating copy to clipboard operation
conduit copied to clipboard

DataType::element_index vs DataType::element_offset?

Open cyrush opened this issue 2 years ago • 0 comments

https://github.com/LLNL/conduit/blob/09818d87230b8158b0796d387ea27f901ab6f5fb/src/libs/conduit/conduit_data_type.hpp#L401

Comment from use in the wild:

    // element_index is extremely misleading. Its actually the byte offset to / the element. 

The implementation is:

offset + stride  * idx

Should we deprecate and add the following replacement method:

// offset (including striding calculation) to element at given index in bytes
index_t element_offset(index_t idx)

cyrush avatar Jul 19 '23 18:07 cyrush