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>
23
24class VLCCellPairC08Traversal : public C08BasedTraversal<ParticleCell, PairwiseFunctor>,
25 public VLCCellPairTraversalInterface<typename ParticleCell::ParticleType> {
26 public:
37 explicit VLCCellPairC08Traversal(const std::array<unsigned long, 3> &dims, PairwiseFunctor *pairwiseFunctor,
38 double interactionLength, const std::array<double, 3> &cellLength,
39 DataLayoutOption dataLayout, bool useNewton3)
40 : C08BasedTraversal<ParticleCell, PairwiseFunctor>(dims, pairwiseFunctor, interactionLength, cellLength,
41 dataLayout, useNewton3),
42 _functor(pairwiseFunctor),
43 _cellHandler(dims, interactionLength, cellLength) {}
44
45 void traverseParticles() override;
46
47 [[nodiscard]] bool isApplicable() const override {
48 return (this->_dataLayout == DataLayoutOption::aos or this->_dataLayout == DataLayoutOption::soa);
49 }
50
51 [[nodiscard]] TraversalOption getTraversalType() const override { return TraversalOption::vlp_c08; }
52
57 void setSortingThreshold(size_t sortingThreshold) override {}
58
59 private:
60 PairwiseFunctor *_functor;
66};
67
68template <class ParticleCell, class PairwiseFunctor>
70 if (this->_dataLayout == DataLayoutOption::soa) {
71 _soa = this->_cellPairVerletList->loadSoA(_functor);
72 }
73
74 this->c08Traversal([&](unsigned long x, unsigned long y, unsigned long z) {
75 const auto baseIndex = utils::ThreeDimensionalMapping::threeToOneD(x, y, z, this->_cellsPerDimension);
76 _cellHandler.processCellListsC08(*(this->_cellPairVerletList), baseIndex, _functor, this->_dataLayout, _soa,
77 this->_useNewton3);
78 });
79
80 if (this->_dataLayout == DataLayoutOption::soa) {
81 this->_cellPairVerletList->extractSoA(_functor);
82 _soa = nullptr;
83 }
84}
85
86} // namespace autopas
This class provides the base for traversals using the c08 base step.
Definition: C08BasedTraversal.h:24
PairwiseFunctor class.
Definition: PairwiseFunctor.h:31
Class for Cells of Particles.
Definition: ParticleCell.h:51
Structur of the array class.
Definition: SoA.h:28
DataLayoutOption _dataLayout
The datalayout used by this traversal.
Definition: TraversalInterface.h:75
This class provides the base logic for the c08 traversal for VLCCellPairNeighborList.
Definition: VLCCellPairC08CellHandler.h:20
C08 traversal for VLCCellPairNeighborList.
Definition: VLCCellPairC08Traversal.h:25
bool isApplicable() const override
Checks if the traversal is applicable to the current state of the domain.
Definition: VLCCellPairC08Traversal.h:47
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VLCCellPairC08Traversal.h:51
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VLCCellPairC08Traversal.h:69
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 fot VLCCellPairNeighborList.
Definition: VLCCellPairC08Traversal.h:37
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: VLCCellPairC08Traversal.h:57
Interface for traversals used with VLCCellPairNeighborList.
Definition: VLCCellPairTraversalInterface.h:16
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