# Row-major ordering in VTK-m

**URL:** https://discourse.vtk.org/t/row-major-ordering-in-vtk-m/15045
**Category:** Support
**Created:** [December 18, 2024, 11:45am UTC](https://discourse.vtk.org/t/row-major-ordering-in-vtk-m/15045 "2024-12-18T11:45:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Francisco](https://discourse.vtk.org/user_avatar/discourse.vtk.org/francisco/32/6715_2.png) [@Francisco](https://discourse.vtk.org/u/Francisco)
#### Post date: [December 18, 2024, 11:45am UTC](https://discourse.vtk.org/t/row-major-ordering-in-vtk-m/15045/1 "2024-12-18T11:45:58Z")

</div>

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.
