Replace array transform with array decorator in contour tree algorithm
In merge request !2396 (merged) @kmorel added a note that in one instance it is more appropriate to use an array decorator instead of an array transform. The merge request changes the transform functor directly to a corresponding decorator (CombinedVectorDifferentFromNext.h
).
Previous text that suggested two variants
This merge request suggests two alternate ways of doing so. (Both in the code selectable via a #if 0/1 #else #endif
statement.
- Replace the transform functor directly with a corresponding decorator (
CombinedVectorDifferentFromNext.h
) - Just have a simpler decorator (
CombinedArrayHandleDecorator.h
) for combining two arrays and implement the rest via a variety of "standard" array operations (view, zip, transform).
I originally thought that option two would be preferable since it re-uses more existing vtk-m array functions, but it turns out to be more verbose than the first. The "Combine" decorator also somewhat "abuses" the decorator notion in that array indices are not contiguous, i.e., it claims that the array has n_1 + n_2 elements, but those are not accessed by indices in the range [0, n_1+n_2-1]. Instead setting the most significant bit in the index switches between the two arrays. I am not sure if that use of the decorator could cause issues down the road. Based on these concerns