AutoPas  3.0.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
autopas::internal::CellFunctor< ParticleCell_T, ParticleFunctor_T, bidirectional > Class Template Reference

A cell functor. More...

#include <CellFunctor.h>

Inheritance diagram for autopas::internal::CellFunctor< ParticleCell_T, ParticleFunctor_T, bidirectional >:
Inheritance graph
[legend]

Public Member Functions

 CellFunctor (ParticleFunctor_T &f, const double sortingCutoff, DataLayoutOption dataLayout, bool useNewton3)
 The constructor of CellFunctor.
 
void processCell (ParticleCell_T &cell)
 Process the interactions inside one cell.
 
void processCellPair (ParticleCell_T &cell1, ParticleCell_T &cell2, const std::array< double, 3 > &sortingDirection={0., 0., 0.})
 Process the interactions between the particles of cell1 with particles of cell2.
 
DataLayoutOption::Value getDataLayout () const
 Getter.
 
bool getNewton3 () const
 Getter.
 
bool getBidirectional () const
 Getter.
 
void setAoSSortingThreshold (size_t aosSortingThreshold)
 Set the aos-sorting-threshold.
 
void setSoASortingThreshold (size_t soaSortingThreshold)
 Set the SoA sorting-threshold.
 
SoASortingData computeSortingData (const std::vector< std::pair< double, size_t > > &projIdxI, const std::vector< std::pair< double, size_t > > &projIdxJ, std::vector< size_t > &maxIndexCache, std::vector< size_t > &minIndexCache) const
 Computes conservative per-particle index bounds into projIdxJ based on a 1-D projection cutoff check.
 

Detailed Description

template<class ParticleCell_T, class ParticleFunctor_T, bool bidirectional = true>
class autopas::internal::CellFunctor< ParticleCell_T, ParticleFunctor_T, bidirectional >

A cell functor.

This functor is built from the normal Functor of the template type ParticleFunctor_T. It is an internal object to handle interactions between two cells of particles.

Template Parameters
ParticleCell_T
ParticleFunctor_Tthe functor which
bidirectionalif no newton3 is used processCellPair(cell1, cell2) should also handle processCellPair(cell2, cell1)

Constructor & Destructor Documentation

◆ CellFunctor()

template<class ParticleCell_T , class ParticleFunctor_T , bool bidirectional = true>
autopas::internal::CellFunctor< ParticleCell_T, ParticleFunctor_T, bidirectional >::CellFunctor ( ParticleFunctor_T &  f,
const double  sortingCutoff,
DataLayoutOption  dataLayout,
bool  useNewton3 
)
inlineexplicit

The constructor of CellFunctor.

Parameters
fThe particle functor, which should be used for the interaction.
sortingCutoffThis parameter indicates the maximal distance the sorted particles are to interact. This parameter is only relevant for optimization (sorting). This parameter normally should be the cutoff, for building verlet lists, this should be cutoff+skin.
dataLayoutThe data layout to be used.
useNewton3Parameter to specify whether newton3 is used or not.

Member Function Documentation

◆ computeSortingData()

template<class ParticleCell_T , class ParticleFunctor_T , bool bidirectional>
SoASortingData autopas::internal::CellFunctor< ParticleCell_T, ParticleFunctor_T, bidirectional >::computeSortingData ( const std::vector< std::pair< double, size_t > > &  projIdxI,
const std::vector< std::pair< double, size_t > > &  projIdxJ,
std::vector< size_t > &  maxIndexCache,
std::vector< size_t > &  minIndexCache 
) const

Computes conservative per-particle index bounds into projIdxJ based on a 1-D projection cutoff check.

Particles are projected onto the sorting axis. A pair can only interact if their 1-D projection distance is within the cutoff (necessary but not sufficient condition for a 3-D interaction). Because both projIdxI and projIdxJ are sorted, a two-pointer sweep computes the bounds in O(nI + nJ).

