15template <
class Particle_T>
16class VerletNeighborListAsBuild;
28template <
class Particle_T,
bool callCheckInstead = false>
41 return std::array<typename Particle_T::AttributeNames, 4>{
42 Particle_T::AttributeNames::ptr, Particle_T::AttributeNames::posX, Particle_T::AttributeNames::posY,
43 Particle_T::AttributeNames::posZ};
50 return std::array<typename Particle_T::AttributeNames, 4>{
51 Particle_T::AttributeNames::id, Particle_T::AttributeNames::posX, Particle_T::AttributeNames::posY,
52 Particle_T::AttributeNames::posZ};
58 constexpr static auto getComputedAttr() {
return std::array<typename Particle_T::AttributeNames, 0>{}; }
71 _cutoffskinsquared(cutoffskin * cutoffskin) {}
73 std::string
getName()
override {
return "AsBuildPairGeneratorFunctor"; }
83 void AoSFunctor(Particle_T &i, Particle_T &j,
bool newton3)
override {
84 using namespace autopas::utils::ArrayMath::literals;
86 const auto dist = i.getR() - j.getR();
88 if (distsquare < _cutoffskinsquared) {
89 if (callCheckInstead) {
90 _list.checkPair(&i, &j);
92 _list.addPair(&i, &j);
103 if (soa.
size() == 0)
return;
105 auto **
const __restrict ptrptr = soa.template begin<Particle_T::AttributeNames::ptr>();
106 double *
const __restrict xptr = soa.template begin<Particle_T::AttributeNames::posX>();
107 double *
const __restrict yptr = soa.template begin<Particle_T::AttributeNames::posY>();
108 double *
const __restrict zptr = soa.template begin<Particle_T::AttributeNames::posZ>();
110 size_t numPart = soa.
size();
111 for (
unsigned int i = 0; i < numPart; ++i) {
112 for (
unsigned int j = i + 1; j < numPart; ++j) {
113 const double drx = xptr[i] - xptr[j];
114 const double dry = yptr[i] - yptr[j];
115 const double drz = zptr[i] - zptr[j];
117 const double drx2 = drx * drx;
118 const double dry2 = dry * dry;
119 const double drz2 = drz * drz;
121 const double dr2 = drx2 + dry2 + drz2;
123 if (dr2 < _cutoffskinsquared) {
124 _list.addPair(ptrptr[i], ptrptr[j]);
126 _list.addPair(ptrptr[j], ptrptr[i]);
139 if (soa1.
size() == 0 || soa2.
size() == 0)
return;
141 auto **
const __restrict ptrptr1 = soa1.template begin<Particle_T::AttributeNames::ptr>();
142 double *
const __restrict x1ptr = soa1.template begin<Particle_T::AttributeNames::posX>();
143 double *
const __restrict y1ptr = soa1.template begin<Particle_T::AttributeNames::posY>();
144 double *
const __restrict z1ptr = soa1.template begin<Particle_T::AttributeNames::posZ>();
146 auto **
const __restrict ptrptr2 = soa2.template begin<Particle_T::AttributeNames::ptr>();
147 double *
const __restrict x2ptr = soa2.template begin<Particle_T::AttributeNames::posX>();
148 double *
const __restrict y2ptr = soa2.template begin<Particle_T::AttributeNames::posY>();
149 double *
const __restrict z2ptr = soa2.template begin<Particle_T::AttributeNames::posZ>();
151 size_t numPart1 = soa1.
size();
152 for (
unsigned int i = 0; i < numPart1; ++i) {
153 size_t numPart2 = soa2.
size();
154 for (
unsigned int j = 0; j < numPart2; ++j) {
155 const double drx = x1ptr[i] - x2ptr[j];
156 const double dry = y1ptr[i] - y2ptr[j];
157 const double drz = z1ptr[i] - z2ptr[j];
159 const double drx2 = drx * drx;
160 const double dry2 = dry * dry;
161 const double drz2 = drz * drz;
163 const double dr2 = drx2 + dry2 + drz2;
165 if (dr2 < _cutoffskinsquared) {
166 _list.addPair(ptrptr1[i], ptrptr2[j]);
180 double _cutoffskinsquared;
PairwiseFunctor class.
Definition: PairwiseFunctor.h:31
View on a fixed part of a SoA between a start index and an end index.
Definition: SoAView.h:23
size_t size() const
Returns the number of particles in the view.
Definition: SoAView.h:83
This class implements a neighbor list that remembers which thread added which particle pair and at wh...
Definition: VerletNeighborListAsBuild.h:22
This functor can generate or check variable verlet lists using the typical pairwise traversal.
Definition: AsBuildPairGeneratorFunctor.h:30
void AoSFunctor(Particle_T &i, Particle_T &j, bool newton3) override
Adds the given pair to the neighbor list.
Definition: AsBuildPairGeneratorFunctor.h:83
AsBuildPairGeneratorFunctor(VerletNeighborListAsBuild< Particle_T > &neighborList, double cutoffskin)
Constructor of the functor.
Definition: AsBuildPairGeneratorFunctor.h:68
void SoAFunctorSingle(SoAView< SoAArraysType > soa, bool newton3) override
Adds all pairs of the SoA to the neighbor list.
Definition: AsBuildPairGeneratorFunctor.h:102
static constexpr auto getNeededAttr(std::false_type)
Get attributes needed for computation without N3 optimization.
Definition: AsBuildPairGeneratorFunctor.h:49
bool allowsNewton3() override
Specifies whether the functor is capable of Newton3-like functors.
Definition: AsBuildPairGeneratorFunctor.h:60
typename Particle_T::SoAArraysType SoAArraysType
The structure of the SoAs is defined by the particle.
Definition: AsBuildPairGeneratorFunctor.h:35
static constexpr auto getNeededAttr()
Get attributes needed for computation.
Definition: AsBuildPairGeneratorFunctor.h:40
void SoAFunctorPair(SoAView< SoAArraysType > soa1, SoAView< SoAArraysType > soa2, bool) override
Adds all pairs (p1, p2), p1 element soa1, p2 element soa2 to the neighbor list.
Definition: AsBuildPairGeneratorFunctor.h:138
std::string getName() override
Returns name of functor.
Definition: AsBuildPairGeneratorFunctor.h:73
bool isRelevantForTuning() override
Specifies whether the functor should be considered for the auto-tuning process.
Definition: AsBuildPairGeneratorFunctor.h:75
static constexpr auto getComputedAttr()
Get attributes computed by this functor.
Definition: AsBuildPairGeneratorFunctor.h:58
bool allowsNonNewton3() override
Specifies whether the functor is capable of non-Newton3-like functors.
Definition: AsBuildPairGeneratorFunctor.h:61
constexpr T dot(const std::array< T, SIZE > &a, const std::array< T, SIZE > &b)
Generates the dot product of two arrays.
Definition: ArrayMath.h:233
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32