AutoPas  3.0.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
autopas::InteractionListGeneratorFunctor< Particle_T, isInternal > Class Template Reference

This functor generates lists of particles within interactionLength of each other: can be used internally for Verlet list generation and provides a base for a public-facing externally used version, provided in the applicationLibrary. More...

#include <InteractionListGeneratorFunctor.h>

Inheritance diagram for autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >:
Inheritance graph
[legend]
Collaboration diagram for autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >:
Collaboration graph
[legend]

Public Types

using SoAArraysType = Particle_T::SoAArraysType
 Structure of the SoAs defined by the particle.
 
using NeighborListAoSType = std::unordered_map< Particle_T *, std::vector< Particle_T * > >
 Neighbor list AoS style.
 
- Public Types inherited from autopas::PairwiseFunctor< Particle_T, CRTP_T >
using SoAArraysType = typename Particle_T::SoAArraysType
 Structure of the SoAs defined by the particle.
 
- Public Types inherited from autopas::Functor< Particle_T, CRTP_T >
using SoAArraysType = typename Particle_T::SoAArraysType
 Structure of the SoAs defined by the particle.
 
using Functor_T = CRTP_T
 Make the Implementation type template publicly available.
 

Public Member Functions

 InteractionListGeneratorFunctor (NeighborListAoSType &neighborListsAoS, double interactionLength, bool gatherNewton3Lists)
 Constructor.
 
std::string getName () override
 
template<class ParticleIterator_T >
void initializeNeighborList (ParticleIterator_T particlesBegin)
 Initializes the neighbor list map for the given range of particles: clears any previous contents and inserts an empty neighbor list for every particle.
 
bool isRelevantForTuning () override
 Whether particle is relevant for tuning.
 
bool allowsNewton3 () override
 Whether InteractionListGeneratorFunctor allows Newton3.
 
bool allowsNonNewton3 () override
 Whether InteractionListGeneratorFunctor allows non-newton3.
 
void AoSFunctor (Particle_T &i, Particle_T &j, bool newton3) override
 AoSFunctor for interaction list generation.
 
void SoAFunctorSingle (SoAView< SoAArraysType > soa, bool) override
 SoAFunctor for verlet list generation.
 
void SoAFunctorPair (SoAView< SoAArraysType > soa1, SoAView< SoAArraysType > soa2, bool newton3) override
 SoAFunctor for the verlet list generation.
 
void SoAFunctorVerlet (SoAView< SoAArraysType > soa, const size_t indexFirst, const std::vector< size_t, AlignedAllocator< size_t > > &verletList, bool newton3) override
 SoAFunctorVerlet for interaction list generation.
 
- Public Member Functions inherited from autopas::PairwiseFunctor< Particle_T, CRTP_T >
 PairwiseFunctor (double cutoff)
 Constructor.
 
virtual void AoSFunctor (Particle_T &i, Particle_T &j, bool newton3)
 PairwiseFunctor for arrays of structures (AoS).
 
virtual void SoAFunctorSingle (SoAView< SoAArraysType > soa, bool newton3)
 PairwiseFunctor for structure of arrays (SoA)
 
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.
 
virtual void SoAFunctorPair (SoAView< SoAArraysType > soa1, SoAView< SoAArraysType > soa2, bool newton3)
 PairwiseFunctor for structure of arrays (SoA)
 
virtual void SoAFunctorPairSorted (SoAView< SoAArraysType > soa1, SoAView< SoAArraysType > soa2, const SoASortingData &sortingData, bool newton3)
 SoAFunctorPair on pre-sorted, pre-packed SoA views.
 
bool isVecPatternAllowed (const VectorizationPatternOption::Value vecPattern) override
 Specifies whether the functor is capable of using the specified Vectorization Pattern in the SoA functor.
 
- Public Member Functions inherited from autopas::Functor< Particle_T, CRTP_T >
 Functor (double cutoff)
 Constructor.
 
virtual void initTraversal ()
 This function is called at the start of each traversal.
 
virtual void endTraversal (bool newton3)
 This function is called at the end of each traversal.
 
template<class ParticleCell >
void SoALoader (ParticleCell &cell, SoA< SoAArraysType > &soa, size_t offset, bool skipSoAResize)
 Copies the AoS data of the given cell in the given soa.
 
template<typename ParticleCell >
void SoAExtractor (ParticleCell &cell, SoA< SoAArraysType > &soa, size_t offset)
 Copies the data stored in the soa back into the cell.
 
virtual bool allowsNewton3 ()=0
 Specifies whether the functor is capable of Newton3-like functors.
 
virtual bool allowsNonNewton3 ()=0
 Specifies whether the functor is capable of non-Newton3-like functors.
 
virtual bool isVecPatternAllowed (const VectorizationPatternOption::Value vecPattern)=0
 Specifies whether the functor is capable of using the specified Vectorization Pattern in the SoA functor.
 
