AutoPas  3.0.0
Loading...
Searching...
No Matches
VLCC08Traversal.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 VLCC08Traversal : public C08BasedTraversal<ParticleCell, PairwiseFunctor>,
29 public VLCTraversalInterface<typename ParticleCell::ParticleType, NeighborList> {
30 public:
41 explicit VLCC08Traversal(const std::array<unsigned long, 3> &dims, PairwiseFunctor &pairwiseFunctor,
42 double interactionLength, const std::array<double, 3> &cellLength,
43 DataLayoutOption dataLayout, bool useNewton3)
44 : C08BasedTraversal<ParticleCell, PairwiseFunctor>(dims, pairwiseFunctor, interactionLength, cellLength,
45 dataLayout, useNewton3),
46 VLCTraversalInterface<typename ParticleCell::ParticleType, NeighborList>(ContainerOption::verletListsCells),
47 _functor(pairwiseFunctor) {}
48
49 void traverseParticles() override;
50
51 [[nodiscard]] TraversalOption getTraversalType() const override { return TraversalOption::vlc_c08; }
52
53 [[nodiscard]] bool isApplicableToDomain() const override {
54 // This traversal is only safe to use with cell lengths at least as large as _interactionLength (typically holds for
55 // CSF>=1)
56 const double minCellLength = *std::min_element(this->_cellLength.cbegin(), this->_cellLength.cend());
57 const bool maxOneCellInCutoff = minCellLength >= this->_interactionLength;
58
59 return maxOneCellInCutoff;
60 }
61
66 void setAoSSortingThreshold(size_t aosSortingThreshold) override {}
70 void setSoASortingThreshold(size_t soaSortingThreshold) override {}
71
72 private:
73 PairwiseFunctor &_functor;
74};
75
76template <class ParticleCell, class PairwiseFunctor, class NeighborList>
78 if (this->_dataLayout == DataLayoutOption::soa) {
79 this->loadSoA(_functor, *(this->_verletList));
80 }
81
82 this->c08Traversal([&](unsigned long x, unsigned long y, unsigned long z) {
83 const auto baseIndex = utils::ThreeDimensionalMapping::threeToOneD(x, y, z, this->_cellsPerDimension);
84 this->template processCellLists<PairwiseFunctor>(*(this->_verletList), baseIndex, _functor, this->_dataLayout,
85 this->_useNewton3);
86 });
87
88 if (this->_dataLayout == DataLayoutOption::soa) {
89 this->extractSoA(_functor, *(this->_verletList));
90 }
91}
92
93} // namespace autopas
This class provides the base for traversals using the c08 base step.
Definition: C08BasedTraversal.h:24
const double _interactionLength
Interaction length (cutoff + skin).
Definition: ColorBasedTraversal.h:111
const std::array< double, 3 > _cellLength
cell length in CellBlock3D.
Definition: ColorBasedTraversal.h:116
PairwiseFunctor class.
Definition: PairwiseFunctor.h:45
Class for Cells of Particles.
Definition: ParticleCell.h:49
This class provides the vlc_c08 traversal.
Definition: VLCC08Traversal.h:29
void setSoASortingThreshold(size_t soaSortingThreshold) override
Set the SoA sorting-threshold for traversals that use the CellFunctor.
Definition: VLCC08Traversal.h:70
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: VLCC08Traversal.h:66
bool isApplicableToDomain() const override
Checks if the traversal is applicable to the current state of the domain.
Definition: VLCC08Traversal.h:53
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VLCC08Traversal.h:77
VLCC08Traversal(const std::array< unsigned long, 3 > &dims, PairwiseFunctor &pairwiseFunctor, double interactionLength, const std::array< double, 3 > &cellLength, DataLayoutOption dataLayout, bool useNewton3)
Constructor of the vlc_c08 traversal.
Definition: VLCC08Traversal.h:41
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VLCC08Traversal.h:51
This class provides the Traversal Interface for the verlet lists cells container.
Definition: VLCTraversalInterface.h:38
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