From c674bc8fb914b990350f9b8c243bff4c307c12b5 Mon Sep 17 00:00:00 2001 From: phkahler <14852918+phkahler@users.noreply.github.com> Date: Thu, 22 Oct 2020 10:48:27 -0400 Subject: [PATCH] Add OpenMP parallel for to SShell::CopyCurvesSplitAgainst --- src/srf/boolean.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/srf/boolean.cpp b/src/srf/boolean.cpp index 7546b0b..1edf46e 100644 --- a/src/srf/boolean.cpp +++ b/src/srf/boolean.cpp @@ -201,16 +201,19 @@ SCurve SCurve::MakeCopySplitAgainst(SShell *agnstA, SShell *agnstB, } void SShell::CopyCurvesSplitAgainst(bool opA, SShell *agnst, SShell *into) { - SCurve *sc; - for(sc = curve.First(); sc; sc = curve.NextAfter(sc)) { +#pragma omp parallel for + for(int i=0; iMakeCopySplitAgainst(agnst, NULL, surface.FindById(sc->surfA), surface.FindById(sc->surfB)); scn.source = opA ? SCurve::Source::A : SCurve::Source::B; - - hSCurve hsc = into->curve.AddAndAssignId(&scn); - // And note the new ID so that we can rewrite the trims appropriately - sc->newH = hsc; +#pragma omp critical + { + hSCurve hsc = into->curve.AddAndAssignId(&scn); + // And note the new ID so that we can rewrite the trims appropriately + sc->newH = hsc; + } } }