------------------------------------------------------------------------------
| 137 | |
| 138 | //------------------------------------------------------------------------------ |
| 139 | void 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 | //------------------------------------------------------------------------------ |
| 182 | bool vtkEdgeListIterator::HasNext() |
no test coverage detected