Skip to content

Commit

Permalink
Make Find_coplanar_faces parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
unageek committed Sep 10, 2024
1 parent 3593a50 commit 50c1458
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Here are the timings (in seconds) for computing the Boolean intersection between
|-------------------|-----------------------:|--------------------------:|---------------:|--------------:|-----------------------:|---------------:|
| **Open** | 4.6 | FAILED | 2.8 | 1.7 | FAILED | FAILED |
| **Open & closed** | FAILED | 70.5 | 2.0 | 1.3 | FAILED | FAILED |
| **Closed** | 57.4 | FAILED | 6.4 | 3.5 | 8.9 | 1.7 |
| **Closed** | 57.4 | FAILED | 6.4 | 3.4 | 8.9 | 1.7 |
| **Non-manifold** | FAILED | FAILED | 0.5 | 0.3 | FAILED | FAILED |

¹ Ran with `KIGUMI_NUM_THREADS=1`. ² Configured with `-DMANIFOLD_PAR=TBB`.
Expand Down
7 changes: 4 additions & 3 deletions include/kigumi/Find_coplanar_faces.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <kigumi/Face_tag.h>
#include <kigumi/Mesh_indices.h>
#include <kigumi/Triangle_soup.h>
#include <kigumi/parallel_do.h>

#include <algorithm>
#include <array>
Expand Down Expand Up @@ -43,22 +44,22 @@ class Find_coplanar_faces {
triangle_to_fi.emplace(tri, fi);
}

for (auto fi : b.faces()) {
parallel_do(b.faces().begin(), b.faces().end(), [&](Face_index fi) {
auto tri = triangle(b, fi, b_points);

auto it = triangle_to_fi.find(tri);
if (it != triangle_to_fi.end()) {
a_face_tags.at(it->second.idx()) = Face_tag::COPLANAR;
b_face_tags.at(fi.idx()) = Face_tag::COPLANAR;
continue;
return;
}

it = triangle_to_fi.find(opposite(tri));
if (it != triangle_to_fi.end()) {
a_face_tags.at(it->second.idx()) = Face_tag::OPPOSITE;
b_face_tags.at(fi.idx()) = Face_tag::OPPOSITE;
}
}
});

return {std::move(left_face_tags), std::move(right_face_tags)};
}
Expand Down

0 comments on commit 50c1458

Please sign in to comment.