AutoPas  3.0.0
Loading...
Searching...
No Matches
VLCC18Traversal.h
Go to the documentation of this file.
1
7#pragma once
8
11
12namespace autopas {
13
27template <class ParticleCell, class PairwiseFunctor, class NeighborList>
28class VLCC18Traversal : public C18BasedTraversal<ParticleCell, PairwiseFunctor>,
29 public VLCTraversalInterface<typename ParticleCell::ParticleType, NeighborList> {
30 public:
42 explicit VLCC18Traversal(const std::array<unsigned long, 3> &dims, PairwiseFunctor &pairwiseFunctor,
43 const double interactionLength, const std::array<double, 3> &cellLength,
44 DataLayoutOption dataLayout, bool useNewton3, ContainerOption::Value typeOfList)
45 : C18BasedTraversal<ParticleCell, PairwiseFunctor>(dims, pairwiseFunctor, interactionLength, cellLength,
46 dataLayout, useNewton3),
47 VLCTraversalInterface<typename ParticleCell::ParticleType, NeighborList>(typeOfList),
48 _functor(pairwiseFunctor) {}
49
50 void traverseParticles() override;
51
52 [[nodiscard]] TraversalOption getTraversalType() const override {
53 switch (this->_typeOfList) {
54 case (ContainerOption::verletListsCells):
55 return TraversalOption::vlc_c18;
56 case (ContainerOption::pairwiseVerletLists):
57 return TraversalOption::vlp_c18;
58 default:
59 utils::ExceptionHandler::exception("Traversal was created with an unsupported neighborlist type: {}",
60 this->_typeOfList.to_string());
61 }
62 // should never be reached.
63 return TraversalOption();
64 }
65
70 [[nodiscard]] bool isApplicableToDomain() const override { return true; }
71
76 void setAoSSortingThreshold(size_t aosSortingThreshold) override {}
80 void setSoASortingThreshold(size_t soaSortingThreshold) override {}
81
82 private:
83 PairwiseFunctor &_functor;
84};
85
86template <class ParticleCell, class PairwiseFunctor, class NeighborList>
88 if (this->_dataLayout == DataLayoutOption::soa) {
89 this->loadSoA(_functor, *(this->_verletList));
90 }
91
92 this->template c18Traversal</*allCells*/ true>([&](unsigned long x, unsigned long y, unsigned long z) {
93 unsigned long baseIndex = utils::ThreeDimensionalMapping::threeToOneD(x, y, z, this->_cellsPerDimension);
94 this->template processCellLists<PairwiseFunctor>(*(this->_verletList), baseIndex, _functor, this->_dataLayout,
95 this->_useNewton3);
96 });
97
98 if (this->_dataLayout == DataLayoutOption::soa) {
99 this->extractSoA(_functor, *(this->_verletList));
100 }
101}
102
103} // namespace autopas
This class provides the base for traversals using the c18 base step.
Definition: C18BasedTraversal.h:23
PairwiseFunctor class.
Definition: PairwiseFunctor.h:45
Class for Cells of Particles.
Definition: ParticleCell.h:49
This class provides the lc_c18 traversal.
Definition: VLCC18Traversal.h:29
VLCC18Traversal(const std::array< unsigned long, 3 > &dims, PairwiseFunctor &pairwiseFunctor, const double interactionLength, const std::array< double, 3 > &cellLength, DataLayoutOption dataLayout, bool useNewton3, ContainerOption::Value typeOfList)
Constructor of the lc_c18 traversal.
Definition: VLCC18Traversal.h:42
void setSoASortingThreshold(size_t soaSortingThreshold) override
Set the SoA sorting-threshold for traversals that use the CellFunctor.
Definition: VLCC18Traversal.h:80
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VLCC18Traversal.h:52
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VLCC18Traversal.h:87
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: VLCC18Traversal.h:76
bool isApplicableToDomain() const override
VLC C18 is always applicable to the domain.
Definition: VLCC18Traversal.h:70
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