AutoPas  3.0.0
Loading...
Searching...
No Matches
VLCC08Traversal.h
Go to the documentation of this file.
1
7#pragma once
8
14
15namespace autopas {
16
30template <class ParticleCell, class PairwiseFunctor, class NeighborList>
31class VLCC08Traversal : public C08BasedTraversal<ParticleCell, PairwiseFunctor>,
32 public VLCTraversalInterface<typename ParticleCell::ParticleType, NeighborList> {
33 public:
44 explicit VLCC08Traversal(const std::array<unsigned long, 3> &dims, PairwiseFunctor *pairwiseFunctor,
45 double interactionLength, const std::array<double, 3> &cellLength,
46 DataLayoutOption dataLayout, bool useNewton3)
47 : C08BasedTraversal<ParticleCell, PairwiseFunctor>(dims, pairwiseFunctor, interactionLength, cellLength,
48 dataLayout, useNewton3),
49 VLCTraversalInterface<typename ParticleCell::ParticleType, NeighborList>(ContainerOption::verletListsCells),
50 _functor(pairwiseFunctor) {}
51
52 void traverseParticles() override;
53
54 [[nodiscard]] TraversalOption getTraversalType() const override { return TraversalOption::vlc_c08; }
55
56 [[nodiscard]] bool isApplicable() const override {
57 // This traversal is only safe to use for CSF>=1
58 const double minCellLength = *std::min_element(this->_cellLength.cbegin(), this->_cellLength.cend());
59 const bool maxOneCellInCutoff = minCellLength >= this->_interactionLength;
60
61 return maxOneCellInCutoff;
62 }
63
68 void setSortingThreshold(size_t sortingThreshold) override {}
69
70 private:
71 PairwiseFunctor *_functor;
72};
73
74template <class ParticleCell, class PairwiseFunctor, class NeighborList>
76 if (this->_dataLayout == DataLayoutOption::soa) {
77 this->loadSoA(_functor, *(this->_verletList));
78 }
79
80 this->c08Traversal([&](unsigned long x, unsigned long y, unsigned long z) {
81 const auto baseIndex = utils::ThreeDimensionalMapping::threeToOneD(x, y, z, this->_cellsPerDimension);
82 this->template processCellLists<PairwiseFunctor>(*(this->_verletList), baseIndex, _functor, this->_dataLayout,
83 this->_useNewton3);
84 });
85
86 if (this->_dataLayout == DataLayoutOption::soa) {
87 this->extractSoA(_functor, *(this->_verletList));
88 }
89}
90
91} // 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:31
Class for Cells of Particles.
Definition: ParticleCell.h:51
This class provides the vlc_c08 traversal.
Definition: VLCC08Traversal.h:32
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:44
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VLCC08Traversal.h:75
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: VLCC08Traversal.h:68
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VLCC08Traversal.h:54
bool isApplicable() const override
Checks if the traversal is applicable to the current state of the domain.
Definition: VLCC08Traversal.h:56
This class provides the Traversal Interface for the verlet lists cells container.
Definition: VLCTraversalInterface.h:27
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