replace #ifdef CGAL_LINED_WITH_TBB by constexpr

This commit is contained in:
Léo Valque 2025-02-19 17:33:57 +01:00
parent 09239da179
commit 0bbaa2a661
1 changed files with 31 additions and 31 deletions

View File

@ -135,6 +135,7 @@ bool polygon_soup_snap_rounding(PointRange &points,
Sequential_tag
> ::type Concurrency_tag;
constexpr bool parallel_execution = std::is_same_v<Parallel_tag, Concurrency_tag>;
#ifndef CGAL_LINKED_WITH_TBB
@ -202,8 +203,7 @@ bool polygon_soup_snap_rounding(PointRange &points,
std::cout << "Round all coordinates on doubles" << std::endl;
#endif
#ifdef CGAL_LINKED_WITH_TBB
if(parallel_execution)
if constexpr(parallel_execution)
{
tbb::parallel_for(tbb::blocked_range<size_t>(0, points.size()),
[&](const tbb::blocked_range<size_t>& r){
@ -211,10 +211,10 @@ bool polygon_soup_snap_rounding(PointRange &points,
points[pi] = Point_3(to_double(points[pi].x()), to_double(points[pi].y()), to_double(points[pi].z()));
}
);
} else
#endif
} else {
for (Point_3 &p : points)
p = Point_3(to_double(p.x()), to_double(p.y()), to_double(p.z()));
}
repair_polygon_soup(points, triangles, np);
// Get all intersecting triangles
@ -265,8 +265,8 @@ bool polygon_soup_snap_rounding(PointRange &points,
snap_points.erase(std::unique(snap_points.begin(), snap_points.end()), snap_points.end());
// If the snapped version of a point correspond to one of the previous point, we snap it
#ifdef CGAL_LINKED_WITH_TBB
if(parallel_execution)
if constexpr(parallel_execution)
{
tbb::parallel_for(tbb::blocked_range<size_t>(0, points.size()),
[&](const tbb::blocked_range<size_t>& r){
@ -277,14 +277,14 @@ bool polygon_soup_snap_rounding(PointRange &points,
}
}
);
} else
#endif
} else {
for (Point_3 &p : points)
{
Point_3 p_snap = snap_p(p);
if (std::binary_search(snap_points.begin(), snap_points.end(), p_snap))
p = p_snap;
}
}
#else
// Version where points in a voxel are rounded to their barycenter.