glotzopt::CellList Class Reference
[Optimization]

Contains and manages many Cell(s). More...

#include <CellList.h>

List of all members.

Public Types

enum  { FULL = 0, HALF = 1 }
 List of modes for SetNeighborStyle. More...

Public Member Functions

 CellList ()
 Constructor.
virtual ~CellList ()
 Destructor.
int GetSequencer () const
 Returns the id of the cell list.
int GetNumberOfCells () const
 Returns number of Cells in the CellList.
int GetCellContaining (glotz_vec &) const
 Returns the cell containing a position in the box.
int GetCellContaining (ObjectInCellList &) const
 Returns the cell containing an object.
int GetCellContaining (ObjectInCellList *) const
 Returns the cell containing an object.
const glotz_vecGetBoxDimension () const
 Returns the size of the box.
CellGetCell (int) const
 Returns cell at index i.
Celloperator[] (int) const
 Indexing operator; returns cell [i].
void SetIsPeriodic (bool, bool, bool)
 Sets the boundary conditions to periodic or hard.
void SetIsPeriodic (bool)
 Sets the boundary conditions to periodic or hard.
void SetBoundary (glotz_vec &)
 Sets the physical boundary of the cell list (i.e., the box size).
void SetMinimumCellSize (glotz_flt)
 Sets the smallest possible cell dimension.
void SetInteractionRange (glotz_flt)
 Sets the range of the interaction potential.
void SetNeighborStyle (int)
 Sets the neighbor style, or the way the cell neighbor list is built.
void Clear ()
 Clears the contents of all the cells, their memory space, and the list of cells.
virtual void ClearContents ()
 Clears the contents of all the cells.
void PlaceInCorrectCell (ObjectInCellList &)
 If object has changed position, removes it from old cell, places it in new cell.
void PlaceInCorrectCell (ObjectInCellList *)
 If object has changed position, removes it from old cell, places it in new cell.
void Insert (ObjectInCellList &)
 Inserts an object into the cell list.
void Remove (ObjectInCellList &)
 Removes an object from the cell list.
virtual void Insert (ObjectInCellList *)
 Inserts an object into the cell list.
virtual void Remove (ObjectInCellList *)
 Removes an object from the cell list.
virtual void Print (std::ostream &)
 Prints the contents of the cell list to a stream.
void PrintVisual (std::ostream &)
 Print a visual representation of the cell list structure.
bool Good () const
 Indicates whether the cell list is valid.
bool Fail () const
 Indicates whether the cell list is invalid.
void GetNeighborsOf (ObjectInCellList *, std::vector< ObjectInCellList * > &) const
 Special function to get the neighbors of an object.

Public Attributes

std::vector< Cell * > xCell
 List of all cells in the cell list.

Protected Member Functions

virtual void Rebuild ()
 Builds the cell list.
virtual void DivideBoxIntoCells ()
 Divides the box into cells.

Protected Attributes

glotz_flt mInteractionRange
 The range of the interaction potential.
glotz_flt mMinimumCellSize
 The smallest possible cell dimension (usually mInteractionRange).
glotz_vec mCellDimension
 Size of cell in x,y,z.
glotz_vec mInverseCellDimension
 1/over mCellDimension
glotz_vec mBoxDimension
 Size of Box in x,y,z.
glotz_vec mHalfBox
 0.5*mBoxDimension
glotz_vec mNcellPerDimension
 Number of cells in x,y,z.
bool mIsPeriodic [3]
 True if box is periodic in dimension [i].
int mNeighborStyle
 An integer indicating how to build cell neighbor list.
std::map< int, int > mCellOf
 The cell containing an object.
int mSequencer
 For keeping track of which cell list this is.
bool mForceRebuild
 If true, then rebuild the list no matter what next time Rebuild is called.
bool mIsGood
 <Indicates whether the cell list is valid
glotz_vec mNcellPow210
 A factor for finding CellContaining an object based on xPosition.


