PSCF v1.4.0
Pscf::VertexIterator< WT > Class Template Reference

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

#include <VertexIterator.h>

Public Member Functions

 VertexIterator (PolymerSpecies< WT > 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

template<typename WT>
class Pscf::VertexIterator< WT >

Vertex iterator for graph associated with a polymer.

Usage: Suppose that object p is an instance of a subclass of PolymerSpecies<WT>. 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
}
VertexIterator(PolymerSpecies< WT > const &polymer)
Constructor.

Definition at line 35 of file VertexIterator.h.

Constructor & Destructor Documentation

◆ VertexIterator()

template<typename WT>
Pscf::VertexIterator< WT >::VertexIterator ( PolymerSpecies< WT > const & polymer)

Constructor.

Parameters
polymerassociated PolymerSpecies object

Definition at line 18 of file VertexIterator.tpp.

Referenced by operator++().

◆ ~VertexIterator()

template<typename WT>
Pscf::VertexIterator< WT >::~VertexIterator ( )

Destructor.

Definition at line 28 of file VertexIterator.tpp.

Member Function Documentation

◆ begin()

template<typename WT>
void Pscf::VertexIterator< WT >::begin ( int sourceId,
int targetId )

Initialize iterator.

Definition at line 35 of file VertexIterator.tpp.

◆ operator++()

template<typename WT>
VertexIterator< WT > & Pscf::VertexIterator< WT >::operator++ ( )

Increment operator - move to next vertex.

Definition at line 45 of file VertexIterator.tpp.

References notEnd(), UTIL_CHECK, Pscf::Edge::vertexId(), and VertexIterator().

◆ currentId()

template<typename WT>
int Pscf::VertexIterator< WT >::currentId ( ) const

Get index of the current vertex.

Definition at line 68 of file VertexIterator.tpp.

◆ isEnd()

template<typename WT>
bool Pscf::VertexIterator< WT >::isEnd ( ) const

Return true iff currentId == targetId.

Definition at line 75 of file VertexIterator.tpp.

◆ notEnd()

template<typename WT>
bool Pscf::VertexIterator< WT >::notEnd ( ) const

Return true iff currentId != targetId.

Definition at line 84 of file VertexIterator.tpp.

Referenced by operator++().


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