23template <
class ParticleCell,
class PairwiseFunctor>
37 [[nodiscard]] TraversalOption
getTraversalType()
const override {
return TraversalOption::vl_list_iteration; }
45 auto &cells = *(this->
_cells);
49 std::vector<size_t> offsets(cells.size() + 1);
51 cells.begin(), cells.end(), offsets.begin() + 1,
52 [](
const size_t &partialSum,
const auto &cell) { return partialSum + cell.size(); }, 0);
57 for (
size_t i = 0; i < cells.size(); ++i) {
58 _functor->
SoALoader(cells[i], _soa, offsets[i],
true);
64 auto &cells = *(this->
_cells);
67 for (
auto &cell : cells) {
69 offset += cell.size();
78 case DataLayoutOption::aos: {
81 size_t buckets = aosNeighborLists.bucket_count();
84 for (
size_t bucketId = 0; bucketId < buckets; bucketId++) {
85 auto endIter = aosNeighborLists.end(bucketId);
86 for (
auto bucketIter = aosNeighborLists.begin(bucketId); bucketIter != endIter; ++bucketIter) {
87 ParticleType &particle = *(bucketIter->first);
88 for (
auto neighborPtr : bucketIter->second) {
89 ParticleType &neighbor = *neighborPtr;
90 _functor->
AoSFunctor(particle, neighbor,
false);
95 for (
auto &[particlePtr, neighborPtrList] : aosNeighborLists) {
96 ParticleType &particle = *particlePtr;
97 for (
auto neighborPtr : neighborPtrList) {
98 ParticleType &neighbor = *neighborPtr;
106 case DataLayoutOption::soa: {
110 for (
size_t particleIndex = 0; particleIndex < soaNeighborLists.size(); particleIndex++) {
115 for (
size_t particleIndex = 0; particleIndex < soaNeighborLists.size(); particleIndex++) {
#define AUTOPAS_OPENMP(args)
Empty macro to throw away any arguments.
Definition: WrapOpenMP.h:126
void SoALoader(ParticleCell &cell, SoA< SoAArraysType > &soa, size_t offset, bool skipSoAResize)
Copies the AoS data of the given cell in the given soa.
Definition: Functor.h:112
void SoAExtractor(ParticleCell &cell, SoA< SoAArraysType > &soa, size_t offset)
Copies the data stored in the soa back into the cell.
Definition: Functor.h:126
PairwiseFunctor class.
Definition: PairwiseFunctor.h:31
virtual void AoSFunctor(Particle_T &i, Particle_T &j, bool newton3)
PairwiseFunctor for arrays of structures (AoS).
Definition: PairwiseFunctor.h:56
virtual void SoAFunctorVerlet(SoAView< SoAArraysType > soa, const size_t indexFirst, const std::vector< size_t, AlignedAllocator< size_t > > &neighborList, bool newton3)
PairwiseFunctor for structure of arrays (SoA) for neighbor lists.
Definition: PairwiseFunctor.h:86
Particle_T ParticleType
The particle type for this cell.
Definition: ParticleCell.h:56
Structur of the array class.
Definition: SoA.h:28
void resizeArrays(size_t length)
Resizes all Vectors to the given length.
Definition: SoA.h:45
This interface serves as a common parent class for all traversals.
Definition: TraversalInterface.h:18
DataLayoutOption _dataLayout
The datalayout used by this traversal.
Definition: TraversalInterface.h:75
bool _useNewton3
If this traversal makes use of newton3.
Definition: TraversalInterface.h:80
This class provides a Traversal for the verlet lists container.
Definition: VLListIterationTraversal.h:24
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VLListIterationTraversal.h:37
VLListIterationTraversal(PairwiseFunctor *pairwiseFunctor, DataLayoutOption dataLayout, bool useNewton3)
Constructor for Verlet Traversal.
Definition: VLListIterationTraversal.h:34
bool isApplicable() const override
Checks if the traversal is applicable to the current state of the domain.
Definition: VLListIterationTraversal.h:39
void endTraversal() override
Finalizes the traversal.
Definition: VLListIterationTraversal.h:63
void initTraversal() override
Initializes the traversal.
Definition: VLListIterationTraversal.h:44
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VLListIterationTraversal.h:74
This class provides the Traversal Interface for the verlet lists container.
Definition: VLTraversalInterface.h:22
VerletListHelpers< typenameLinkedParticleCell::ParticleType >::NeighborListAoSType * _aosNeighborLists
The AoS neighbor list of the verlet lists container.
Definition: VLTraversalInterface.h:52
std::vector< ParticleCell > * _cells
The cells of the underlying linked cells container of the verlet lists container.
Definition: VLTraversalInterface.h:48
std::vector< std::vector< size_t, autopas::AlignedAllocator< size_t > > > * _soaNeighborLists
The SoA neighbor list of the verlet lists container.
Definition: VLTraversalInterface.h:57
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:63
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32
int autopas_get_max_threads()
Dummy for omp_get_max_threads() when no OpenMP is available.
Definition: WrapOpenMP.h:144