23template <
class ParticleCell,
class PairwiseFunctor>
37 [[nodiscard]] TraversalOption
getTraversalType()
const override {
return TraversalOption::vl_list_iteration; }
46 auto &cells = *(this->
_cells);
50 std::vector<size_t> offsets(cells.size() + 1);
52 cells.begin(), cells.end(), offsets.begin() + 1,
53 [](
const size_t &partialSum,
const auto &cell) { return partialSum + cell.size(); }, 0);
58 for (
size_t i = 0; i < cells.size(); ++i) {
59 _functor.
SoALoader(cells[i], _soa, offsets[i],
true);
65 auto &cells = *(this->
_cells);
68 for (
auto &cell : cells) {
70 offset += cell.size();
79 case DataLayoutOption::aos: {
82 size_t buckets = aosNeighborLists.bucket_count();
85 for (
size_t bucketId = 0; bucketId < buckets; bucketId++) {
86 auto endIter = aosNeighborLists.end(bucketId);
87 for (
auto bucketIter = aosNeighborLists.begin(bucketId); bucketIter != endIter; ++bucketIter) {
88 ParticleType &particle = *(bucketIter->first);
89 for (
auto neighborPtr : bucketIter->second) {
90 ParticleType &neighbor = *neighborPtr;
91 _functor.
AoSFunctor(particle, neighbor,
false);
96 for (
auto &[particlePtr, neighborPtrList] : aosNeighborLists) {
97 ParticleType &particle = *particlePtr;
98 for (
auto neighborPtr : neighborPtrList) {
99 ParticleType &neighbor = *neighborPtr;
107 case DataLayoutOption::soa: {
111 for (
size_t particleIndex = 0; particleIndex < soaNeighborLists.size(); particleIndex++) {
116 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:127
void SoAExtractor(ParticleCell &cell, SoA< SoAArraysType > &soa, size_t offset)
Copies the data stored in the soa back into the cell.
Definition: Functor.h:141
PairwiseFunctor class.
Definition: PairwiseFunctor.h:45
virtual void AoSFunctor(Particle_T &i, Particle_T &j, bool newton3)
PairwiseFunctor for arrays of structures (AoS).
Definition: PairwiseFunctor.h:70
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:100
Particle_T ParticleType
The particle type for this cell.
Definition: ParticleCell.h:54
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:77
bool _useNewton3
If this traversal makes use of newton3.
Definition: TraversalInterface.h:82
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
void endTraversal() override
Finalizes the traversal.
Definition: VLListIterationTraversal.h:64
void initTraversal() override
Initializes the traversal.
Definition: VLListIterationTraversal.h:45
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VLListIterationTraversal.h:75
VLListIterationTraversal(PairwiseFunctor &pairwiseFunctor, DataLayoutOption dataLayout, bool useNewton3)
Constructor for Verlet Traversal.
Definition: VLListIterationTraversal.h:34
bool isApplicableToDomain() const override
VL List iteration is always applicable to the domain.
Definition: VLListIterationTraversal.h:43
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:64
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:34
int autopas_get_max_threads()
Dummy for omp_get_max_threads() when no OpenMP is available.
Definition: WrapOpenMP.h:144