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

This class implements a neighbor list that remembers which thread added which particle pair and at which color during the build with C08 from LinkedCells. More...

#include <VerletNeighborListAsBuild.h>

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

Public Types

using AoSThreadNeighborList = std::unordered_map< Particle_T *, std::vector< Particle_T * > >
 This type represents the neighbor list that each thread has for each color.
 
using AoSColorNeighborList = std::vector< AoSThreadNeighborList >
 This type represents the thread lists for all colors.
 
using SoAThreadNeighborList = std::vector< std::pair< size_t, std::vector< size_t, autopas::AlignedAllocator< size_t > > > >
 This type represents the SoA neighbor list that each thread has for each color.
 
using SoAColorNeighborList = std::vector< SoAThreadNeighborList >
 This type represents the SoA thread lists for all colors.
 

Public Member Functions

 VerletNeighborListAsBuild ()
 Constructor for the VerletNeighborListAsBuild.
 
ContainerOption getContainerType () const override
 Returns the ContainerOption this neighbor list is for.
 
void buildAoSNeighborList (LinkedCells< Particle_T > &linkedCells, bool useNewton3) override
 Builds the neighbor list from a LinkedCells object.
 
bool checkNeighborListValidity (bool useNewton3, double cutoff) override
 Checks if the neighbor list contains all pairs that is should.
 
const auto & getAoSNeighborList ()
 Returns the internal AoS neighbor list.
 
const auto & getSoANeighborList ()
 Returns the internal SoA neighbor list.
 
void receiveColorChange (unsigned long newColor) override
 Gets called when the color changes during the observed traversal.
 
void generateSoAFromAoS () override
 
template<class TFunctor >
auto * loadSoA (TFunctor *f)
 Loads the particle information in the SoA and returns a pointer to the filled SoA.
 
template<class TFunctor >
void extractSoA (TFunctor *f)
 Extracts the particle information out of the SoA returned by loadSoA() before.
 
bool isSoAListValid () const override
 Returns whether the SoA is build and up to date with the AoS.
 
long getNumberOfNeighborPairs () const override
 Returns the number of neighbor pairs in the list.
 
- Public Member Functions inherited from autopas::VerletNeighborListInterface< Particle_T >
virtual ~VerletNeighborListInterface ()=default
 virtual default destructor
 
virtual ContainerOption getContainerType () const =0
 Returns the ContainerOption this neighbor list is for.
 
virtual void buildAoSNeighborList (LinkedCells< Particle_T > &linkedCells, bool useNewton3)=0
 Builds the neighbor list from a LinkedCells object.
 
virtual bool checkNeighborListValidity (bool useNewton3, double cutoff)=0
 Checks if the neighbor list contains all pairs that is should.
 
virtual void generateSoAFromAoS ()=0
 Generates the SoA from the AoS.
 
virtual bool isSoAListValid () const =0
 Returns whether the SoA is build and up to date with the AoS.
 
virtual long getNumberOfNeighborPairs () const =0
 Returns the number of neighbor pairs in the list.
 

Friends

class internal::AsBuildPairGeneratorFunctor< Particle_T, true >
 Adds the generator functor for validation checks as friend so it can call checkPair().
 
class internal::AsBuildPairGeneratorFunctor< Particle_T, false >
 Adds the generator functor for adding pairs as friend so it can call addPair().
 

Detailed Description

template<class Particle_T>
class autopas::VerletNeighborListAsBuild< Particle_T >

This class implements a neighbor list that remembers which thread added which particle pair and at which color during the build with C08 from LinkedCells.

Template Parameters
Particle_TThe particle type the class uses.

Constructor & Destructor Documentation

◆ VerletNeighborListAsBuild()

template<class Particle_T >
autopas::VerletNeighborListAsBuild< Particle_T >::VerletNeighborListAsBuild ( )
inline

Constructor for the VerletNeighborListAsBuild.

Does only default initialization.

Member Function Documentation

◆ buildAoSNeighborList()

template<class Particle_T >
void autopas::VerletNeighborListAsBuild< Particle_T >::buildAoSNeighborList ( LinkedCells< Particle_T > &  linkedCells,
bool  useNewton3 
)
inlineoverridevirtual

Builds the neighbor list from a LinkedCells object.

This only builds the AoS.

Parameters
linkedCellsThe linked cells to use for building the neighbor list.
useNewton3If true, use newton 3 for the neighbor list.

It executes C08 on the passed LinkedCells container and saves the resulting pairs in the neighbor list, remembering the thread and current color for each pair.

Implements autopas::VerletNeighborListInterface< Particle_T >.

◆ checkNeighborListValidity()

template<class Particle_T >
bool autopas::VerletNeighborListAsBuild< Particle_T >::checkNeighborListValidity ( bool  useNewton3,
double  cutoff 
)
inlineoverridevirtual

Checks if the neighbor list contains all pairs that is should.

This is very costly, comparable to rebuilding it.

