AutoPas  3.0.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
autopas::SortedSoAView< Particle_T, Functor_T > Class Template Reference

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 +=.
 

Detailed Description

template<class Particle_T, class Functor_T>
class autopas::SortedSoAView< Particle_T, Functor_T >

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 +=.

Note
Modifications to the source SoA invalidate the view.
Template Parameters
Particle_TParticle type providing AttributeNames and SoAArraysType.
Functor_TFunctor type providing getNeededAttr() and getComputedAttr().

Constructor & Destructor Documentation

◆ SortedSoAView()

template<class Particle_T , class Functor_T >
autopas::SortedSoAView< Particle_T, Functor_T >::SortedSoAView ( SoAView< SoAArraysType >  source,
const std::array< double, 3 > &  sortingDirection,
SoA< SoAArraysType > &  cachedSoa,
std::vector< std::pair< double, size_t > > &  cachedProjIdx 
)
inline

Projects particles onto sortingDirection, sorts by projection, and packs needed attributes into an internal SoA.

Computed attributes are zero-initialized.

Parameters
sourceView of the source SoA buffer to sort.
sortingDirectionNormalized direction vector along which to sort.
cachedSoaReference to a persistent SoA buffer to avoid allocations.
cachedProjIdxReference to a persistent projection vector to avoid allocations.

Member Function Documentation

◆ getView()

template<class Particle_T , class Functor_T >
SoAView< SoAArraysType > autopas::SortedSoAView< Particle_T, Functor_T >::getView ( )
inline

Returns a SoAView into the sorted, contiguous internal buffer.

Returns
SoAView of the sorted SoA.

◆ scatterBack()

template<class Particle_T , class Functor_T >
void autopas::SortedSoAView< Particle_T, Functor_T >::scatterBack ( )
inline

Scatters computed attribute contributions accumulated in the sorted SoA back to the source via +=.

Must be called after the functor to commit writes.


The documentation for this class was generated from the following file: