xcompact3d / x3d2

https://xcompact3d.github.io/x3d2
BSD 3-Clause "New" or "Revised" License
3 stars 4 forks source link

Add reorder kernels for switching from/to Cartesian ordering #76

Closed semi-h closed 5 months ago

semi-h commented 5 months ago

The idea is we interact with outside world always with Cartesian data order.

Backends require a special data structure, but they are capable of converting the specialist data structure into Cartesian and vice versa, so we can and should always input from and output to Cartesian ordered arrays. We plan to carry out this operation with the get_field/set_field subroutines in both backends, but as of now they can't carry out the conversion to and from Cartesian yet. Becase in order to switch to and from Cartesian we need to be able to request a Cartesian shape from the allocator, (#34), and the plan is to merge the PR enables this on Monday after finalising some important decisions.

Although this PR doesn't enables the actual functionality we need, it provides all the necessary kernels. I think the best would be merging this before #34, and making the final minor changes in get_field/set_field in #34.

semi-h commented 5 months ago

I think the PR in its final shape, and ready for a review. get_field_data and set_field_data functions are now implemented at base backend level, and capable of passing back a 3D array with any directionality we can optionally provide. All use cases in the codebase as of now input and output a Cartesian 3D array, so I made Cartesian ordering default if no directionality is specified. However, one can easily allocate a x-directional Fortran array and request get_field_data to output into x-directional 3D array. @JamieJQuinn, please let me know if the PR provides the functionality you need for the IO.

semi-h commented 5 months ago

Added some documentation but otherwise looks good! Cartesian remap should enable continued development on IO.

Thanks a lot!