AutoPas  3.0.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
autopas::SlicedC02BasedTraversal< ParticleCell, Functor > Class Template Reference

This class provides the colored sliced traversal. More...

#include <SlicedC02BasedTraversal.h>

Inheritance diagram for autopas::SlicedC02BasedTraversal< ParticleCell, Functor >:
Inheritance graph
[legend]
Collaboration diagram for autopas::SlicedC02BasedTraversal< ParticleCell, Functor >:
Collaboration graph
[legend]

Public Member Functions

 SlicedC02BasedTraversal (const std::array< unsigned long, 3 > &dims, Functor *functor, const double interactionLength, const std::array< double, 3 > &cellLength, DataLayoutOption dataLayout, bool useNewton3, bool spaciallyForward)
 Constructor of the colored sliced traversal.
 
template<typename LoopBody >
void cSlicedTraversal (LoopBody &&loopBody)
 The main traversal of the colored sliced traversal.
 
bool isApplicable () const override
 Checks if the traversal is applicable to the current state of the domain.
 
void initTraversal () override
 Load Data Layouts and sets up slice thicknesses.
 
- Public Member Functions inherited from autopas::SlicedBasedTraversal< ParticleCell, Functor >
 SlicedBasedTraversal (const std::array< unsigned long, 3 > &dims, Functor *functor, const double interactionLength, const std::array< double, 3 > &cellLength, DataLayoutOption dataLayout, bool useNewton3, bool spaciallyForward)
 Constructor of the sliced traversal.
 
bool isApplicable () const override
 Checks if the traversal is applicable to the current state of the domain.
 
virtual void initSliceThickness (unsigned long minSliceThickness)
 Sets up the slice thicknesses to create as many slices as possible while respecting minSliceThickness.
 
void initTraversal () override
 Load Data Layouts and sets up slice thicknesses.
 
void endTraversal () override
 Write Data to AoS if cells have been set through setCellsToTraverse().
 
- Public Member Functions inherited from autopas::CellTraversal< ParticleCell >
 CellTraversal (const std::array< unsigned long, 3 > &dims)
 Constructor of CellTraversal.
 
virtual ~CellTraversal ()=default
 Destructor of CellTraversal.
 
virtual void setCellsToTraverse (std::vector< ParticleCell > &cells)
 Sets the cells to iterate over.
 
virtual void setSortingThreshold (size_t sortingThreshold)=0
 Set the sorting-threshold for traversals that use the CellFunctor 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.
 
- Public Member Functions inherited from autopas::TraversalInterface
virtual ~TraversalInterface ()=default
 Destructor of TraversalInterface.
 
 TraversalInterface (DataLayoutOption dataLayout, bool useNewton3)
 Constructor of the TraversalInterface.
 
virtual TraversalOption getTraversalType () const =0
 Return a enum representing the name of the traversal class.
 
virtual bool isApplicable () const =0
 Checks if the traversal is applicable to the current state of the domain.
 
virtual void initTraversal ()=0
 Initializes the traversal.
 
virtual void traverseParticles ()=0
 Traverse the particles by pairs, triplets etc.
 
virtual void endTraversal ()=0
 Finalizes the traversal.
 
bool getUseNewton3 () const
 Return whether the traversal uses newton 3.
 
DataLayoutOption getDataLayout () const
 Return the data layout option.
 

Additional Inherited Members

- Protected Member Functions inherited from autopas::SlicedBasedTraversal< ParticleCell, Functor >
void init (const std::array< unsigned long, 3 > &dims)
 Resets the cell structure of the traversal.
 
virtual void loadDataLayout ()
 Load Data Layouts required for this Traversal if cells have been set through setCellsToTraverse().
 
- Protected Attributes inherited from autopas::SlicedBasedTraversal< ParticleCell, Functor >
std::array< unsigned long, 3 > _overlap
 Overlap of interacting cells.
 
