AutoPas  3.0.0
Loading...
Searching...
No Matches
VCLClusterIterationTraversal.h
Go to the documentation of this file.
1
7#pragma once
8
12
13namespace autopas {
14
21template <class ParticleCell, class PairwiseFunctor>
23 public VCLTraversalInterface<typename ParticleCell::ParticleType> {
24 using ParticleType = typename ParticleCell::ParticleType;
25
26 public:
34 explicit VCLClusterIterationTraversal(PairwiseFunctor *pairwiseFunctor, size_t clusterSize,
35 DataLayoutOption dataLayout, bool useNewton3)
36 : TraversalInterface(dataLayout, useNewton3),
37 _functor(pairwiseFunctor),
38 _clusterFunctor(pairwiseFunctor, clusterSize, dataLayout, useNewton3) {}
39
40 [[nodiscard]] TraversalOption getTraversalType() const override { return TraversalOption::vcl_cluster_iteration; }
41
42 [[nodiscard]] bool isApplicable() const override {
43 return (_dataLayout == DataLayoutOption::aos or _dataLayout == DataLayoutOption::soa) and not _useNewton3;
44 }
45
46 void initTraversal() override {
47 if (_dataLayout == DataLayoutOption::soa) {
48 VCLTraversalInterface<ParticleType>::_verletClusterLists->loadParticlesIntoSoAs(_functor);
49 }
50 }
51
52 void endTraversal() override {
53 if (_dataLayout == DataLayoutOption::soa) {
54 VCLTraversalInterface<ParticleType>::_verletClusterLists->extractParticlesFromSoAs(_functor);
55 }
56 }
57
58 void traverseParticles() override {
60
61 const auto _clusterTraverseFunctor = [this](internal::Cluster<ParticleType> &cluster) {
62 _clusterFunctor.processCluster(cluster, false);
63 };
64
65 clusterList.template traverseClusters<true>(_clusterTraverseFunctor);
66 }
67
68 private:
69 PairwiseFunctor *_functor;
71};
72} // namespace autopas
PairwiseFunctor class.
Definition: PairwiseFunctor.h:31
Particle_T ParticleType
The particle type for this cell.
Definition: ParticleCell.h:56
This interface serves as a common parent class for all traversals.
Definition: TraversalInterface.h:18
DataLayoutOption _dataLayout
The datalayout used by this traversal.
Definition: TraversalInterface.h:75
bool _useNewton3
If this traversal makes use of newton3.
Definition: TraversalInterface.h:80
Traversal for VerletClusterLists.
Definition: VCLClusterIterationTraversal.h:23
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VCLClusterIterationTraversal.h:40
void initTraversal() override
Initializes the traversal.
Definition: VCLClusterIterationTraversal.h:46
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VCLClusterIterationTraversal.h:58
void endTraversal() override
Finalizes the traversal.
Definition: VCLClusterIterationTraversal.h:52
VCLClusterIterationTraversal(PairwiseFunctor *pairwiseFunctor, size_t clusterSize, DataLayoutOption dataLayout, bool useNewton3)
Constructor of the VCLClusterIterationTraversal.
Definition: VCLClusterIterationTraversal.h:34
bool isApplicable() const override
Checks if the traversal is applicable to the current state of the domain.
Definition: VCLClusterIterationTraversal.h:42
Interface for traversals of the VerletClusterLists container.
Definition: VCLTraversalInterface.h:20
This class represents a cluster in the VerletClusterLists container.
Definition: Cluster.h:26
Provides methods to traverse a single cluster and a pair of clusters.
Definition: VCLClusterFunctor.h:21
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32