AutoPas  3.0.0
Loading...
Searching...
No Matches
PairwiseFunctor.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <type_traits>
11#include <vector>
12
13#include "Functor.h"
17
18namespace autopas {
19
20template <class Particle>
22
31 size_t startI;
32 const std::vector<size_t> &maxIndex;
33 const std::vector<size_t> &minIndex;
34};
35
44template <class Particle_T, class CRTP_T>
45class PairwiseFunctor : public Functor<Particle_T, CRTP_T> {
46 public:
50 using SoAArraysType = typename Particle_T::SoAArraysType;
51
56 explicit PairwiseFunctor(double cutoff) : Functor<Particle_T, CRTP_T>(cutoff){};
57
58 virtual ~PairwiseFunctor() = default;
59
70 virtual void AoSFunctor(Particle_T &i, Particle_T &j, bool newton3) {
71 utils::ExceptionHandler::exception("{}::AoSFunctor: not implemented", this->getName());
72 }
73
84 virtual void SoAFunctorSingle(SoAView<SoAArraysType> soa, bool newton3) {
85 utils::ExceptionHandler::exception("{}::SoAFunctorSingle: not implemented", this->getName());
86 }
87
100 virtual void SoAFunctorVerlet(SoAView<SoAArraysType> soa, const size_t indexFirst,
101 const std::vector<size_t, AlignedAllocator<size_t>> &neighborList, bool newton3) {
102 utils::ExceptionHandler::exception("{}::SoAFunctorVerlet: not implemented", this->getName());
103 }
104
116 virtual void SoAFunctorPair(SoAView<SoAArraysType> soa1, SoAView<SoAArraysType> soa2, bool newton3) {
117 utils::ExceptionHandler::exception("{}::SoAFunctorPair: not implemented", this->getName());
118 }
119
132 const SoASortingData &sortingData, bool newton3) {
133 if constexpr (not CRTP_T::supportsSoASorting) {
135 "SoAFunctorPairSorted() called on functor {} which has supportsSoASorting=false.", typeid(CRTP_T).name());
136 } else {
138 "Functor {} has supportsSoASorting=true but does not implement SoAFunctorPairSorted().",
139 typeid(CRTP_T).name());
140 }
141 }
142
150 bool isVecPatternAllowed(const VectorizationPatternOption::Value vecPattern) override {
151 return vecPattern == VectorizationPatternOption::p1xVec;
152 }
153};
154
155} // namespace autopas
AlignedAllocator class.
Definition: AlignedAllocator.h:29
Functor base class.
Definition: Functor.h:41
virtual std::string getName()=0
Returns name of functor.
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
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:150
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
virtual void SoAFunctorPair(SoAView< SoAArraysType > soa1, SoAView< SoAArraysType > soa2, bool newton3)
PairwiseFunctor for structure of arrays (SoA)
Definition: PairwiseFunctor.h:116
PairwiseFunctor(double cutoff)
Constructor.
Definition: PairwiseFunctor.h:56
virtual void SoAFunctorSingle(SoAView< SoAArraysType > soa, bool newton3)
PairwiseFunctor for structure of arrays (SoA)
Definition: PairwiseFunctor.h:84
typename Particle_T::SoAArraysType SoAArraysType
Structure of the SoAs defined by the particle.
Definition: PairwiseFunctor.h:50
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:131
View on a fixed part of a SoA between a start index and an end index.
Definition: SoAView.h:25
Definition: PairwiseFunctor.h:21
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 SoA pair.
Definition: PairwiseFunctor.h:30
const std::vector< size_t > & minIndex
Per-particle lower bound index into soa2 (inclusive).
Definition: PairwiseFunctor.h:33
const std::vector< size_t > & maxIndex
Per-particle upper bound index into soa2 (exclusive).
Definition: PairwiseFunctor.h:32
size_t startI
First index in soa1 whose projection range overlaps soa2.
Definition: PairwiseFunctor.h:31