Skip to content

Commit b4e1ce4

Browse files
committed
Use OpenMP for triangulation
1 parent 7baf585 commit b4e1ce4

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/srf/surface.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,9 +1050,18 @@ void SShell::MakeSectionEdgesInto(Vector n, double d, SEdgeList *sel, SBezierLis
10501050
}
10511051

10521052
void SShell::TriangulateInto(SMesh *sm) {
1053-
SSurface *s;
1054-
for(s = surface.First(); s; s = surface.NextAfter(s)) {
1055-
s->TriangulateInto(this, sm);
1053+
std::vector<SMesh> tm(surface.n);
1054+
1055+
#pragma omp parallel for
1056+
for(int i=0; i<surface.n; i++) {
1057+
SSurface *s = &surface[i];
1058+
s->TriangulateInto(this, &tm[i]);
1059+
}
1060+
1061+
// merge the per-surface meshes
1062+
for (auto& m : tm) {
1063+
sm->MakeFromCopyOf(&m);
1064+
m.Clear();
10561065
}
10571066
}
10581067

0 commit comments

Comments
 (0)