26template <
class ParticleCell,
class PairwiseFunctor>
40 static constexpr std::array<unsigned long, 3> _stride{3ul, 2ul, 1ul};
49 void processColorCell(
unsigned long xColorCell,
unsigned long yColorCell,
unsigned long zColorCell,
50 int towersPerColoringCell);
63 _functor(pairwiseFunctor),
64 _clusterFunctor(pairwiseFunctor, clusterSize, dataLayout, useNewton3) {}
66 [[nodiscard]] TraversalOption
getTraversalType()
const override {
return TraversalOption::vcl_c06; }
87 const auto towersPerColoringCell = clusterList.getNumTowersPerInteractionLength();
88 std::array<unsigned long, 2> coloringCellsPerDim{};
89 for (
int i = 0; i < 2; i++) {
90 coloringCellsPerDim[i] =
91 static_cast<unsigned long>(std::ceil(clusterList.getTowersPerDimension()[i] / (
double)towersPerColoringCell));
94 auto loopBody = [
this, towersPerColoringCell](
unsigned long x,
unsigned long y,
unsigned long z) {
95 processColorCell(x, y, z, towersPerColoringCell);
99 auto localStride = _stride;
101 {coloringCellsPerDim[0], coloringCellsPerDim[1], 1}, localStride);
115template <
class ParticleCell,
class PairwiseFunctor>
116void VCLC06Traversal<ParticleCell, PairwiseFunctor>::processColorCell(
unsigned long xColorCell,
117 unsigned long yColorCell,
118 unsigned long zColorCell,
119 int towersPerColoringCell) {
121 if (zColorCell != 0) {
126 const auto towersPerDim = clusterList.getTowersPerDimension();
128 for (
int yInner = 0; yInner < towersPerColoringCell; yInner++) {
129 for (
int xInner = 0; xInner < towersPerColoringCell; xInner++) {
130 const auto y = yColorCell * towersPerColoringCell + yInner;
131 const auto x = xColorCell * towersPerColoringCell + xInner;
134 if (x >= towersPerDim[0] or y >= towersPerDim[1]) {
138 auto ¤tTower = clusterList.getTowerByIndex(x, y);
139 for (
auto clusterIter = this->_useNewton3 ? currentTower.getClusters().begin()
140 : currentTower.getFirstOwnedCluster();
142 (this->_useNewton3 ? currentTower.getClusters().end() : currentTower.getFirstTailHaloCluster());
144 const auto isHaloCluster =
145 clusterIter < currentTower.getFirstOwnedCluster() or clusterIter >= currentTower.getFirstTailHaloCluster();
146 _clusterFunctor.processCluster(*clusterIter, isHaloCluster);
This class provides the base for traversals using base steps based on cell coloring.
Definition: ColorBasedTraversal.h:27
void colorTraversal(LoopBody &&loopBody, const std::array< unsigned long, 3 > &end, const std::array< unsigned long, 3 > &stride, const std::array< unsigned long, 3 > &offset={0ul, 0ul, 0ul})
The main traversal of the ColorBasedTraversal.
Definition: ColorBasedTraversal.h:132
PairwiseFunctor class.
Definition: PairwiseFunctor.h:31
Class for Cells of Particles.
Definition: ParticleCell.h:51
Particle_T ParticleType
The particle type for this cell.
Definition: ParticleCell.h:56
DataLayoutOption _dataLayout
The datalayout used by this traversal.
Definition: TraversalInterface.h:75
A traversal for VerletClusterLists that uses a coloring over the grids of the container.
Definition: VCLC06Traversal.h:28
void initTraversal() override
Initializes the traversal.
Definition: VCLC06Traversal.h:72
bool isApplicable() const override
Checks if the traversal is applicable to the current state of the domain.
Definition: VCLC06Traversal.h:68
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VCLC06Traversal.h:66
void endTraversal() override
Finalizes the traversal.
Definition: VCLC06Traversal.h:78
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: VCLC06Traversal.h:108
VCLC06Traversal(PairwiseFunctor *pairwiseFunctor, size_t clusterSize, DataLayoutOption dataLayout, bool useNewton3)
Constructor of the VCLClusterIterationTraversal.
Definition: VCLC06Traversal.h:60
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VCLC06Traversal.h:84
Interface for traversals of the VerletClusterLists container.
Definition: VCLTraversalInterface.h:20
VerletClusterLists< Particle_T > * _verletClusterLists
The cluster list to iterate over.
Definition: VCLTraversalInterface.h:53
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:63
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32