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"
26
27namespace autopas {
28
46template <class Particle_T>
47class DirectSum : public CellBasedParticleContainer<FullParticleCell<Particle_T>> {
48 public:
53
57 using ParticleType = Particle_T;
58
70 DirectSum(const std::array<double, 3> &boxMin, const std::array<double, 3> &boxMax, double cutoff, double skin,
71 const size_t aosSortingThresholdFallback, const size_t soaSortingThresholdFallback)
72 : CellBasedParticleContainer<ParticleCellType>(boxMin, boxMax, cutoff, skin, aosSortingThresholdFallback,
73 soaSortingThresholdFallback),
74 _cellBorderFlagManager() {
75 using namespace autopas::utils::ArrayMath::literals;
76 // 1 owned and 6 halo cells
77 this->_cells.resize(7);
78 this->_cells[0].setPossibleParticleOwnerships(OwnershipState::owned);
79 std::for_each(++this->_cells.begin(), this->_cells.end(),
80 [&](auto &cell) { cell.setPossibleParticleOwnerships(OwnershipState::halo); });
81 auto boxLength = boxMax - boxMin;
82 this->_cells[0].setCellLength(boxLength);
83 }
84
88 [[nodiscard]] ContainerOption getContainerType() const override { return ContainerOption::directSum; }
89
90 void reserve(size_t numParticles, size_t numParticlesHaloEstimate) override {
91 this->getOwnedCell().reserve(numParticles);
92 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
93 cellIt->reserve(numParticlesHaloEstimate);
94 }
95 };
96
100 void addParticleImpl(const Particle_T &p) override { getOwnedCell().addParticle(p); }
101
105 void addHaloParticleImpl(const Particle_T &haloParticle) override {
106 const auto boxMax = this->getBoxMax();
107 const auto boxMin = this->getBoxMin();
108 const auto pos = haloParticle.getR();
109
110 for (size_t dim = 0; dim < 3; ++dim) {
111 if (pos[dim] < boxMin[dim]) {
112 this->_cells[2 * dim + 1].addParticle(haloParticle);
113 return;
114 } else if (pos[dim] >= boxMax[dim]) {
115 this->_cells[2 * dim + 2].addParticle(haloParticle);
116 return;
117 }
118 }
119 }
120
124 bool updateHaloParticle(const Particle_T &haloParticle) override {
125 const auto boxMax = this->getBoxMax();
126 const auto boxMin = this->getBoxMin();
127 const auto pos = haloParticle.getR();
128 const auto skinHalf = 0.5 * this->getVerletSkin();
129
130 // Look for the particle in halo cells that are within half the skin distance of its position
131 for (size_t dim = 0; dim < 3; ++dim) {
132 if (pos[dim] < boxMin[dim] + skinHalf) {
133 std::lock_guard<AutoPasLock> cellLock(this->_cells[2 * dim + 1].getCellLock());
134 if (internal::checkParticleInCellAndUpdateByIDAndPosition(this->_cells[2 * dim + 1], haloParticle, skinHalf)) {
135 return true;
136 }
137 } else if (pos[dim] >= boxMax[dim] - skinHalf) {
138 std::lock_guard<AutoPasLock> cellLock(this->_cells[2 * dim + 2].getCellLock());
139 if (internal::checkParticleInCellAndUpdateByIDAndPosition(this->_cells[2 * dim + 2], haloParticle, skinHalf)) {
140 return true;
141 }
142 }
143 }
144 return false;
145 }
146
147 void deleteHaloParticles() override {
148 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
149 cellIt->clear();
150 }
151 }
152
153 void rebuildNeighborLists(TraversalInterface *traversal) override {
154 // nothing to do.
155 }
156
157 void computeInteractions(TraversalInterface *traversal) override {
158 prepareTraversal(traversal);
159
160 traversal->initTraversal();
161 traversal->traverseParticles();
162 traversal->endTraversal();
163 }
164
165 [[nodiscard]] std::vector<Particle_T> updateContainer(bool keepNeighborListsValid) override {
166 if (keepNeighborListsValid) {
168 }
169 // first we delete halo particles, as we don't want them here.
171 getOwnedCell().deleteDummyParticles();
172
173 std::vector<Particle_T> invalidParticles{};
174 auto &particleVec = getOwnedCell()._particles;
175 for (auto iter = particleVec.begin(); iter != particleVec.end();) {
176 if (utils::notInBox(iter->getR(), this->getBoxMin(), this->getBoxMax())) {
177 invalidParticles.push_back(*iter);
178 // swap-delete
179 *iter = particleVec.back();
180 particleVec.pop_back();
181 } else {
182 ++iter;
183 }
184 }
185 return invalidParticles;
186 }
187
191 [[nodiscard]] TraversalSelectorInfo getTraversalSelectorInfo() const override {
192 using namespace autopas::utils::ArrayMath::literals;
193
194 // direct sum consists of seven cells (owned + two halo cells in each dimension)
196 // DS container can be viewed as a 3x3x3 grid with some halo cells being combined.
197 {3, 3, 3},
198 // intentionally use cutoff here, as ds_sequential should be using the cutoff.
199 this->getCutoff(), this->getBoxMax() - this->getBoxMin(), 0);
200 }
201
206 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo,
208 std::nullopt) override {
209 return ContainerIterator<Particle_T, true, false>(*this, behavior, additionalVectors);
210 }
211
216 IteratorBehavior behavior = IteratorBehavior::ownedOrHalo,
218 std::nullopt) const override {
219 return ContainerIterator<Particle_T, false, false>(*this, behavior, additionalVectors);
220 }
221
225 template <typename Lambda>
226 void forEach(Lambda forEachLambda, IteratorBehavior behavior) {
227 if (behavior & IteratorBehavior::owned) {
228 getOwnedCell().forEach(forEachLambda);
229 }
230 if (behavior & IteratorBehavior::halo) {
231 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
232 cellIt->forEach(forEachLambda);
233 }
234 }
235 // sanity check
236 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
237 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
238 }
239 }
240
244 template <typename Lambda, typename A>
245 void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior) {
246 if (behavior & IteratorBehavior::owned) {
247 getOwnedCell().reduce(reduceLambda, result);
248 }
249 if (behavior & IteratorBehavior::halo) {
250 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
251 cellIt->reduce(reduceLambda, result);
252 }
253 }
254 // sanity check
255 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
256 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
257 }
258 }
259
264 const std::array<double, 3> &lowerCorner, const std::array<double, 3> &higherCorner, IteratorBehavior behavior,
266 std::nullopt) override {
267 return ContainerIterator<Particle_T, true, true>(*this, behavior, additionalVectors, lowerCorner, higherCorner);
268 }
269
274 const std::array<double, 3> &lowerCorner, const std::array<double, 3> &higherCorner, IteratorBehavior behavior,
276 std::nullopt) const override {
277 return ContainerIterator<Particle_T, false, true>(*this, behavior, additionalVectors, lowerCorner, higherCorner);
278 }
279
283 template <typename Lambda>
284 void forEachInRegion(Lambda forEachLambda, const std::array<double, 3> &lowerCorner,
285 const std::array<double, 3> &higherCorner, IteratorBehavior behavior) {
286 if (behavior & IteratorBehavior::owned) {
287 getOwnedCell().forEach(forEachLambda, lowerCorner, higherCorner, behavior);
288 }
289 if (behavior & IteratorBehavior::halo) {
290 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
291 cellIt->forEach(forEachLambda, lowerCorner, higherCorner, behavior);
292 }
293 }
294 // sanity check
295 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
296 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
297 }
298 }
299
303 template <typename Lambda, typename A>
304 void reduceInRegion(Lambda reduceLambda, A &result, const std::array<double, 3> &lowerCorner,
305 const std::array<double, 3> &higherCorner, IteratorBehavior behavior) {
306 if (behavior & IteratorBehavior::owned) {
307 getOwnedCell().reduce(reduceLambda, result, lowerCorner, higherCorner, behavior);
308 }
309 if (behavior & IteratorBehavior::halo) {
310 for (auto cellIt = ++this->_cells.begin(); cellIt != this->_cells.end(); cellIt++) {
311 cellIt->reduce(reduceLambda, result, lowerCorner, higherCorner, behavior);
312 }
313 }
314 // sanity check
315 if (not(behavior & IteratorBehavior::ownedOrHalo)) {
316 utils::ExceptionHandler::exception("Encountered invalid iterator behavior!");
317 }
318 }
319
320 std::tuple<const Particle_T *, size_t, size_t> getParticle(size_t cellIndex, size_t particleIndex,
321 IteratorBehavior iteratorBehavior,
322 const std::array<double, 3> &boxMin,
323 const std::array<double, 3> &boxMax) const override {
324 return getParticleImpl<true>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
325 }
326 std::tuple<const Particle_T *, size_t, size_t> getParticle(size_t cellIndex, size_t particleIndex,
327 IteratorBehavior iteratorBehavior) const override {
328 // this is not a region iter hence we stretch the bounding box to the numeric max
329 constexpr std::array<double, 3> boxMin{std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest(),
330 std::numeric_limits<double>::lowest()};
331
332 constexpr std::array<double, 3> boxMax{std::numeric_limits<double>::max(), std::numeric_limits<double>::max(),
333 std::numeric_limits<double>::max()};
334 return getParticleImpl<false>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
335 }
336
340 void deleteParticle(Particle_T &particle) override {
341 // This function doesn't actually delete anything. The particle is removed when the container is rebuilt.
343 }
344
345 void deleteParticle(size_t cellIndex, size_t particleIndex) override {
346 // This function doesn't actually delete anything. The particle is removed when the container is rebuilt.
347 internal::markParticleAsDeleted(this->_cells[cellIndex][particleIndex]);
348 }
349
350 private:
351 class DirectSumCellBorderAndFlagManager : public internal::CellBorderAndFlagManager {
355 using index_t = std::size_t;
356
357 public:
358 [[nodiscard]] bool cellCanContainHaloParticles(index_t index1d) const override {
359 return index1d >= 1 and index1d <= 6;
360 }
361
362 [[nodiscard]] bool cellCanContainOwnedParticles(index_t index1d) const override { return index1d == 0; }
363
364 } _cellBorderFlagManager;
365
377 template <bool regionIter>
378 std::tuple<const Particle_T *, size_t, size_t> getParticleImpl(size_t cellIndex, size_t particleIndex,
379 IteratorBehavior iteratorBehavior,
380 const std::array<double, 3> &boxMin,
381 const std::array<double, 3> &boxMax) const {
382 // first and last relevant cell index
383 const auto [startCellIndex, endCellIndex] = [&]() -> std::tuple<size_t, size_t> {
384 // shortcuts to limit the iterator to only part of the domain.
385 if (not(iteratorBehavior & IteratorBehavior::halo)) {
386 // only owned region
387 return {0, 0};
388 }
389 if (not(iteratorBehavior & IteratorBehavior::owned)) {
390 // only halo region
391 return {1, 6};
392 }
393 if constexpr (regionIter) {
394 // if the region lies fully within the container only look at the owned cell
395 if (utils::ArrayMath::less(this->getBoxMin(), boxMin) and utils::ArrayMath::less(boxMax, this->getBoxMax())) {
396 return {0, 0};
397 }
398 }
399 // all cells
400 return {0, 6};
401 }();
402
403 // if we are at the start of an iteration determine this thread's cell index
404 if (cellIndex == 0 and particleIndex == 0) {
405 cellIndex =
406 startCellIndex + ((iteratorBehavior & IteratorBehavior::forceSequential) ? 0 : autopas_get_thread_num());
407 }
408 // abort if the index is out of bounds
409 if (cellIndex >= this->_cells.size()) {
410 return {nullptr, 0, 0};
411 }
412 // check the data behind the indices
413 if (particleIndex >= this->_cells[cellIndex].size() or
414 not containerIteratorUtils::particleFulfillsIteratorRequirements<regionIter>(
415 this->_cells[cellIndex][particleIndex], iteratorBehavior, boxMin, boxMax)) {
416 // either advance them to something interesting or invalidate them.
417 std::tie(cellIndex, particleIndex) =
418 advanceIteratorIndices<regionIter>(cellIndex, particleIndex, iteratorBehavior, boxMin, boxMax);
419 }
420
421 // shortcut if the given index doesn't exist
422 if (cellIndex >= this->_cells.size()) {
423 return {nullptr, 0, 0};
424 }
425 const Particle_T *retPtr = &this->_cells[cellIndex][particleIndex];
426
427 return {retPtr, cellIndex, particleIndex};
428 }
429
441 template <bool regionIter>
442 std::tuple<size_t, size_t> advanceIteratorIndices(size_t cellIndex, size_t particleIndex,
443 IteratorBehavior iteratorBehavior,
444 const std::array<double, 3> &boxMin,
445 const std::array<double, 3> &boxMax) const {
446 // Find the indices for the next particle
447 const size_t stride = (iteratorBehavior & IteratorBehavior::forceSequential) ? 1 : autopas_get_num_threads();
448
449 do {
450 // advance to the next particle
451 ++particleIndex;
452 // If this breaches the end of a cell, find the next non-empty cell and reset particleIndex.
453 while (particleIndex >= this->_cells[cellIndex].size()) {
454 cellIndex += stride;
455 particleIndex = 0;
456 // If there are no more reasonable cells return invalid indices.
457 if (cellIndex > ((not(iteratorBehavior & IteratorBehavior::halo)) ? 0 : (this->_cells.size() - 1))) {
458 return {std::numeric_limits<decltype(cellIndex)>::max(), std::numeric_limits<decltype(particleIndex)>::max()};
459 }
460 }
461 } while (not containerIteratorUtils::particleFulfillsIteratorRequirements<regionIter>(
462 this->_cells[cellIndex][particleIndex], iteratorBehavior, boxMin, boxMax));
463
464 // the indices returned at this point should always be valid
465 return {cellIndex, particleIndex};
466 }
467
473 template <typename Traversal>
474 void prepareTraversal(Traversal &traversal) {
475 auto *dsTraversal = dynamic_cast<DSTraversalInterface *>(traversal);
476 auto *cellTraversal = dynamic_cast<CellTraversal<ParticleCellType> *>(traversal);
477 if (dsTraversal && cellTraversal) {
478 cellTraversal->setAoSSortingThresholds(*this->_aosSortingThresholds);
479 cellTraversal->setSoASortingThresholds(*this->_soaSortingThresholds);
480 cellTraversal->setCellsToTraverse(this->_cells);
481 } else {
483 "The selected traversal is not compatible with the DirectSum container. TraversalID: {}",
484 traversal->getTraversalType());
485 }
486 }
487
488 ParticleCellType &getOwnedCell() { return this->_cells[0]; };
489
490 ParticleCellType &getHaloCell() { return this->_cells[1]; };
491};
492
493} // 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:96
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:109
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:47
void deleteParticle(Particle_T &particle) override
Marks the given particle as deleted.
Definition: DirectSum.h:340
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:326
void addParticleImpl(const Particle_T &p) override
Adds a particle to the container.
Definition: DirectSum.h:100
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:304
TraversalSelectorInfo getTraversalSelectorInfo() const override
Generates a traversal selector info for this container.
Definition: DirectSum.h:191
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:284
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:215
void rebuildNeighborLists(TraversalInterface *traversal) override
Rebuilds the neighbor lists for the next traversals.
Definition: DirectSum.h:153
void deleteHaloParticles() override
Deletes all halo particles.
Definition: DirectSum.h:147
FullParticleCell< Particle_T > ParticleCellType
Type of the ParticleCell.
Definition: DirectSum.h:52
void deleteParticle(size_t cellIndex, size_t particleIndex) override
Marks the particle at the given index positions as deleted.
Definition: DirectSum.h:345
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:90
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:320
void computeInteractions(TraversalInterface *traversal) override
Iterates over all particle multiples (e.g.
Definition: DirectSum.h:157
std::vector< Particle_T > updateContainer(bool keepNeighborListsValid) override
Updates the container.
Definition: DirectSum.h:165
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:263
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:70
void forEach(Lambda forEachLambda, IteratorBehavior behavior)
Execute code on all particles in this container as defined by a lambda function.
Definition: DirectSum.h:226
bool updateHaloParticle(const Particle_T &haloParticle) override
Update a halo particle of the container with the given haloParticle.
Definition: DirectSum.h:124
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:105
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:273
ContainerOption getContainerType() const override
Get the ContainerType.
Definition: DirectSum.h:88
Particle_T ParticleType
Type of the Particle.
Definition: DirectSum.h:57
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:205
void reduce(Lambda reduceLambda, A &result, IteratorBehavior behavior)
Reduce properties of particles as defined by a lambda function.
Definition: DirectSum.h:245
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
void markParticleAsDeleted(Particle_T &p)
Marks a particle as deleted.
Definition: markParticleAsDeleted.h:23
static bool checkParticleInCellAndUpdateByIDAndPosition(CellType &cell, const typename CellType::ParticleType &particle, double absError)
Updates a found particle within cellI to the values of particleI.
Definition: ParticleCellHelpers.h:25
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