Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
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 79 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 88 of file SundanceCellIterator.hpp.


Constructor & Destructor Documentation

Empty ctor

Definition at line 51 of file SundanceCellIterator.cpp.

Copy ctor

Definition at line 58 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 67 of file SundanceCellIterator.cpp.

References Begin, Sundance::CellReordererImplemBase::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 107 of file SundanceCellIterator.cpp.

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


Member Function Documentation

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

Advance the iterator

Definition at line 153 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 182 of file SundanceCellIterator.hpp.

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

Definition at line 144 of file SundanceCellIterator.hpp.

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

Dereferencing operator

Definition at line 108 of file SundanceCellIterator.hpp.

References currentLID_, isImplicit_, and iter_.

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

Postfix increment: advances iterator and returns previous value

Definition at line 115 of file SundanceCellIterator.hpp.

References advance().

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

Prefix increment: advances iterator, returning new value

Definition at line 124 of file SundanceCellIterator.hpp.

References advance().

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

Definition at line 128 of file SundanceCellIterator.cpp.

References currentLID_, isImplicit_, iter_, and reorderer_.

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

Definition at line 131 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 171 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 167 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 179 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 175 of file SundanceCellIterator.hpp.

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

Site Contact