PSCF v1.2
|
Edge iterator for graph associated with a polymer. More...
#include <EdgeIterator.h>
Public Member Functions | |
EdgeIterator (PolymerSpecies const &polymer) | |
Constructor. | |
~EdgeIterator () | |
Destructor. | |
void | begin (int sourceId, int targetId) |
Initialize iterator. | |
EdgeIterator & | operator++ () |
Increment operator - move to next vertex. | |
int | currentEdgeId () const |
Get index of 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. | |
Edge 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 edge (or block) iSource to edge iTarget of the associated polymer:
Definition at line 38 of file EdgeIterator.h.
Pscf::EdgeIterator::EdgeIterator | ( | PolymerSpecies const & | polymer | ) |
Constructor.
polymer | associated PolymerSpecies object |
Definition at line 18 of file EdgeIterator.cpp.
Pscf::EdgeIterator::~EdgeIterator | ( | ) |
Destructor.
Definition at line 27 of file EdgeIterator.cpp.
void Pscf::EdgeIterator::begin | ( | int | sourceId, |
int | targetId ) |
Initialize iterator.
sourceId | index of the initial (or source) edge |
targetId | index of the final (or target) edge |
Definition at line 33 of file EdgeIterator.cpp.
References Pscf::PolymerSpecies::edge(), Pscf::PolymerSpecies::path(), UTIL_CHECK, UTIL_THROW, and Pscf::Edge::vertexId().
Referenced by Pscf::Rpc::IntraCorrelation< D >::computeIntraCorrelations(), and Pscf::Rpg::IntraCorrelation< D >::computeIntraCorrelations().
EdgeIterator & Pscf::EdgeIterator::operator++ | ( | ) |
Increment operator - move to next vertex.
Definition at line 95 of file EdgeIterator.cpp.
References Pscf::PolymerSpecies::edge(), notEnd(), Pscf::PolymerSpecies::path(), UTIL_CHECK, and Pscf::Edge::vertexId().
int Pscf::EdgeIterator::currentEdgeId | ( | ) | const |
Get index of the current edge.
Definition at line 120 of file EdgeIterator.cpp.
Referenced by Pscf::Rpc::IntraCorrelation< D >::computeIntraCorrelations(), and Pscf::Rpg::IntraCorrelation< D >::computeIntraCorrelations().
int Pscf::EdgeIterator::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 126 of file EdgeIterator.cpp.
bool Pscf::EdgeIterator::isEnd | ( | ) | const |
Return true iff currentId == targetId.
Definition at line 132 of file EdgeIterator.cpp.
bool Pscf::EdgeIterator::notEnd | ( | ) | const |
Return true iff currentId != targetId.
Definition at line 140 of file EdgeIterator.cpp.
Referenced by Pscf::Rpc::IntraCorrelation< D >::computeIntraCorrelations(), Pscf::Rpg::IntraCorrelation< D >::computeIntraCorrelations(), and operator++().