virtual bool isRelevantForTuning ()=0
 Specifies whether the functor should be considered for the auto-tuning process.
 
virtual std::string getName ()=0
 Returns name of functor.
 
double getCutoff () const
 Getter for the functor's cutoff.
 
virtual void setVecPattern (const VectorizationPatternOption::Value vecPattern)
 Setter for the vectorization pattern to be used.
 
virtual size_t getNumFLOPs () const
 Get the number of FLOPs.
 
virtual double getHitRate () const
 Get the hit rate.
 

Static Public Member Functions

static constexpr std::array< typename Particle_T::AttributeNames, 5 > getNeededAttr ()
 Get attributes needed for computation.
 
static constexpr std::array< typename Particle_T::AttributeNames, 5 > getNeededAttr (std::false_type)
 Get attributes needed for computation without N3 optimization.
 
static constexpr std::array< typename Particle_T::AttributeNames, 0 > getComputedAttr ()
 Get attributes computed by this functor.
 
- Static Public Member Functions inherited from autopas::Functor< Particle_T, CRTP_T >
static constexpr std::array< typename Particle_T::AttributeNames, 0 > getNeededAttr ()
 Get attributes needed for computation.
 
static constexpr std::array< typename Particle_T::AttributeNames, 0 > getNeededAttr (std::false_type)
 Get attributes needed for computation without N3 optimization.
 
static constexpr std::array< typename Particle_T::AttributeNames, 0 > getComputedAttr ()
 Get attributes computed by this functor.
 

Additional Inherited Members

- Static Public Attributes inherited from autopas::Functor< Particle_T, CRTP_T >
static constexpr bool supportsSoASorting = false
 Whether this functor supports the SortedSoAView optimization path (SoAFunctorPairSorted).
 

Detailed Description

template<class Particle_T, bool isInternal = false>
class autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >

This functor generates lists of particles within interactionLength of each other: can be used internally for Verlet list generation and provides a base for a public-facing externally used version, provided in the applicationLibrary.

After applying AutoPas's computeInteractions function with this functor, a std::unordered_map<Particle_T *, std::vector<Particle_T *>> is filled, mapping from each particle pointer to a vector of pointers to all particles within interactionLength of the first.

Template Parameters
Particle_TThe type of Particle class used.
isInternalShould be set true if used internally within AutoPas. Makes the functor irrelevant for tuning.

Constructor & Destructor Documentation

◆ InteractionListGeneratorFunctor()

template<class Particle_T , bool isInternal = false>
autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >::InteractionListGeneratorFunctor ( NeighborListAoSType neighborListsAoS,
double  interactionLength,
bool  gatherNewton3Lists 
)
inline

Constructor.

Parameters
neighborListsAoSReference to the neighbor list map. Must be initialized before the actual functor calls but, if used with computeInteractions, this will be handled automatically (this will override anything in the list).
interactionLengthThe distance between particles within which particle pairs get added to the neighbor lists.
gatherNewton3ListsIf false, for a particle pair i, j that are neighbors, both particle j will be in particle i's list and particle i will be in particle j's list. If true, for a particle pair i, j that are neighbors, either particle j will be in particle i's list or particle i will be in particle j's list. The latter can be used more easily to reduce calculations by applying forces to both particles in the pair, but care should be taken to avoid race conditions. If true, we make no guarantee which of particle i or j will be in the other's list. If true, this functor will only allow functor calls with newton3 enabled.

Member Function Documentation

◆ allowsNewton3()

template<class Particle_T , bool isInternal = false>
bool autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >::allowsNewton3 ( )
inlineoverridevirtual

Whether InteractionListGeneratorFunctor allows Newton3.

Is always allowed.

Returns

Implements autopas::Functor< Particle_T, CRTP_T >.

◆ allowsNonNewton3()

template<class Particle_T , bool isInternal = false>
bool autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >::allowsNonNewton3 ( )
inlineoverridevirtual

Whether InteractionListGeneratorFunctor allows non-newton3.

This is not allowed if gathering N3 lists. (Not a fundamental issue but messy implementation and not really needed).

Returns

Implements autopas::Functor< Particle_T, CRTP_T >.

◆ AoSFunctor()

template<class Particle_T , bool isInternal = false>
void autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >::AoSFunctor ( Particle_T &  i,
Particle_T &  j,
bool  newton3 
)
inlineoverridevirtual

AoSFunctor for interaction list generation.

Parameters
i
j
newton3Whether AutoPas is using N3 or not for list generation. This is regardless of whether the user requests N3 lists or not. If this and gatherNewton3Lists match, the handling is trivial. If newton3=true and gatherNewton3Lists=false, we just add each particle to each other's list. We do not allow newton3=false with gatherNewton3Lists=true - there are no fundamental issues with this but messy to implement and probably not too needed.

