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

Functor base class. More...

#include <Functor.h>

Inheritance diagram for autopas::Functor< Particle_T, CRTP_T >:
Inheritance graph
[legend]

Public Types

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

 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 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 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, 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.
 

Detailed Description

template<class Particle_T, class CRTP_T>
class autopas::Functor< Particle_T, CRTP_T >

Functor base class.

Both an array of structure (AoS) and a structure of array (SoA) are supported to be used with functors. Newton3: A functor does not have to implement both a newton3 and a non-newton3 version. Instead you can specify, which version you use by overriding allowsNonNewton3 resp. allowsNewton3

Template Parameters
Particle_Tthe type of Particle
CRTP_Tthe actual type of the functor

Constructor & Destructor Documentation

◆ Functor()

template<class Particle_T , class CRTP_T >
autopas::Functor< Particle_T, CRTP_T >::Functor ( double  cutoff)
inlineexplicit

Constructor.

Parameters
cutoff

Member Function Documentation

◆ allowsNewton3()

template<class Particle_T , class CRTP_T >
virtual bool autopas::Functor< Particle_T, CRTP_T >::allowsNewton3 ( )
pure virtual

◆ allowsNonNewton3()

template<class Particle_T , class CRTP_T >
virtual bool autopas::Functor< Particle_T, CRTP_T >::allowsNonNewton3 ( )
pure virtual

◆ endTraversal()

template<class Particle_T , class CRTP_T >
virtual void autopas::Functor< Particle_T, CRTP_T >::endTraversal ( bool  newton3)
inlinevirtual

◆ getComputedAttr()

template<class Particle_T , class CRTP_T >
static constexpr std::array< typename Particle_T::AttributeNames, 0 > autopas::Functor< Particle_T, CRTP_T >::getComputedAttr ( )
inlinestaticconstexpr

Get attributes computed by this functor.

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

◆ getCutoff()

template<class Particle_T , class CRTP_T >
double autopas::Functor< Particle_T, CRTP_T >::getCutoff ( ) const
inline

Getter for the functor's cutoff.

Returns

◆ getHitRate()

template<class Particle_T , class CRTP_T >
virtual double autopas::Functor< Particle_T, CRTP_T >::getHitRate ( ) const
inlinevirtual

Get the hit rate.

Implementation required if FLOPLogger used.

If derived class provides no implementation, the FLOPLogger interprets the default NaN output as invalid and leaves "Not Implemented" in the log.

Returns
(number of kernel calls) / (number of distance calculations)

Reimplemented in mdLib::AxilrodTellerFunctor< Particle_T, useMixing, useNewton3, calculateGlobals, countFLOPs >, and mdLib::LJFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >.

◆ getName()

template<class Particle_T , class CRTP_T >
virtual std::string autopas::Functor< Particle_T, CRTP_T >::getName ( )
pure virtual

◆ getNeededAttr() [1/2]

template<class Particle_T , class CRTP_T >
static constexpr std::array< typename Particle_T::AttributeNames, 0 > autopas::Functor< Particle_T, CRTP_T >::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 , class CRTP_T >
static constexpr std::array< typename Particle_T::AttributeNames, 0 > autopas::Functor< Particle_T, CRTP_T >::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

◆ getNumFLOPs()

template<class Particle_T , class CRTP_T >
virtual size_t autopas::Functor< Particle_T, CRTP_T >::getNumFLOPs ( ) const
inlinevirtual

Get the number of FLOPs.

Implementation required if FLOPLogger used.

If derived class provides no implementation, the FLOPLogger interprets the default numeric_limits<size_t>::max() output as invalid and leaves "Not Implemented" the log.

Returns
number of FLOPs

Reimplemented in mdLib::AxilrodTellerFunctor< Particle_T, useMixing, useNewton3, calculateGlobals, countFLOPs >, and mdLib::LJFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >.

◆ initTraversal()

template<class Particle_T , class CRTP_T >
virtual void autopas::Functor< Particle_T, CRTP_T >::initTraversal ( )
inlinevirtual

◆ isRelevantForTuning()

template<class Particle_T , class CRTP_T >
virtual bool autopas::Functor< Particle_T, CRTP_T >::isRelevantForTuning ( )
pure virtual

◆ SoAExtractor()

template<class Particle_T , class CRTP_T >
template<typename ParticleCell >
void autopas::Functor< Particle_T, CRTP_T >::SoAExtractor ( ParticleCell cell,
SoA< SoAArraysType > &  soa,
size_t  offset 
)
inline

Copies the data stored in the soa back into the cell.

Parameters
cellCell where the data should be stored.
soaStructure of arrays from where the data is loaded.
offsetOffset within the SoA. The data of the soa should be extracted starting at offset.
Template Parameters
ParticleCellType of the cell.

◆ SoALoader()

template<class Particle_T , class CRTP_T >
template<class ParticleCell >
void autopas::Functor< Particle_T, CRTP_T >::SoALoader ( ParticleCell cell,
SoA< SoAArraysType > &  soa,
size_t  offset,
bool  skipSoAResize 
)
inline

Copies the AoS data of the given cell in the given soa.

Parameters
cellCell from where the data is loaded.
soaStructure of arrays where the data is copied to.
offsetOffset within the SoA. The data of the cell should be added to the SoA with the specified offset.
skipSoAResizeIf resizing of the SoA buffers should be skipped or not. If this is called with true, it must be ensured before the call that there is sufficient capacity in the SoA.
Note
The parameter skipSoAResize is usually set to false, only for VerletListsCellBased Containers it is set to true, since they resize the SoA before the call to SoALoader.
Template Parameters
ParticleCellType of the cell.

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