23template <
class ParticleCell,
class Particle_T,
class PairwiseFunctor>
47 :
TraversalInterface(dataLayout, useNewton3), _functor(pairwiseFunctor), _soa{nullptr} {}
52 _soa = neighborList.
loadSoA(_functor);
67 case DataLayoutOption::aos:
68 iterateAoS(neighborList);
70 case DataLayoutOption::soa:
71 iterateSoA(neighborList);
82 [[nodiscard]] TraversalOption
getTraversalType()
const override {
return TraversalOption::vvl_as_built; }
95template <
class ParticleCell,
class Particle_T,
class PairwiseFunctor>
96void VVLAsBuildTraversal<ParticleCell, Particle_T, PairwiseFunctor>::iterateAoS(
97 VerletNeighborListAsBuild<Particle_T> &neighborList) {
98 const auto &list = neighborList.getAoSNeighborList();
101 constexpr int numColors = 8;
102 for (
int color = 0; color < numColors; color++) {
104 for (
unsigned int thread = 0; thread < list[color].size(); thread++) {
105 const auto &particleToNeighborMap = list[color][thread];
106 for (
const auto &[particlePtr, neighborPtrList] : particleToNeighborMap) {
107 for (
auto neighborPtr : neighborPtrList) {
108 _functor->AoSFunctor(*particlePtr, *neighborPtr, _useNewton3);
116template <
class ParticleCell,
class Particle_T,
class PairwiseFunctor>
117void VVLAsBuildTraversal<ParticleCell, Particle_T, PairwiseFunctor>::iterateSoA(
118 VerletNeighborListAsBuild<Particle_T> &neighborList) {
119 const auto &soaNeighborList = neighborList.getSoANeighborList();
122 constexpr int numColors = 8;
123 for (
int color = 0; color < numColors; color++) {
125 for (
unsigned int thread = 0; thread < soaNeighborList[color].size(); thread++) {
126 const auto &threadNeighborList = soaNeighborList[color][thread];
127 for (
const auto &[indexFirst, neighbors] : threadNeighborList) {
128 _functor->SoAFunctorVerlet(*_soa, indexFirst, neighbors, _useNewton3);
#define AUTOPAS_OPENMP(args)
Empty macro to throw away any arguments.
Definition: WrapOpenMP.h:126
PairwiseFunctor class.
Definition: PairwiseFunctor.h:31
Structur of the array class.
Definition: SoA.h:28
This interface serves as a common parent class for all traversals.
Definition: TraversalInterface.h:18
DataLayoutOption _dataLayout
The datalayout used by this traversal.
Definition: TraversalInterface.h:75
Traversal for VarVerletLists with VerletNeighborListAsBuild as neighbor list.
Definition: VVLAsBuildTraversal.h:25
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VVLAsBuildTraversal.h:64
VVLAsBuildTraversal(PairwiseFunctor *pairwiseFunctor, DataLayoutOption dataLayout, bool useNewton3)
The Constructor of VVLAsBuildTraversal.
Definition: VVLAsBuildTraversal.h:46
void initTraversal() override
Initializes the traversal.
Definition: VVLAsBuildTraversal.h:49
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VVLAsBuildTraversal.h:82
bool isApplicable() const override
Checks if the traversal is applicable to the current state of the domain.
Definition: VVLAsBuildTraversal.h:78
void endTraversal() override
Finalizes the traversal.
Definition: VVLAsBuildTraversal.h:56
Interface for all traversals for VarVerletLists containers.
Definition: VVLTraversalInterface.h:16
VerletNeighborListAsBuild< Particle_T > * _neighborList
The neighbor list to traverse.
Definition: VVLTraversalInterface.h:38
This class implements a neighbor list that remembers which thread added which particle pair and at wh...
Definition: VerletNeighborListAsBuild.h:22
auto * loadSoA(TFunctor *f)
Loads the particle information in the SoA and returns a pointer to the filled SoA.
Definition: VerletNeighborListAsBuild.h:200
void extractSoA(TFunctor *f)
Extracts the particle information out of the SoA returned by loadSoA() before.
Definition: VerletNeighborListAsBuild.h:226
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:63
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32