Reimplemented from autopas::PairwiseFunctor< Particle_T, CRTP_T >.

◆ getComputedAttr()

template<class Particle_T , bool isInternal = false>
static constexpr std::array< typename Particle_T::AttributeNames, 0 > autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >::getComputedAttr ( )
inlinestaticconstexpr

Get attributes computed by this functor.

Returns
Attributes computed by this functor.
Todo:
C++20: make this function virtual

◆ getName()

template<class Particle_T , bool isInternal = false>
std::string autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >::getName ( )
inlineoverridevirtual
Returns
The name of the functor

Implements autopas::Functor< Particle_T, CRTP_T >.

◆ getNeededAttr() [1/2]

template<class Particle_T , bool isInternal = false>
static constexpr std::array< typename Particle_T::AttributeNames, 5 > autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >::getNeededAttr ( )
inlinestaticconstexpr

Get attributes needed for computation.

Returns
Attributes needed for computation.
Todo:
C++20: make this function virtual

◆ getNeededAttr() [2/2]

template<class Particle_T , bool isInternal = false>
static constexpr std::array< typename Particle_T::AttributeNames, 5 > autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >::getNeededAttr ( std::false_type  )
inlinestaticconstexpr

Get attributes needed for computation without N3 optimization.

Returns
Attributes needed for computation.
Todo:
C++20: make this function virtual

◆ initializeNeighborList()

template<class Particle_T , bool isInternal = false>
template<class ParticleIterator_T >
void autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >::initializeNeighborList ( ParticleIterator_T  particlesBegin)
inline

Initializes the neighbor list map for the given range of particles: clears any previous contents and inserts an empty neighbor list for every particle.

This must happen before the functor is applied, and it must also happen after any particle rearrangement in memory. AutoPas's computeInteractions() calls this automatically when this functor (or a child of it) is used, so the handling of the list is safe when used with computeInteractions.

Template Parameters
ParticleIterator_TType of the particle iterator
Parameters
particlesBeginIterator to the first particle. Iterated until no longer valid.

◆ isRelevantForTuning()

template<class Particle_T , bool isInternal = false>
bool autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >::isRelevantForTuning ( )
inlineoverridevirtual

Whether particle is relevant for tuning.

True, unless functor used internally.

Returns

Implements autopas::Functor< Particle_T, CRTP_T >.

◆ SoAFunctorPair()

template<class Particle_T , bool isInternal = false>
void autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >::SoAFunctorPair ( SoAView< SoAArraysType soa1,
SoAView< SoAArraysType soa2,
bool  newton3 
)
inlineoverridevirtual

SoAFunctor for the verlet list generation.

(two cell version)

Parameters
soa1soa of first cell
soa2soa of second cell
newton3Whether AutoPas is using N3 or not for list generation. This is regardless of whether the user requests N3 lists or not. If this and gatherNewton3Lists match, the handling is trivial. If newton3=true and gatherNewton3Lists=false, we just add each particle to each other's list. We do not allow newton3=false with gatherNewton3Lists=true - there are no fundamental issues with this but messy to implement and probably not too needed.

Reimplemented from autopas::PairwiseFunctor< Particle_T, CRTP_T >.

◆ SoAFunctorSingle()

template<class Particle_T , bool isInternal = false>
void autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >::SoAFunctorSingle ( SoAView< SoAArraysType soa,
bool   
)
inlineoverridevirtual

SoAFunctor for verlet list generation.

(single cell version)

Parameters
soathe soa

Reimplemented from autopas::PairwiseFunctor< Particle_T, CRTP_T >.

◆ SoAFunctorVerlet()

template<class Particle_T , bool isInternal = false>
void autopas::InteractionListGeneratorFunctor< Particle_T, isInternal >::SoAFunctorVerlet ( SoAView< SoAArraysType soa,
const size_t  indexFirst,
const std::vector< size_t, AlignedAllocator< size_t > > &  verletList,
bool  newton3 
)
inlineoverridevirtual

SoAFunctorVerlet for interaction list generation.

Generates interaction list entries for the particle at index indexFirst in soa and every potential neighbor given by the Verlet list.

Parameters
soathe soa
indexFirstindex of the particle whose neighbors are given in verletList
verletListindices of the potential neighbors of indexFirst
newton3Whether AutoPas is using N3 or not for list generation. This is regardless of whether the user requests N3 lists or not. If this and gatherNewton3Lists match, the handling is trivial. If newton3=true and gatherNewton3Lists=false, we just add each particle to each other's list. We do not allow newton3=false with gatherNewton3Lists=true - there are no fundamental issues with this but messy to implement and probably not too needed.

Reimplemented from autopas::PairwiseFunctor< Particle_T, CRTP_T >.


The documentation for this class was generated from the following file: