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
|
Sequential_tag
|
||||||
> ::type Concurrency_tag;
|
> ::type Concurrency_tag;
|
||||||
|
|
||||||
|
|
||||||
constexpr bool parallel_execution = std::is_same_v<Parallel_tag, Concurrency_tag>;
|
constexpr bool parallel_execution = std::is_same_v<Parallel_tag, Concurrency_tag>;
|
||||||
|
|
||||||
#ifndef CGAL_LINKED_WITH_TBB
|
#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;
|
std::cout << "Round all coordinates on doubles" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CGAL_LINKED_WITH_TBB
|
if constexpr(parallel_execution)
|
||||||
if(parallel_execution)
|
|
||||||
{
|
{
|
||||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, points.size()),
|
tbb::parallel_for(tbb::blocked_range<size_t>(0, points.size()),
|
||||||
[&](const tbb::blocked_range<size_t>& r){
|
[&](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()));
|
points[pi] = Point_3(to_double(points[pi].x()), to_double(points[pi].y()), to_double(points[pi].z()));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else
|
} else {
|
||||||
#endif
|
|
||||||
for (Point_3 &p : points)
|
for (Point_3 &p : points)
|
||||||
p = Point_3(to_double(p.x()), to_double(p.y()), to_double(p.z()));
|
p = Point_3(to_double(p.x()), to_double(p.y()), to_double(p.z()));
|
||||||
|
}
|
||||||
repair_polygon_soup(points, triangles, np);
|
repair_polygon_soup(points, triangles, np);
|
||||||
|
|
||||||
// Get all intersecting triangles
|
// 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());
|
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
|
// 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()),
|
tbb::parallel_for(tbb::blocked_range<size_t>(0, points.size()),
|
||||||
[&](const tbb::blocked_range<size_t>& r){
|
[&](const tbb::blocked_range<size_t>& r){
|
||||||
|
|
@ -277,14 +277,14 @@ bool polygon_soup_snap_rounding(PointRange &points,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else
|
} else {
|
||||||
#endif
|
|
||||||
for (Point_3 &p : points)
|
for (Point_3 &p : points)
|
||||||
{
|
{
|
||||||
Point_3 p_snap = snap_p(p);
|
Point_3 p_snap = snap_p(p);
|
||||||
if (std::binary_search(snap_points.begin(), snap_points.end(), p_snap))
|
if (std::binary_search(snap_points.begin(), snap_points.end(), p_snap))
|
||||||
p = p_snap;
|
p = p_snap;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// Version where points in a voxel are rounded to their barycenter.
|
// Version where points in a voxel are rounded to their barycenter.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue