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
66 DirectSum(const std::array<double, 3> &boxMin, const std::array<double, 3> &boxMax, double cutoff, double skin,
67 const size_t sortingThreshold)
68 : CellBasedParticleContainer<ParticleCellType>(boxMin, boxMax, cutoff, skin, sortingThreshold),
69 _cellBorderFlagManager() {
70 using namespace autopas::utils::ArrayMath::literals;
71 // 1 owned and 6 halo cells
72 this->_cells.resize(7);
73 this->_cells[0].setPossibleParticleOwnerships(OwnershipState::owned);
74 std::for_each(++this->_cells.begin(), this->_cells.end(),
75 [&](auto &cell) { cell.setPossibleParticleOwnerships(OwnershipState::halo); });
76 auto boxLength = boxMax - boxMin;
77 this->_cells[0].setCellLength(boxLength);
78 }
79
83 [[nodiscard]] ContainerOption getContainerType() const override { return ContainerOption::directSum; }
84
85 void reserve(size_t numParticles, size_t numParticlesHaloEstimate) override {
86 this->getOwnedCell().reserve(numParticles);
87 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
88 cellIt->reserve(numParticlesHaloEstimate);
89 }
90 };
91
95 void addParticleImpl(const Particle_T &p) override { getOwnedCell().addParticle(p); }
96
100 void addHaloParticleImpl(const Particle_T &haloParticle) override {
101 const auto boxMax = this->getBoxMax();
102 const auto boxMin = this->getBoxMin();
103 const auto pos = haloParticle.getR();
104
105 for (size_t dim = 0; dim < 3; ++dim) {
106 if (pos[dim] < boxMin[dim]) {
107 this->_cells[2 * dim + 1].addParticle(haloParticle);
108 return;
109 } else if (pos[dim] >= boxMax[dim]) {
110 this->_cells[2 * dim + 2].addParticle(haloParticle);
111 return;
112 }
113 }
114 }
115
119 bool updateHaloParticle(const Particle_T &haloParticle) override {
120 const auto boxMax = this->getBoxMax();
121 const auto boxMin = this->getBoxMin();
122 const auto pos = haloParticle.getR();
123 const auto skinHalf = 0.5 * this->getVerletSkin();
124
125 // Look for the particle in halo cells that are within half the skin distance of its position
126 for (size_t dim = 0; dim < 3; ++dim) {
127 if (pos[dim] < boxMin[dim] + skinHalf) {
128 if (internal::checkParticleInCellAndUpdateByIDAndPosition(this->_cells[2 * dim + 1], haloParticle, skinHalf)) {
129 return true;
130 }
131 } else if (pos[dim] >= boxMax[dim] - skinHalf) {
132 if (internal::checkParticleInCellAndUpdateByIDAndPosition(this->_cells[2 * dim + 2], haloParticle, skinHalf)) {
133 return true;
134 }
135 }
136 }
137 return false;
138 }
139
140 void deleteHaloParticles() override {
141 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
142 cellIt->clear();
143 }
144 }
145
146 void rebuildNeighborLists(TraversalInterface *traversal) override {
147 // nothing to do.
148 }
149
150 void computeInteractions(TraversalInterface *traversal) override {
151 prepareTraversal(traversal);
152
153 traversal->initTraversal();
154 traversal->traverseParticles();
155 traversal->endTraversal();
156 }
157
158 [[nodiscard]] std::vector<Particle_T> updateContainer(bool keepNeighborListsValid) override {
159 if (keepNeighborListsValid) {
161 }
162 // first we delete halo particles, as we don't want them here.
164 getOwnedCell().deleteDummyParticles();
165
166 std::vector<Particle_T> invalidParticles{};
167 auto &particleVec = getOwnedCell()._particles;
168 for (auto iter = particleVec.begin(); iter != particleVec.end();) {
169 if (utils::notInBox(iter->getR(), this->getBoxMin(), this->getBoxMax())) {
170 invalidParticles.push_back(*iter);
171 // swap-delete
172 *iter = particleVec.back();
173 particleVec.pop_back();
174 } else {
175 ++iter;
176 }
177 }
178 return invalidParticles;
179 }
180
184 [[nodiscard]] TraversalSelectorInfo getTraversalSelectorInfo() const override {
185 using namespace autopas::utils::ArrayMath::literals;
186
187 // direct sum consists of seven cells (owned + two halo cells in each dimension)
189 // DS container can be viewed as a 3x3x3 grid with some halo cells being combined.
190 {3, 3, 3},
191 // intentionally use cutoff here, as ds_sequential should be using the cutoff.
192 this->getCutoff(), this->getBoxMax() - this->getBoxMin(), 0);
193 }
194
199 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo,
200 typename ContainerIterator<Particle_T, true, false>::ParticleVecType *additionalVectors = nullptr) override {
201 return ContainerIterator<Particle_T, true, false>(*this, behavior, additionalVectors);
202 }
203
208 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo,
210 nullptr) const override {
211 return ContainerIterator<Particle_T, false, false>(*this, behavior, additionalVectors);
212 }
213
217 template <typename Lambda>
218 void forEach(Lambda forEachLambda, IteratorBehavior behavior) {
219 if (behavior & IteratorBehavior::owned) {
220 getOwnedCell().forEach(forEachLambda);
221 }
222 if (behavior & IteratorBehavior::halo) {
223 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
224 cellIt->forEach(forEachLambda);
225 }
226 }
227 // sanity check
228 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
229 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
230 }
231 }
232
236 template <typename Lambda, typename A>
237 void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior) {
238 if (behavior & IteratorBehavior::owned) {
239 getOwnedCell().reduce(reduceLambda, result);
240 }
241 if (behavior & IteratorBehavior::halo) {
242 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
243 cellIt->reduce(reduceLambda, result);
244 }
245 }
246 // sanity check
247 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
248 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
249 }
250 }
251
256 const std::array<double, 3> &lowerCorner, const std::array<double, 3> &higherCorner, IteratorBehavior behavior,
257 typename ContainerIterator<Particle_T, true, true>::ParticleVecType *additionalVectors = nullptr) override {
258 return ContainerIterator<Particle_T, true, true>(*this, behavior, additionalVectors, lowerCorner, higherCorner);
259 }
260
265 const std::array<double, 3> &lowerCorner, const std::array<double, 3> &higherCorner, IteratorBehavior behavior,
267 nullptr) const override {
268 return ContainerIterator<Particle_T, false, true>(*this, behavior, additionalVectors, lowerCorner, higherCorner);
269 }
270
274 template <typename Lambda>
275 void forEachInRegion(Lambda forEachLambda, const std::array<double, 3> &lowerCorner,
276 const std::array<double, 3> &higherCorner, IteratorBehavior behavior) {
277 if (behavior & IteratorBehavior::owned) {
278 getOwnedCell().forEach(forEachLambda, lowerCorner, higherCorner, behavior);
279 }
280 if (behavior & IteratorBehavior::halo) {
281 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
282 cellIt->forEach(forEachLambda, lowerCorner, higherCorner, behavior);
283 }
284 }
285 // sanity check
286 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
287 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
288 }
289 }
290
294 template <typename Lambda, typename A>
295 void reduceInRegion(Lambda reduceLambda, A &result, const std::array<double, 3> &lowerCorner,
296 const std::array<double, 3> &higherCorner, IteratorBehavior behavior) {
297 if (behavior & IteratorBehavior::owned) {
298 getOwnedCell().reduce(reduceLambda, result, lowerCorner, higherCorner, behavior);
299 }
300 if (behavior & IteratorBehavior::halo) {
301 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
302 cellIt->reduce(reduceLambda, result, lowerCorner, higherCorner, behavior);
303 }
304 }
305 // sanity check
306 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
307 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
308 }
309 }
310
311 std::tuple<const Particle_T *, size_t, size_t> getParticle(size_t cellIndex, size_t particleIndex,
312 IteratorBehavior iteratorBehavior,
313 const std::array<double, 3> &boxMin,
314 const std::array<double, 3> &boxMax) const override {
315 return getParticleImpl<true>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
316 }
317 std::tuple<const Particle_T *, size_t, size_t> getParticle(size_t cellIndex, size_t particleIndex,
318 IteratorBehavior iteratorBehavior) const override {
319 // this is not a region iter hence we stretch the bounding box to the numeric max
320 constexpr std::array<double, 3> boxMin{std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest(),
321 std::numeric_limits<double>::lowest()};
322
323 constexpr std::array<double, 3> boxMax{std::numeric_limits<double>::max(), std::numeric_limits<double>::max(),
324 std::numeric_limits<double>::max()};
325 return getParticleImpl<false>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
326 }
327
331 bool deleteParticle(Particle_T &particle) override {
332 // swap-delete helper function
333 auto swapDelFromCell = [&](auto &particleCell) -> bool {
334 auto &particleVec = particleCell._particles;
335 const bool isRearParticle = &particle == &particleVec.back();
336 particle = particleVec.back();
337 particleVec.pop_back();
338 return isRearParticle;
339 };
340
341 // deduce into which vector the reference points
342 if (particle.isOwned()) {
343 return swapDelFromCell(getOwnedCell());
344 } else if (particle.isHalo()) {
345 const auto boxMin = this->getBoxMin();
346 const auto boxMax = this->getBoxMax();
347 const auto skinHalf = 0.5 * this->getVerletSkin();
348 const auto pos = particle.getR();
349
350 // Look for the particle in halo cells that are within half the skinHalf distance of its position
351 for (size_t dim = 0; dim < 3; ++dim) {
352 if (pos[dim] < boxMin[dim] + skinHalf) {
353 if (swapDelFromCell(this->_cells[2 * dim + 1])) {
354 return true;
355 }
356 } else if (pos[dim] >= boxMax[dim] - skinHalf) {
357 if (swapDelFromCell(this->_cells[2 * dim + 2])) {
358 return true;
359 }
360 }
361 }
362 }
363 return false;
364 }
365
366 bool deleteParticle(size_t cellIndex, size_t particleIndex) override {
367 auto &particleVec = this->_cells[cellIndex]._particles;
368 auto &particle = particleVec[particleIndex];
369 // swap-delete
370 particle = particleVec.back();
371 particleVec.pop_back();
372 return particleIndex < particleVec.size();
373 }
374
375 private:
376 class DirectSumCellBorderAndFlagManager : public internal::CellBorderAndFlagManager {
380 using index_t = std::size_t;
381
382 public:
383 [[nodiscard]] bool cellCanContainHaloParticles(index_t index1d) const override {
384 return index1d >= 1 and index1d <= 6;
385 }
386
387 [[nodiscard]] bool cellCanContainOwnedParticles(index_t index1d) const override { return index1d == 0; }
388
389 } _cellBorderFlagManager;
390
402 template <bool regionIter>
403 std::tuple<const Particle_T *, size_t, size_t> getParticleImpl(size_t cellIndex, size_t particleIndex,
404 IteratorBehavior iteratorBehavior,
405 const std::array<double, 3> &boxMin,
406 const std::array<double, 3> &boxMax) const {
407 // first and last relevant cell index
408 const auto [startCellIndex, endCellIndex] = [&]() -> std::tuple<size_t, size_t> {
409 // shortcuts to limit the iterator to only part of the domain.
410 if (not(iteratorBehavior & IteratorBehavior::halo)) {
411 // only owned region
412 return {0, 0};
413 }
414 if (not(iteratorBehavior & IteratorBehavior::owned)) {
415 // only halo region
416 return {1, 6};
417 }
418 if constexpr (regionIter) {
419 // if the region lies fully within the container only look at the owned cell
420 if (utils::ArrayMath::less(this->getBoxMin(), boxMin) and utils::ArrayMath::less(boxMax, this->getBoxMax())) {
421 return {0, 0};
422 }
423 }
424 // all cells
425 return {0, 6};
426 }();
427
428 // if we are at the start of an iteration determine this thread's cell index
429 if (cellIndex == 0 and particleIndex == 0) {
430 cellIndex =
431 startCellIndex + ((iteratorBehavior & IteratorBehavior::forceSequential) ? 0 : autopas_get_thread_num());
432 }
433 // abort if the index is out of bounds
434 if (cellIndex >= this->_cells.size()) {
435 return {nullptr, 0, 0};
436 }
437 // check the data behind the indices
438 if (particleIndex >= this->_cells[cellIndex].size() or
439 not containerIteratorUtils::particleFulfillsIteratorRequirements<regionIter>(
440 this->_cells[cellIndex][particleIndex], iteratorBehavior, boxMin, boxMax)) {
441 // either advance them to something interesting or invalidate them.
442 std::tie(cellIndex, particleIndex) =
443 advanceIteratorIndices<regionIter>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
444 }
445
446 // shortcut if the given index doesn't exist
447 if (cellIndex >= this->_cells.size()) {
448 return {nullptr, 0, 0};
449 }
450 const Particle_T *retPtr = &this->_cells[cellIndex][particleIndex];
451
452 return {retPtr, cellIndex, particleIndex};
453 }
454
466 template <bool regionIter>
467 std::tuple<size_t, size_t> advanceIteratorIndices(size_t cellIndex, size_t particleIndex,
468 IteratorBehavior iteratorBehavior,
469 const std::array<double, 3> &boxMin,
470 const std::array<double, 3> &boxMax) const {
471 // Find the indices for the next particle
472 const size_t stride = (iteratorBehavior & IteratorBehavior::forceSequential) ? 1 : autopas_get_num_threads();
473
474 do {
475 // advance to the next particle
476 ++particleIndex;
477 // If this breaches the end of a cell, find the next non-empty cell and reset particleIndex.
478 while (particleIndex >= this->_cells[cellIndex].size()) {
479 cellIndex += stride;
480 particleIndex = 0;
481 // If there are no more reasonable cells return invalid indices.
482 if (cellIndex > ((not(iteratorBehavior & IteratorBehavior::halo)) ? 0 : (this->_cells.size() - 1))) {
483 return {std::numeric_limits<decltype(cellIndex)>::max(), std::numeric_limits<decltype(particleIndex)>::max()};
484 }
485 }
486 } while (not containerIteratorUtils::particleFulfillsIteratorRequirements<regionIter>(
487 this->_cells[cellIndex][particleIndex], iteratorBehavior, boxMin, boxMax));
488
489 // the indices returned at this point should always be valid
490 return {cellIndex, particleIndex};
491 }
492
498 template <typename Traversal>
499 void prepareTraversal(Traversal &traversal) {
500 auto *dsTraversal = dynamic_cast<DSTraversalInterface *>(traversal);
501 auto *cellTraversal = dynamic_cast<CellTraversal<ParticleCellType> *>(traversal);
502 if (dsTraversal && cellTraversal) {
503 cellTraversal->setSortingThreshold(this->_sortingThreshold);
504 cellTraversal->setCellsToTraverse(this->_cells);
505 } else {
507 "The selected traversal is not compatible with the DirectSum container. TraversalID: {}",
508 traversal->getTraversalType());
509 }
510 }
511
512 ParticleCellType &getOwnedCell() { return this->_cells[0]; };
513
514 ParticleCellType &getHaloCell() { return this->_cells[1]; };
515};
516
517} // 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:71
size_t _sortingThreshold
If the number of particles in a cell or cell pair exceeds this threshold, the particles will be sorte...
Definition: CellBasedParticleContainer.h:164
size_t size() const override
Get the total number of particles saved in the container (owned + halo + dummy).
Definition: CellBasedParticleContainer.h:133
double getVerletSkin() const final
Returns the verlet Skin length.
Definition: CellBasedParticleContainer.h:96
double getCutoff() const final
Return the cutoff of the container.
Definition: CellBasedParticleContainer.h:81
const std::array< double, 3 > & getBoxMin() const final
Get the lower corner of the container without halo.
Definition: CellBasedParticleContainer.h:76
std::vector< ParticleCellType > _cells
Vector of particle cells.
Definition: CellBasedParticleContainer.h:159
A cell pair traversal.
Definition: CellTraversal.h:23
virtual void setSortingThreshold(size_t sortingThreshold)=0
Set the sorting-threshold for traversals that use the CellFunctor If the sum of the number of particl...
Public iterator class that iterates over a particle container and additional vectors (which are typic...
Definition: ContainerIterator.h:93
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:106
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
ContainerIterator< Particle_T, true, false > begin(IteratorBehavior behavior=IteratorBehavior::ownedOrHalo, typename ContainerIterator< Particle_T, true, false >::ParticleVecType *additionalVectors=nullptr) override
Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .
Definition: DirectSum.h:198
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:366
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:317
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:331
ContainerIterator< Particle_T, false, true > getRegionIterator(const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior, typename ContainerIterator< Particle_T, false, true >::ParticleVecType *additionalVectors=nullptr) const override
Iterate over all particles in a specified region for(auto iter = container.getRegionIterator(lowCorne...
Definition: DirectSum.h:264
void addParticleImpl(const Particle_T &p) override
Adds a particle to the container.
Definition: DirectSum.h:95
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:295
TraversalSelectorInfo getTraversalSelectorInfo() const override
Generates a traversal selector info for this container.
Definition: DirectSum.h:184
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:275
void rebuildNeighborLists(TraversalInterface *traversal) override
Rebuilds the neighbor lists for the next traversals.
Definition: DirectSum.h:146
void deleteHaloParticles() override
Deletes all halo particles.
Definition: DirectSum.h:140
FullParticleCell< Particle_T > ParticleCellType
Type of the ParticleCell.
Definition: DirectSum.h:51
ContainerIterator< Particle_T, false, false > begin(IteratorBehavior behavior=IteratorBehavior::ownedOrHalo, typename ContainerIterator< Particle_T, false, false >::ParticleVecType *additionalVectors=nullptr) const override
Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .
Definition: DirectSum.h:207
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:85
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:311
void computeInteractions(TraversalInterface *traversal) override
Iterates over all particle multiples (e.g.
Definition: DirectSum.h:150
std::vector< Particle_T > updateContainer(bool keepNeighborListsValid) override
Updates the container.
Definition: DirectSum.h:158
void forEach(Lambda forEachLambda, IteratorBehavior behavior)
Execute code on all particles in this container as defined by a lambda function.
Definition: DirectSum.h:218
bool updateHaloParticle(const Particle_T &haloParticle) override
Update a halo particle of the container with the given haloParticle.
Definition: DirectSum.h:119
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:100
DirectSum(const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax, double cutoff, double skin, const size_t sortingThreshold)
Constructor of the DirectSum class.
Definition: DirectSum.h:66
ContainerOption getContainerType() const override
Get the ContainerType.
Definition: DirectSum.h:83
Particle_T ParticleType
Type of the Particle.
Definition: DirectSum.h:56
ContainerIterator< Particle_T, true, true > getRegionIterator(const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior, typename ContainerIterator< Particle_T, true, true >::ParticleVecType *additionalVectors=nullptr) override
Iterate over all particles in a specified region for(auto iter = container.getRegionIterator(lowCorne...
Definition: DirectSum.h:255
void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior)
Reduce properties of particles as defined by a lambda function.
Definition: DirectSum.h:237
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:63
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
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32
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