By taking inspiration from the PyFR framework, where a similar conflict occurs [1]}, and from the optimization of tensor operations in YATeTo [2]}
(both are open source software), we implemented a hybrid Array-of-Structure-of-Array (AoSoA) data layout.
In this hybrid layout, the quantity dimension is put in between the spatial dimensions:
for a tensor \(A\) , instead of having the quantity dimension \(s\)  being the fastest, i.e. \(A_{k,j,i,s}\)  (in AoS layout), or the slowest, \(A_{s,k,j,i}\)  (in SoA layout),
our AoSoA layout mixed it in between the spatial dimension, resulting in a \(A_{k,j,s,i}\)  hybrid data layout.
While this layout is slightly less intuitive to work with, it allows the kernels to keep working with a pseudo-AoS layout and to trivially extract SoA subarrays for the user functions.
