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);
84 [[nodiscard]] TraversalOption
getTraversalType()
const override {
return TraversalOption::vvl_as_built; }
97template <
class ParticleCell,
class Particle_T,
class PairwiseFunctor>
98void VVLAsBuildTraversal<ParticleCell, Particle_T, PairwiseFunctor>::iterateAoS(
99 VerletNeighborListAsBuild<Particle_T> &neighborList) {
100 const auto &list = neighborList.getAoSNeighborList();
103 constexpr int numColors = 8;
104 for (
int color = 0; color < numColors; color++) {
106 for (
unsigned int thread = 0; thread < list[color].size(); thread++) {
107 const auto &particleToNeighborMap = list[color][thread];
108 for (
const auto &[particlePtr, neighborPtrList] : particleToNeighborMap) {
109 for (
auto neighborPtr : neighborPtrList) {
110 _functor.AoSFunctor(*particlePtr, *neighborPtr, _useNewton3);
118template <
class ParticleCell,
class Particle_T,
class PairwiseFunctor>
119void VVLAsBuildTraversal<ParticleCell, Particle_T, PairwiseFunctor>::iterateSoA(
120 VerletNeighborListAsBuild<Particle_T> &neighborList) {
121 const auto &soaNeighborList = neighborList.getSoANeighborList();
124 constexpr int numColors = 8;
125 for (
int color = 0; color < numColors; color++) {
127 for (
unsigned int thread = 0; thread < soaNeighborList[color].size(); thread++) {
128 const auto &threadNeighborList = soaNeighborList[color][thread];
129 for (
const auto &[indexFirst, neighbors] : threadNeighborList) {
130 _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:45
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:77
Traversal for VarVerletLists with VerletNeighborListAsBuild as neighbor list.
Definition: VVLAsBuildTraversal.h:25
bool isApplicableToDomain() const override
VVL As Build is always applicable to the domain.
Definition: VVLAsBuildTraversal.h:82
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VVLAsBuildTraversal.h:64
void initTraversal() override
Initializes the traversal.
Definition: VVLAsBuildTraversal.h:49
VVLAsBuildTraversal(PairwiseFunctor &pairwiseFunctor, DataLayoutOption dataLayout, bool useNewton3)
The Constructor of VVLAsBuildTraversal.
Definition: VVLAsBuildTraversal.h:46
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VVLAsBuildTraversal.h:84
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
void extractSoA(TFunctor &f)
Extracts the particle information out of the SoA returned by loadSoA() before.
Definition: VerletNeighborListAsBuild.h:226
auto * loadSoA(TFunctor &f)
Loads the particle information in the SoA and returns a pointer to the filled SoA.
Definition: VerletNeighborListAsBuild.h:200
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:64
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:34