Add OpenMP parallel for to SShell::CopyCurvesSplitAgainst

This commit is contained in:
phkahler 2020-10-22 10:48:27 -04:00
parent 0f1ece2b8e
commit c674bc8fb9

View File

@ -201,16 +201,19 @@ SCurve SCurve::MakeCopySplitAgainst(SShell *agnstA, SShell *agnstB,
} }
void SShell::CopyCurvesSplitAgainst(bool opA, SShell *agnst, SShell *into) { void SShell::CopyCurvesSplitAgainst(bool opA, SShell *agnst, SShell *into) {
SCurve *sc; #pragma omp parallel for
for(sc = curve.First(); sc; sc = curve.NextAfter(sc)) { for(int i=0; i<curve.n; i++) {
SCurve *sc = &curve[i];
SCurve scn = sc->MakeCopySplitAgainst(agnst, NULL, SCurve scn = sc->MakeCopySplitAgainst(agnst, NULL,
surface.FindById(sc->surfA), surface.FindById(sc->surfA),
surface.FindById(sc->surfB)); surface.FindById(sc->surfB));
scn.source = opA ? SCurve::Source::A : SCurve::Source::B; scn.source = opA ? SCurve::Source::A : SCurve::Source::B;
#pragma omp critical
hSCurve hsc = into->curve.AddAndAssignId(&scn); {
// And note the new ID so that we can rewrite the trims appropriately hSCurve hsc = into->curve.AddAndAssignId(&scn);
sc->newH = hsc; // And note the new ID so that we can rewrite the trims appropriately
sc->newH = hsc;
}
} }
} }