Skip to content

Commit

Permalink
Use omp critical to simplify parallel triangulation. NFC.
Browse files Browse the repository at this point in the history
  • Loading branch information
phkahler committed May 11, 2020
1 parent c355a47 commit e84fd46
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/srf/surface.cpp
Expand Up @@ -1050,16 +1050,12 @@ void SShell::MakeSectionEdgesInto(Vector n, double d, SEdgeList *sel, SBezierLis
}

void SShell::TriangulateInto(SMesh *sm) {
std::vector<SMesh> tm(surface.n);

#pragma omp parallel for
for(int i=0; i<surface.n; i++) {
SSurface *s = &surface[i];
s->TriangulateInto(this, &tm[i]);
}

// merge the per-surface meshes
for (auto& m : tm) {
SMesh m;
s->TriangulateInto(this, &m);
#pragma omp critical
sm->MakeFromCopyOf(&m);
m.Clear();
}
Expand Down

0 comments on commit e84fd46

Please sign in to comment.