ParM  parm
A molecular dynamics library
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
Grid Class Reference

A fast algorithm for finding all pairs of neighboring atoms. More...

#include <trackers.hpp>

Public Types

typedef GridIterator iterator
 
typedef GridPairedIterator pair_iter
 

Public Member Functions

vector< uintneighbors (uint i)
 
uint get_loc (Vec v, Vec bsize)
 
 Grid (sptr< OriginBox > box, sptr< AtomGroup > atoms, const uint width=1)
 /param width Number of divisions along all axes More...
 
 Grid (sptr< OriginBox > box, sptr< AtomGroup > atoms, vector< uint > width)
 /param widths Number of divisions along each axis More...
 
 Grid (sptr< OriginBox > box, sptr< AtomGroup > atoms, const flt minwidth, const flt goalwidth)
 /param minwidth The minimum size of a box, e.g. the widest diameter of a particle. More...
 
void optimize_widths ()
 Reshape the grid to optimize number of Atom pairs. More...
 
void make_grid ()
 Reshape the grid to optimize number of Atom pairs. More...
 
iterator begin ()
 Iterator over pairs. More...
 
iterator end ()
 
pair_iter pairs (AtomID a)
 Get all pairs of a specific Atom. More...
 
flt time_to_edge (Atom &a)
 Find the amount of time until an Atom leaves its current cell. More...
 
flt time_to_edge (uint i)
 
vector< IDPairall_pairs ()
 Return a list of all pairs. SLOW function, but useful for debugging. More...
 
vector< AtomIDall_pairs (AtomID a)
 Return a list of all neighbors of a given Atom. SLOW function, but useful for debugging. More...
 
uint numcells (uint i)
 
uint numcells ()
 

Public Attributes

sptr< OriginBoxbox
 
sptr< AtomGroupatoms
 
flt minwidth
 minwidth is minimum size of a box, in real units. More...
 
flt goalwidth
 goalwidth is how many atoms per box (goal). More...
 
uint widths [NDIM]
 Number of box divisions per dimension. More...
 
vector< set< AtomID > > gridlocs
 Atoms in each grid location. More...
 

Friends

class GridIterator
 
class GridPairedIterator
 

Detailed Description

A fast algorithm for finding all pairs of neighboring atoms.

A Grid splits the OriginBox into "cells", where no cell is narrower than any Atom. For any given Atom, all atoms within the same cell or any neighboring cell are considered "neighbors".

Member Typedef Documentation

Constructor & Destructor Documentation

Grid::Grid ( sptr< OriginBox box,
sptr< AtomGroup atoms,
const uint  width = 1 
)

/param width Number of divisions along all axes

Grid::Grid ( sptr< OriginBox box,
sptr< AtomGroup atoms,
vector< uint width 
)

/param widths Number of divisions along each axis

Grid::Grid ( sptr< OriginBox box,
sptr< AtomGroup atoms,
const flt  minwidth,
const flt  goalwidth 
)

/param minwidth The minimum size of a box, e.g. the widest diameter of a particle.

/param goalwidth Number of atoms to try and fit per box.

Member Function Documentation

vector< IDPair > Grid::all_pairs ( )

Return a list of all pairs. SLOW function, but useful for debugging.

vector< AtomID > Grid::all_pairs ( AtomID  a)

Return a list of all neighbors of a given Atom. SLOW function, but useful for debugging.

Grid::iterator Grid::begin ( )

Iterator over pairs.

Grid::iterator Grid::end ( )
uint Grid::get_loc ( Vec  v,
Vec  bsize 
)
void Grid::make_grid ( )

Reshape the grid to optimize number of Atom pairs.

vector< uint > Grid::neighbors ( uint  i)
uint Grid::numcells ( uint  i)
inline
uint Grid::numcells ( )
inline
void Grid::optimize_widths ( )

Reshape the grid to optimize number of Atom pairs.

No-op if minwidth <= 1 or goalwidth <= 0.

Grid::pair_iter Grid::pairs ( AtomID  a)

Get all pairs of a specific Atom.

flt Grid::time_to_edge ( Atom a)

Find the amount of time until an Atom leaves its current cell.

flt Grid::time_to_edge ( uint  i)
inline

Friends And Related Function Documentation

friend class GridIterator
friend
friend class GridPairedIterator
friend

Member Data Documentation

sptr<AtomGroup> Grid::atoms
sptr<OriginBox> Grid::box
flt Grid::goalwidth

goalwidth is how many atoms per box (goal).

See minwidth.

vector<set<AtomID> > Grid::gridlocs

Atoms in each grid location.

flt Grid::minwidth

minwidth is minimum size of a box, in real units.

This is used to calculate the widths of new boxes in optimize_widths().

May be 0 or negative, to indicate that optimize_widths() should never change the box sizes.

uint Grid::widths[NDIM]

Number of box divisions per dimension.


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