![]() |
.Simulation
|
This class provides the functionality of a three dimensional cell list. More...
#include <CellListFast.h>
Classes | |
class | NeighborCellIterator |
Public Member Functions | |
CellList (const int ps, const int xs, const int ys, const int zs) | |
Constructor. More... | |
const IntVector & | ParticlePosition (const int ps) const |
Get the particle's position in the grid space. | |
void | ParticlePosition (const int ps, IntVector &v) const |
Return the particle position through a referenced IntVector. | |
void | MoveParticle (const int ps, const IntVector &mv) |
Moves a particle the set number of cells in each direction. More... | |
void | SetParticle (const int ps, const int x, const int y, const int z) |
Sets the position of the current particle. More... | |
void | SetParticle (const int particle, const IntVector &v) |
Sets the position of the current particle. More... | |
NeighborCellIterator | BeginNeighborCell (const int particle, const IntVector &low, const IntVector &high) |
Create an iterator into the neighboring cells of a given particle. More... | |
void | Resize (const int ps, const IntVector &ex) |
Resize the cell list to a new volume. More... | |
void | Clear () |
Clear out the contents of the CellList . More... | |
unsigned long | Dims (const int i) const |
Get the number of partitions along each dimension. More... | |
This class provides the functionality of a three dimensional cell list.
It provides the ability to quickly find neighboring particles in a three dimensional system. This is accomplished using a three dimensional array to store the contents of each voxel in the system. In that manner, neighbors can be quickly found by examining the current and adjacent voxels.
MDSimulation::CellList::CellList | ( | const int | ps, |
const int | xs, | ||
const int | ys, | ||
const int | zs | ||
) |
Constructor.
Fixes a 3d vector such that it "wraps" around a space with dimensions specified by x, y, and z.
v | The vector to be fixed. |
x | The size of the x dimension. |
y | The size of the y dimension. |
z | The size of the z dimension. |
CellList::NeighborCellIterator MDSimulation::CellList::BeginNeighborCell | ( | const int | particle, |
const IntVector & | low, | ||
const IntVector & | high | ||
) |
Create an iterator into the neighboring cells of a given particle.
Get an iterator into the neighboring cells of a particle, including the one the current particle is occupying.
Will include the current particle.
particle | The particle to get the neighbors for. |
low | The low bounds along each axis for traversal. This is relative to the position of the particle with the given index. |
high | The high bound along each axis. |
particle | The index of the particle to search around. |
void MDSimulation::CellList::Clear | ( | ) |
Clear out the contents of the CellList
.
This will invalidate all of the particle placements.
|
inline |
Get the number of partitions along each dimension.
i | The index of the dimension (0 = x, 1 = y, 2 = z). |
void MDSimulation::CellList::MoveParticle | ( | const int | ps, |
const IntVector & | mv | ||
) |
Moves a particle the set number of cells in each direction.
ps | The index of the particle to move. |
mv | The displacement in each direction. |
void MDSimulation::CellList::Resize | ( | const int | ps, |
const IntVector & | ex | ||
) |
Resize the cell list to a new volume.
This will invalidate and clear out the contents of the CellList
. Any iterators into this object will be invalidated once this operaton is performed.
ps | The number of particles in the new system. |
xs | The number of partitions along the x-axis. |
ys | The number of partitions along the y-axis. |
zs | The number of partitions along the z-axis. |
void MDSimulation::CellList::SetParticle | ( | const int | ps, |
const int | x, | ||
const int | y, | ||
const int | z | ||
) |
Sets the position of the current particle.
particle | The index of the particle being set. |
x | The x coordinate of the particle. |
y | The y coordinate of the particle. |
z | The z coordinate of the particle. |
void MDSimulation::CellList::SetParticle | ( | const int | particle, |
const IntVector & | v | ||
) |
Sets the position of the current particle.
Functions as a convenient adaptor as we often wish to position the particles based on a pre computed vector.
particle | The index of the particle being set. |
v | Vector representing the coordinates of the particle. |