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
46 [[nodiscard]] bool isApplicableToDomain() const override { return true; }
47
48 void initTraversal() override {
49 if (_dataLayout == DataLayoutOption::soa) {
50 VCLTraversalInterface<ParticleType>::_verletClusterLists->loadParticlesIntoSoAs(_functor);
51 }
52 }
53
54 void endTraversal() override {
55 if (_dataLayout == DataLayoutOption::soa) {
56 VCLTraversalInterface<ParticleType>::_verletClusterLists->extractParticlesFromSoAs(_functor);
57 }
58 }
59
60 void traverseParticles() override {
62
63 const auto _clusterTraverseFunctor = [this](internal::Cluster<ParticleType> &cluster) {
64 _clusterFunctor.processCluster(cluster, false);
65 };
66
67 clusterList.template traverseClusters<true>(_clusterTraverseFunctor);
68 }
69
70 private:
71 PairwiseFunctor &_functor;
73};
74} // namespace autopas
PairwiseFunctor class.
Definition: PairwiseFunctor.h:45
Particle_T ParticleType
The particle type for this cell.
Definition: ParticleCell.h:54
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:77
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
VCLClusterIterationTraversal(PairwiseFunctor &pairwiseFunctor, size_t clusterSize, DataLayoutOption dataLayout, bool useNewton3)
Constructor of the VCLClusterIterationTraversal.
Definition: VCLClusterIterationTraversal.h:34
void initTraversal() override
Initializes the traversal.
Definition: VCLClusterIterationTraversal.h:48
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VCLClusterIterationTraversal.h:60
void endTraversal() override
Finalizes the traversal.
Definition: VCLClusterIterationTraversal.h:54
bool isApplicableToDomain() const override
VCL Cluster Iteration is always applicable to the domain.
Definition: VCLClusterIterationTraversal.h:46
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:34