mirror of https://github.com/CGAL/cgal
replace #ifdef CGAL_LINED_WITH_TBB by constexpr
This commit is contained in:
parent
09239da179
commit
0bbaa2a661
|
|
@ -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,19 +203,18 @@ 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)
|
||||
{
|
||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, points.size()),
|
||||
[&](const tbb::blocked_range<size_t>& r){
|
||||
for(size_t pi = r.begin(); pi != r.end(); ++pi)
|
||||
points[pi] = Point_3(to_double(points[pi].x()), to_double(points[pi].y()), to_double(points[pi].z()));
|
||||
}
|
||||
);
|
||||
} else
|
||||
#endif
|
||||
for (Point_3 &p : points)
|
||||
p = Point_3(to_double(p.x()), to_double(p.y()), to_double(p.z()));
|
||||
if constexpr(parallel_execution)
|
||||
{
|
||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, points.size()),
|
||||
[&](const tbb::blocked_range<size_t>& r){
|
||||
for(size_t pi = r.begin(); pi != r.end(); ++pi)
|
||||
points[pi] = Point_3(to_double(points[pi].x()), to_double(points[pi].y()), to_double(points[pi].z()));
|
||||
}
|
||||
);
|
||||
} 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,25 +265,25 @@ 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)
|
||||
{
|
||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, points.size()),
|
||||
[&](const tbb::blocked_range<size_t>& r){
|
||||
for(size_t pi = r.begin(); pi != r.end(); ++pi){
|
||||
Point_3 p_snap=snap_p(points[pi]);
|
||||
if (std::binary_search(snap_points.begin(), snap_points.end(), p_snap))
|
||||
points[pi] = p_snap;
|
||||
}
|
||||
}
|
||||
);
|
||||
} else
|
||||
#endif
|
||||
for (Point_3 &p : points)
|
||||
|
||||
if constexpr(parallel_execution)
|
||||
{
|
||||
Point_3 p_snap = snap_p(p);
|
||||
if (std::binary_search(snap_points.begin(), snap_points.end(), p_snap))
|
||||
p = p_snap;
|
||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, points.size()),
|
||||
[&](const tbb::blocked_range<size_t>& r){
|
||||
for(size_t pi = r.begin(); pi != r.end(); ++pi){
|
||||
Point_3 p_snap=snap_p(points[pi]);
|
||||
if (std::binary_search(snap_points.begin(), snap_points.end(), p_snap))
|
||||
points[pi] = p_snap;
|
||||
}
|
||||
}
|
||||
);
|
||||
} 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
|
||||
|
|
|
|||
Loading…
Reference in New Issue