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

Pass-2 functor for the two-pass CRS build. More...

#include <VerletListHelpers.h>

Inheritance diagram for autopas::VerletListHelpers< Particle_T >::VerletListFillerFunctor:
Inheritance graph
[legend]
Collaboration diagram for autopas::VerletListHelpers< Particle_T >::VerletListFillerFunctor:
Collaboration graph
[legend]

Public Types

using SoAArraysType = typename Particle_T::SoAArraysType
 Structure of the SoAs defined by the particle.
 
using PaddedAtomic = typename VerletListCounterFunctor::PaddedAtomic
 Atomic counter.
 
- Public Types inherited from autopas::PairwiseFunctor< Particle_T, VerletListFillerFunctor >
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

 VerletListFillerFunctor (NeighborListCRS &neighborList, std::vector< PaddedAtomic > &fillPos, const std::unordered_map< const Particle_T *, size_t > &particleToIndex, double interactionLength)
 
std::string getName () override
 Returns name of functor.
 
bool isRelevantForTuning () override
 Specifies whether the functor should be considered for the auto-tuning process.
 
bool allowsNewton3 () override
 Specifies whether the functor is capable of Newton3-like functors.
 
bool allowsNonNewton3 () override
 Specifies whether the functor is capable of non-Newton3-like functors.
 
void AoSFunctor (Particle_T &i, Particle_T &j, bool) override
 
void SoAFunctorSingle (SoAView< SoAArraysType > soa, const bool newton3) override
 PairwiseFunctor for structure of arrays (SoA)
 
void SoAFunctorPair (SoAView< SoAArraysType > soa1, SoAView< SoAArraysType > soa2, bool) override
 
- Public Member Functions inherited from autopas::PairwiseFunctor< Particle_T, VerletListFillerFunctor >
 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, std::span< const 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, 4 > getNeededAttr ()
 Get attributes needed for computation.
 
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>
class autopas::VerletListHelpers< Particle_T >::VerletListFillerFunctor

Pass-2 functor for the two-pass CRS build.

The CRS offsets are already set. For each interacting pair (i, j) this functor writes j's index directly into the pre-allocated _neighborList.indices slice for particle i, advancing a per-particle fill cursor with a relaxed atomic fetch-add.

The fill cursors reuse the same cache-line-padded PaddedAtomic array as the counter pass (reset to the CRS start offset before this pass runs).

Note
In contrast to other functors, newton3 is deliberately ignored in AoSFunctor() and SoAFunctorPair(). Used with a newton3 traversal, it will lead to "half" neighbor lists, where each particle only has the other particle in its list if it is the "first" particle of the pair. Used with a non-newton3 traversal, it will lead to "full" neighbor lists, where each particle has the other particle in its list for every interacting pair, regardless of whether newton3 is enabled or not.

Constructor & Destructor Documentation

◆ VerletListFillerFunctor()

template<class Particle_T >
autopas::VerletListHelpers< Particle_T >::VerletListFillerFunctor::VerletListFillerFunctor ( NeighborListCRS &  neighborList,
std::vector< PaddedAtomic > &  fillPos,
const std::unordered_map< const Particle_T *, size_t > &  particleToIndex,
double  interactionLength 
)
inline
Parameters
neighborListThe CRS structure with offsets already filled and indices pre-allocated.
fillPosPer-particle fill cursors, initialized to neighborList.offsets[i] before this pass starts.
particleToIndexMap from particle pointer to its dense SoA index.
interactionLengthcutoff + skin.

Member Function Documentation

◆ allowsNewton3()

template<class Particle_T >
bool autopas::VerletListHelpers< Particle_T >::VerletListFillerFunctor::allowsNewton3 ( )
inlineoverridevirtual

Specifies whether the functor is capable of Newton3-like functors.

If the functor provides an interface to soa or aos functions that utilize Newton's third law of motion (actio = reactio) to reduce the computational complexity this function should return true. If this is not the case this function should return false.

Returns
true if and only if this functor provides an interface to Newton3-like functions.

Implements autopas::Functor< Particle_T, CRTP_T >.

◆ allowsNonNewton3()

template<class Particle_T >
bool autopas::VerletListHelpers< Particle_T >::VerletListFillerFunctor::allowsNonNewton3 ( )
inlineoverridevirtual

Specifies whether the functor is capable of non-Newton3-like functors.

If the functor provides an interface to soa or aos functions that do not utilize Newton's third law of motion (actio = reactio) this function should return true. If this is not the case this function should return false.

Returns
true if and only if this functor provides an interface to functions that do not utilize Newton3.

Implements autopas::Functor< Particle_T, CRTP_T >.

◆ AoSFunctor()

template<class Particle_T >
void autopas::VerletListHelpers< Particle_T >::VerletListFillerFunctor::AoSFunctor ( Particle_T &  i,
Particle_T &  j,
bool   
)
inlineoverridevirtual
Parameters
ithe first particle
jthe neighbor particle

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

◆ getComputedAttr()

template<class Particle_T >
static constexpr std::array< typename Particle_T::AttributeNames, 0 > autopas::VerletListHelpers< Particle_T >::VerletListFillerFunctor::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 >
std::string autopas::VerletListHelpers< Particle_T >::VerletListFillerFunctor::getName ( )
inlineoverridevirtual

Returns name of functor.

Intended for use with the iteration logger, to differentiate between calls to computeInteractions using different functors in the logs.

Returns
name of functor.

Implements autopas::Functor< Particle_T, CRTP_T >.

◆ getNeededAttr()

template<class Particle_T >
static constexpr std::array< typename Particle_T::AttributeNames, 4 > autopas::VerletListHelpers< Particle_T >::VerletListFillerFunctor::getNeededAttr ( )
inlinestaticconstexpr

Get attributes needed for computation.

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

◆ isRelevantForTuning()

template<class Particle_T >
bool autopas::VerletListHelpers< Particle_T >::VerletListFillerFunctor::isRelevantForTuning ( )
inlineoverridevirtual

Specifies whether the functor should be considered for the auto-tuning process.

Returns
true if and only if this functor is relevant for auto-tuning.

Implements autopas::Functor< Particle_T, CRTP_T >.

◆ SoAFunctorPair()

template<class Particle_T >
void autopas::VerletListHelpers< Particle_T >::VerletListFillerFunctor::SoAFunctorPair ( SoAView< SoAArraysType >  soa1,
SoAView< SoAArraysType >  soa2,
bool   
)
inlineoverridevirtual
Parameters
soa1SoA of first cell
soa2SoA of second cell

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

◆ SoAFunctorSingle()

template<class Particle_T >
void autopas::VerletListHelpers< Particle_T >::VerletListFillerFunctor::SoAFunctorSingle ( SoAView< SoAArraysType >  soa,
const bool  newton3 
)
inlineoverridevirtual

PairwiseFunctor for structure of arrays (SoA)

This functor should calculate the forces or any other pair-wise interaction between all particles in an soa. This should include a cutoff check if needed!

Parameters
soaStructure of arrays
newton3defines whether or whether not to use newton 3

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


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