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>
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. | |
![]() | |
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(). | |
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.
Particle_T | The particle type the class uses. |
|
inline |
Constructor for the VerletNeighborListAsBuild.
Does only default initialization.
|
inlineoverridevirtual |
Builds the neighbor list from a LinkedCells object.
This only builds the AoS.
linkedCells | The linked cells to use for building the neighbor list. |
useNewton3 | If 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 >.
|
inlineoverridevirtual |
Checks if the neighbor list contains all pairs that is should.
This is very costly, comparable to rebuilding it.
useNewton3 | If the neighbor list should use newton 3. |
cutoff | The cutoff. Two particles that are further away than this distance are not considered. |
Implements autopas::VerletNeighborListInterface< Particle_T >.
|
inline |
|
inlineoverridevirtual |
Implements autopas::VerletNeighborListInterface< Particle_T >.
|
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>
|
inlineoverridevirtual |
Returns the ContainerOption this neighbor list is for.
Implements autopas::VerletNeighborListInterface< Particle_T >.
|
inlineoverridevirtual |
Returns the number of neighbor pairs in the list.
Implements autopas::VerletNeighborListInterface< Particle_T >.
|
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>
|
inlineoverridevirtual |
Returns whether the SoA is build and up to date with the AoS.
Implements autopas::VerletNeighborListInterface< Particle_T >.
|
inline |
|
inlineoverridevirtual |
Gets called when the color changes during the observed traversal.
newColor | The new color that the traversal handles now. |
Implements autopas::ColorChangeObserver.
|
friend |
Adds the generator functor for adding pairs as friend so it can call addPair().
false | test mark that it is for adding pairs. |
|
friend |
Adds the generator functor for validation checks as friend so it can call checkPair().
true | mark that it is for validation checks. |