------------------------------------------------------------------------------
| 1869 | |
| 1870 | //------------------------------------------------------------------------------ |
| 1871 | void 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 |
no test coverage detected