AutoPas  3.0.0
Loading...
Searching...
No Matches
DirectSum.h
Go to the documentation of this file.
1
8#pragma once
9
24#include "autopas/utils/inBox.h"
25
26namespace autopas {
27
45template <class Particle_T>
46class DirectSum : public CellBasedParticleContainer<FullParticleCell<Particle_T>> {
47 public:
52
56 using ParticleType = Particle_T;
57
67 DirectSum(const std::array<double, 3> &boxMin, const std::array<double, 3> &boxMax, double cutoff, double skin,
68 const size_t aosSortingThreshold, const size_t soaSortingThreshold)
69 : CellBasedParticleContainer<ParticleCellType>(boxMin, boxMax, cutoff, skin, aosSortingThreshold,
70 soaSortingThreshold),
71 _cellBorderFlagManager() {
72 using namespace autopas::utils::ArrayMath::literals;
73 // 1 owned and 6 halo cells
74 this->_cells.resize(7);
75 this->_cells[0].setPossibleParticleOwnerships(OwnershipState::owned);
76 std::for_each(++this->_cells.begin(), this->_cells.end(),
77 [&](auto &cell) { cell.setPossibleParticleOwnerships(OwnershipState::halo); });
78 auto boxLength = boxMax - boxMin;
79 this->_cells[0].setCellLength(boxLength);
80 }
81
85 [[nodiscard]] ContainerOption getContainerType() const override { return ContainerOption::directSum; }
86
87 void reserve(size_t numParticles, size_t numParticlesHaloEstimate) override {
88 this->getOwnedCell().reserve(numParticles);
89 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
90 cellIt->reserve(numParticlesHaloEstimate);
91 }
92 };
93
97 void addParticleImpl(const Particle_T &p) override { getOwnedCell().addParticle(p); }
98
102 void addHaloParticleImpl(const Particle_T &haloParticle) override {
103 const auto boxMax = this->getBoxMax();
104 const auto boxMin = this->getBoxMin();
105 const auto pos = haloParticle.getR();
106
107 for (size_t dim = 0; dim < 3; ++dim) {
108 if (pos[dim] < boxMin[dim]) {
109 this->_cells[2 * dim + 1].addParticle(haloParticle);
110 return;
111 } else if (pos[dim] >= boxMax[dim]) {
112 this->_cells[2 * dim + 2].addParticle(haloParticle);
113 return;
114 }
115 }
116 }
117
121 bool updateHaloParticle(const Particle_T &haloParticle) override {
122 const auto boxMax = this->getBoxMax();
123 const auto boxMin = this->getBoxMin();
124 const auto pos = haloParticle.getR();
125 const auto skinHalf = 0.5 * this->getVerletSkin();
126
127 // Look for the particle in halo cells that are within half the skin distance of its position
128 for (size_t dim = 0; dim < 3; ++dim) {
129 if (pos[dim] < boxMin[dim] + skinHalf) {
130 if (internal::checkParticleInCellAndUpdateByIDAndPosition(this->_cells[2 * dim + 1], haloParticle, skinHalf)) {
131 return true;
132 }
133 } else if (pos[dim] >= boxMax[dim] - skinHalf) {
134 if (internal::checkParticleInCellAndUpdateByIDAndPosition(this->_cells[2 * dim + 2], haloParticle, skinHalf)) {
135 return true;
136 }
137 }
138 }
139 return false;
140 }
141
142 void deleteHaloParticles() override {
143 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
144 cellIt->clear();
145 }
146 }
147
148 void rebuildNeighborLists(TraversalInterface *traversal) override {
149 // nothing to do.
150 }
151
152 void computeInteractions(TraversalInterface *traversal) override {
153 prepareTraversal(traversal);
154
155 traversal->initTraversal();
156 traversal->traverseParticles();
157 traversal->endTraversal();
158 }
159
160 [[nodiscard]] std::vector<Particle_T> updateContainer(bool keepNeighborListsValid) override {
161 if (keepNeighborListsValid) {
163 }
164 // first we delete halo particles, as we don't want them here.
166 getOwnedCell().deleteDummyParticles();
167
168 std::vector<Particle_T> invalidParticles{};
169 auto &particleVec = getOwnedCell()._particles;
170 for (auto iter = particleVec.begin(); iter != particleVec.end();) {
171 if (utils::notInBox(iter->getR(), this->getBoxMin(), this->getBoxMax())) {
172 invalidParticles.push_back(*iter);
173 // swap-delete
174 *iter = particleVec.back();
175 particleVec.pop_back();
176 } else {
177 ++iter;
178 }
179 }
180 return invalidParticles;
181 }
182
186 [[nodiscard]] TraversalSelectorInfo getTraversalSelectorInfo() const override {
187 using namespace autopas::utils::ArrayMath::literals;
188
189 // direct sum consists of seven cells (owned + two halo cells in each dimension)
191 // DS container can be viewed as a 3x3x3 grid with some halo cells being combined.
192 {3, 3, 3},
193 // intentionally use cutoff here, as ds_sequential should be using the cutoff.
194 this->getCutoff(), this->getBoxMax() - this->getBoxMin(), 0);
195 }
196
201 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo,
203 std::nullopt) override {
204 return ContainerIterator<Particle_T, true, false>(*this, behavior, additionalVectors);
205 }
206
211 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo,
213 std::nullopt) const override {
214 return ContainerIterator<Particle_T, false, false>(*this, behavior, additionalVectors);
215 }
216
220 template <typename Lambda>
221 void forEach(Lambda forEachLambda, IteratorBehavior behavior) {
222 if (behavior & IteratorBehavior::owned) {
223 getOwnedCell().forEach(forEachLambda);
224 }
225 if (behavior & IteratorBehavior::halo) {
226 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
227 cellIt->forEach(forEachLambda);
228 }
229 }
230 // sanity check
231 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
232 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
233 }
234 }
235
239 template <typename Lambda, typename A>
240 void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior) {
241 if (behavior & IteratorBehavior::owned) {
242 getOwnedCell().reduce(reduceLambda, result);
243 }
244 if (behavior & IteratorBehavior::halo) {
245 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
246 cellIt->reduce(reduceLambda, result);
247 }
248 }
249 // sanity check
250 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
251 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
252 }
253 }
254
259 const std::array<double, 3> &lowerCorner, const std::array<double, 3> &higherCorner, IteratorBehavior behavior,
261 std::nullopt) override {
262 return ContainerIterator<Particle_T, true, true>(*this, behavior, additionalVectors, lowerCorner, higherCorner);
263 }
264
269 const std::array<double, 3> &lowerCorner, const std::array<double, 3> &higherCorner, IteratorBehavior behavior,
271 std::nullopt) const override {
272 return ContainerIterator<Particle_T, false, true>(*this, behavior, additionalVectors, lowerCorner, higherCorner);
273 }
274
278 template <typename Lambda>
279 void forEachInRegion(Lambda forEachLambda, const std::array<double, 3> &lowerCorner,
280 const std::array<double, 3> &higherCorner, IteratorBehavior behavior) {
281 if (behavior & IteratorBehavior::owned) {
282 getOwnedCell().forEach(forEachLambda, lowerCorner, higherCorner, behavior);
283 }
284 if (behavior & IteratorBehavior::halo) {
285 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
286 cellIt->forEach(forEachLambda, lowerCorner, higherCorner, behavior);
287 }
288 }
289 // sanity check
290 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
291 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
292 }
293 }
294
298 template <typename Lambda, typename A>
299 void reduceInRegion(Lambda reduceLambda, A &result, const std::array<double, 3> &lowerCorner,
300 const std::array<double, 3> &higherCorner, IteratorBehavior behavior) {
301 if (behavior & IteratorBehavior::owned) {
302 getOwnedCell().reduce(reduceLambda, result, lowerCorner, higherCorner, behavior);
303 }
304 if (behavior & IteratorBehavior::halo) {
305 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
306 cellIt->reduce(reduceLambda, result, lowerCorner, higherCorner, behavior);
307 }
308 }
309 // sanity check
310 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
311 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
312 }
313 }
314
315 std::tuple<const Particle_T *, size_t, size_t> getParticle(size_t cellIndex, size_t particleIndex,
316 IteratorBehavior iteratorBehavior,
317 const std::array<double, 3> &boxMin,
318 const std::array<double, 3> &boxMax) const override {
319 return getParticleImpl<true>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
320 }
321 std::tuple<const Particle_T *, size_t, size_t> getParticle(size_t cellIndex, size_t particleIndex,
322 IteratorBehavior iteratorBehavior) const override {
323 // this is not a region iter hence we stretch the bounding box to the numeric max
324 constexpr std::array<double, 3> boxMin{std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest(),
325 std::numeric_limits<double>::lowest()};
326
327 constexpr std::array<double, 3> boxMax{std::numeric_limits<double>::max(), std::numeric_limits<double>::max(),
328 std::numeric_limits<double>::max()};
329 return getParticleImpl<false>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
330 }
331
335 bool deleteParticle(Particle_T &particle) override {
336 // swap-delete helper function
337 auto swapDelFromCell = [&](auto &particleCell) -> bool {
338 auto &particleVec = particleCell._particles;
339 const bool isRearParticle = &particle == &particleVec.back();
340 particle = particleVec.back();
341 particleVec.pop_back();
342 return isRearParticle;
343 };
344
345 // deduce into which vector the reference points
346 if (particle.isOwned()) {
347 return swapDelFromCell(getOwnedCell());
348 } else if (particle.isHalo()) {
349 const auto boxMin = this->getBoxMin();
350 const auto boxMax = this->getBoxMax();
351 const auto skinHalf = 0.5 * this->getVerletSkin();
352 const auto pos = particle.getR();
353
354 // Look for the particle in halo cells that are within half the skinHalf distance of its position
355 for (size_t dim = 0; dim < 3; ++dim) {
356 if (pos[dim] < boxMin[dim] + skinHalf) {
357 if (swapDelFromCell(this->_cells[2 * dim + 1])) {
358 return true;
359 }
360 } else if (pos[dim] >= boxMax[dim] - skinHalf) {
361 if (swapDelFromCell(this->_cells[2 * dim + 2])) {
362 return true;
363 }
364 }
365 }
366 }
367 return false;
368 }
369
370 bool deleteParticle(size_t cellIndex, size_t particleIndex) override {
371 auto &particleVec = this->_cells[cellIndex]._particles;
372 auto &particle = particleVec[particleIndex];
373 // swap-delete
374 particle = particleVec.back();
375 particleVec.pop_back();
376 return particleIndex < particleVec.size();
377 }
378
379 private:
380 class DirectSumCellBorderAndFlagManager : public internal::CellBorderAndFlagManager {
384 using index_t = std::size_t;
385
386 public:
387 [[nodiscard]] bool cellCanContainHaloParticles(index_t index1d) const override {
388 return index1d >= 1 and index1d <= 6;
389 }
390
391 [[nodiscard]] bool cellCanContainOwnedParticles(index_t index1d) const override { return index1d == 0; }
392
393 } _cellBorderFlagManager;
394
406 template <bool regionIter>
407 std::tuple<const Particle_T *, size_t, size_t> getParticleImpl(size_t cellIndex, size_t particleIndex,
408 IteratorBehavior iteratorBehavior,
409 const std::array<double, 3> &boxMin,
410 const std::array<double, 3> &boxMax) const {
411 // first and last relevant cell index
412 const auto [startCellIndex, endCellIndex] = [&]() -> std::tuple<size_t, size_t> {
413 // shortcuts to limit the iterator to only part of the domain.
414 if (not(iteratorBehavior & IteratorBehavior::halo)) {
415 // only owned region
416 return {0, 0};
417 }
418 if (not(iteratorBehavior & IteratorBehavior::owned)) {
419 // only halo region
420 return {1, 6};
421 }
422 if constexpr (regionIter) {
423 // if the region lies fully within the container only look at the owned cell
424 if (utils::ArrayMath::less(this->getBoxMin(), boxMin) and utils::ArrayMath::less(boxMax, this->getBoxMax())) {
425 return {0, 0};
426 }
427 }
428 // all cells
429 return {0, 6};
430 }();
431
432 // if we are at the start of an iteration determine this thread's cell index
433 if (cellIndex == 0 and particleIndex == 0) {
434 cellIndex =
435 startCellIndex + ((iteratorBehavior & IteratorBehavior::forceSequential) ? 0 : autopas_get_thread_num());
436 }
437 // abort if the index is out of bounds
438 if (cellIndex >= this->_cells.size()) {
439 return {nullptr, 0, 0};
440 }
441 // check the data behind the indices
442 if (particleIndex >= this->_cells[cellIndex].size() or
443 not containerIteratorUtils::particleFulfillsIteratorRequirements<regionIter>(
444 this->_cells[cellIndex][particleIndex], iteratorBehavior, boxMin, boxMax)) {
445 // either advance them to something interesting or invalidate them.
446 std::tie(cellIndex, particleIndex) =
447 advanceIteratorIndices<regionIter>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
448 }
449
450 // shortcut if the given index doesn't exist
451 if (cellIndex >= this->_cells.size()) {
452 return {nullptr, 0, 0};
453 }
454 const Particle_T *retPtr = &this->_cells[cellIndex][particleIndex];
455
456 return {retPtr, cellIndex, particleIndex};
457 }
458
470 template <bool regionIter>
471 std::tuple<size_t, size_t> advanceIteratorIndices(size_t cellIndex, size_t particleIndex,
472 IteratorBehavior iteratorBehavior,
473 const std::array<double, 3> &boxMin,
474 const std::array<double, 3> &boxMax) const {
475 // Find the indices for the next particle
476 const size_t stride = (iteratorBehavior & IteratorBehavior::forceSequential) ? 1 : autopas_get_num_threads();
477
478 do {
479 // advance to the next particle
480 ++particleIndex;
481 // If this breaches the end of a cell, find the next non-empty cell and reset particleIndex.
482 while (particleIndex >= this->_cells[cellIndex].size()) {
483 cellIndex += stride;
484 particleIndex = 0;
485 // If there are no more reasonable cells return invalid indices.
486 if (cellIndex > ((not(iteratorBehavior & IteratorBehavior::halo)) ? 0 : (this->_cells.size() - 1))) {
487 return {std::numeric_limits<decltype(cellIndex)>::max(), std::numeric_limits<decltype(particleIndex)>::max()};
488 }
489 }
490 } while (not containerIteratorUtils::particleFulfillsIteratorRequirements<regionIter>(
491 this->_cells[cellIndex][particleIndex], iteratorBehavior, boxMin, boxMax));
492
493 // the indices returned at this point should always be valid
494 return {cellIndex, particleIndex};
495 }
496
502 template <typename Traversal>
503 void prepareTraversal(Traversal &traversal) {
504 auto *dsTraversal = dynamic_cast<DSTraversalInterface *>(traversal);
505 auto *cellTraversal = dynamic_cast<CellTraversal<ParticleCellType> *>(traversal);
506 if (dsTraversal && cellTraversal) {
507 cellTraversal->setAoSSortingThreshold(this->_aosSortingThreshold);
508 cellTraversal->setSoASortingThreshold(this->_soaSortingThreshold);
509 cellTraversal->setCellsToTraverse(this->_cells);
510 } else {
512 "The selected traversal is not compatible with the DirectSum container. TraversalID: {}",
513 traversal->getTraversalType());
514 }
515 }
516
517 ParticleCellType &getOwnedCell() { return this->_cells[0]; };
518
519 ParticleCellType &getHaloCell() { return this->_cells[1]; };
520};
521
522} // namespace autopas
The CellBasedParticleContainer class stores particles in some object and provides methods to iterate ...
Definition: CellBasedParticleContainer.h:25
const std::array< double, 3 > & getBoxMax() const final
Get the upper corner of the container without halo.
Definition: CellBasedParticleContainer.h:74
size_t size() const override
Get the total number of particles saved in the container (owned + halo + dummy).
Definition: CellBasedParticleContainer.h:136
double getVerletSkin() const final
Returns the verlet Skin length.
Definition: CellBasedParticleContainer.h:99
double getCutoff() const final
Return the cutoff of the container.
Definition: CellBasedParticleContainer.h:84
size_t _aosSortingThreshold
If the number of particles in a cell or cell pair exceeds this threshold, the particles will be sorte...
Definition: CellBasedParticleContainer.h:167
const std::array< double, 3 > & getBoxMin() const final
Get the lower corner of the container without halo.
Definition: CellBasedParticleContainer.h:79
size_t _soaSortingThreshold
If the sum of the SoA buffer sizes of two cells exceeds this threshold, SoAFunctorPairSorted is used.
Definition: CellBasedParticleContainer.h:171
std::vector< ParticleCellType > _cells
Vector of particle cells.
Definition: CellBasedParticleContainer.h:162
A cell pair traversal.
Definition: CellTraversal.h:23
virtual void setAoSSortingThreshold(size_t aosSortingThreshold)=0
Set the aos-sorting-threshold for traversals that use the CellFunctor If the sum of the number of par...
Public iterator class that iterates over a particle container and additional vectors (which are typic...
Definition: ContainerIterator.h:95
std::conditional_t< modifiable, std::vector< std::vector< Particle_T > * >, std::vector< std::vector< Particle_T > const * > > ParticleVecType
Type of the additional vector collection.
Definition: ContainerIterator.h:108
Interface for traversals used by the DirectSum container.
Definition: DSTraversalInterface.h:18
This class stores all owned particles in a single cell.
Definition: DirectSum.h:46
bool deleteParticle(size_t cellIndex, size_t particleIndex) override
Deletes the particle at the given index positions as long as this does not compromise the validity of...
Definition: DirectSum.h:370
std::tuple< const Particle_T *, size_t, size_t > getParticle(size_t cellIndex, size_t particleIndex, IteratorBehavior iteratorBehavior) const override
Fetch the pointer to a particle, identified via a cell and particle index.
Definition: DirectSum.h:321
bool deleteParticle(Particle_T &particle) override
Deletes the given particle as long as this does not compromise the validity of the container.
Definition: DirectSum.h:335
void addParticleImpl(const Particle_T &p) override
Adds a particle to the container.
Definition: DirectSum.h:97
void reduceInRegion(Lambda reduceLambda, A &result, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior)
Execute code on all particles in this container in a certain region as defined by a lambda function.
Definition: DirectSum.h:299
TraversalSelectorInfo getTraversalSelectorInfo() const override
Generates a traversal selector info for this container.
Definition: DirectSum.h:186
void forEachInRegion(Lambda forEachLambda, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior)
Execute code on all particles in this container in a certain region as defined by a lambda function.
Definition: DirectSum.h:279
ContainerIterator< Particle_T, false, false > begin(IteratorBehavior behavior=IteratorBehavior::ownedOrHalo, utils::optRef< typename ContainerIterator< Particle_T, false, false >::ParticleVecType > additionalVectors=std::nullopt) const override
Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .
Definition: DirectSum.h:210
void rebuildNeighborLists(TraversalInterface *traversal) override
Rebuilds the neighbor lists for the next traversals.
Definition: DirectSum.h:148
void deleteHaloParticles() override
Deletes all halo particles.
Definition: DirectSum.h:142
FullParticleCell< Particle_T > ParticleCellType
Type of the ParticleCell.
Definition: DirectSum.h:51
void reserve(size_t numParticles, size_t numParticlesHaloEstimate) override
Reserve memory for a given number of particles in the container and logic layers.
Definition: DirectSum.h:87
std::tuple< const Particle_T *, size_t, size_t > getParticle(size_t cellIndex, size_t particleIndex, IteratorBehavior iteratorBehavior, const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax) const override
Fetch the pointer to a particle, identified via a cell and particle index.
Definition: DirectSum.h:315
void computeInteractions(TraversalInterface *traversal) override
Iterates over all particle multiples (e.g.
Definition: DirectSum.h:152
DirectSum(const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax, double cutoff, double skin, const size_t aosSortingThreshold, const size_t soaSortingThreshold)
Constructor of the DirectSum class.
Definition: DirectSum.h:67
std::vector< Particle_T > updateContainer(bool keepNeighborListsValid) override
Updates the container.
Definition: DirectSum.h:160
ContainerIterator< Particle_T, true, true > getRegionIterator(const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior, utils::optRef< typename ContainerIterator< Particle_T, true, true >::ParticleVecType > additionalVectors=std::nullopt) override
Iterate over all particles in a specified region for(auto iter = container.getRegionIterator(lowCorne...
Definition: DirectSum.h:258
void forEach(Lambda forEachLambda, IteratorBehavior behavior)
Execute code on all particles in this container as defined by a lambda function.
Definition: DirectSum.h:221
bool updateHaloParticle(const Particle_T &haloParticle) override
Update a halo particle of the container with the given haloParticle.
Definition: DirectSum.h:121
void addHaloParticleImpl(const Particle_T &haloParticle) override
Adds a particle to the container that lies in the halo region of the container.
Definition: DirectSum.h:102
ContainerIterator< Particle_T, false, true > getRegionIterator(const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior, utils::optRef< typename ContainerIterator< Particle_T, false, true >::ParticleVecType > additionalVectors=std::nullopt) const override
Iterate over all particles in a specified region for(auto iter = container.getRegionIterator(lowCorne...
Definition: DirectSum.h:268
ContainerOption getContainerType() const override
Get the ContainerType.
Definition: DirectSum.h:85
Particle_T ParticleType
Type of the Particle.
Definition: DirectSum.h:56
ContainerIterator< Particle_T, true, false > begin(IteratorBehavior behavior=IteratorBehavior::ownedOrHalo, utils::optRef< typename ContainerIterator< Particle_T, true, false >::ParticleVecType > additionalVectors=std::nullopt) override
Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .
Definition: DirectSum.h:200
void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior)
Reduce properties of particles as defined by a lambda function.
Definition: DirectSum.h:240
This class handles the storage of particles in their full form.
Definition: FullParticleCell.h:26
void deleteDummyParticles() override
Deletes all dummy particles in this cell.
Definition: FullParticleCell.h:227
StorageType _particles
Storage of the molecules of the cell.
Definition: FullParticleCell.h:274
void forEach(Lambda forEachLambda)
Executes code for every particle in this cell as defined by lambda function.
Definition: FullParticleCell.h:105
void reserve(size_t n)
Requests that the vector capacity be at least enough to contain n elements.
Definition: FullParticleCell.h:269
void addParticle(const Particle_T &p) override
Adds a Particle to the cell.
Definition: FullParticleCell.h:51
void reduce(Lambda reduceLambda, A &result)
Reduce properties of particles as defined by a lambda function.
Definition: FullParticleCell.h:144
This interface serves as a common parent class for all traversals.
Definition: TraversalInterface.h:18
virtual void endTraversal()=0
Finalizes the traversal.
virtual void traverseParticles()=0
Traverse the particles by pairs, triplets etc.
virtual void initTraversal()=0
Initializes the traversal.
Info for traversals of a specific container.
Definition: TraversalSelectorInfo.h:14
Interface class to handle cell borders and cell types of cells.
Definition: CellBorderAndFlagManager.h:17
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:64
std::vector< typename ContainerType::ParticleType > collectParticlesAndMarkNonOwnedAsDummy(ContainerType &container)
Collects leaving particles and marks halo particles as dummy.
Definition: LeavingParticleCollector.h:85
static bool checkParticleInCellAndUpdateByIDAndPosition(CellType &cell, const typename CellType::ParticleType &particle, double absError)
Same as checkParticleInCellAndUpdateByID(CellType, ParticleType), but additionally checks whether the...
Definition: ParticleCellHelpers.h:39
constexpr bool less(const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
True iff for all d the following holds: a[d] < b[d].
Definition: ArrayMath.h:79
bool notInBox(const std::array< T, 3 > &position, const std::array< T, 3 > &low, const std::array< T, 3 > &high)
Checks if position is not inside of a box defined by low and high.
Definition: inBox.h:50
std::optional< std::reference_wrapper< T > > optRef
Short alias for std::optional<std::reference_wrapper<T>>
Definition: optRef.h:16
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:34
int autopas_get_num_threads()
Dummy for omp_get_num_threads() when no OpenMP is available.
Definition: WrapOpenMP.h:138
@ owned
Owned state, a particle with this state is an actual particle and owned by the current AutoPas object...
int autopas_get_thread_num()
Dummy for omp_set_lock() when no OpenMP is available.
Definition: WrapOpenMP.h:132