vtk-m/docs/changelog/resize-extracted-component.md
Kenneth Moreland 2061e95efe Add ability to resize ArrayHandleStride
This feature enables the ability to anonomously create an array (such as
with `UnknownArrayHandle::NewInstance()`) and then use that as an output
array. Although resizing `ArrayHandleStride` is a little wonky, it
allows worklets to resize them after creation rather than having to know
what size to make and allocating the array.
2023-01-18 14:29:23 -06:00

955 B

Added ability to resize strided arrays from ArrayExtractComponent

Previously, it was not possible to resize an ArrayHandleStride because the operation is a bit ambiguous. The actual array is likely to be padded by some amount, and there could be an unknown amount of space skipped at the beginning.

However, there is a good reason to want to resize ArrayHandleStride. This is the array used to implement the ArrayExtractComponent feature, and this in turn is used when extracting arrays from an UnknownArrayHandle whether independent or as an ArrayHandleRecombineVec.

The problem really happens when you create an array of an unknown type in an UnknownArrayHandle (such as with NewInstance) and then use that as an output to a worklet. Sure, you could use ArrayHandle::Allocate to resize before getting the array, but that is awkward for programers. Instead, allow the extracted arrays to be resized as normal output arrays would be.