MCPcopy Create free account
hub / github.com/Kitware/VTK / Increment

Method Increment

Common/DataModel/vtkEdgeListIterator.cxx:139–179  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

137
138//------------------------------------------------------------------------------
139void vtkEdgeListIterator::Increment()
140{
141 if (!this->Graph)
142 {
143 return;
144 }
145
146 vtkIdType lastVertex = this->Graph->GetNumberOfVertices();
147
148 vtkDistributedGraphHelper* helper = this->Graph->GetDistributedGraphHelper();
149 if (helper)
150 {
151 int myRank = this->Graph->GetInformation()->Get(vtkDataObject::DATA_PIECE_NUMBER());
152 this->Vertex = helper->MakeDistributedId(myRank, this->Vertex);
153 lastVertex = helper->MakeDistributedId(myRank, lastVertex);
154 }
155
156 ++this->Current;
157 if (this->Current == this->End)
158 {
159 // Find a vertex with nonzero out degree.
160 ++this->Vertex;
161 while (this->Vertex < lastVertex && this->Graph->GetOutDegree(this->Vertex) == 0)
162 {
163 ++this->Vertex;
164 }
165
166 // If there is another vertex with out edges, get its edges.
167 // Otherwise, signal that we have reached the end of the iterator.
168 if (this->Vertex < lastVertex)
169 {
170 vtkIdType nedges;
171 this->Graph->GetOutEdges(this->Vertex, this->Current, nedges);
172 this->End = this->Current + nedges;
173 }
174 else
175 {
176 this->Current = nullptr;
177 }
178 }
179}
180
181//------------------------------------------------------------------------------
182bool vtkEdgeListIterator::HasNext()

Callers 3

SetGraphMethod · 0.95
NextMethod · 0.95
operator()Method · 0.45

Calls 7

GetNumberOfVerticesMethod · 0.80
MakeDistributedIdMethod · 0.80
GetOutDegreeMethod · 0.80
GetOutEdgesMethod · 0.80
GetMethod · 0.45
GetInformationMethod · 0.45

Tested by

no test coverage detected