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 unsigned int verletRebuildFrequency)
68 : CellBasedParticleContainer<ParticleCell>(boxMin, boxMax, cutoff, skin, verletRebuildFrequency),
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 ParticleType &p) override { getOwnedCell().addParticle(p); }
96
100 void addHaloParticleImpl(const ParticleType &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 ParticleType &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
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<ParticleType> 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<ParticleType> 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
198 IteratorBehavior behavior = autopas::IteratorBehavior::ownedOrHalo,
199 typename ContainerIterator<ParticleType, true, false>::ParticleVecType *additionalVectors = nullptr) override {
200 return ContainerIterator<ParticleType, true, false>(*this, behavior, additionalVectors);
201 }
202
204 IteratorBehavior behavior = autopas::IteratorBehavior::ownedOrHalo,
206 nullptr) const override {
207 return ContainerIterator<ParticleType, false, false>(*this, behavior, additionalVectors);
208 }
209
213 template <typename Lambda>
214 void forEach(Lambda forEachLambda, IteratorBehavior behavior) {
215 if (behavior & IteratorBehavior::owned) {
216 getOwnedCell().forEach(forEachLambda);
217 }
218 if (behavior & IteratorBehavior::halo) {
219 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
220 cellIt->forEach(forEachLambda);
221 }
222 }
223 // sanity check
224 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
225 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
226 }
227 }
228
232 template <typename Lambda, typename A>
233 void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior) {
234 if (behavior & IteratorBehavior::owned) {
235 getOwnedCell().reduce(reduceLambda, result);
236 }
237 if (behavior & IteratorBehavior::halo) {
238 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
239 cellIt->reduce(reduceLambda, result);
240 }
241 }
242 // sanity check
243 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
244 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
245 }
246 }
247
249 const std::array<double, 3> &lowerCorner, const std::array<double, 3> &higherCorner, IteratorBehavior behavior,
250 typename ContainerIterator<ParticleType, true, true>::ParticleVecType *additionalVectors = nullptr) override {
251 return ContainerIterator<ParticleType, true, true>(*this, behavior, additionalVectors, lowerCorner, higherCorner);
252 }
253
255 const std::array<double, 3> &lowerCorner, const std::array<double, 3> &higherCorner, IteratorBehavior behavior,
257 nullptr) const override {
258 return ContainerIterator<ParticleType, false, true>(*this, behavior, additionalVectors, lowerCorner, higherCorner);
259 }
260
264 template <typename Lambda>
265 void forEachInRegion(Lambda forEachLambda, const std::array<double, 3> &lowerCorner,
266 const std::array<double, 3> &higherCorner, IteratorBehavior behavior) {
267 if (behavior & IteratorBehavior::owned) {
268 getOwnedCell().forEach(forEachLambda, lowerCorner, higherCorner, behavior);
269 }
270 if (behavior & IteratorBehavior::halo) {
271 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
272 cellIt->forEach(forEachLambda, lowerCorner, higherCorner, behavior);
273 }
274 }
275 // sanity check
276 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
277 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
278 }
279 }
280
284 template <typename Lambda, typename A>
285 void reduceInRegion(Lambda reduceLambda, A &result, const std::array<double, 3> &lowerCorner,
286 const std::array<double, 3> &higherCorner, IteratorBehavior behavior) {
287 if (behavior & IteratorBehavior::owned) {
288 getOwnedCell().reduce(reduceLambda, result, lowerCorner, higherCorner, behavior);
289 }
290 if (behavior & IteratorBehavior::halo) {
291 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
292 cellIt->reduce(reduceLambda, result, lowerCorner, higherCorner, behavior);
293 }
294 }
295 // sanity check
296 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
297 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
298 }
299 }
300
301 std::tuple<const Particle_T *, size_t, size_t> getParticle(size_t cellIndex, size_t particleIndex,
302 IteratorBehavior iteratorBehavior,
303 const std::array<double, 3> &boxMin,
304 const std::array<double, 3> &boxMax) const override {
305 return getParticleImpl<true>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
306 }
307 std::tuple<const Particle_T *, size_t, size_t> getParticle(size_t cellIndex, size_t particleIndex,
308 IteratorBehavior iteratorBehavior) const override {
309 // this is not a region iter hence we stretch the bounding box to the numeric max
310 constexpr std::array<double, 3> boxMin{std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest(),
311 std::numeric_limits<double>::lowest()};
312
313 constexpr std::array<double, 3> boxMax{std::numeric_limits<double>::max(), std::numeric_limits<double>::max(),
314 std::numeric_limits<double>::max()};
315 return getParticleImpl<false>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
316 }
317
318 bool deleteParticle(Particle_T &particle) override {
319 // swap-delete helper function
320 auto swapDelFromCell = [&](auto &particleCell) -> bool {
321 auto &particleVec = particleCell._particles;
322 const bool isRearParticle = &particle == &particleVec.back();
323 particle = particleVec.back();
324 particleVec.pop_back();
325 return isRearParticle;
326 };
327
328 // deduce into which vector the reference points
329 if (particle.isOwned()) {
330 return swapDelFromCell(getOwnedCell());
331 } else if (particle.isHalo()) {
332 const auto boxMin = this->getBoxMin();
333 const auto boxMax = this->getBoxMax();
334 const auto skinHalf = 0.5 * this->getVerletSkin();
335 const auto pos = particle.getR();
336
337 // Look for the particle in halo cells that are within half the skinHalf distance of its position
338 for (size_t dim = 0; dim < 3; ++dim) {
339 if (pos[dim] < boxMin[dim] + skinHalf) {
340 if (swapDelFromCell(this->_cells[2 * dim + 1])) {
341 return true;
342 }
343 } else if (pos[dim] >= boxMax[dim] - skinHalf) {
344 if (swapDelFromCell(this->_cells[2 * dim + 2])) {
345 return true;
346 }
347 }
348 }
349 }
350 return false;
351 }
352
353 bool deleteParticle(size_t cellIndex, size_t particleIndex) override {
354 auto &particleVec = this->_cells[cellIndex]._particles;
355 auto &particle = particleVec[particleIndex];
356 // swap-delete
357 particle = particleVec.back();
358 particleVec.pop_back();
359 return particleIndex < particleVec.size();
360 }
361
362 private:
363 class DirectSumCellBorderAndFlagManager : public internal::CellBorderAndFlagManager {
367 using index_t = std::size_t;
368
369 public:
370 [[nodiscard]] bool cellCanContainHaloParticles(index_t index1d) const override {
371 return index1d >= 1 and index1d <= 6;
372 }
373
374 [[nodiscard]] bool cellCanContainOwnedParticles(index_t index1d) const override { return index1d == 0; }
375
376 } _cellBorderFlagManager;
377
389 template <bool regionIter>
390 std::tuple<const Particle_T *, size_t, size_t> getParticleImpl(size_t cellIndex, size_t particleIndex,
391 IteratorBehavior iteratorBehavior,
392 const std::array<double, 3> &boxMin,
393 const std::array<double, 3> &boxMax) const {
394 // first and last relevant cell index
395 const auto [startCellIndex, endCellIndex] = [&]() -> std::tuple<size_t, size_t> {
396 // shortcuts to limit the iterator to only part of the domain.
397 if (not(iteratorBehavior & IteratorBehavior::halo)) {
398 // only owned region
399 return {0, 0};
400 }
401 if (not(iteratorBehavior & IteratorBehavior::owned)) {
402 // only halo region
403 return {1, 6};
404 }
405 if constexpr (regionIter) {
406 // if the region lies fully within the container only look at the owned cell
407 if (utils::ArrayMath::less(this->getBoxMin(), boxMin) and utils::ArrayMath::less(boxMax, this->getBoxMax())) {
408 return {0, 0};
409 }
410 }
411 // all cells
412 return {0, 6};
413 }();
414
415 // if we are at the start of an iteration determine this thread's cell index
416 if (cellIndex == 0 and particleIndex == 0) {
417 cellIndex =
418 startCellIndex + ((iteratorBehavior & IteratorBehavior::forceSequential) ? 0 : autopas_get_thread_num());
419 }
420 // abort if the index is out of bounds
421 if (cellIndex >= this->_cells.size()) {
422 return {nullptr, 0, 0};
423 }
424 // check the data behind the indices
425 if (particleIndex >= this->_cells[cellIndex].size() or
426 not containerIteratorUtils::particleFulfillsIteratorRequirements<regionIter>(
427 this->_cells[cellIndex][particleIndex], iteratorBehavior, boxMin, boxMax)) {
428 // either advance them to something interesting or invalidate them.
429 std::tie(cellIndex, particleIndex) =
430 advanceIteratorIndices<regionIter>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
431 }
432
433 // shortcut if the given index doesn't exist
434 if (cellIndex >= this->_cells.size()) {
435 return {nullptr, 0, 0};
436 }
437 const Particle_T *retPtr = &this->_cells[cellIndex][particleIndex];
438
439 return {retPtr, cellIndex, particleIndex};
440 }
441
453 template <bool regionIter>
454 std::tuple<size_t, size_t> advanceIteratorIndices(size_t cellIndex, size_t particleIndex,
455 IteratorBehavior iteratorBehavior,
456 const std::array<double, 3> &boxMin,
457 const std::array<double, 3> &boxMax) const {
458 // Find the indices for the next particle
459 const size_t stride = (iteratorBehavior & IteratorBehavior::forceSequential) ? 1 : autopas_get_num_threads();
460
461 do {
462 // advance to the next particle
463 ++particleIndex;
464 // If this breaches the end of a cell, find the next non-empty cell and reset particleIndex.
465 while (particleIndex >= this->_cells[cellIndex].size()) {
466 cellIndex += stride;
467 particleIndex = 0;
468 // If there are no more reasonable cells return invalid indices.
469 if (cellIndex > ((not(iteratorBehavior & IteratorBehavior::halo)) ? 0 : (this->_cells.size() - 1))) {
470 return {std::numeric_limits<decltype(cellIndex)>::max(), std::numeric_limits<decltype(particleIndex)>::max()};
471 }
472 }
473 } while (not containerIteratorUtils::particleFulfillsIteratorRequirements<regionIter>(
474 this->_cells[cellIndex][particleIndex], iteratorBehavior, boxMin, boxMax));
475
476 // the indices returned at this point should always be valid
477 return {cellIndex, particleIndex};
478 }
479
485 template <typename Traversal>
486 void prepareTraversal(Traversal &traversal) {
487 auto *dsTraversal = dynamic_cast<DSTraversalInterface *>(traversal);
488 auto *cellTraversal = dynamic_cast<CellTraversal<ParticleCell> *>(traversal);
489 if (dsTraversal && cellTraversal) {
490 cellTraversal->setCellsToTraverse(this->_cells);
491 } else {
493 "The selected traversal is not compatible with the DirectSum container. TraversalID: {}",
494 traversal->getTraversalType());
495 }
496 }
497
498 ParticleCell &getOwnedCell() { return this->_cells[0]; };
499
500 ParticleCell &getHaloCell() { return this->_cells[1]; };
501};
502
503} // namespace autopas
The CellBasedParticleContainer class stores particles in some object and provides methods to iterate ...
Definition: CellBasedParticleContainer.h:25
double getVerletSkin() const final
Returns the verlet Skin length.
Definition: CellBasedParticleContainer.h:94
std::vector< FullParticleCell< Particle_T > > _cells
Vector of particle cells.
Definition: CellBasedParticleContainer.h:157
double getCutoff() const final
Return the cutoff of the container.
Definition: CellBasedParticleContainer.h:79
size_t size() const override
Get the total number of particles saved in the container (owned + halo + dummy).
Definition: CellBasedParticleContainer.h:131
const std::array< double, 3 > & getBoxMin() const final
Get the lower corner of the container without halo.
Definition: CellBasedParticleContainer.h:74
const std::array< double, 3 > & getBoxMax() const final
Get the upper corner of the container without halo.
Definition: CellBasedParticleContainer.h:69
A cell pair traversal.
Definition: CellTraversal.h:23
virtual void setCellsToTraverse(std::vector< ParticleCell > &cells)
Sets the cells to iterate over.
Definition: CellTraversal.h:40
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
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:353
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:307
DirectSum(const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax, double cutoff, double skin, unsigned int verletRebuildFrequency)
Constructor of the DirectSum class.
Definition: DirectSum.h:66
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:318
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:285
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:265
ContainerIterator< ParticleType, true, false > begin(IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo, typename ContainerIterator< ParticleType, true, false >::ParticleVecType *additionalVectors=nullptr) override
Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .
Definition: DirectSum.h:197
void addHaloParticleImpl(const ParticleType &haloParticle) override
Adds a particle to the container that lies in the halo region of the container.
Definition: DirectSum.h:100
std::vector< ParticleType > updateContainer(bool keepNeighborListsValid) override
Updates the container.
Definition: DirectSum.h:160
void rebuildNeighborLists(TraversalInterface *traversal) override
Rebuilds the neighbor lists for the next traversals.
Definition: DirectSum.h:146
ContainerIterator< ParticleType, false, false > begin(IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo, typename ContainerIterator< ParticleType, false, false >::ParticleVecType *additionalVectors=nullptr) const override
Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .
Definition: DirectSum.h:203
bool updateHaloParticle(const ParticleType &haloParticle) override
Update a halo particle of the container with the given haloParticle.
Definition: DirectSum.h:119
ContainerIterator< ParticleType, true, true > getRegionIterator(const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior, typename ContainerIterator< ParticleType, true, true >::ParticleVecType *additionalVectors=nullptr) override
Iterate over all particles in a specified region for(auto iter = container.getRegionIterator(lowCorne...
Definition: DirectSum.h:248
void deleteHaloParticles() override
Deletes all halo particles.
Definition: DirectSum.h:140
CellType getParticleCellTypeEnum() const override
Get the ParticleCell type as an Enum.
Definition: DirectSum.h:150
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:301
void computeInteractions(TraversalInterface *traversal) override
Iterates over all particle multiples (e.g.
Definition: DirectSum.h:152
void forEach(Lambda forEachLambda, IteratorBehavior behavior)
Execute code on all particles in this container as defined by a lambda function.
Definition: DirectSum.h:214
ContainerIterator< ParticleType, false, true > getRegionIterator(const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior, typename ContainerIterator< ParticleType, false, true >::ParticleVecType *additionalVectors=nullptr) const override
Iterate over all particles in a specified region for(auto iter = container.getRegionIterator(lowCorne...
Definition: DirectSum.h:254
void addParticleImpl(const ParticleType &p) override
Adds a particle to the container.
Definition: DirectSum.h:95
ContainerOption getContainerType() const override
Get the ContainerType.
Definition: DirectSum.h:83
Particle_T ParticleType
Type of the Particle.
Definition: DirectSum.h:56
void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior)
Reduce properties of particles as defined by a lambda function.
Definition: DirectSum.h:233
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
Class for Cells of Particles.
Definition: ParticleCell.h:51
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
CellType
The ParticleCell Type as an Enum.
Definition: ParticleCell.h:19
@ FullParticleCell
FullParticleCell : Default cell type for almost everything.
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