AutoPas  3.0.0
Loading...
Searching...
No Matches
LCC08Traversal.h
Go to the documentation of this file.
1
7#pragma once
8
9#include "LCC08CellHandler.h"
13
14namespace autopas {
15
27template <class ParticleCell, class PairwiseFunctor>
28class LCC08Traversal : public C08BasedTraversal<ParticleCell, PairwiseFunctor>, public LCTraversalInterface {
29 public:
40 explicit LCC08Traversal(const std::array<unsigned long, 3> &dims, PairwiseFunctor *pairwiseFunctor,
41 double interactionLength, const std::array<double, 3> &cellLength,
42 DataLayoutOption dataLayout, bool useNewton3)
43 : C08BasedTraversal<ParticleCell, PairwiseFunctor>(dims, pairwiseFunctor, interactionLength, cellLength,
44 dataLayout, useNewton3),
45
46 _cellHandler(pairwiseFunctor, this->_cellsPerDimension, interactionLength, cellLength, this->_overlap,
47 dataLayout, useNewton3) {}
48
49 void traverseParticles() override;
50
51 [[nodiscard]] TraversalOption getTraversalType() const override { return TraversalOption::lc_c08; }
52
57 [[nodiscard]] bool isApplicable() const override { return true; }
58
62 void setSortingThreshold(size_t sortingThreshold) override { _cellHandler.setSortingThreshold(sortingThreshold); }
63
64 private:
66};
67
68template <class ParticleCell, class PairwiseFunctor>
70 auto &cells = *(this->_cells);
71 this->c08Traversal([&](unsigned long x, unsigned long y, unsigned long z) {
72 unsigned long baseIndex = utils::ThreeDimensionalMapping::threeToOneD(x, y, z, this->_cellsPerDimension);
73 _cellHandler.processBaseCell(cells, baseIndex);
74 });
75}
76
77} // namespace autopas
This class provides the base for traversals using the c08 base step.
Definition: C08BasedTraversal.h:24
std::array< unsigned long, 3 > _cellsPerDimension
The dimensions of the cellblock.
Definition: CellTraversal.h:55
std::array< unsigned long, 3 > _overlap
overlap of interacting cells.
Definition: ColorBasedTraversal.h:121
This class provides the base for traversals using the c08 base step.
Definition: LCC08CellHandler.h:28
This class provides the lc_c08 traversal.
Definition: LCC08Traversal.h:28
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: LCC08Traversal.h:62
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: LCC08Traversal.h:51
LCC08Traversal(const std::array< unsigned long, 3 > &dims, PairwiseFunctor *pairwiseFunctor, double interactionLength, const std::array< double, 3 > &cellLength, DataLayoutOption dataLayout, bool useNewton3)
Constructor of the lc_c08 traversal.
Definition: LCC08Traversal.h:40
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: LCC08Traversal.h:69
bool isApplicable() const override
C08 traversals are always usable.
Definition: LCC08Traversal.h:57
Interface for traversals used by the LinkedCell class.
Definition: LCTraversalInterface.h:18
PairwiseFunctor class.
Definition: PairwiseFunctor.h:31
Class for Cells of Particles.
Definition: ParticleCell.h:51
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:32