Surface_mesh: Add exact_num_faces(const SM&) (#8215)

## Summary of Changes

Add a partial specialization for `CGAL::internal::exact_num_faces(const
Surface_mesh&)` to have an `O(1)` time. This was pointed out as
important for the `Face_count_stop_predicate` in Issue #8158

## Release Management

* Affected package(s): Surface_mesh
* Issue(s) solved (if any): fix #5720
* License and copyright ownership: unchanged
This commit is contained in:
Sebastien Loriot 2024-05-26 17:48:47 +02:00 committed by GitHub
commit 94b9726a46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 32 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include <CGAL/boost/graph/Euler_operations.h> #include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/boost/graph/iterator.h> #include <CGAL/boost/graph/iterator.h>
#include <CGAL/boost/graph/named_params_helper.h> #include <CGAL/boost/graph/named_params_helper.h>
#include <CGAL/boost/graph/internal/helpers.h>
#include <CGAL/Named_function_parameters.h> #include <CGAL/Named_function_parameters.h>
#include <CGAL/circulator.h> #include <CGAL/circulator.h>
#include <CGAL/Handle_hash_function.h> #include <CGAL/Handle_hash_function.h>
@ -2802,6 +2803,37 @@ namespace internal{
} }
} }
namespace internal {
template <typename P>
std::size_t
exact_num_faces(const CGAL::Surface_mesh<P>& sm)
{
return sm.number_of_faces();
}
template <typename P>
std::size_t
exact_num_edges(const CGAL::Surface_mesh<P>& sm)
{
return sm.number_of_edges();
}
template <typename P>
std::size_t
exact_num_halfedges(const CGAL::Surface_mesh<P>& sm)
{
return sm.number_of_halfedges();
}
template <typename P>
std::size_t
exact_num_vertices(const CGAL::Surface_mesh<P>& sm)
{
return sm.number_of_vertices();
}
} // namespace internal
} // namespace CGAL } // namespace CGAL
#ifndef DOXYGEN_RUNNING #ifndef DOXYGEN_RUNNING