std::array< int, 3 > _dimsPerLength
 Store ids of dimensions ordered by number of cells per dimensions.
 
unsigned long _overlapLongestAxis
 Overlap of interacting cells along the longest axis.
 
std::vector< unsigned long > _sliceThickness
 The number of cells per slice in the dimension that was sliced.
 
bool _spaciallyForward
 Whether the base step only covers neigboring cells tha are spacially forward (for example c08).
 
- Protected Attributes inherited from autopas::CellTraversal< ParticleCell >
std::array< unsigned long, 3 > _cellsPerDimension
 The dimensions of the cellblock.
 
std::vector< ParticleCell > * _cells
 The cells to traverse.
 
- Protected Attributes inherited from autopas::TraversalInterface
DataLayoutOption _dataLayout
 The datalayout used by this traversal.
 
bool _useNewton3
 If this traversal makes use of newton3.
 

Detailed Description

template<class ParticleCell, class Functor>
class autopas::SlicedC02BasedTraversal< ParticleCell, Functor >

This class provides the colored sliced traversal.

The traversal finds the longest dimension of the simulation domain and cuts the domain into as many slices as possible along this dimension. Unlike the regular sliced traversal, this version uses a 2-coloring to prevent race conditions, instead of locking the starting layers. This could also be describes as a c02-traversal. This class is however not derived from ColorBasedTraversal, as that would not allow varying slice thicknesses, and would prevent us from selecting the dimension in which we cut the slices.

Template Parameters
ParticleCellThe type of cells.
FunctorThe functor that defines the interaction between particles.

Constructor & Destructor Documentation

◆ SlicedC02BasedTraversal()

template<class ParticleCell , class Functor >
autopas::SlicedC02BasedTraversal< ParticleCell, Functor >::SlicedC02BasedTraversal ( const std::array< unsigned long, 3 > &  dims,
Functor functor,
const double  interactionLength,
const std::array< double, 3 > &  cellLength,
DataLayoutOption  dataLayout,
bool  useNewton3,
bool  spaciallyForward 
)
inlineexplicit

Constructor of the colored sliced traversal.

Parameters
dimsThe dimensions of the cellblock, i.e. the number of cells in x, y and z direction.
functorThe functor that defines the interaction between particles.
interactionLengthInteraction length (cutoff + skin).
cellLengthcell length.
dataLayoutThe data layout with which this traversal should be initialized.
useNewton3Parameter to specify whether the traversal makes use of newton3 or not.
spaciallyForwardWhether the base step only covers neighboring cells that are spacially forward (for example c08).

Member Function Documentation

◆ cSlicedTraversal()

template<class ParticleCell , class Functor >
template<typename LoopBody >
void autopas::SlicedC02BasedTraversal< ParticleCell, Functor >::cSlicedTraversal ( LoopBody &&  loopBody)
inline

The main traversal of the colored sliced traversal.

This provides the structure of the loops and its parallelization.

This provides the structure of the loops and its parallelization.

Template Parameters
LoopBody
Parameters
loopBodyThe body of the loop as a function. Normally a lambda function, that takes as as parameters (x,y,z). If you need additional input from outside, please use captures (by reference).

◆ initTraversal()

template<class ParticleCell , class Functor >
void autopas::SlicedC02BasedTraversal< ParticleCell, Functor >::initTraversal ( )
inlineoverridevirtual

Load Data Layouts and sets up slice thicknesses.

Reimplemented from autopas::SlicedBasedTraversal< ParticleCell, Functor >.

◆ isApplicable()

template<class ParticleCell , class Functor >
bool autopas::SlicedC02BasedTraversal< ParticleCell, Functor >::isApplicable ( ) const
inlineoverridevirtual

Checks if the traversal is applicable to the current state of the domain.

Returns
true iff the traversal can be applied.

Reimplemented from autopas::SlicedBasedTraversal< ParticleCell, Functor >.


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