Detailed Description

Contains and manages many Cell(s).

Author:
Aaron Keys
Pretty much the best cell list ever..... i think....

Member Enumeration Documentation

anonymous enum

List of modes for SetNeighborStyle.

For an MD-style cell list where interactions are pairwise, HALF is typically used, since we only need half of the cell neighbors to compute the total force. For an MC-style cell list, FULL is typically used, since we often need to look at an individual particle and compute the force over paritcles in all neighboring cells.

Enumerator:
FULL 
HALF 


Constructor & Destructor Documentation

glotzopt::CellList::CellList (  ) 

Constructor.

glotzopt::CellList::~CellList (  )  [virtual]

Destructor.

Clears all of the cells.


Member Function Documentation

int glotzopt::CellList::GetSequencer (  )  const

Returns the id of the cell list.

Returns:
number of cells in the list

int glotzopt::CellList::GetNumberOfCells (  )  const

Returns number of Cells in the CellList.

Returns:
number of cells in the list

int glotzopt::CellList::GetCellContaining ( glotz_vec position  )  const

Returns the cell containing a position in the box.

int glotzopt::CellList::GetCellContaining ( ObjectInCellList object  )  const

Returns the cell containing an object.

Parameters:
object is an object in the cell list
Returns:
the cell containing the object

int glotzopt::CellList::GetCellContaining ( ObjectInCellList object  )  const

Returns the cell containing an object.

Parameters:
object is an object in the cell list
Returns:
the cell containing the object

const glotz_vec & glotzopt::CellList::GetBoxDimension (  )  const

Returns the size of the box.

Cell * glotzopt::CellList::GetCell ( int  i  )  const

Returns cell at index i.

Returns a reference to a cell in the list.

Parameters:
i is the number of the referenced cell

Cell * glotzopt::CellList::operator[] ( int  i  )  const

Indexing operator; returns cell [i].

Returns a reference to a cell in the list.

Parameters:
i is the number of the referenced cell

void glotzopt::CellList::SetIsPeriodic ( bool  x,
bool  y,
bool  z 
)

Sets the boundary conditions to periodic or hard.

Parameters:
x is a bool representing whether or not the boundary is periodic in x
y is a bool representing whether or not the boundary is periodic in y
z is a bool representing whether or not the boundary is periodic in z

void glotzopt::CellList::SetIsPeriodic ( bool  val  ) 

Sets the boundary conditions to periodic or hard.

Parameters:
val is a bool representing whether or not the boundary is periodic

void glotzopt::CellList::SetBoundary ( glotz_vec box  ) 

Sets the physical boundary of the cell list (i.e., the box size).

Parameters:
box is the size of the boundary in x,y,z

void glotzopt::CellList::SetMinimumCellSize ( glotz_flt  size  ) 

Sets the smallest possible cell dimension.

If the minimum cell size is not set, the default value is the interaction range.

Parameters:
size is the minimum cell size

void glotzopt::CellList::SetInteractionRange ( glotz_flt  range  ) 

Sets the range of the interaction potential.

The interaction range determines which cells are neighbors. Normally, the cell size is slightly larger than the interaction range such that each cell has 26 neighbors. However, we can make the cells smaller and loop over more cell neighbors to more closely approximate a spherical interaction range and avoid calculating interactions between non-interacting particles.

Parameters:
range is the interaction range

void glotzopt::CellList::SetNeighborStyle ( int  style  ) 

Sets the neighbor style, or the way the cell neighbor list is built.

Parameters:
style is an int representing a given neighbor style

void glotzopt::CellList::Clear (  ) 

Clears the contents of all the cells, their memory space, and the list of cells.

void glotzopt::CellList::ClearContents (  )  [virtual]

Clears the contents of all the cells.

void glotzopt::CellList::PlaceInCorrectCell ( ObjectInCellList object  ) 

