AutoPas  3.0.0
Loading...
Searching...
No Matches
VCLSlicedTraversal.h
Go to the documentation of this file.
1
7#pragma once
8
13
14namespace autopas {
15
25template <class ParticleCell, class PairwiseFunctor>
26class VCLSlicedTraversal : public SlicedLockBasedTraversal<ParticleCell, PairwiseFunctor>,
27 public VCLTraversalInterface<typename ParticleCell::ParticleType> {
28 private:
29 using ParticleType = typename ParticleCell::ParticleType;
30
31 PairwiseFunctor *_functor;
33
34 void processBaseStep(unsigned long x, unsigned long y) {
36 auto &currentTower = clusterList.getTowerByIndex(x, y);
37 for (auto clusterIter =
38 (this->_useNewton3 ? currentTower.getClusters().begin() : currentTower.getFirstOwnedCluster());
39 clusterIter < (this->_useNewton3 ? currentTower.getClusters().end() : currentTower.getFirstTailHaloCluster());
40 ++clusterIter) {
41 const auto isHaloCluster =
42 clusterIter < currentTower.getFirstOwnedCluster() or clusterIter >= currentTower.getFirstTailHaloCluster();
43 _clusterFunctor.processCluster(*clusterIter, isHaloCluster);
44 }
45 }
46
47 public:
59 explicit VCLSlicedTraversal(const std::array<unsigned long, 3> &dims, PairwiseFunctor *pairwiseFunctor,
60 double interactionLength, const std::array<double, 3> &cellLength, size_t clusterSize,
61 DataLayoutOption dataLayout, bool useNewton3)
62 : SlicedLockBasedTraversal<ParticleCell, PairwiseFunctor>(dims, pairwiseFunctor, interactionLength, cellLength,
63 dataLayout, useNewton3, false),
64 _functor(pairwiseFunctor),
65 _clusterFunctor(pairwiseFunctor, clusterSize, dataLayout, useNewton3) {}
66
67 [[nodiscard]] TraversalOption getTraversalType() const override { return TraversalOption::vcl_sliced; }
68
69 void loadDataLayout() override {
70 if (this->_dataLayout == DataLayoutOption::soa) {
71 VCLTraversalInterface<ParticleType>::_verletClusterLists->loadParticlesIntoSoAs(_functor);
72 }
73 }
74
75 void endTraversal() override {
76 if (this->_dataLayout == DataLayoutOption::soa) {
77 VCLTraversalInterface<ParticleType>::_verletClusterLists->extractParticlesFromSoAs(_functor);
78 }
79 }
80
81 void traverseParticles() override {
82 this->slicedTraversal([&](unsigned long x, unsigned long y, unsigned long z) { processBaseStep(x, y); });
83 }
84
89 void setSortingThreshold(size_t sortingThreshold) override {}
90};
91} // namespace autopas
PairwiseFunctor class.
Definition: PairwiseFunctor.h:31
Class for Cells of Particles.
Definition: ParticleCell.h:51
Particle_T ParticleType
The particle type for this cell.
Definition: ParticleCell.h:56
This class provides the sliced traversal.
Definition: SlicedLockBasedTraversal.h:32
void slicedTraversal(LoopBody &&loopBody)
The main traversal of the sliced traversal.
Definition: SlicedLockBasedTraversal.h:62
DataLayoutOption _dataLayout
The datalayout used by this traversal.
Definition: TraversalInterface.h:75
bool _useNewton3
If this traversal makes use of newton3.
Definition: TraversalInterface.h:80
This traversal splits the domain into slices along the longer dimension among x and y.
Definition: VCLSlicedTraversal.h:27
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VCLSlicedTraversal.h:81
VCLSlicedTraversal(const std::array< unsigned long, 3 > &dims, PairwiseFunctor *pairwiseFunctor, double interactionLength, const std::array< double, 3 > &cellLength, size_t clusterSize, DataLayoutOption dataLayout, bool useNewton3)
Constructor of the VCLSlicedTraversal.
Definition: VCLSlicedTraversal.h:59
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VCLSlicedTraversal.h:67
void loadDataLayout() override
Load Data Layouts required for this Traversal if cells have been set through setCellsToTraverse().
Definition: VCLSlicedTraversal.h:69
void setSortingThreshold(size_t sortingThreshold) override
Set the sorting-threshold for traversals that use the CellFunctor If the sum of the number of particl...
Definition: VCLSlicedTraversal.h:89
void endTraversal() override
Write Data to AoS if cells have been set through setCellsToTraverse().
Definition: VCLSlicedTraversal.h:75
Interface for traversals of the VerletClusterLists container.
Definition: VCLTraversalInterface.h:20
Provides methods to traverse a single cluster and a pair of clusters.
Definition: VCLClusterFunctor.h:21
void processCluster(internal::Cluster< Particle_T > &cluster, bool isHaloCluster)
Invokes the calculations of all interactions within the cluster and, if they exist,...
Definition: VCLClusterFunctor.h:38
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32