PSCF v1.2
Pscf::VertexIterator Class Reference

Vertex iterator for graph associated with a polymer. More...

#include <VertexIterator.h>

Public Member Functions

 VertexIterator (PolymerSpecies const &polymer)
 Constructor.
 
 ~VertexIterator ()
 Destructor.
 
void begin (int sourceId, int targetId)
 Initialize iterator.
 
VertexIteratoroperator++ ()
 Increment operator - move to next vertex.
 
int currentId () const
 Get index of the current vertex.
 
bool isEnd () const
 Return true iff currentId == targetId.
 
bool notEnd () const
 Return true iff currentId != targetId.
 

Detailed Description

Vertex iterator for graph associated with a polymer.

Usage: Suppose that object p is an instance of a subclass of PolymerSpecies. The following snippet illustrates how to iterate from vertex iSource to vertex iTarget of the associated polymer:

VertexIterator = iter(p);
int iVertex;
for (iter.begin(iSource, iTarget); iter.notEnd(); ++iter) {
iVertex = iter.currentId();
// do something with vertex number iVertex
}
Vertex iterator for graph associated with a polymer.

Definition at line 37 of file VertexIterator.h.

Constructor & Destructor Documentation

◆ VertexIterator()

Pscf::VertexIterator::VertexIterator ( PolymerSpecies const & polymer)

Constructor.

Parameters
polymerassociated PolymerSpecies object

Definition at line 17 of file VertexIterator.cpp.

◆ ~VertexIterator()

Pscf::VertexIterator::~VertexIterator ( )

Destructor.

Definition at line 26 of file VertexIterator.cpp.

Member Function Documentation

◆ begin()

void Pscf::VertexIterator::begin ( int sourceId,
int targetId )

Initialize iterator.

Definition at line 32 of file VertexIterator.cpp.

◆ operator++()

VertexIterator & Pscf::VertexIterator::operator++ ( )

Increment operator - move to next vertex.

Definition at line 41 of file VertexIterator.cpp.

References Pscf::PolymerSpecies::edge(), notEnd(), Pscf::PolymerSpecies::path(), UTIL_CHECK, and Pscf::Edge::vertexId().

◆ currentId()

int Pscf::VertexIterator::currentId ( ) const

Get index of the current vertex.

Definition at line 63 of file VertexIterator.cpp.

◆ isEnd()

bool Pscf::VertexIterator::isEnd ( ) const

Return true iff currentId == targetId.

Definition at line 69 of file VertexIterator.cpp.

◆ notEnd()

bool Pscf::VertexIterator::notEnd ( ) const

Return true iff currentId != targetId.

Definition at line 77 of file VertexIterator.cpp.

Referenced by operator++().


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