AutoPas  3.0.0
Loading...
Searching...
No Matches
VLCCellPairC08Traversal.h
Go to the documentation of this file.
1
7#pragma once
12
13namespace autopas {
14
22template <class ParticleCell, class PairwiseFunctor>
23class VLCCellPairC08Traversal : public C08BasedTraversal<ParticleCell, PairwiseFunctor>,
24 public VLCCellPairTraversalInterface<typename ParticleCell::ParticleType> {
25 public:
36 explicit VLCCellPairC08Traversal(const std::array<unsigned long, 3> &dims, PairwiseFunctor &pairwiseFunctor,
37 double interactionLength, const std::array<double, 3> &cellLength,
38 DataLayoutOption dataLayout, bool useNewton3)
39 : C08BasedTraversal<ParticleCell, PairwiseFunctor>(dims, pairwiseFunctor, interactionLength, cellLength,
40 dataLayout, useNewton3),
41 _functor(pairwiseFunctor),
42 _cellHandler(dims, interactionLength, cellLength) {}
43
44 void traverseParticles() override;
45
50 [[nodiscard]] bool isApplicableToDomain() const override { return true; }
51
52 [[nodiscard]] TraversalOption getTraversalType() const override { return TraversalOption::vlp_c08; }
53
58 void setAoSSortingThreshold(size_t aosSortingThreshold) override {}
62 void setSoASortingThreshold(size_t soaSortingThreshold) override {}
63
64 private:
65 PairwiseFunctor &_functor;
71};
72
73template <class ParticleCell, class PairwiseFunctor>
75 if (this->_dataLayout == DataLayoutOption::soa) {
76 _soa = this->_cellPairVerletList->loadSoA(_functor);
77 }
78
79 this->c08Traversal([&](unsigned long x, unsigned long y, unsigned long z) {
80 const auto baseIndex = utils::ThreeDimensionalMapping::threeToOneD(x, y, z, this->_cellsPerDimension);
81 _cellHandler.processCellListsC08(*(this->_cellPairVerletList), baseIndex, _functor, this->_dataLayout, _soa,
82 this->_useNewton3);
83 });
84
85 if (this->_dataLayout == DataLayoutOption::soa) {
86 this->_cellPairVerletList->extractSoA(_functor);
87 _soa = nullptr;
88 }
89}
90
91} // namespace autopas
This class provides the base for traversals using the c08 base step.
Definition: C08BasedTraversal.h:24
PairwiseFunctor class.
Definition: PairwiseFunctor.h:45
Class for Cells of Particles.
Definition: ParticleCell.h:49
Structur of the array class.
Definition: SoA.h:28
This class provides the base logic for the c08 traversal for VLCCellPairNeighborList.
Definition: VLCCellPairC08CellHandler.h:19
C08 traversal for VLCCellPairNeighborList.
Definition: VLCCellPairC08Traversal.h:24
VLCCellPairC08Traversal(const std::array< unsigned long, 3 > &dims, PairwiseFunctor &pairwiseFunctor, double interactionLength, const std::array< double, 3 > &cellLength, DataLayoutOption dataLayout, bool useNewton3)
Constructor of the c08 traversal for VLCCellPairNeighborList.
Definition: VLCCellPairC08Traversal.h:36
bool isApplicableToDomain() const override
PVL C08 is always applicable to the domain.
Definition: VLCCellPairC08Traversal.h:50
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VLCCellPairC08Traversal.h:52
void setSoASortingThreshold(size_t soaSortingThreshold) override
Set the SoA sorting-threshold for traversals that use the CellFunctor.
Definition: VLCCellPairC08Traversal.h:62
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VLCCellPairC08Traversal.h:74
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: VLCCellPairC08Traversal.h:58
Interface for traversals used with VLCCellPairNeighborList.
Definition: VLCCellPairTraversalInterface.h:21
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