Sundance::CellIterator Class Reference

List of all members.

Public Types

enum  CellIteratorPos { Begin, End }

Public Member Functions

 CellIterator ()
 CellIterator (const CellIterator &other)
 CellIterator (const Mesh &mesh, int cellDim, CellIteratorPos pos)
 CellIterator (const Set< int > *cells, CellIteratorPos pos)
CellIteratoroperator= (const CellIterator &other)
const int & operator* () const
CellIterator operator++ (int)
CellIteratoroperator++ ()
bool operator== (const CellIterator &other) const
bool operator!= (const CellIterator &other) const

Private Member Functions

void advance ()

Static Private Member Functions

static Set< int > dummy ()

Private Attributes

bool isImplicit_
int currentLID_
const CellReordererImplemBasereorderer_
Set< int >::const_iterator iter_


Detailed Description

CellIterator is an iterator for walking through cell sets. It satisfies the requirements for an input iterator in STL.

This class design violates the usual rules of good OO style: it has polymorphic behavior packed into a single class. The justification for this decision is to avoid the expense of the clone() operations that would be required by the copy ctor for iterators were a polymorphic class heirarchy used.

Two cell set types exist: explicit, where the member cells LIDs are enumerated in a physical Set<int> object, and implicit, where no physical Set is made, rather, the sequence of cell LIDs is obtained through some scheme of walking the mesh.

The only cell sets that can represented implicitly are the set of all cells of a given dimension.

See also:
CellSet, CellFilter, CellIteratorPos

Definition at line 68 of file SundanceCellIterator.hpp.


Member Enumeration Documentation

CellIteratorPos is used to specify whether a new CellIterator is positioned at the beginning or end of a set.

Enumerator:
Begin 
End 

Definition at line 77 of file SundanceCellIterator.hpp.


Constructor & Destructor Documentation

CellIterator::CellIterator (  ) 

Empty ctor

Definition at line 40 of file SundanceCellIterator.cpp.

CellIterator::CellIterator ( const CellIterator other  ) 

Copy ctor

Definition at line 47 of file SundanceCellIterator.cpp.

References isImplicit_, and iter_.

CellIterator::CellIterator ( const Mesh mesh,
int  cellDim,
CellIteratorPos  pos 
)

Construct an implicit iterator for walking all cells of a given dimension on the given mesh.

Definition at line 56 of file SundanceCellIterator.cpp.

References Sundance::CellReordererImplemBase::begin(), Begin, currentLID_, End, Sundance::Mesh::numCells(), reorderer_, Sundance::Mesh::spatialDim(), SUNDANCE_OUT, and Playa::Handle< PointerType >::verb().

CellIterator::CellIterator ( const Set< int > *  cells,
CellIteratorPos  pos 
)

Construct an explicit iterator for walking an explicitly enumerated set of cells.

Definition at line 96 of file SundanceCellIterator.cpp.

References Sundance::Set< Key, Compare >::begin(), Begin, Sundance::Set< Key, Compare >::end(), End, and iter_.


Member Function Documentation

void Sundance::CellIterator::advance (  )  [inline, private]

Advance the iterator

Definition at line 142 of file SundanceCellIterator.hpp.

References Sundance::CellReordererImplemBase::advance(), currentLID_, isImplicit_, iter_, and reorderer_.

Referenced by operator++().

static Set<int> Sundance::CellIterator::dummy (  )  [inline, static, private]

Definition at line 171 of file SundanceCellIterator.hpp.

bool Sundance::CellIterator::operator!= ( const CellIterator other  )  const [inline]

Definition at line 133 of file SundanceCellIterator.hpp.

const int& Sundance::CellIterator::operator* (  )  const [inline]

Dereferencing operator

Definition at line 97 of file SundanceCellIterator.hpp.

References currentLID_, isImplicit_, and iter_.

CellIterator& Sundance::CellIterator::operator++ (  )  [inline]

Prefix increment: advances iterator, returning new value

Definition at line 113 of file SundanceCellIterator.hpp.

References advance().

CellIterator Sundance::CellIterator::operator++ ( int   )  [inline]

Postfix increment: advances iterator and returns previous value

Definition at line 104 of file SundanceCellIterator.hpp.

References advance().

CellIterator & CellIterator::operator= ( const CellIterator other  ) 

Definition at line 117 of file SundanceCellIterator.cpp.

References currentLID_, isImplicit_, iter_, and reorderer_.

bool Sundance::CellIterator::operator== ( const CellIterator other  )  const [inline]

Definition at line 120 of file SundanceCellIterator.hpp.

References currentLID_, isImplicit_, and iter_.


Member Data Documentation

The LID to which this iterator is currently pointing. Used only for implicit iterators.

Definition at line 160 of file SundanceCellIterator.hpp.

Referenced by advance(), CellIterator(), Sundance::ExplicitCellIterator::operator!=(), operator*(), operator=(), and operator==().

Flag indicating whether this iterator is implicit

Definition at line 156 of file SundanceCellIterator.hpp.

Referenced by advance(), CellIterator(), operator*(), operator=(), and operator==().

Set<int>::const_iterator Sundance::CellIterator::iter_ [private]

iterator for enumerated cells. Used only for explicit iterators.

Definition at line 168 of file SundanceCellIterator.hpp.

Referenced by advance(), CellIterator(), operator*(), operator=(), Sundance::ExplicitCellIterator::operator==(), and operator==().

Unmanaged pointer to the reorderer used for walking implicit cell sets. Used only for implicit iterators.

Definition at line 164 of file SundanceCellIterator.hpp.

Referenced by advance(), CellIterator(), and operator=().

Site Contact