AutoPas  3.0.0
Loading...
Searching...
No Matches
VCLSlicedC02Traversal.h
Go to the documentation of this file.
1
7#pragma once
8
13
14namespace autopas {
15
24template <class ParticleCell, class PairwiseFunctor>
25class VCLSlicedC02Traversal : public SlicedC02BasedTraversal<ParticleCell, PairwiseFunctor>,
26 public VCLTraversalInterface<typename ParticleCell::ParticleType> {
27 private:
28 using ParticleType = typename ParticleCell::ParticleType;
29
30 PairwiseFunctor *_functor;
32
33 void processBaseStep(unsigned long x, unsigned long y) {
35 auto &currentTower = clusterList.getTowerByIndex(x, y);
36 for (auto clusterIter =
37 (this->_useNewton3 ? currentTower.getClusters().begin() : currentTower.getFirstOwnedCluster());
38 clusterIter < (this->_useNewton3 ? currentTower.getClusters().end() : currentTower.getFirstTailHaloCluster());
39 ++clusterIter) {
40 const auto isHaloCluster =
41 clusterIter < currentTower.getFirstOwnedCluster() or clusterIter >= currentTower.getFirstTailHaloCluster();
42 _clusterFunctor.processCluster(*clusterIter, isHaloCluster);
43 }
44 }
45
46 public:
58 explicit VCLSlicedC02Traversal(const std::array<unsigned long, 3> &dims, PairwiseFunctor *pairwiseFunctor,
59 double interactionLength, const std::array<double, 3> &cellLength, size_t clusterSize,
60 DataLayoutOption dataLayout, bool useNewton3)
61 : SlicedC02BasedTraversal<ParticleCell, PairwiseFunctor>(dims, pairwiseFunctor, interactionLength, cellLength,
62 dataLayout, useNewton3, false),
63 _functor(pairwiseFunctor),
64 _clusterFunctor(pairwiseFunctor, clusterSize, dataLayout, useNewton3) {}
65
66 [[nodiscard]] TraversalOption getTraversalType() const override { return TraversalOption::vcl_sliced_c02; }
67
68 void loadDataLayout() override {
69 if (this->_dataLayout == DataLayoutOption::soa) {
70 VCLTraversalInterface<ParticleType>::_verletClusterLists->loadParticlesIntoSoAs(_functor);
71 }
72 }
73
74 void endTraversal() override {
75 if (this->_dataLayout == DataLayoutOption::soa) {
76 VCLTraversalInterface<ParticleType>::_verletClusterLists->extractParticlesFromSoAs(_functor);
77 }
78 }
79
80 void traverseParticles() override {
81 this->cSlicedTraversal([&](unsigned long x, unsigned long y, unsigned long z) { processBaseStep(x, y); });
82 }
83
88 void setSortingThreshold(size_t sortingThreshold) override {}
89};
90} // 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 colored sliced traversal.
Definition: SlicedC02BasedTraversal.h:33
void cSlicedTraversal(LoopBody &&loopBody)
The main traversal of the colored sliced traversal.
Definition: SlicedC02BasedTraversal.h:76
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: VCLSlicedC02Traversal.h:26
void loadDataLayout() override
Load Data Layouts required for this Traversal if cells have been set through setCellsToTraverse().
Definition: VCLSlicedC02Traversal.h:68
VCLSlicedC02Traversal(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 VCLSlicedC02Traversal.
Definition: VCLSlicedC02Traversal.h:58
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VCLSlicedC02Traversal.h:66
void endTraversal() override
Write Data to AoS if cells have been set through setCellsToTraverse().
Definition: VCLSlicedC02Traversal.h:74
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: VCLSlicedC02Traversal.h:88
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VCLSlicedC02Traversal.h:80
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