Buffered cell_split matthieu
Here is an alternative version to what you wrote.
Instead of sorting the buffers and the particles at each recursion level of space_split_recursive()
(via cell_split()
), I only sort the buffers and at the end, when all the recursion is done, I re-arrange the part
/gpart
array using the indices that I store in the cell_buff
structure. That means that each part
is only accessed twice. Once to initially construct the buffers and once to do the final swap.
In @nnrw56's version the particles are swapped once per level (and 3 times per level in the old master
). That also allows to do the part
<->gpart
linking only once and not once per level.
Pedro, what do you think of this ? There might be some room for micro-level improvement in the function cell_reorder_parts()
using similar tricks to your memswap
function.
Note, this is built on top of your branch "cell_split".