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

Helper class for rebuilding the VerletClusterLists container. More...

#include <VerletClusterListsRebuilder.h>

Inheritance diagram for autopas::internal::VerletClusterListsRebuilder< Particle_T >:
Inheritance graph
[legend]

Public Types

using NeighborListsBuffer_T = NeighborListsBuffer< const internal::Cluster< Particle_T > *, internal::Cluster< Particle_T > * >
 Type alias for the neighbor list buffer.
 

Public Member Functions

 VerletClusterListsRebuilder (ClusterTowerBlock2D< Particle_T > &towerBlock, std::vector< Particle_T > &particlesToAdd, NeighborListsBuffer_T &neighborListsBuffer, size_t clusterSize, double interactionLengthSqr, bool newton3)
 Constructs the builder from the cluster list.
 
size_t rebuildTowersAndClusters ()
 Rebuilds the towers, sorts the particles into them and creates the clusters with a reference to an uninitialized neighbor list.
 
void rebuildNeighborListsAndFillClusters ()
 Rebuilds the neighbor lists and fills Clusters with dummies as described in ClusterTower::setDummyValues.
 
void clearNeighborListsAndMoveDummiesIntoClusters ()
 Clears previously saved neighbors from clusters and sets the 3D positions of the dummy particles to inside of the cluster to avoid all dummies being in one place and potentially trigger cluster-cluster distance evaluations.
 
std::vector< std::vector< Particle_T > > collectAllParticlesFromTowers ()
 Takes all particles from all towers and returns them.
 
std::vector< std::vector< Particle_T > > collectOutOfBoundsParticlesFromTowers ()
 Collect all particles that are stored in the wrong towers.
 
void sortParticlesIntoTowers (const std::vector< std::vector< Particle_T > > &particles2D)
 Sorts all passed particles in the appropriate clusters.
 
void updateNeighborLists ()
 Updates the neighbor lists for all clusters.
 
template<class FunType >
void iterateNeighborTowers (const int towerIndexX, const int towerIndexY, const int minNeighborIndexX, const int maxNeighborIndexX, const int minNeighborIndexY, const int maxNeighborIndexY, FunType function)
 For all clusters in a tower, given by it's x/y indices, find all neighbors in towers that are given by an area (min/max x/y neighbor indices).
 
int get1DInteractionCellIndexForTower (const int towerIndexX, const int towerIndexY)
 Returns the index of a imagined interaction cell with side length equal the interaction length that contains the given tower.
 
bool isForwardNeighbor (const int towerIndexX, const int towerIndexY, const int neighborIndexX, const int neighborIndexY)
 Decides if a given neighbor tower is a forward neighbor to a given tower.
 
void calculateNeighborsBetweenTowers (internal::ClusterTower< Particle_T > &towerA, internal::ClusterTower< Particle_T > &towerB)
 Calculates for all clusters in the given tower:
 
bool getNewton3 () const
 Getter.
 

Detailed Description

template<class Particle_T>
class autopas::internal::VerletClusterListsRebuilder< Particle_T >

Helper class for rebuilding the VerletClusterLists container.

Note
Towers are always built on the xy plane towering into the z dimension.
Template Parameters
Particle_TThe type of the particle the container contains.

Constructor & Destructor Documentation

◆ VerletClusterListsRebuilder()

template<class Particle_T >
autopas::internal::VerletClusterListsRebuilder< Particle_T >::VerletClusterListsRebuilder ( ClusterTowerBlock2D< Particle_T > &  towerBlock,
std::vector< Particle_T > &  particlesToAdd,
NeighborListsBuffer_T neighborListsBuffer,
size_t  clusterSize,
double  interactionLengthSqr,
bool  newton3 
)
inline

Constructs the builder from the cluster list.

Parameters
towerBlockThe towers from the cluster list to rebuild.
particlesToAddNew particles to add.
neighborListsBufferBuffer structure to hold all neighbor lists.
clusterSizeSize of the clusters in particles.
interactionLengthSqrSquared interaction length (cutoff + skin)^2
newton3If the current configuration uses newton3

Member Function Documentation

◆ calculateNeighborsBetweenTowers()

template<class Particle_T >
void autopas::internal::VerletClusterListsRebuilder< Particle_T >::calculateNeighborsBetweenTowers ( internal::ClusterTower< Particle_T > &  towerA,
internal::ClusterTower< Particle_T > &  towerB 
)
inline

Calculates for all clusters in the given tower:

  • all neighbor clusters within the interaction length that are contained in the given neighbor tower.
Parameters
towerAThe given tower.
towerBThe given neighbor tower. contain. If an cluster A interacts with cluster B, then this interaction will either show up only once in the interaction lists of the custers (for newton3 == true) or show up in the interaction lists of both (for newton3 == false)

◆ collectAllParticlesFromTowers()

template<class Particle_T >
std::vector< std::vector< Particle_T > > autopas::internal::VerletClusterListsRebuilder< Particle_T >::collectAllParticlesFromTowers ( )
inline

Takes all particles from all towers and returns them.

