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

Method ReorderOutVertices

Common/DataModel/vtkGraph.cxx:1671–1709  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1669
1670//------------------------------------------------------------------------------
1671void vtkGraph::ReorderOutVertices(vtkIdType v, vtkIdTypeArray* vertices)
1672{
1673 vtkIdType index = v;
1674 if (vtkDistributedGraphHelper* helper = this->GetDistributedGraphHelper())
1675 {
1676 int myRank = this->Information->Get(vtkDataObject::DATA_PIECE_NUMBER());
1677 if (myRank != helper->GetVertexOwner(v))
1678 {
1679 vtkErrorMacro("vtkGraph cannot reorder the out vertices for a non-local vertex");
1680 return;
1681 }
1682
1683 index = helper->GetVertexIndex(v);
1684 }
1685
1686 this->ForceOwnership();
1687 std::vector<vtkOutEdgeType> outEdges;
1688 std::vector<vtkOutEdgeType>::iterator it, itEnd;
1689 itEnd = this->Internals->Adjacency[index].OutEdges.end();
1690 for (vtkIdType i = 0; i < vertices->GetNumberOfTuples(); ++i)
1691 {
1692 vtkIdType vert = vertices->GetValue(i);
1693 // Find the matching edge
1694 for (it = this->Internals->Adjacency[index].OutEdges.begin(); it != itEnd; ++it)
1695 {
1696 if (it->Target == vert)
1697 {
1698 outEdges.push_back(*it);
1699 break;
1700 }
1701 }
1702 }
1703 if (outEdges.size() != this->Internals->Adjacency[index].OutEdges.size())
1704 {
1705 vtkErrorMacro("Invalid reorder list.");
1706 return;
1707 }
1708 this->Internals->Adjacency[index].OutEdges = outEdges;
1709}
1710
1711//------------------------------------------------------------------------------
1712bool vtkGraph::IsSameStructure(vtkGraph* other)

Callers 1

ReorderChildrenMethod · 0.80

Calls 11

ForceOwnershipMethod · 0.95
GetVertexOwnerMethod · 0.80
GetMethod · 0.45
GetVertexIndexMethod · 0.45
endMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetValueMethod · 0.45
beginMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected