A sorted view on a SoA buffer. More...
#include <SortedSoAView.h>
Public Member Functions | |
| SortedSoAView (SoAView< SoAArraysType > source, const std::array< double, 3 > &sortingDirection, SoA< SoAArraysType > &cachedSoa, std::vector< std::pair< double, size_t > > &cachedProjIdx) | |
| Projects particles onto sortingDirection, sorts by projection, and packs needed attributes into an internal SoA. | |
| SoAView< SoAArraysType > | getView () |
| Returns a SoAView into the sorted, contiguous internal buffer. | |
| void | scatterBack () |
| Scatters computed attribute contributions accumulated in the sorted SoA back to the source via +=. | |
A sorted view on a SoA buffer.
Particles are projected onto a normalized direction vector, sorted ascending by projection, and packed into a contiguous internal SoA, similar to SortedCellView for AoS.
Only the attributes declared by Functor_T::getNeededAttr() are packed from source. Attributes declared by Functor_T::getComputedAttr() are zero-initialized so the functor can accumulate into them. Call scatterBack() after the functor to add the accumulated values back to the source via +=.
| Particle_T | Particle type providing AttributeNames and SoAArraysType. |
| Functor_T | Functor type providing getNeededAttr() and getComputedAttr(). |
|
inline |
Projects particles onto sortingDirection, sorts by projection, and packs needed attributes into an internal SoA.
Computed attributes are zero-initialized.
|
inline |
|
inline |
Scatters computed attribute contributions accumulated in the sorted SoA back to the source via +=.
Must be called after the functor to commit writes.