diff --git a/BGL/include/CGAL/BGL/Helper.h b/BGL/include/CGAL/BGL/Helper.h index 333877b92de..0a63ee3e6d1 100644 --- a/BGL/include/CGAL/BGL/Helper.h +++ b/BGL/include/CGAL/BGL/Helper.h @@ -179,69 +179,6 @@ is_border_vertex(const Graph& g return boost::optional::halfedge_descriptor>(); } -// Check if a graph fulfills the constant-vertex-is-border guarantee. -// -// \returns true, if for each vertex `v` which lies on a border -// (e.g. one of its incident halfedges is a border halfedge), -// `bm[halfedge(v)] == true` holds -template -bool -constant_vertex_is_border(const Graph& g, BorderMap bm) -{ - typename boost::graph_traits::vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(g); vb != ve; ++vb) { - bool has_border = is_border_vertex(g, *vb, bm); // optional -> bool - if(!(get(bm, halfedge(*vb, g)) == has_border)) - return false; - } - return true; -} - -// overload -template -bool -constant_vertex_is_border(const Graph& g) -{ return constant_vertex_is_border(g, get(CGAL::halfedge_is_border, g)); } - -template -void -set_constant_vertex_is_border(Graph& g, - typename boost::graph_traits::vertex_descriptor v, - BorderMap bm) -{ - // AF: this is not the solution - adjust_border_halfedge(v,g); - return; - boost::optional::halfedge_descriptor> - border = is_border_vertex(g, v, bm); - if(border && !get(bm, halfedge(v, g))) { - // has a border, but the current halfedge is not it - CGAL_assertion(target(*border, g) == v); - set_halfedge(v, *border, g); - } -} - - -// Check the constant-vertex-is-border guarantee and repair vertices -// that violate it. -template -void -set_constant_vertex_is_border(Graph& g, BorderMap bm) -{ - typename boost::graph_traits::vertex_iterator vb, ve; - for(boost::tie(vb, ve) = vertices(g); vb != ve; ++vb) { - set_constant_vertex_is_border(g, *vb, bm); - } -} - - -// overload -template -void -set_constant_vertex_is_border(Graph& g) -{ - set_constant_vertex_is_border(g, get(CGAL::halfedge_is_border, g)); -} template diff --git a/BGL/test/BGL/test_Helpers.cpp b/BGL/test/BGL/test_Helpers.cpp deleted file mode 100644 index bde9fc6951d..00000000000 --- a/BGL/test/BGL/test_Helpers.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#define BOOST_TEST_MODULE graph_traits_helpers_test -#include -#include - -#include "test_Prefix.h" - -#include - -#if defined(CGAL_USE_SURFACE_MESH) -BOOST_AUTO_TEST_CASE(constant_vertex_is_border_surface_mesh) -{ - Surface_fixture_1 f1; - Surface_fixture_2 f2; - Surface_fixture_3 f3; - BOOST_CHECK(CGAL::internal::constant_vertex_is_border(f1.m)); - BOOST_CHECK(CGAL::internal::constant_vertex_is_border(f2.m)); - BOOST_CHECK(CGAL::internal::constant_vertex_is_border(f3.m)); - - // invalidate - boost::graph_traits::halfedge_descriptor h; - bool found; - boost::tie(h, found) = halfedge(f1.w ,f1.v, f1.m); - BOOST_CHECK(found); - - set_halfedge(f1.v, h, f1.m); - BOOST_CHECK(!CGAL::internal::constant_vertex_is_border(f1.m)); - CGAL::internal::set_constant_vertex_is_border(f1.m); - BOOST_CHECK(CGAL::internal::constant_vertex_is_border(f1.m)); -} -#endif - -BOOST_AUTO_TEST_CASE(constant_vertex_is_border_polyhedron) -{ - Surface_fixture_1 f1; - Surface_fixture_2 f2; - Surface_fixture_3 f3; - // those tests are expected to fail for polyhedron, as the file - // reader does not respect the border guarantee - BOOST_CHECK(CGAL::internal::constant_vertex_is_border(f1.m)); - BOOST_CHECK(CGAL::internal::constant_vertex_is_border(f2.m)); - BOOST_CHECK(CGAL::internal::constant_vertex_is_border(f3.m)); - - // repair them - CGAL::internal::set_constant_vertex_is_border(f1.m); - CGAL::internal::set_constant_vertex_is_border(f2.m); - CGAL::internal::set_constant_vertex_is_border(f3.m); - - BOOST_CHECK(f1.m.is_valid()); - BOOST_CHECK(f2.m.is_valid()); - BOOST_CHECK(f3.m.is_valid()); - - // check them again - BOOST_CHECK(CGAL::internal::constant_vertex_is_border(f1.m)); - BOOST_CHECK(CGAL::internal::constant_vertex_is_border(f2.m)); - BOOST_CHECK(CGAL::internal::constant_vertex_is_border(f3.m)); -} - - - -// trick cgal_create_CMakeLists -// int main() -// { -// return 0; -// }