AutoPas  3.0.0
Loading...
Searching...
No Matches
NeighborIdentificationFunctor.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <string>
10#include <unordered_map>
11#include <vector>
12
14
15namespace autopas {
16
22template <class Particle_T>
24 public:
29 explicit AoSNeighborListPolicy(std::unordered_map<Particle_T *, std::vector<Particle_T *>> &neighborListAoS)
30 : _neighborListsAoS(neighborListAoS) {}
31
40 template <class ParticleIterator_T>
41 void initializeNeighborList(ParticleIterator_T particlesBegin) {
42 _neighborListsAoS.clear();
43 for (auto iter = particlesBegin; iter.isValid(); ++iter) {
44 _neighborListsAoS[&(*iter)];
45 }
46 }
47
53 void add(Particle_T *i, Particle_T *j) { _neighborListsAoS[i].push_back(j); }
54
55 private:
56 std::unordered_map<Particle_T *, std::vector<Particle_T *>> &_neighborListsAoS;
57};
58
79template <class Particle_T>
81 : public InteractionListGeneratorFunctor<Particle_T, AoSNeighborListPolicy<Particle_T>> {
82 public:
97 const bool gatherNewton3Lists)
98 : InteractionListGeneratorFunctor<Particle_T, AoSNeighborListPolicy<Particle_T>>(policy, interactionLength,
99 gatherNewton3Lists),
100 _policy(policy) {}
101
102 std::string getName() override { return "NeighborIdentificationFunctor"; }
103
114 template <class ParticleIterator_T>
115 void initializeNeighborList(ParticleIterator_T particlesBegin) {
116 _policy.initializeNeighborList(particlesBegin);
117 }
118
123 bool isRelevantForTuning() override { return true; }
124
125 private:
127};
128
129} // namespace autopas
A policy for managing neighbor lists in an Array of Structures (AoS) layout.
Definition: NeighborIdentificationFunctor.h:23
AoSNeighborListPolicy(std::unordered_map< Particle_T *, std::vector< Particle_T * > > &neighborListAoS)
Constructor.
Definition: NeighborIdentificationFunctor.h:29
void add(Particle_T *i, Particle_T *j)
Adds a neighbor j to the neighbor list of particle i.
Definition: NeighborIdentificationFunctor.h:53
void initializeNeighborList(ParticleIterator_T particlesBegin)
Initializes the neighbor list map for the given range of particles: clears any previous contents and ...
Definition: NeighborIdentificationFunctor.h:41
This functor generates lists of particles within interactionLength of each other: can be used interna...
Definition: InteractionListGeneratorFunctor.h:39
This functor generates lists of particles within interactionLength of each other, which could be used...
Definition: NeighborIdentificationFunctor.h:81
std::string getName() override
Returns name of functor.
Definition: NeighborIdentificationFunctor.h:102
NeighborIdentificationFunctor(AoSNeighborListPolicy< Particle_T > &policy, double interactionLength, const bool gatherNewton3Lists)
Constructor.
Definition: NeighborIdentificationFunctor.h:96
void initializeNeighborList(ParticleIterator_T particlesBegin)
Initializes the neighbor list map for the given range of particles: clears any previous contents and ...
Definition: NeighborIdentificationFunctor.h:115
bool isRelevantForTuning() override
Whether the functor is relevant for tuning.
Definition: NeighborIdentificationFunctor.h:123
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:34