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