diff --git a/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h b/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h index 7742bc729e8..ff8ddf22cf6 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h @@ -654,6 +654,25 @@ bool is_valid(OpenMesh::PolyMesh_ArrayKernelT& sm, bool /* verbose */ = false } // namespace OpenMesh +namespace CGAL { + +// Overload CGAL::clear function. PolyMesh_ArrayKernel behaves +// differently from other meshes. Calling clear does not affect the +// number of vertices, edges, or faces in the mesh. To get actual +// numbers it is necessary to first collect garbage. We add an +// overlaod to get consistent behavior. +template +void clear(OpenMesh::PolyMesh_ArrayKernelT& sm) +{ + sm.clear(); + sm.garbage_collection(true, true, true); + CGAL_postcondition(num_edges(sm) == 0); + CGAL_postcondition(num_vertices(sm) == 0); + CGAL_postcondition(num_faces(sm) == 0); +} + +} + #ifndef CGAL_NO_DEPRECATED_CODE #include