22template <
class Particle_T,
class PairwiseFunctor>
35 _functor(pairwiseFunctor),
36 _clusterFunctor(pairwiseFunctor, clusterSize, dataLayout, useNewton3) {}
38 [[nodiscard]] TraversalOption
getTraversalType()
const override {
return TraversalOption::vcl_c01_balanced; }
50 clusterList.loadParticlesIntoSoAs(_functor);
57 clusterList.extractParticlesFromSoAs(_functor);
62 auto &clusterThreadPartition = clusterList.getClusterThreadPartition();
64 auto numThreads = clusterThreadPartition.size();
67 const auto &clusterRange = clusterThreadPartition[threadNum];
69 size_t clusterCount = 0;
70 for (
size_t towerIndex = clusterRange.startTowerIndex;
71 clusterCount < clusterRange.numClusters and towerIndex < towers.size(); towerIndex++) {
72 auto ¤tTower = towers[towerIndex];
73 auto startIndexInTower =
74 clusterCount == 0 ? clusterRange.startIndexInTower : currentTower.getFirstOwnedClusterIndex();
75 for (
size_t clusterIndex = startIndexInTower;
76 clusterCount < clusterRange.numClusters and clusterIndex < currentTower.getFirstTailHaloClusterIndex();
77 clusterIndex++, clusterCount++) {
78 const auto isHaloCluster = clusterIndex < currentTower.getFirstOwnedClusterIndex() or
79 clusterIndex >= currentTower.getFirstTailHaloClusterIndex();
80 _clusterFunctor.processCluster(currentTower.getCluster(clusterIndex), isHaloCluster);
83 if (clusterCount != clusterRange.numClusters) {
85 "VCLC01BalancedTraversal::traverseParticlePairs(): Not all or too many clusters traversed, probably "
86 "the clusterThreadPartitions are wrong! TraversedClusters={}, ClustersInRange={}",
87 clusterCount, clusterRange.numClusters);
#define AUTOPAS_OPENMP(args)
Empty macro to throw away any arguments.
Definition: WrapOpenMP.h:126
PairwiseFunctor class.
Definition: PairwiseFunctor.h:45
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: VCLC01BalancedTraversal.h:23
void initTraversal() override
Initializes the traversal.
Definition: VCLC01BalancedTraversal.h:46
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VCLC01BalancedTraversal.h:60
VCLC01BalancedTraversal(PairwiseFunctor &pairwiseFunctor, size_t clusterSize, DataLayoutOption dataLayout, bool useNewton3)
Constructor of the VCLC01BalancedTraversal.
Definition: VCLC01BalancedTraversal.h:32
bool isApplicableToDomain() const override
VCL C01 Balanced is always applicable to the domain.
Definition: VCLC01BalancedTraversal.h:44
void endTraversal() override
Finalizes the traversal.
Definition: VCLC01BalancedTraversal.h:53
bool needsStaticClusterThreadPartition() override
Returns whether this traversal needs the static cluster thread partition of the cluster list.
Definition: VCLC01BalancedTraversal.h:92
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VCLC01BalancedTraversal.h:38
Interface for traversals of the VerletClusterLists container.
Definition: VCLTraversalInterface.h:20
Provides methods to traverse a single cluster and a pair of clusters.
Definition: VCLClusterFunctor.h:21
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:64
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:34
int autopas_get_thread_num()
Dummy for omp_set_lock() when no OpenMP is available.
Definition: WrapOpenMP.h:132