22template <
class ParticleCell_T,
class PairwiseFunctor_T>
24 using ParticleType = ParticleCell_T::ParticleType;
34 const bool useNewton3)
38 "VLListIterationTraversal: This traversal is not parallelized for newton3 enabled and will utilize "
43 [[nodiscard]] TraversalOption
getTraversalType()
const override {
return TraversalOption::vl_list_iteration; }
53 auto &cells = *(this->
_cells);
56 std::vector<size_t> offsets(cells.size() + 1);
58 cells.begin(), cells.end(), offsets.begin() + 1,
59 [](
const size_t &partialSum,
const auto &cell) { return partialSum + cell.size(); }, 0);
64 for (
size_t i = 0; i < cells.size(); ++i) {
65 _functor.SoALoader(cells[i], _soa, offsets[i],
true);
71 auto &cells = *(this->
_cells);
74 for (
auto &cell : cells) {
75 _functor.SoAExtractor(cell, _soa, offset);
76 offset += cell.size();
83 const size_t numParticles = neighborList.size();
87 case DataLayoutOption::aos: {
91 for (
size_t i = 0; i < numParticles; ++i) {
92 ParticleType &particleI = *indexToParticle[i];
93 const size_t numNeighbors = neighborList.count(i);
94 const size_t *neighborsIPtr = neighborList.begin(i);
95 for (
size_t j = 0; j < numNeighbors; ++j) {
96 _functor.AoSFunctor(particleI, *indexToParticle[neighborsIPtr[j]],
false);
101 for (
size_t i = 0; i < numParticles; ++i) {
102 ParticleType &particleI = *indexToParticle[i];
103 const size_t numNeighbors = neighborList.count(i);
104 const size_t *neighborsIPtr = neighborList.begin(i);
105 for (
size_t j = 0; j < numNeighbors; ++j) {
106 _functor.AoSFunctor(particleI, *indexToParticle[neighborsIPtr[j]],
true);
113 case DataLayoutOption::soa: {
116 for (
size_t i = 0; i < numParticles; ++i) {
117 _functor.SoAFunctorVerlet(_soa, i, neighborList.getNeighbors(i),
false);
121 for (
size_t i = 0; i < numParticles; ++i) {
122 _functor.SoAFunctorVerlet(_soa, i, neighborList.getNeighbors(i),
true);
137 PairwiseFunctor_T &_functor;
#define AutoPasLog(lvl, fmt,...)
Macro for logging providing common meta information without filename.
Definition: Logger.h:74
#define AUTOPAS_OPENMP(args)
Empty macro to throw away any arguments.
Definition: WrapOpenMP.h:126
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:23
bool isApplicableToDomain() const override
VL List iteration is always applicable to the domain.
Definition: VLListIterationTraversal.h:49
VLListIterationTraversal(PairwiseFunctor_T &pairwiseFunctor, const DataLayoutOption dataLayout, const bool useNewton3)
Constructor for Verlet Traversal.
Definition: VLListIterationTraversal.h:33
void traverseParticles() override
Traverse the particles by pairs, triplets etc.
Definition: VLListIterationTraversal.h:81
TraversalOption getTraversalType() const override
Return a enum representing the name of the traversal class.
Definition: VLListIterationTraversal.h:43
void initTraversal() override
Initializes the traversal.
Definition: VLListIterationTraversal.h:51
void endTraversal() override
Finalizes the traversal.
Definition: VLListIterationTraversal.h:70
This class provides the Traversal Interface for the verlet lists container.
Definition: VLTraversalInterface.h:22
const std::vector< ParticleType * > * _indexToParticle
Vector mapping SoA indices to particle pointers.
Definition: VLTraversalInterface.h:69
std::vector< ParticleCell_T > * _cells
The cells of the underlying linked cells container of the verlet lists container.
Definition: VLTraversalInterface.h:52
VerletListHelpers< ParticleType >::NeighborListCRS * _neighborList
The flat CRS neighbor list.
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