The returned SoASortingData contains:

  • startI: index of the first i-particle that could interact with any j-particle. All i before startI project farther than cutoff below projIdxJ[0] and can be skipped unconditionally.
  • maxIndex[i]: exclusive upper bound; the first j where projJ > projI[i] + cutoff. A functor iterating j up to (but not including) this index will not miss any candidate pair for particle i.
  • minIndex[i]: inclusive lower bound; the first j where projJ >= projI[i] - cutoff. A functor may start its j-loop here and skip all earlier j-particles for particle i.

Both maxIndex and minIndex are monotonically non-decreasing with i. A functor processing i-particles in order can therefore advance its j-loop bounds without backtracking, and may also derive valid bounds for a contiguous block of i-particles (For example with VecPatterns != 1xVec) by taking minIndex of the first and maxIndex of the last.

Parameters
projIdxISorted (projection, original index) pairs for the outer-loop (i) cell.
projIdxJSorted (projection, original index) pairs for the inner-loop (j) cell.
maxIndexCacheOutput buffer for maxIndex; resized and overwritten by this function.
minIndexCacheOutput buffer for minIndex; resized and overwritten by this function.
Returns
SoASortingData with startI and per-i index bounds into projIdxJ.

◆ getBidirectional()

template<class ParticleCell_T , class ParticleFunctor_T , bool bidirectional = true>
bool autopas::internal::CellFunctor< ParticleCell_T, ParticleFunctor_T, bidirectional >::getBidirectional ( ) const
inline

Getter.

Returns

◆ getDataLayout()

template<class ParticleCell_T , class ParticleFunctor_T , bool bidirectional = true>
DataLayoutOption::Value autopas::internal::CellFunctor< ParticleCell_T, ParticleFunctor_T, bidirectional >::getDataLayout ( ) const
inline

Getter.

Returns

◆ getNewton3()

template<class ParticleCell_T , class ParticleFunctor_T , bool bidirectional = true>
bool autopas::internal::CellFunctor< ParticleCell_T, ParticleFunctor_T, bidirectional >::getNewton3 ( ) const
inline

Getter.

Returns

◆ processCell()

template<class ParticleCell_T , class ParticleFunctor_T , bool bidirectional>
void autopas::internal::CellFunctor< ParticleCell_T, ParticleFunctor_T, bidirectional >::processCell ( ParticleCell_T &  cell)

Process the interactions inside one cell.

Parameters
cellAll pairwise interactions of particles inside this cell are calculated.

◆ processCellPair()

template<class ParticleCell_T , class ParticleFunctor_T , bool bidirectional>
void autopas::internal::CellFunctor< ParticleCell_T, ParticleFunctor_T, bidirectional >::processCellPair ( ParticleCell_T &  cell1,
ParticleCell_T &  cell2,
const std::array< double, 3 > &  sortingDirection = {0., 0., 0.} 
)

Process the interactions between the particles of cell1 with particles of cell2.

Parameters
cell1
cell2
sortingDirectionNormalized vector connecting centers of cell1 and cell2. If no parameter or {0, 0, 0} is given, sorting will be disabled.

◆ setAoSSortingThreshold()

template<class ParticleCell_T , class ParticleFunctor_T , bool bidirectional>
void autopas::internal::CellFunctor< ParticleCell_T, ParticleFunctor_T, bidirectional >::setAoSSortingThreshold ( size_t  aosSortingThreshold)

Set the aos-sorting-threshold.

If the sum of the number of particles in two cells is greater or equal to that value, the CellFunctor creates a sorted view of the particles to avoid unnecessary distance checks.

Parameters
aosSortingThresholdSum of the number of particles in two cells from which sorting should be enabled.

◆ setSoASortingThreshold()

template<class ParticleCell_T , class ParticleFunctor_T , bool bidirectional>
void autopas::internal::CellFunctor< ParticleCell_T, ParticleFunctor_T, bidirectional >::setSoASortingThreshold ( size_t  soaSortingThreshold)

Set the SoA sorting-threshold.

If the sum of the number of particles in two SoA buffers is greater than this value, the SoA path uses SoAFunctorPairSorted instead of SoAFunctorPair.

Parameters
soaSortingThresholdSum of the number of particles in two cells from which SoA sorting should be enabled.

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