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

Method CloseStream

Common/DataModel/vtkReebGraph.cxx:1871–2032  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1869
1870//------------------------------------------------------------------------------
1871void vtkReebGraph::CloseStream()
1872{
1873
1874 vtkIdType prevArcId = -1, arcId = 0;
1875 while (arcId != prevArcId)
1876 {
1877 prevArcId = arcId;
1878 arcId = this->Storage->GetPreviousArcId();
1879 }
1880 prevArcId = -1;
1881
1882 // loop over the arcs and build the local adjacency map
1883
1884 // vertex -> (down vertices, up vertices)
1885 std::map<int, std::pair<std::vector<int>, std::vector<int>>> localAdjacency;
1886 while (prevArcId != arcId)
1887 {
1888 vtkIdType downVertexId, upVertexId;
1889 downVertexId = this->Storage->GetNode((this->Storage->GetArc(arcId))->NodeId0)->VertexId;
1890 upVertexId = this->Storage->GetNode((this->Storage->GetArc(arcId))->NodeId1)->VertexId;
1891
1892 std::map<int, std::pair<std::vector<int>, std::vector<int>>>::iterator aIt;
1893
1894 // lookUp for the down vertex
1895 aIt = localAdjacency.find(downVertexId);
1896 if (aIt == localAdjacency.end())
1897 {
1898 std::pair<std::vector<int>, std::vector<int>> adjacencyItem;
1899 adjacencyItem.second.push_back(upVertexId);
1900 localAdjacency[downVertexId] = adjacencyItem;
1901 }
1902 else
1903 {
1904 aIt->second.second.push_back(upVertexId);
1905 }
1906
1907 // same thing for the up vertex
1908 aIt = localAdjacency.find(upVertexId);
1909 if (aIt == localAdjacency.end())
1910 {
1911 std::pair<std::vector<int>, std::vector<int>> adjacencyItem;
1912 adjacencyItem.first.push_back(downVertexId);
1913 localAdjacency[upVertexId] = adjacencyItem;
1914 }
1915 else
1916 {
1917 aIt->second.first.push_back(downVertexId);
1918 }
1919
1920 prevArcId = arcId;
1921 arcId = this->Storage->GetNextArcId();
1922 }
1923
1924 // now build the super-arcs with deg-2 nodes
1925
1926 // <vertex,vertex>,<vertex list> (arc, deg2 node list)
1927 std::vector<std::pair<std::pair<int, int>, std::vector<int>>> globalAdjacency;
1928

Callers 1

BuildMethod · 0.95

Calls 15

GetPreviousArcIdMethod · 0.80
GetArcMethod · 0.80
GetNextArcIdMethod · 0.80
EndVertexMethod · 0.80
FlushLabelsMethod · 0.80
GetPreviousNodeIdMethod · 0.80
GetNodeVertexIdMethod · 0.80
GetNextNodeIdMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetNodeMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected