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

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

#include <EdgeIterator.h>

Public Member Functions

 EdgeIterator (PolymerSpecies< WT > const &polymer)
 Constructor.
 ~EdgeIterator ()
 Destructor.
void begin (int sourceId, int targetId)
 Initialize iterator.
EdgeIterator< WT > & operator++ ()
 Increment operator - move to next vertex.
int currentEdgeId () const
 Get index of the current edge.
int currentDirectionId () const
 Get direction index for the path within the current edge.
int currentVertexId () 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::EdgeIterator< WT >

Edge 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 edge (or block) iSource to edge iTarget of the associated polymer:

EdgeIterator = iter(p);
int iEdge;
for (iter.begin(iSource, iTarget); iter.notEnd(); ++iter) {
iEdge = iter.currentEdgeId();
// do something with edge iEdge
}
EdgeIterator(PolymerSpecies< WT > const &polymer)
Constructor.

Definition at line 36 of file EdgeIterator.h.

Constructor & Destructor Documentation

◆ EdgeIterator()

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

Constructor.

Parameters
polymerassociated PolymerSpecies object

Definition at line 19 of file EdgeIterator.tpp.

Referenced by operator++().

◆ ~EdgeIterator()

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

Destructor.

Definition at line 29 of file EdgeIterator.tpp.

Member Function Documentation

◆ begin()

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

Initialize iterator.

Parameters
sourceIdindex of the initial (or source) edge
targetIdindex of the final (or target) edge

Definition at line 36 of file EdgeIterator.tpp.

References UTIL_CHECK, and UTIL_THROW.

◆ operator++()

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

Increment operator - move to next vertex.

Definition at line 101 of file EdgeIterator.tpp.

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

◆ currentEdgeId()

template<typename WT>
int Pscf::EdgeIterator< WT >::currentEdgeId ( ) const

Get index of the current edge.

Definition at line 127 of file EdgeIterator.tpp.

◆ currentDirectionId()

template<typename WT>
int Pscf::EdgeIterator< WT >::currentDirectionId ( ) const

Get direction index for the path within the current edge.

Definition at line 134 of file EdgeIterator.tpp.

◆ currentVertexId()

template<typename WT>
int Pscf::EdgeIterator< WT >::currentVertexId ( ) const

Get index of the current vertex.

When the current edge is not the target edge, the current vertex is the vertex of the current edge that is closer to the closest vertex of the target edge.

When the current edge is also the target edge, the current vertex is the vertex of the target edge that is farther from the initial source edge.

Definition at line 141 of file EdgeIterator.tpp.

◆ isEnd()

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

Return true iff currentId == targetId.

Definition at line 148 of file EdgeIterator.tpp.

◆ notEnd()

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

Return true iff currentId != targetId.

Definition at line 157 of file EdgeIterator.tpp.

Referenced by operator++().


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