AutoPas  3.0.0
Loading...
Searching...
No Matches
LCSlicedBalancedTraversal.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <algorithm>
11
18
19namespace autopas {
20
34template <class ParticleCell, class PairwiseFunctor>
35class LCSlicedBalancedTraversal : public SlicedBalancedBasedTraversal<ParticleCell, PairwiseFunctor>,
37 public:
48 explicit LCSlicedBalancedTraversal(const std::array<unsigned long, 3> &dims, PairwiseFunctor *pairwiseFunctor,
49 double interactionLength, const std::array<double, 3> &cellLength,
50 DataLayoutOption dataLayout, bool useNewton3)
51 : SlicedBalancedBasedTraversal<ParticleCell, PairwiseFunctor>(dims, pairwiseFunctor, interactionLength,
52 cellLength, dataLayout, useNewton3, true),
53 _cellHandler(pairwiseFunctor, this->_cellsPerDimension, interactionLength, cellLength, this->_overlap,
54 dataLayout, useNewton3) {}
55
56 void traverseParticles() override;
57
58 [[nodiscard]] TraversalOption getTraversalType() const override { return TraversalOption::lc_sliced_balanced; }
59
63 void setSortingThreshold(size_t sortingThreshold) override { _cellHandler.setSortingThreshold(sortingThreshold); }
64
65 private:
67};
68
69template <class ParticleCell, class PairwiseFunctor>
71 auto &cells = *(this->_cells);
72 this->slicedTraversal([&](unsigned long x, unsigned long y, unsigned long z) {
73 auto id = utils::ThreeDimensionalMapping::threeToOneD(x, y, z, this->_cellsPerDimension);
74 _cellHandler.processBaseCell(cells, id);
75 });
76}
77
78} // 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:28
This class provides the balanced sliced traversal.
Definition: LCSlicedBalancedTraversal.h:36
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: LCSlicedBalancedTraversal.h:70
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: LCSlicedBalancedTraversal.h:58
LCSlicedBalancedTraversal(const std::array< unsigned long, 3 > &dims, PairwiseFunctor *pairwiseFunctor, double interactionLength, const std::array< double, 3 > &cellLength, DataLayoutOption dataLayout, bool useNewton3)
Constructor of the balanced sliced traversal.
Definition: LCSlicedBalancedTraversal.h:48
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: LCSlicedBalancedTraversal.h:63
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
This class provides a load balanced version of the base sliced traversal.
Definition: SlicedBalancedBasedTraversal.h:30
std::array< unsigned long, 3 > _overlap
Overlap of interacting cells.
Definition: SlicedBasedTraversal.h:142
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