AutoPas  3.0.0
Loading...
Searching...
No Matches
VLCSlicedC02Traversal.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <algorithm>
11
15
16namespace autopas {
17
30template <class ParticleCell, class PairwiseFunctor, class NeighborList>
31class VLCSlicedC02Traversal : public SlicedC02BasedTraversal<ParticleCell, PairwiseFunctor>,
32 public VLCTraversalInterface<typename ParticleCell::ParticleType, NeighborList> {
33 public:
45 explicit VLCSlicedC02Traversal(const std::array<unsigned long, 3> &dims, PairwiseFunctor &pairwiseFunctor,
46 double interactionLength, const std::array<double, 3> &cellLength,
47 DataLayoutOption dataLayout, bool useNewton3, ContainerOption::Value typeOfList)
48 : SlicedC02BasedTraversal<ParticleCell, PairwiseFunctor>(dims, pairwiseFunctor, interactionLength, cellLength,
49 dataLayout, useNewton3, false),
50 VLCTraversalInterface<typename ParticleCell::ParticleType, NeighborList>(typeOfList),
51 _functor(pairwiseFunctor) {}
52
53 void traverseParticles() override;
54
55 [[nodiscard]] TraversalOption getTraversalType() const override {
56 switch (this->_typeOfList) {
57 case (ContainerOption::verletListsCells):
58 return TraversalOption::vlc_sliced_c02;
59 case (ContainerOption::pairwiseVerletLists):
60 return TraversalOption::vlp_sliced_c02;
61 default:
62 autopas::utils::ExceptionHandler::exception("Traversal was created with an unsupported neighborlist type: {}",
63 this->_typeOfList.to_string());
64 }
65 // should never be reached.
66 return TraversalOption();
67 }
68
73 [[nodiscard]] bool isApplicableToDomain() const override { return true; }
74
79 void setAoSSortingThreshold(size_t aosSortingThreshold) override {}
83 void setSoASortingThreshold(size_t soaSortingThreshold) override {}
84
85 private:
86 PairwiseFunctor &_functor;
87};
88
89template <class ParticleCell, class PairwiseFunctor, class NeighborList>
91 if (this->_dataLayout == DataLayoutOption::soa) {
92 this->loadSoA(_functor, *(this->_verletList));
93 }
94
95 this->cSlicedTraversal([&](unsigned long x, unsigned long y, unsigned long z) {
96 auto baseIndex = utils::ThreeDimensionalMapping::threeToOneD(x, y, z, this->_cellsPerDimension);
97 this->template processCellLists<PairwiseFunctor>(*(this->_verletList), baseIndex, _functor, this->_dataLayout,
98 this->_useNewton3);
99 });
100
101 if (this->_dataLayout == DataLayoutOption::soa) {
102 this->extractSoA(_functor, *(this->_verletList));
103 }
104}
105
106} // namespace autopas
PairwiseFunctor class.
Definition: PairwiseFunctor.h:45
Class for Cells of Particles.
Definition: ParticleCell.h:49
This class provides the colored sliced traversal.
Definition: SlicedC02BasedTraversal.h:33
This class provides the colored sliced traversal.
Definition: VLCSlicedC02Traversal.h:32
void setSoASortingThreshold(size_t soaSortingThreshold) override
Set the SoA sorting-threshold for traversals that use the CellFunctor.
Definition: VLCSlicedC02Traversal.h:83
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VLCSlicedC02Traversal.h:55
void setAoSSortingThreshold(size_t aosSortingThreshold) override
Set the aos-sorting-threshold for traversals that use the CellFunctor If the sum of the number of par...
Definition: VLCSlicedC02Traversal.h:79
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VLCSlicedC02Traversal.h:90
bool isApplicableToDomain() const override
VLC Sliced C02 is always applicable to the domain.
Definition: VLCSlicedC02Traversal.h:73
VLCSlicedC02Traversal(const std::array< unsigned long, 3 > &dims, PairwiseFunctor &pairwiseFunctor, double interactionLength, const std::array< double, 3 > &cellLength, DataLayoutOption dataLayout, bool useNewton3, ContainerOption::Value typeOfList)
Constructor of the colored sliced traversal.
Definition: VLCSlicedC02Traversal.h:45
This class provides the Traversal Interface for the verlet lists cells container.
Definition: VLCTraversalInterface.h:38
ContainerOption _typeOfList
The type of neighbor list as an enum value.
Definition: VLCTraversalInterface.h:108
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:64
constexpr T threeToOneD(T x, T y, T z, const std::array< T, 3 > &dims)
Convert a 3d index to a 1d index.
Definition: ThreeDimensionalMapping.h:29
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:34