Towers are cleared afterwards.

Returns
All particles in the container sorted in 2D as they were in the towers.

◆ collectOutOfBoundsParticlesFromTowers()

template<class Particle_T >
std::vector< std::vector< Particle_T > > autopas::internal::VerletClusterListsRebuilder< Particle_T >::collectOutOfBoundsParticlesFromTowers ( )
inline

Collect all particles that are stored in the wrong towers.

The particles are deleted from their towers.

Returns

◆ get1DInteractionCellIndexForTower()

template<class Particle_T >
int autopas::internal::VerletClusterListsRebuilder< Particle_T >::get1DInteractionCellIndexForTower ( const int  towerIndexX,
const int  towerIndexY 
)
inline

Returns the index of a imagined interaction cell with side length equal the interaction length that contains the given tower.

Parameters
towerIndexXThe x index of the given tower.
towerIndexYThe y index of the given tower.
Returns
The index of the interaction cell containing the given tower.

◆ getNewton3()

template<class Particle_T >
bool autopas::internal::VerletClusterListsRebuilder< Particle_T >::getNewton3 ( ) const
inline

Getter.

Returns

◆ isForwardNeighbor()

template<class Particle_T >
bool autopas::internal::VerletClusterListsRebuilder< Particle_T >::isForwardNeighbor ( const int  towerIndexX,
const int  towerIndexY,
const int  neighborIndexX,
const int  neighborIndexY 
)
inline

Decides if a given neighbor tower is a forward neighbor to a given tower.

A forward neighbor is either in a interaction cell with a higher index or in the same interaction cell with a higher tower index.

Helps the VCLC06Traversal to have no data races.

Parameters
towerIndexXThe x-index of the given tower.
towerIndexYThe y-index of the given tower.
neighborIndexXThe x-index of the given neighbor tower.
neighborIndexYThe y-index of the given neighbor tower.
Returns
True, if neighbor is a forward neighbor of tower.

◆ iterateNeighborTowers()

template<class Particle_T >
template<class FunType >
void autopas::internal::VerletClusterListsRebuilder< Particle_T >::iterateNeighborTowers ( const int  towerIndexX,
const int  towerIndexY,
const int  minNeighborIndexX,
const int  maxNeighborIndexX,
const int  minNeighborIndexY,
const int  maxNeighborIndexY,
FunType  function 
)
inline

For all clusters in a tower, given by it's x/y indices, find all neighbors in towers that are given by an area (min/max x/y neighbor indices).

With the useNewton3 parameter, the lists can be either built containing all, or only the forward neighbors. If an cluster A interacts with cluster B, then this interaction will either show up only once in the interaction lists of the custers (for newton3 == true) or show up in the interaction lists of both (for newton3 == false)

Note
_newton3 Specifies, whether neighbor lists should contain only forward neighbors.
Template Parameters
FunTypetype of function
Parameters
towerIndexXThe x index of the given tower.
towerIndexYThe y index of the given tower.
minNeighborIndexXThe minimum neighbor tower index in x direction.
maxNeighborIndexXThe maximum neighbor tower index in x direction.
minNeighborIndexYThe minimum neighbor tower index in y direction.
maxNeighborIndexYThe maximum neighbor tower index in y direction.
functionFunction to apply on every neighbor tower. Typically this is calculateNeighborsBetweenTowers().

◆ rebuildNeighborListsAndFillClusters()

template<class Particle_T >
void autopas::internal::VerletClusterListsRebuilder< Particle_T >::rebuildNeighborListsAndFillClusters ( )
inline

Rebuilds the neighbor lists and fills Clusters with dummies as described in ClusterTower::setDummyValues.

Note
Here, _newton3 decides, whether neighbor lists should use newton3. This changes what the lists contain. For two interacting clusters A and B, if _newton3 == false, the interaction A->B is in the list of cluster B, and B->A is in cluster A. If _newton3 == true, the two-way interaction A<->B will only be in the cluster that comes first when iterating through towers.

◆ rebuildTowersAndClusters()

template<class Particle_T >
size_t autopas::internal::VerletClusterListsRebuilder< Particle_T >::rebuildTowersAndClusters ( )
inline

Rebuilds the towers, sorts the particles into them and creates the clusters with a reference to an uninitialized neighbor list.

Returns
number of clusters

◆ sortParticlesIntoTowers()

template<class Particle_T >
void autopas::internal::VerletClusterListsRebuilder< Particle_T >::sortParticlesIntoTowers ( const std::vector< std::vector< Particle_T > > &  particles2D)
inline

Sorts all passed particles in the appropriate clusters.

Note
This Function takes a 2D vector because it expects the layout from the old clusters. The information however, is not utilized hence when in doubt all particles can go in one vector.
Parameters
particles2DThe particles to sort in the towers.

◆ updateNeighborLists()

template<class Particle_T >
void autopas::internal::VerletClusterListsRebuilder< Particle_T >::updateNeighborLists ( )
inline

Updates the neighbor lists for all clusters.

Todo:
: find sensible chunksize

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