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
69 DirectSum(const std::array<double, 3> &boxMin, const std::array<double, 3> &boxMax, double cutoff, double skin,
70 const size_t aosSortingThresholdFallback, const size_t soaSortingThresholdFallback)
71 : CellBasedParticleContainer<ParticleCellType>(boxMin, boxMax, cutoff, skin, aosSortingThresholdFallback,
72 soaSortingThresholdFallback),
73 _cellBorderFlagManager() {
74 using namespace autopas::utils::ArrayMath::literals;
75 // 1 owned and 6 halo cells
76 this->_cells.resize(7);
77 this->_cells[0].setPossibleParticleOwnerships(OwnershipState::owned);
78 std::for_each(++this->_cells.begin(), this->_cells.end(),
79 [&](auto &cell) { cell.setPossibleParticleOwnerships(OwnershipState::halo); });
80 auto boxLength = boxMax - boxMin;
81 this->_cells[0].setCellLength(boxLength);
82 }
83
87 [[nodiscard]] ContainerOption getContainerType() const override { return ContainerOption::directSum; }
88
89 void reserve(size_t numParticles, size_t numParticlesHaloEstimate) override {
90 this->getOwnedCell().reserve(numParticles);
91 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
92 cellIt->reserve(numParticlesHaloEstimate);
93 }
94 };
95
99 void addParticleImpl(const Particle_T &p) override { getOwnedCell().addParticle(p); }
100
104 void addHaloParticleImpl(const Particle_T &haloParticle) override {
105 const auto boxMax = this->getBoxMax();
106 const auto boxMin = this->getBoxMin();
107 const auto pos = haloParticle.getR();
108
109 for (size_t dim = 0; dim < 3; ++dim) {
110 if (pos[dim] < boxMin[dim]) {
111 this->_cells[2 * dim + 1].addParticle(haloParticle);
112 return;
113 } else if (pos[dim] >= boxMax[dim]) {
114 this->_cells[2 * dim + 2].addParticle(haloParticle);
115 return;
116 }
117 }
118 }
119
123 bool updateHaloParticle(const Particle_T &haloParticle) override {
124 const auto boxMax = this->getBoxMax();
125 const auto boxMin = this->getBoxMin();
126 const auto pos = haloParticle.getR();
127 const auto skinHalf = 0.5 * this->getVerletSkin();
128
129 // Look for the particle in halo cells that are within half the skin distance of its position
130 for (size_t dim = 0; dim < 3; ++dim) {
131 if (pos[dim] < boxMin[dim] + skinHalf) {
132 if (internal::checkParticleInCellAndUpdateByIDAndPosition(this->_cells[2 * dim + 1], haloParticle, skinHalf)) {
133 return true;
134 }
135 } else if (pos[dim] >= boxMax[dim] - skinHalf) {
136 if (internal::checkParticleInCellAndUpdateByIDAndPosition(this->_cells[2 * dim + 2], haloParticle, skinHalf)) {
137 return true;
138 }
139 }
140 }
141 return false;
142 }
143
144 void deleteHaloParticles() override {
145 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
146 cellIt->clear();
147 }
148 }
149
150 void rebuildNeighborLists(TraversalInterface *traversal) override {
151 // nothing to do.
152 }
153
154 void computeInteractions(TraversalInterface *traversal) override {
155 prepareTraversal(traversal);
156
157 traversal->initTraversal();
158 traversal->traverseParticles();
159 traversal->endTraversal();
160 }
161
162 [[nodiscard]] std::vector<Particle_T> updateContainer(bool keepNeighborListsValid) override {
163 if (keepNeighborListsValid) {
165 }
166 // first we delete halo particles, as we don't want them here.
168 getOwnedCell().deleteDummyParticles();
169
170 std::vector<Particle_T> invalidParticles{};
171 auto &particleVec = getOwnedCell()._particles;
172 for (auto iter = particleVec.begin(); iter != particleVec.end();) {
173 if (utils::notInBox(iter->getR(), this->getBoxMin(), this->getBoxMax())) {
174 invalidParticles.push_back(*iter);
175 // swap-delete
176 *iter = particleVec.back();
177 particleVec.pop_back();
178 } else {
179 ++iter;
180 }
181 }
182 return invalidParticles;
183 }
184
188 [[nodiscard]] TraversalSelectorInfo getTraversalSelectorInfo() const override {
189 using namespace autopas::utils::ArrayMath::literals;
190
191 // direct sum consists of seven cells (owned + two halo cells in each dimension)
193 // DS container can be viewed as a 3x3x3 grid with some halo cells being combined.
194 {3, 3, 3},
195 // intentionally use cutoff here, as ds_sequential should be using the cutoff.
196 this->getCutoff(), this->getBoxMax() - this->getBoxMin(), 0);
197 }
198
203 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo,
205 std::nullopt) override {
206 return ContainerIterator<Particle_T, true, false>(*this, behavior, additionalVectors);
207 }
208
213 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo,
215 std::nullopt) const override {
216 return ContainerIterator<Particle_T, false, false>(*this, behavior, additionalVectors);
217 }
218
222 template <typename Lambda>
223 void forEach(Lambda forEachLambda, IteratorBehavior behavior) {
224 if (behavior & IteratorBehavior::owned) {
225 getOwnedCell().forEach(forEachLambda);
226 }
227 if (behavior & IteratorBehavior::halo) {
228 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
229 cellIt->forEach(forEachLambda);
230 }
231 }
232 // sanity check
233 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
234 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
235 }
236 }
237
241 template <typename Lambda, typename A>
242 void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior) {
243 if (behavior & IteratorBehavior::owned) {
244 getOwnedCell().reduce(reduceLambda, result);
245 }
246 if (behavior & IteratorBehavior::halo) {
247 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
248 cellIt->reduce(reduceLambda, result);
249 }
250 }
251 // sanity check
252 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
253 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
254 }
255 }
256
261 const std::array<double, 3> &lowerCorner, const std::array<double, 3> &higherCorner, IteratorBehavior behavior,
263 std::nullopt) override {
264 return ContainerIterator<Particle_T, true, true>(*this, behavior, additionalVectors, lowerCorner, higherCorner);
265 }
266
271 const std::array<double, 3> &lowerCorner, const std::array<double, 3> &higherCorner, IteratorBehavior behavior,
273 std::nullopt) const override {
274 return ContainerIterator<Particle_T, false, true>(*this, behavior, additionalVectors, lowerCorner, higherCorner);
275 }
276
280 template <typename Lambda>
281 void forEachInRegion(Lambda forEachLambda, const std::array<double, 3> &lowerCorner,
282 const std::array<double, 3> &higherCorner, IteratorBehavior behavior) {
283 if (behavior & IteratorBehavior::owned) {
284 getOwnedCell().forEach(forEachLambda, lowerCorner, higherCorner, behavior);
285 }
286 if (behavior & IteratorBehavior::halo) {
287 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
288 cellIt->forEach(forEachLambda, lowerCorner, higherCorner, behavior);
289 }
290 }
291 // sanity check
292 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
293 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
294 }
295 }
296
300 template <typename Lambda, typename A>
301 void reduceInRegion(Lambda reduceLambda, A &result, const std::array<double, 3> &lowerCorner,
302 const std::array<double, 3> &higherCorner, IteratorBehavior behavior) {
303 if (behavior & IteratorBehavior::owned) {
304 getOwnedCell().reduce(reduceLambda, result, lowerCorner, higherCorner, behavior);
305 }
306 if (behavior & IteratorBehavior::halo) {
307 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
308 cellIt->reduce(reduceLambda, result, lowerCorner, higherCorner, behavior);
309 }
310 }
311 // sanity check
312 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
313 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
314 }
315 }
316
317 std::tuple<const Particle_T *, size_t, size_t> getParticle(size_t cellIndex, size_t particleIndex,
318 IteratorBehavior iteratorBehavior,
319 const std::array<double, 3> &boxMin,
320 const std::array<double, 3> &boxMax) const override {
321 return getParticleImpl<true>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
322 }
323 std::tuple<const Particle_T *, size_t, size_t> getParticle(size_t cellIndex, size_t particleIndex,
324 IteratorBehavior iteratorBehavior) const override {
325 // this is not a region iter hence we stretch the bounding box to the numeric max
326 constexpr std::array<double, 3> boxMin{std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest(),
327 std::numeric_limits<double>::lowest()};
328
329 constexpr std::array<double, 3> boxMax{std::numeric_limits<double>::max(), std::numeric_limits<double>::max(),
330 std::numeric_limits<double>::max()};
331 return getParticleImpl<false>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
332 }
333
337 bool deleteParticle(Particle_T &particle) override {
338 // swap-delete helper function
339 auto swapDelFromCell = [&](auto &particleCell) -> bool {
340 auto &particleVec = particleCell._particles;
341 const bool isRearParticle = &particle == &particleVec.back();
342 particle = particleVec.back();
343 particleVec.pop_back();
344 return isRearParticle;
345 };
346
347 // deduce into which vector the reference points
348 if (particle.isOwned()) {
349 return swapDelFromCell(getOwnedCell());
350 } else if (particle.isHalo()) {
351 const auto boxMin = this->getBoxMin();
352 const auto boxMax = this->getBoxMax();
353 const auto skinHalf = 0.5 * this->getVerletSkin();
354 const auto pos = particle.getR();
355
356 // Look for the particle in halo cells that are within half the skinHalf distance of its position
357 for (size_t dim = 0; dim < 3; ++dim) {
358 if (pos[dim] < boxMin[dim] + skinHalf) {
359 if (swapDelFromCell(this->_cells[2 * dim + 1])) {
360 return true;
361 }
362 } else if (pos[dim] >= boxMax[dim] - skinHalf) {
363 if (swapDelFromCell(this->_cells[2 * dim + 2])) {
364 return true;
365 }
366 }
367 }
368 }
369 return false;
370 }
371
372 bool deleteParticle(size_t cellIndex, size_t particleIndex) override {
373 auto &particleVec = this->_cells[cellIndex]._particles;
374 auto &particle = particleVec[particleIndex];
375 // swap-delete
376 particle = particleVec.back();
377 particleVec.pop_back();
378 return particleIndex < particleVec.size();
379 }
380
381 private:
382 class DirectSumCellBorderAndFlagManager : public internal::CellBorderAndFlagManager {
386 using index_t = std::size_t;
387
388 public:
389 [[nodiscard]] bool cellCanContainHaloParticles(index_t index1d) const override {
390 return index1d >= 1 and index1d <= 6;
391 }
392
393 [[nodiscard]] bool cellCanContainOwnedParticles(index_t index1d) const override { return index1d == 0; }
394
395 } _cellBorderFlagManager;
396
408 template <bool regionIter>
409 std::tuple<const Particle_T *, size_t, size_t> getParticleImpl(size_t cellIndex, size_t particleIndex,
410 IteratorBehavior iteratorBehavior,
411 const std::array<double, 3> &boxMin,
412 const std::array<double, 3> &boxMax) const {
413 // first and last relevant cell index
414 const auto [startCellIndex, endCellIndex] = [&]() -> std::tuple<size_t, size_t> {
415 // shortcuts to limit the iterator to only part of the domain.
416 if (not(iteratorBehavior & IteratorBehavior::halo)) {
417 // only owned region
418 return {0, 0};
419 }
420 if (not(iteratorBehavior & IteratorBehavior::owned)) {
421 // only halo region
422 return {1, 6};
423 }
424 if constexpr (regionIter) {
425 // if the region lies fully within the container only look at the owned cell
426 if (utils::ArrayMath::less(this->getBoxMin(), boxMin) and utils::ArrayMath::less(boxMax, this->getBoxMax())) {
427 return {0, 0};
428 }
429 }
430 // all cells
431 return {0, 6};
432 }();
433
434 // if we are at the start of an iteration determine this thread's cell index
435 if (cellIndex == 0 and particleIndex == 0) {
436 cellIndex =
437 startCellIndex + ((iteratorBehavior & IteratorBehavior::forceSequential) ? 0 : autopas_get_thread_num());
438 }
439 // abort if the index is out of bounds
440 if (cellIndex >= this->_cells.size()) {
441 return {nullptr, 0, 0};
442 }
443 // check the data behind the indices
444 if (particleIndex >= this->_cells[cellIndex].size() or
445 not containerIteratorUtils::particleFulfillsIteratorRequirements<regionIter>(
446 this->_cells[cellIndex][particleIndex], iteratorBehavior, boxMin, boxMax)) {
447 // either advance them to something interesting or invalidate them.
448 std::tie(cellIndex, particleIndex) =
449 advanceIteratorIndices<regionIter>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
450 }
451
452 // shortcut if the given index doesn't exist
453 if (cellIndex >= this->_cells.size()) {
454 return {nullptr, 0, 0};
455 }
456 const Particle_T *retPtr = &this->_cells[cellIndex][particleIndex];
457
458 return {retPtr, cellIndex, particleIndex};
459 }
460
472 template <bool regionIter>
473 std::tuple<size_t, size_t> advanceIteratorIndices(size_t cellIndex, size_t particleIndex,
474 IteratorBehavior iteratorBehavior,
475 const std::array<double, 3> &boxMin,
476 const std::array<double, 3> &boxMax) const {
477 // Find the indices for the next particle
478 const size_t stride = (iteratorBehavior & IteratorBehavior::forceSequential) ? 1 : autopas_get_num_threads();
479
480 do {
481 // advance to the next particle
482 ++particleIndex;
483 // If this breaches the end of a cell, find the next non-empty cell and reset particleIndex.
484 while (particleIndex >= this->_cells[cellIndex].size()) {
485 cellIndex += stride;
486 particleIndex = 0;
487 // If there are no more reasonable cells return invalid indices.
488 if (cellIndex > ((not(iteratorBehavior & IteratorBehavior::halo)) ? 0 : (this->_cells.size() - 1))) {
489 return {std::numeric_limits<decltype(cellIndex)>::max(), std::numeric_limits<decltype(particleIndex)>::max()};
490 }
491 }
492 } while (not containerIteratorUtils::particleFulfillsIteratorRequirements<regionIter>(
493 this->_cells[cellIndex][particleIndex], iteratorBehavior, boxMin, boxMax));
494
495 // the indices returned at this point should always be valid
496 return {cellIndex, particleIndex};
497 }
498
504 template <typename Traversal>
505 void prepareTraversal(Traversal &traversal) {
506 auto *dsTraversal = dynamic_cast<DSTraversalInterface *>(traversal);
507 auto *cellTraversal = dynamic_cast<CellTraversal<ParticleCellType> *>(traversal);
508 if (dsTraversal && cellTraversal) {
509 cellTraversal->setAoSSortingThresholds(*this->_aosSortingThresholds);
510 cellTraversal->setSoASortingThresholds(*this->_soaSortingThresholds);
511 cellTraversal->setCellsToTraverse(this->_cells);
512 } else {
514 "The selected traversal is not compatible with the DirectSum container. TraversalID: {}",
515 traversal->getTraversalType());
516 }
517 }
518
519 ParticleCellType &getOwnedCell() { return this->_cells[0]; };
520
521 ParticleCellType &getHaloCell() { return this->_cells[1]; };
522};
523
524} // namespace autopas
The CellBasedParticleContainer class stores particles in some object and provides methods to iterate ...
Definition: CellBasedParticleContainer.h:28
const std::array< double, 3 > & getBoxMax() const final
Get the upper corner of the container without halo.
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:141
double getVerletSkin() const final
Returns the verlet Skin length.
Definition: CellBasedParticleContainer.h:104
double getCutoff() const final
Return the cutoff of the container.
Definition: CellBasedParticleContainer.h:89
std::shared_ptr< const SortingThresholdInfoInterface > _soaSortingThresholds
Current AoS pair-sorting threshold, forwarded to freshly generated traversals in prepareTraversal().
Definition: CellBasedParticleContainer.h:192
std::shared_ptr< const SortingThresholdInfoInterface > _aosSortingThresholds
Current AoS pair-sorting threshold, forwarded to freshly generated traversals in prepareTraversal().
Definition: CellBasedParticleContainer.h:188
const std::array< double, 3 > & getBoxMin() const final
Get the lower corner of the container without halo.
Definition: CellBasedParticleContainer.h:84
std::vector< ParticleCellType > _cells
Vector of particle cells.
Definition: CellBasedParticleContainer.h:181
A cell pair traversal.
Definition: CellTraversal.h:25
virtual void setAoSSortingThresholds(const SortingThresholdInfoInterface &aosSortingThreshold)=0
Set the aos-sorting-threshold for traversals that use the CellFunctor.
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:372
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:323
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:337
void addParticleImpl(const Particle_T &p) override
Adds a particle to the container.
Definition: DirectSum.h:99
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:301
TraversalSelectorInfo getTraversalSelectorInfo() const override
Generates a traversal selector info for this container.
Definition: DirectSum.h:188
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:281
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:212
void rebuildNeighborLists(TraversalInterface *traversal) override
Rebuilds the neighbor lists for the next traversals.
Definition: DirectSum.h:150
void deleteHaloParticles() override
Deletes all halo particles.
Definition: DirectSum.h:144
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:89
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:317
void computeInteractions(TraversalInterface *traversal) override
Iterates over all particle multiples (e.g.
Definition: DirectSum.h:154
std::vector< Particle_T > updateContainer(bool keepNeighborListsValid) override
Updates the container.
Definition: DirectSum.h:162
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:260
DirectSum(const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax, double cutoff, double skin, const size_t aosSortingThresholdFallback, const size_t soaSortingThresholdFallback)
Constructor of the DirectSum class.
Definition: DirectSum.h:69
void forEach(Lambda forEachLambda, IteratorBehavior behavior)
Execute code on all particles in this container as defined by a lambda function.
Definition: DirectSum.h:223
bool updateHaloParticle(const Particle_T &haloParticle) override
Update a halo particle of the container with the given haloParticle.
Definition: DirectSum.h:123
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:104
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:270
ContainerOption getContainerType() const override
Get the ContainerType.
Definition: DirectSum.h:87
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:202
void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior)
Reduce properties of particles as defined by a lambda function.
Definition: DirectSum.h:242
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