AutoPas  3.0.0
Loading...
Searching...
No Matches
PairwiseFunctor.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <span>
11#include <type_traits>
12#include <vector>
13
14#include "Functor.h"
18
19namespace autopas {
20
21template <class Particle>
22class VerletListHelpers;
23
37 size_t startI;
38
43 size_t endI;
44
48 const std::vector<size_t> &maxIndex;
49
54 const std::vector<size_t> &minIndex;
55};
56
65template <class Particle_T, class CRTP_T>
66class PairwiseFunctor : public Functor<Particle_T, CRTP_T> {
67 public:
71 using SoAArraysType = typename Particle_T::SoAArraysType;
72
77 explicit PairwiseFunctor(double cutoff) : Functor<Particle_T, CRTP_T>(cutoff){};
78
79 virtual ~PairwiseFunctor() = default;
80
91 virtual void AoSFunctor(Particle_T &i, Particle_T &j, bool newton3) {
92 utils::ExceptionHandler::exception("{}::AoSFunctor: not implemented", this->getName());
93 }
94
105 virtual void SoAFunctorSingle(SoAView<SoAArraysType> soa, bool newton3) {
106 utils::ExceptionHandler::exception("{}::SoAFunctorSingle: not implemented", this->getName());
107 }
108
121 virtual void SoAFunctorVerlet(SoAView<SoAArraysType> soa, const size_t indexFirst,
122 std::span<const size_t> neighborList, bool newton3) {
123 utils::ExceptionHandler::exception("{}::SoAFunctorVerlet: not implemented", this->getName());
124 }
125
137 virtual void SoAFunctorPair(SoAView<SoAArraysType> soa1, SoAView<SoAArraysType> soa2, bool newton3) {
138 utils::ExceptionHandler::exception("{}::SoAFunctorPair: not implemented", this->getName());
139 }
140
153 const SoASortingData &sortingData, bool newton3) {
154 if constexpr (not CRTP_T::supportsSoASorting) {
156 "SoAFunctorPairSorted() called on functor {} which has supportsSoASorting=false.", typeid(CRTP_T).name());
157 } else {
159 "Functor {} has supportsSoASorting=true but does not implement SoAFunctorPairSorted().",
160 typeid(CRTP_T).name());
161 }
162 }
163
171 bool isVecPatternAllowed(const VectorizationPatternOption::Value vecPattern) override {
172 return vecPattern == VectorizationPatternOption::p1xVec;
173 }
174};
175
176} // namespace autopas
Functor base class.
Definition: Functor.h:41
virtual std::string getName()=0
Returns name of functor.
PairwiseFunctor class.
Definition: PairwiseFunctor.h:66
virtual void AoSFunctor(Particle_T &i, Particle_T &j, bool newton3)
PairwiseFunctor for arrays of structures (AoS).
Definition: PairwiseFunctor.h:91
bool isVecPatternAllowed(const VectorizationPatternOption::Value vecPattern) override
Specifies whether the functor is capable of using the specified Vectorization Pattern in the SoA func...
Definition: PairwiseFunctor.h:171
virtual void SoAFunctorPair(SoAView< SoAArraysType > soa1, SoAView< SoAArraysType > soa2, bool newton3)
PairwiseFunctor for structure of arrays (SoA)
Definition: PairwiseFunctor.h:137
virtual void SoAFunctorVerlet(SoAView< SoAArraysType > soa, const size_t indexFirst, std::span< const size_t > neighborList, bool newton3)
PairwiseFunctor for structure of arrays (SoA) for neighbor lists.
Definition: PairwiseFunctor.h:121
PairwiseFunctor(double cutoff)
Constructor.
Definition: PairwiseFunctor.h:77
virtual void SoAFunctorSingle(SoAView< SoAArraysType > soa, bool newton3)
PairwiseFunctor for structure of arrays (SoA)
Definition: PairwiseFunctor.h:105
typename Particle_T::SoAArraysType SoAArraysType
Structure of the SoAs defined by the particle.
Definition: PairwiseFunctor.h:71
virtual void SoAFunctorPairSorted(SoAView< SoAArraysType > soa1, SoAView< SoAArraysType > soa2, const SoASortingData &sortingData, bool newton3)
SoAFunctorPair on pre-sorted, pre-packed SoA views.
Definition: PairwiseFunctor.h:152
View on a fixed part of a SoA between a start index and an end index.
Definition: SoAView.h:25
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
Precomputed index bounds for iterating a pre-sorted pair of SoA buffers, soa1 as the outer (i) loop a...
Definition: PairwiseFunctor.h:33
size_t endI
Exclusive upper bound index into soa1 that can interact with soa2, skipping soa1 particles too far ab...
Definition: PairwiseFunctor.h:43
const std::vector< size_t > & minIndex
Per-i (soa1) inclusive lower bound index into soa2, skipping soa2 particles too far below particle i.
Definition: PairwiseFunctor.h:54
const std::vector< size_t > & maxIndex
Per-i (soa1) exclusive upper bound index into soa2, skipping soa2 particles too far above particle i.
Definition: PairwiseFunctor.h:48
size_t startI
First index into soa1 that can interact with soa2, skipping soa1 particles too far below.
Definition: PairwiseFunctor.h:37