Is there a good way to use VTKm with external Uniform datasets (ie. “3D Images”) in row-major ordering?
I have been able to successfully create some VTKm DataSet
s from existing structured data in my code with zero-copy, using make_ArrayHandle
with CopyFlag::Off
. However my data is in C-order (AKA row-major, z is the fast-varying index). It seems like VTK (and VTKm) use Fortran-order (AKA column-major, x is the fast-varying index), so I would need to transpose the data, negating the benefit of zero-copy.
Something like numpy, xtensor, eigen3… would “just” update the strides of the tensor to give a transposed view. While VTKm has ArrayHandleStride
, it seems like its UC, having only one stride, is for alternate access to data, such as extracting the X component, SoA->AoS mapping, etc.
Another (probably more canonical) way to do this would be to use a CoordinateSystem
that is transposed. The default one hardcodes column-major access in ArrayPortalUniformPointCoordinates::Get
, so I guess all I am left is with implementing it myself?
Just checking that there is not a better way already present in the code that I am missing.