Parameters
useNewton3If the neighbor list should use newton 3.
cutoffThe cutoff. Two particles that are further away than this distance are not considered.
Returns
If the current neighbor list is valid.

Implements autopas::VerletNeighborListInterface< Particle_T >.

◆ extractSoA()

template<class Particle_T >
template<class TFunctor >
void autopas::VerletNeighborListAsBuild< Particle_T >::extractSoA ( TFunctor *  f)
inline

Extracts the particle information out of the SoA returned by loadSoA() before.

Template Parameters
TFunctorThe type of the functor to use for extracting the particles.
Parameters
fThe functor to use for extracting the particles.

◆ generateSoAFromAoS()

template<class Particle_T >
void autopas::VerletNeighborListAsBuild< Particle_T >::generateSoAFromAoS ( )
inlineoverridevirtual

◆ getAoSNeighborList()

template<class Particle_T >
const auto & autopas::VerletNeighborListAsBuild< Particle_T >::getAoSNeighborList ( )
inline

Returns the internal AoS neighbor list.

Should be used by traversals.

The internal neighbor list structure is an array of vectors for each color. Each of those vectors contains a neighbor list for each thread. Each of those neighbor lists is a map from particle pointers to a vector containing its neighbor pointers.

Or in short: _aosNeighborList = std::array<AoSColorNeighborList, _numColors> = std::array<std::vector<AoSThreadNeighborList>>, _numColors> = std::array<std::vector<std::unordered_map<Particle_T *, std::vector<Particle_T *>>>, _numColors>

Returns
the internal AoS neighbor list.

◆ getContainerType()

template<class Particle_T >
ContainerOption autopas::VerletNeighborListAsBuild< Particle_T >::getContainerType ( ) const
inlineoverridevirtual

Returns the ContainerOption this neighbor list is for.

Returns
the ContainerOption this neighbor list is for.

Implements autopas::VerletNeighborListInterface< Particle_T >.

◆ getNumberOfNeighborPairs()

template<class Particle_T >
long autopas::VerletNeighborListAsBuild< Particle_T >::getNumberOfNeighborPairs ( ) const
inlineoverridevirtual

Returns the number of neighbor pairs in the list.

Returns
the number of neighbor pairs in the list.

Implements autopas::VerletNeighborListInterface< Particle_T >.

◆ getSoANeighborList()

template<class Particle_T >
const auto & autopas::VerletNeighborListAsBuild< Particle_T >::getSoANeighborList ( )
inline

Returns the internal SoA neighbor list.

Should be used by traversals.

The internal SoA neighbor list structure is an array of vectors for each color. Each of those vectors contains one SoA neighbor list per thread. Each of those SoA neighbor lists is a vector of pairs mimicing a map. Each pair contains an index in the SoA and a vector of the indices of all its neighbors in the SoA.

Or in short: _soaNeighborList = std::array<SoAColorNeighborList, _numColors> = std::array<std::vector<SoAThreadNeighborList>, _numColors> = std::array<std::vector<std::pair<size_t, std::vector<size_t, autopas::AlignedAllocator<size_t>>>>, _numColors>

Returns
the internal SoA neighbor list.

◆ isSoAListValid()

template<class Particle_T >
bool autopas::VerletNeighborListAsBuild< Particle_T >::isSoAListValid ( ) const
inlineoverridevirtual

Returns whether the SoA is build and up to date with the AoS.

Returns
True, if the SoA is up to date with the AoS, false otherwise.

Implements autopas::VerletNeighborListInterface< Particle_T >.

◆ loadSoA()

template<class Particle_T >
template<class TFunctor >
auto * autopas::VerletNeighborListAsBuild< Particle_T >::loadSoA ( TFunctor *  f)
inline

Loads the particle information in the SoA and returns a pointer to the filled SoA.

Template Parameters
TFunctorThe type of the functor to use for loading the particles.
Parameters
fThe functor to use for loading the particles.
Returns
A pointer to the SoA filled. Ownership is not passed.

◆ receiveColorChange()

template<class Particle_T >
void autopas::VerletNeighborListAsBuild< Particle_T >::receiveColorChange ( unsigned long  newColor)
inlineoverridevirtual

Gets called when the color changes during the observed traversal.

Parameters
newColorThe new color that the traversal handles now.

Implements autopas::ColorChangeObserver.

Friends And Related Symbol Documentation

◆ internal::AsBuildPairGeneratorFunctor< Particle_T, false >

template<class Particle_T >
friend class internal::AsBuildPairGeneratorFunctor< Particle_T, false >
friend

Adds the generator functor for adding pairs as friend so it can call addPair().

Parameters
falsetest mark that it is for adding pairs.

◆ internal::AsBuildPairGeneratorFunctor< Particle_T, true >

template<class Particle_T >
friend class internal::AsBuildPairGeneratorFunctor< Particle_T, true >
friend

Adds the generator functor for validation checks as friend so it can call checkPair().

Parameters
truemark that it is for validation checks.

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