From 33149cf3d76704d90526484f82c4d537a91ecd91 Mon Sep 17 00:00:00 2001 From: skachano Date: Thu, 9 Apr 2015 16:59:17 +0000 Subject: write_bad_links compiles. 信じんない MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/witness@559 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: fbd82029f52cf2ed2a8d7379f8b55777f0758a25 --- .../include/gudhi/Witness_complex.h | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'src/Witness_complex/include/gudhi/Witness_complex.h') diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h index ef470589..174af950 100644 --- a/src/Witness_complex/include/gudhi/Witness_complex.h +++ b/src/Witness_complex/include/gudhi/Witness_complex.h @@ -533,18 +533,22 @@ private: std::vector< Vertex_handle > link_vertices; // Fill link_vertices for (auto u: complex_vertex_range()) - if (u != v && find({u,v}) != null_simplex()) - link_vertices.push_back(u); + { + typeVectorVertex edge = {u,v}; + if (u != v && find(edge) != null_simplex()) + link_vertices.push_back(u); + } // Find the dimension int d = link_dim(link_vertices, link_vertices.begin(),root(),0); //Siblings* curr_sibl = root(); - bool b = link_is_pseudomanifold(link_vertices,d); + if (! link_is_pseudomanifold(link_vertices,d)) + out_file << "Bad link at " << v << "\n"; } } private: int link_dim(std::vector< Vertex_handle >& link_vertices, - typename std::vector< Vertex_handle >::iterator& curr_v, + typename std::vector< Vertex_handle >::iterator curr_v, Siblings* curr_sibl, int curr_d) { Simplex_handle sh; @@ -569,9 +573,10 @@ private: typedef typename boost::adjacency_list Adj_graph; // map that gives to a certain simplex its node in graph and its dimension //typedef std::pair Reference; - typedef boost::container::flat_map Graph_map; typedef boost::graph_traits::vertex_descriptor Vertex_t; typedef boost::graph_traits::edge_descriptor Edge_t; + + typedef boost::container::flat_map Graph_map; /* \brief Verifies if the simplices formed by vertices given by link_vertices * form a pseudomanifold. @@ -592,7 +597,7 @@ private: root(), 0, dimension); for (auto f_map_it : f_map) - if (boost::out_degree(f_map_it->second, adj_graph) != 2) + if (boost::out_degree(f_map_it.second, adj_graph) != 2) return false; // At this point I know that all (d-1)-simplices are adjacent to exactly 2 d-simplices // What is left is to check the connexity @@ -612,6 +617,8 @@ private: Simplex_handle sh; Vertex_t vert; typename typeVectorVertex::iterator it; + std::pair resPair; + //typename Graph_map::iterator resPair; //Add vertices for (it = curr_v; it != link_vertices.end(); ++it) { @@ -621,14 +628,14 @@ private: if (curr_d == dimension) { vert = boost::add_vertex(adj_graph); - f_map.insert(sh,vert); + resPair = f_map.emplace(sh,vert); } else { if (curr_d == dimension-1) { vert = boost::add_vertex(adj_graph); - d_map.insert(sh,vert); + resPair = d_map.emplace(sh,vert); } add_vertices_edges(link_vertices, it+1, @@ -642,10 +649,10 @@ private: } // Add edges typename Graph_map::iterator map_it; - for (auto d_map_it : d_map) + for (auto d_map_pair : d_map) { - sh = d_map_it->first; - Vertex_t d_vert = d_map_it->second; + sh = d_map_pair.first; + Vertex_t d_vert = d_map_pair.second; for (auto facet_sh : boundary_simplex_range(sh)) //for (auto f_map_it : f_map) { -- cgit v1.2.3