Simpatico  v1.10
List of all members | Public Member Functions
McMd::PairIterator Class Reference

Detailed Description

Iterator for pairs in a PairList.

A loop over atom pairs, such as that required to calculated forces or energies, can take the following form:

PairList pairList;
// [build the PairList]
// Loop over pairs
Atom* atom1Ptr;
Atom* atom2Ptr;
for (pairList.begin(iter); iterator.notEnd(); ++iter) {
iterator.getPair(atom1Ptr, atom2Ptr);
// [Do something with atom1Ptr and atom2Ptr]
++iter;
}

Definition at line 48 of file mcMd/neighbor/PairIterator.h.

#include <PairIterator.h>

Public Member Functions

 PairIterator ()
 Default constructor. More...
 
 PairIterator (const PairList &pairList)
 Initializing constructor. More...
 
PairIteratoroperator++ ()
 Increment to next pair. More...
 
bool isEnd () const
 Return true if at end of PairList. More...
 
bool notEnd () const
 Return true if not at end of PairList. More...
 
void getPair (Atom *&atom1Ptr, Atom *&atom2Ptr) const
 Get pointers for current pair of Atoms. More...
 

Constructor & Destructor Documentation

McMd::PairIterator::PairIterator ( )
inline

Default constructor.

Creates an uninitialized iterator, which is not associated with a parent PairList.

Definition at line 135 of file mcMd/neighbor/PairIterator.h.

McMd::PairIterator::PairIterator ( const PairList pairList)
inline

Initializing constructor.

Creates an initialized iterator, for which the current pair is the first pair in a parent PairList.

Parameters
pairListparent PairList object.

Definition at line 148 of file mcMd/neighbor/PairIterator.h.

References McMd::PairList::begin().

Member Function Documentation

PairIterator & McMd::PairIterator::operator++ ( )
inline

Increment to next pair.

Definition at line 174 of file mcMd/neighbor/PairIterator.h.

bool McMd::PairIterator::isEnd ( ) const
inline

Return true if at end of PairList.

When isEnd() is true, the current pair is already one past past the end of the pairlist, and is thus invalid.

Definition at line 190 of file mcMd/neighbor/PairIterator.h.

bool McMd::PairIterator::notEnd ( ) const
inline
void McMd::PairIterator::getPair ( Atom *&  atom1Ptr,
Atom *&  atom2Ptr 
) const
inline

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