AutoPas  3.0.0
Loading...
Searching...
No Matches
LCSlicedTraversal.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <algorithm>
11
16
17namespace autopas {
18
29template <class ParticleCell_T, class Functor_T>
30class LCSlicedTraversal : public SlicedLockBasedTraversal<ParticleCell_T, Functor_T>, public LCTraversalInterface {
31 public:
42 explicit LCSlicedTraversal(const std::array<unsigned long, 3> &dims, Functor_T &functor, double interactionLength,
43 const std::array<double, 3> &cellLength, DataLayoutOption dataLayout, bool useNewton3)
44 : SlicedLockBasedTraversal<ParticleCell_T, Functor_T>(dims, functor, interactionLength, cellLength, dataLayout,
45 useNewton3, true),
46 _cellHandler(functor, this->_cellsPerDimension, interactionLength, cellLength, this->_overlap, dataLayout,
47 useNewton3) {}
48
49 void traverseParticles() override;
50
51 [[nodiscard]] TraversalOption getTraversalType() const override { return TraversalOption::lc_sliced; }
52
56 void setSortingThreshold(size_t sortingThreshold) override { _cellHandler.setSortingThreshold(sortingThreshold); }
57
58 private:
60};
61
62template <class ParticleCell_T, class Functor_T>
64 auto &cells = *(this->_cells);
65 this->slicedTraversal([&](unsigned long x, unsigned long y, unsigned long z) {
66 auto id = utils::ThreeDimensionalMapping::threeToOneD(x, y, z, this->_cellsPerDimension);
67 _cellHandler.processBaseCell(cells, id);
68 });
69}
70
71} // namespace autopas
std::array< unsigned long, 3 > _cellsPerDimension
The dimensions of the cellblock.
Definition: CellTraversal.h:55
This class provides the base for traversals using the c08 base step.
Definition: LCC08CellHandler.h:27
This class provides the (locked) sliced traversal.
Definition: LCSlicedTraversal.h:30
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: LCSlicedTraversal.h:56
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: LCSlicedTraversal.h:63
LCSlicedTraversal(const std::array< unsigned long, 3 > &dims, Functor_T &functor, double interactionLength, const std::array< double, 3 > &cellLength, DataLayoutOption dataLayout, bool useNewton3)
Constructor of the sliced traversal.
Definition: LCSlicedTraversal.h:42
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: LCSlicedTraversal.h:51
Interface for traversals used by the LinkedCell class.
Definition: LCTraversalInterface.h:18
std::array< unsigned long, 3 > _overlap
Overlap of interacting cells.
Definition: SlicedBasedTraversal.h:155
This class provides the sliced traversal.
Definition: SlicedLockBasedTraversal.h:32
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