Class SBSNeighborSearchParticleSystemGrid#
ClassList > SBSNeighborSearchParticleSystemGrid
This class describes a grid-based neighbor search algorithm that can be applied to particle systems. More...
#include <SBSNeighborSearchParticleSystemGrid.hpp>
Inherits the following classes: SBSNeighborSearchParticleSystem
Public Functions#
| Type | Name |
|---|---|
| SBSNeighborSearchParticleSystemGrid (SBParticleSystem * particleSystem, const SBQuantity::length & cutoffDistance) Constructs a neighbor search particle system grid for the given particle system and the given cutoff radius. |
|
| virtual bool | areNeighbors (unsigned int i, unsigned int j) override const Returns whether atoms with indices i andj are neighbors. |
| virtual bool | areNeighbors (SBAtom * atomI, SBAtom * atomJ) override const Returns whether atoms atomI andatomJ are neighbors. |
| virtual void | getNeighbors (SBVector< SBAtom * > & neighborVector, const SBPosition3 & position, const SBQuantity::length & radius) override const Appends to neighborVector all atoms that are at a distance smaller than or equal toradius from the specifiedposition . |
| virtual void | getNeighbors (SBVector< SBAtom * > & neighborVector, const SBIAPosition3 & box) override const Appends to neighborVector all atoms inside thebox . |
| bool | getParallelizationEnabled () const Returns whether the parallelization is enabled. By default, it is enabled and will be used if some criteria (e.g. the minimum number of atoms) are met. |
| virtual void | initializeNeighborLists () override Initializes the neighbor lists. |
| void | onDynamicalEvent (SBDynamicalEvent * dynamicalEvent) Handles dynamical model events. |
| virtual void | print (unsigned int offset=0) override const Prints debugging information. |
| void | setParallelizationEnabled (bool enabled) Sets whether the parallelization is enabled. If set to true then the parallel implementation will be used if some criteria (e.g. the minimum number of atoms) are met, else the serial implementation will be used. |
| virtual void | updateNeighborLists () override Updates the neighbor lists. |
| virtual | ~SBSNeighborSearchParticleSystemGrid () Destructor. |
Public Functions inherited from SBSNeighborSearchParticleSystem#
See SBSNeighborSearchParticleSystem
| Type | Name |
|---|---|
| virtual bool | areNeighbors (unsigned int i, unsigned int j) const Returns whether atoms with indices i andj are neighbors. |
| virtual bool | areNeighbors (SBAtom * atomI, SBAtom * atomJ) const Returns whether atoms atomI andatomJ are neighbors. |
| SBVector< SBAtom * > const * | getNeighborVector (unsigned int i) Returns the neighbor list for the i-th particle. |
| virtual void | getNeighbors (SBVector< SBAtom * > & neighborVector, const SBPosition3 & position, const SBQuantity::length & radius) const Appends to neighborVector all atoms that are at a distance smaller than or equal toradius from the specifiedposition . |
| virtual void | getNeighbors (SBVector< SBAtom * > & neighborVector, const SBIAPosition3 & box) const Appends to neighborVector all atoms inside thebox . |
| virtual void | initializeNeighborLists () Initializes the neighbor lists. |
| void | onDynamicalEvent (SBDynamicalEvent * dynamicalEvent) Handles dynamical model events. |
| virtual void | print (unsigned int offset=0) override const Prints debugging information. |
| virtual void | updateNeighborLists () Updates the neighbor lists. |
| virtual | ~SBSNeighborSearchParticleSystem () Destructor. |
Public Functions inherited from SBSNeighborSearch#
| Type | Name |
|---|---|
| virtual void | print (unsigned int offset=0) const Prints debugging information. |
| virtual | ~SBSNeighborSearch () Destructor. |
Public Functions inherited from SBCReferenceTarget#
| Type | Name |
|---|---|
| SBCReferenceTarget () Builds the reference target. |
|
| unsigned int | getMemoryFootprint () const Returns the memory footprint. |
| void | printReferencesToOwners () const Prints the references to the owners of this reference target. |
| virtual | ~SBCReferenceTarget () Destructor. |
Protected Attributes#
| Type | Name |
|---|---|
| SBHashMap< GridKey, GridCell *, GridKeyFunctor, GridKeyComparator > * | grid |
| SBVector< GridKey > * | gridKeyVector |
| SBHashMap< std::pair< unsigned int, unsigned int >, bool > * | neighborMap Hashmap which caches whether two atoms are neighbors. |
Protected Attributes inherited from SBSNeighborSearchParticleSystem#
See SBSNeighborSearchParticleSystem
| Type | Name |
|---|---|
| SBQuantity::squareLength * | cutoffDistanceSquared The squared cutoff distance. |
| SBQuantity::inverseLength * | inverseCutoffDistance The inverse cutoff distance. |
| SBBuffer< SBVector< SBAtom * > * > * | neighborVectorBuffer The buffer containing the neighbor lists associated to each atom. |
| SBPointer< SBParticleSystem > * | particleSystem The particle system the neighbor search algorithm is attached to. |
Protected Attributes inherited from SBCReferenceTarget#
| Type | Name |
|---|---|
| SBCReferenceTargetData * | dataPointer A pointer to the private data. |
Protected Functions#
| Type | Name |
|---|---|
| SBSNeighborSearchParticleSystemGrid (SBParticleSystem * particleSystem, const SBQuantity::length & cutoffDistance, SBSNeighborSearchParticleSystemGridData * dataPointer) Protected constructor. |
Protected Functions inherited from SBSNeighborSearchParticleSystem#
See SBSNeighborSearchParticleSystem
| Type | Name |
|---|---|
| SBSNeighborSearchParticleSystem (SBParticleSystem * particleSystem, const SBQuantity::length & cutoffDistance) Protected constructor. |
|
| SBSNeighborSearchParticleSystem (SBParticleSystem * particleSystem, const SBQuantity::length & cutoffDistance, SBSNeighborSearchParticleSystemData * dataPointer) Protected constructor. |
Protected Functions inherited from SBSNeighborSearch#
| Type | Name |
|---|---|
| SBSNeighborSearch () Protected constructor. |
|
| SBSNeighborSearch (SBSNeighborSearchData * dataPointer) Protected constructor. |
Protected Functions inherited from SBCReferenceTarget#
| Type | Name |
|---|---|
| SBCReferenceTarget (SBCReferenceTargetData * dataPointer) Protected constructor. |
|
| void | removeAllReferenceOwners () Stops all the reference owners from referencing this reference target. |
Detailed Description#
Short name: SBNeighborSearchParticleSystemGrid
Public Functions Documentation#
function SBSNeighborSearchParticleSystemGrid [2/2]#
Constructs a neighbor search particle system grid for the given particle system and the given cutoff radius.
SBSNeighborSearchParticleSystemGrid::SBSNeighborSearchParticleSystemGrid (
SBParticleSystem * particleSystem,
const SBQuantity::length & cutoffDistance
)
Constructs a neighbor search particle system grid for the given particle system and cutoff distance.
Parameters:
pPointer to the particle system.cCutoff distance.
function areNeighbors [1/2]#
Returns whether atoms with indices i andj are neighbors.
virtual bool SBSNeighborSearchParticleSystemGrid::areNeighbors (
unsigned int i,
unsigned int j
) override const
Parameters:
iIndex of the first atom.jIndex of the second atom.
Returns:
true if the atoms are neighbors, false otherwise.
Implements SBSNeighborSearchParticleSystem::areNeighbors
function areNeighbors [2/2]#
Returns whether atoms atomI andatomJ are neighbors.
virtual bool SBSNeighborSearchParticleSystemGrid::areNeighbors (
SBAtom * atomI,
SBAtom * atomJ
) override const
Parameters:
atomIPointer to the first atom.atomJPointer to the second atom.
Returns:
true if the atoms are neighbors, false otherwise.
Implements SBSNeighborSearchParticleSystem::areNeighbors
function getNeighbors [1/2]#
Appends to neighborVector all atoms that are at a distance smaller than or equal toradius from the specifiedposition .
virtual void SBSNeighborSearchParticleSystemGrid::getNeighbors (
SBVector< SBAtom * > & neighborVector,
const SBPosition3 & position,
const SBQuantity::length & radius
) override const
Appends to neighborVector all atoms within a given radius around position.
Parameters:
neighborVectorVector to which neighbor atoms are appended.positionCenter position for the neighbor search.radiusSearch radius.
Implements SBSNeighborSearchParticleSystem::getNeighbors
function getNeighbors [2/2]#
Appends to neighborVector all atoms inside thebox .
virtual void SBSNeighborSearchParticleSystemGrid::getNeighbors (
SBVector< SBAtom * > & neighborVector,
const SBIAPosition3 & box
) override const
Appends to neighborVector all atoms inside the specified box.
Parameters:
neighborVectorVector to which neighbor atoms are appended.boxAxis-aligned box defining the region of interest.
Implements SBSNeighborSearchParticleSystem::getNeighbors
function getParallelizationEnabled#
Returns whether the parallelization is enabled. By default, it is enabled and will be used if some criteria (e.g. the minimum number of atoms) are met.
Returns whether parallelization is enabled for neighbor list calculations.
Returns:
true if parallelization is enabled; otherwise false.
function initializeNeighborLists#
Initializes the neighbor lists.
Initializes neighbor lists for all atoms based on the current particle positions.
This method clears any existing neighbor data and populates neighbor lists and the neighbor map by examining atoms within neighboring grid cells and within the cutoff distance.
Implements SBSNeighborSearchParticleSystem::initializeNeighborLists
function onDynamicalEvent#
Handles dynamical model events.
Handles a dynamical event for the particle system.
Parameters:
dynamicalEventPointer to the dynamic event.
function print#
Prints debugging information.
Prints debugging information for the neighbor search grid.
Parameters:
offsetOptional indentation offset for the output.
Implements SBSNeighborSearchParticleSystem::print
function setParallelizationEnabled#
Sets whether the parallelization is enabled. If set to true then the parallel implementation will be used if some criteria (e.g. the minimum number of atoms) are met, else the serial implementation will be used.
Sets the parallelization flag for neighbor list calculations.
Parameters:
enabledTrue to enable parallelization; false to disable it.
function updateNeighborLists#
Updates the neighbor lists.
Updates the neighbor lists for the particle system.
This method updates the neighbor lists by pruning outdated neighbor relationships, updating the grid based on atom position changes, and detecting new neighbor relationships. The update may be performed using either a serial or a parallel implementation depending on the configuration and system size.
Implements SBSNeighborSearchParticleSystem::updateNeighborLists
function ~SBSNeighborSearchParticleSystemGrid#
Destructor.
Destroys the neighbor search particle system grid and releases allocated resources.
Protected Attributes Documentation#
variable grid#
SBHashMap<GridKey, GridCell*, GridKeyFunctor, GridKeyComparator>* SBSNeighborSearchParticleSystemGrid::grid;
variable gridKeyVector#
variable neighborMap#
Hashmap which caches whether two atoms are neighbors.
SBHashMap<std::pair<unsigned int, unsigned int>, bool>* SBSNeighborSearchParticleSystemGrid::neighborMap;
Protected Functions Documentation#
function SBSNeighborSearchParticleSystemGrid [1/2]#
Protected constructor.
SBSNeighborSearchParticleSystemGrid::SBSNeighborSearchParticleSystemGrid (
SBParticleSystem * particleSystem,
const SBQuantity::length & cutoffDistance,
SBSNeighborSearchParticleSystemGridData * dataPointer
)
Constructs a neighbor search particle system grid with a specific data pointer.
Parameters:
pPointer to the particle system.cCutoff distance.dataPointerPointer to the data structure used by the grid.