If object has changed position, removes it from old cell, places it in new cell.

Parameters:
object is an object in the cell list

void glotzopt::CellList::PlaceInCorrectCell ( ObjectInCellList object  ) 

If object has changed position, removes it from old cell, places it in new cell.

Parameters:
object is an object in the cell list

void glotzopt::CellList::Insert ( ObjectInCellList object  ) 

Inserts an object into the cell list.

Parameters:
oject is object to be inserted

void glotzopt::CellList::Remove ( ObjectInCellList object  ) 

Removes an object from the cell list.

Parameters:
oject is object to be removed

void glotzopt::CellList::Insert ( ObjectInCellList object  )  [virtual]

Inserts an object into the cell list.

Parameters:
oject is object to be inserted

void glotzopt::CellList::Remove ( ObjectInCellList object  )  [virtual]

Removes an object from the cell list.

Parameters:
oject is object to be removed

void glotzopt::CellList::Print ( std::ostream &  os  )  [virtual]

Prints the contents of the cell list to a stream.

Parameters:
os is the stream to be printed to This function is used primarily for debugging.

void glotzopt::CellList::PrintVisual ( std::ostream &   ) 

Print a visual representation of the cell list structure.

bool glotzopt::CellList::Good (  )  const

Indicates whether the cell list is valid.

bool glotzopt::CellList::Fail (  )  const

Indicates whether the cell list is invalid.

void glotzopt::CellList::GetNeighborsOf ( ObjectInCellList obj,
std::vector< ObjectInCellList * > &  neighbor 
) const

Special function to get the neighbors of an object.

Parameters:
obj is the object whos neighbors to get
neighbors is a list of neigboring objects

void glotzopt::CellList::Rebuild (  )  [protected, virtual]

Builds the cell list.

This function is called whenever the physical boundaries, cutoffs, etc. are changed.

void glotzopt::CellList::DivideBoxIntoCells (  )  [protected, virtual]

Divides the box into cells.

This routine physically divides the box into cells and determines the neighbors of each cell.


Member Data Documentation

std::vector<Cell*> glotzopt::CellList::xCell

List of all cells in the cell list.

glotz_flt glotzopt::CellList::mInteractionRange [protected]

The range of the interaction potential.

glotz_flt glotzopt::CellList::mMinimumCellSize [protected]

The smallest possible cell dimension (usually mInteractionRange).

glotz_vec glotzopt::CellList::mCellDimension [protected]

Size of cell in x,y,z.

glotz_vec glotzopt::CellList::mInverseCellDimension [protected]

1/over mCellDimension

glotz_vec glotzopt::CellList::mBoxDimension [protected]

Size of Box in x,y,z.

glotz_vec glotzopt::CellList::mHalfBox [protected]

0.5*mBoxDimension

glotz_vec glotzopt::CellList::mNcellPerDimension [protected]

Number of cells in x,y,z.

bool glotzopt::CellList::mIsPeriodic[3] [protected]

True if box is periodic in dimension [i].

int glotzopt::CellList::mNeighborStyle [protected]

An integer indicating how to build cell neighbor list.

std::map<int, int> glotzopt::CellList::mCellOf [protected]

The cell containing an object.

int glotzopt::CellList::mSequencer [protected]

For keeping track of which cell list this is.

bool glotzopt::CellList::mForceRebuild [protected]

If true, then rebuild the list no matter what next time Rebuild is called.

bool glotzopt::CellList::mIsGood [protected]

<Indicates whether the cell list is valid

glotz_vec glotzopt::CellList::mNcellPow210 [protected]

A factor for finding CellContaining an object based on xPosition.

Has three components: $ncell[0]^2, ncell[1]^1, ncell[2]^0$. These are muliplied by xPosition of an object to determine it's cell number.


The documentation for this class was generated from the following files:
Generated on Tue Feb 24 20:54:48 2009 by  doxygen 1.5.3