.Simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Classes | Public Member Functions | List of all members
MDSimulation::CellList Class Reference

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 IntVectorParticlePosition (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...
 

Detailed Description

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.

Author
Spenser Bauman

Constructor & Destructor Documentation

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.

Parameters
vThe vector to be fixed.
xThe size of the x dimension.
yThe size of the y dimension.
zThe size of the z dimension.

Member Function Documentation

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.

Parameters
particleThe particle to get the neighbors for.
lowThe low bounds along each axis for traversal. This is relative to the position of the particle with the given index.
highThe high bound along each axis.
particleThe 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.

unsigned long MDSimulation::CellList::Dims ( const int  i) const
inline

Get the number of partitions along each dimension.

Parameters
iThe index of the dimension (0 = x, 1 = y, 2 = z).
Returns
The number of partitions along the given dimension.
void MDSimulation::CellList::MoveParticle ( const int  ps,
const IntVector mv 
)

Moves a particle the set number of cells in each direction.

Parameters
psThe index of the particle to move.
mvThe 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.

Parameters
psThe number of particles in the new system.
xsThe number of partitions along the x-axis.
ysThe number of partitions along the y-axis.
zsThe 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.

Parameters
particleThe index of the particle being set.
xThe x coordinate of the particle.
yThe y coordinate of the particle.
zThe 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.

Parameters
particleThe index of the particle being set.
vVector representing the coordinates of the particle.

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