From: nbv Date: Thu, 7 Jun 2018 14:08:05 +0000 (+0300) Subject: Parallel mode X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=b17bbb8566343d92ee67006abf45769414019f81;p=occt-copy.git Parallel mode --- diff --git a/src/BRepFill/BRepFill_Voluved.cxx b/src/BRepFill/BRepFill_Voluved.cxx index df425dcbe7..05393eb811 100644 --- a/src/BRepFill/BRepFill_Voluved.cxx +++ b/src/BRepFill/BRepFill_Voluved.cxx @@ -62,7 +62,6 @@ static const Standard_Real aPipeLinearTolerance = 1.0e-4; static const Standard_Real aPipeAngularTolerance = 1.0e-2; -static const Standard_Boolean isParallelComputation = Standard_False; const char aDirPatch[] = "D:\\nbv-29523\\shapes\\my\\"; static Standard_Boolean CheckSingularityAndAdd(const TopoDS_Face& theF, @@ -70,7 +69,7 @@ static Standard_Boolean CheckSingularityAndAdd(const TopoDS_Face& theF, TopTools_ListOfShape& theListOfFaces, TopTools_ListOfShape& theListOfSplits); -#define BREPFILL_VOLUVED_DEBUG +//#define BREPFILL_VOLUVED_DEBUG //======================================================================= //function : GetSpineAndProfile @@ -498,7 +497,7 @@ void BRepFill_Voluved::GetLids() // Split interfered edges BOPAlgo_PaveFiller aPF; aPF.SetArguments(aLE); - aPF.SetRunParallel(isParallelComputation); + aPF.SetRunParallel(myIsParallel); aPF.Perform(); if (aPF.HasErrors()) @@ -515,7 +514,7 @@ void BRepFill_Voluved::GetLids() aBuilder.AddArgument(aS); } - aBuilder.SetRunParallel(isParallelComputation); + aBuilder.SetRunParallel(myIsParallel); aBuilder.PerformWithFiller(aPF); if (aBuilder.HasErrors()) { @@ -788,7 +787,7 @@ void BRepFill_Voluved::BuildSolid() // Split interfered faces BOPAlgo_PaveFiller aPF; aPF.SetArguments(aLF); - aPF.SetRunParallel(isParallelComputation); + aPF.SetRunParallel(myIsParallel); aPF.SetFuzzyValue(myFuzzyValue); aPF.Perform(); @@ -802,7 +801,7 @@ void BRepFill_Voluved::BuildSolid() aBuilder.AddArgument(aS); } - aBuilder.SetRunParallel(isParallelComputation); + aBuilder.SetRunParallel(myIsParallel); aBuilder.PerformWithFiller(aPF); myPipeShell = aBuilder.Shape(); } @@ -854,7 +853,7 @@ void BRepFill_Voluved::BuildSolid() aMV.SetArguments(aLF); aMV.SetFuzzyValue(myFuzzyValue); aMV.SetIntersect(Standard_True); - aMV.SetRunParallel(isParallelComputation); + aMV.SetRunParallel(myIsParallel); aMV.SetAvoidInternalShapes(Standard_True); aMV.Perform(); @@ -906,7 +905,7 @@ void BRepFill_Voluved::ExtractOuterSolid(TopoDS_Shape& theShape, BOPAlgo_MakerVolume aMV; aMV.SetArguments(theArgsList); aMV.SetIntersect(Standard_True); - aMV.SetRunParallel(isParallelComputation); + aMV.SetRunParallel(myIsParallel); aMV.SetAvoidInternalShapes(Standard_True); aMV.Perform(); @@ -1590,10 +1589,10 @@ static void InsertEDegenerated(const TopoDS_Face& theFace, //function : CheckSingularityAndAdd //purpose : Returns TRUE if theF has been split //======================================================================= -Standard_Boolean CheckSingularityAndAdd(const TopoDS_Face& theF, - const Standard_Real theFuzzyToler, - TopTools_ListOfShape& theListOfFaces, - TopTools_ListOfShape& theListOfSplits) +Standard_Boolean BRepFill_Voluved::CheckSingularityAndAdd(const TopoDS_Face& theF, + const Standard_Real theFuzzyToler, + TopTools_ListOfShape& theListOfFaces, + TopTools_ListOfShape& theListOfSplits) const { const BRepAdaptor_Surface anAS(theF, Standard_False); GeomAbs_SurfaceType aSType = anAS.GetType(); @@ -1619,7 +1618,7 @@ Standard_Boolean CheckSingularityAndAdd(const TopoDS_Face& theF, // Split interfered edges BOPAlgo_PaveFiller aPF; aPF.SetArguments(aLE); - aPF.SetRunParallel(isParallelComputation); + aPF.SetRunParallel(myIsParallel); aPF.Perform(); if (aPF.HasErrors()) @@ -1644,7 +1643,7 @@ Standard_Boolean CheckSingularityAndAdd(const TopoDS_Face& theF, aBuilder.AddArgument(aS); } - aBuilder.SetRunParallel(isParallelComputation); + aBuilder.SetRunParallel(myIsParallel); aBuilder.PerformWithFiller(aPF); if (aBuilder.HasErrors()) { @@ -1729,7 +1728,7 @@ Standard_Boolean CheckSingularityAndAdd(const TopoDS_Face& theF, aBAB.AddArgument(aSh); } - aBAB.SetRunParallel(isParallelComputation); + aBAB.SetRunParallel(myIsParallel); aBAB.SetNonDestructive(Standard_True); aBAB.PerformWithFiller(aPF); if (aBAB.HasErrors()) diff --git a/src/BRepFill/BRepFill_Voluved.hxx b/src/BRepFill/BRepFill_Voluved.hxx index 5675cc9c75..39c1ca7295 100644 --- a/src/BRepFill/BRepFill_Voluved.hxx +++ b/src/BRepFill/BRepFill_Voluved.hxx @@ -25,6 +25,7 @@ #include #include class BOPAlgo_MakerVolume; +class TopoDS_Face; //! Constructs an evolved volume from a spine (wire or face) //! and a profile ( wire). @@ -35,7 +36,8 @@ public: DEFINE_STANDARD_ALLOC Standard_EXPORT BRepFill_Voluved() :myErrorStatus(BRepFill_Voluved_Empty), - myFuzzyValue(0.0) + myFuzzyValue(0.0), + myIsParallel(Standard_True) { } @@ -55,6 +57,12 @@ public: return myResult; } + //! Triggers computation mode between Parallel/Single-thread + void SetRunParallel(Standard_Boolean theValue) + { + myIsParallel = theValue; + } + protected: Standard_EXPORT void PerformSweep(); @@ -74,6 +82,12 @@ protected: Standard_EXPORT void GetSpineAndProfile(const TopoDS_Wire& theSpine, const TopoDS_Wire& theProfile); + Standard_EXPORT Standard_Boolean CheckSingularityAndAdd(const TopoDS_Face& theF, + const Standard_Real theFuzzyToler, + TopTools_ListOfShape& theListOfFaces, + TopTools_ListOfShape& theListOfSplits) const; + + private: enum @@ -93,7 +107,7 @@ private: TopoDS_Compound myTopBottom; // Lids can be split on several faces TopoDS_Shape myResult; Standard_Real myFuzzyValue; - + Standard_Boolean myIsParallel; }; diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.cxx index 88f20c46da..50e4b0ca2c 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.cxx @@ -46,10 +46,12 @@ BRepOffsetAPI_MakeEvolved::BRepOffsetAPI_MakeEvolved(const TopoDS_Wire& Spin const Standard_Boolean Solid, const Standard_Boolean ProfOnSpine, const Standard_Boolean theIsVolume, - const Standard_Real Tol) + const Standard_Real Tol, + const Standard_Boolean theRunInParallel) { if (theIsVolume) { + myVolume.SetRunParallel(theRunInParallel); myVolume.Perform(Spine, Profil, Tol); } else @@ -85,10 +87,12 @@ BRepOffsetAPI_MakeEvolved::BRepOffsetAPI_MakeEvolved(const TopoDS_Face& Spin const Standard_Boolean Solid, const Standard_Boolean ProfOnSpine, const Standard_Boolean theIsVolume, - const Standard_Real Tol) + const Standard_Real Tol, + const Standard_Boolean theRunInParallel) { if (theIsVolume) { + myVolume.SetRunParallel(theRunInParallel); myVolume.Perform(TopoDS::Wire(TopoDS_Iterator(Spine).Value()), Profil, Tol); } else diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.hxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.hxx index 1a16adb5d9..3a5129bdf4 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.hxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.hxx @@ -67,7 +67,7 @@ public: Standard_EXPORT BRepOffsetAPI_MakeEvolved(); - Standard_EXPORT BRepOffsetAPI_MakeEvolved(const TopoDS_Wire& Spine, const TopoDS_Wire& Profil, const GeomAbs_JoinType Join/* = GeomAbs_Arc*/, const Standard_Boolean AxeProf/* = Standard_True*/, const Standard_Boolean Solid/* = Standard_False*/, const Standard_Boolean ProfOnSpine/* = Standard_False*/, const Standard_Boolean theIsVolume, const Standard_Real Tol/* = Precision::Confusion()*/); + Standard_EXPORT BRepOffsetAPI_MakeEvolved(const TopoDS_Wire& Spine, const TopoDS_Wire& Profil, const GeomAbs_JoinType Join/* = GeomAbs_Arc*/, const Standard_Boolean AxeProf/* = Standard_True*/, const Standard_Boolean Solid/* = Standard_False*/, const Standard_Boolean ProfOnSpine/* = Standard_False*/, const Standard_Boolean theIsVolume, const Standard_Real Tol/* = Precision::Confusion()*/, const Standard_Boolean theRunInParallel); //! These constructors construct an evolved shape by sweeping the profile //! Profile along the spine Spine. @@ -89,7 +89,7 @@ public: //! axis passing along the vertex and the normal to the //! plane of the spine. At present, this is the only //! construction type implemented. - Standard_EXPORT BRepOffsetAPI_MakeEvolved(const TopoDS_Face& Spine, const TopoDS_Wire& Profil, const GeomAbs_JoinType Join/* = GeomAbs_Arc*/, const Standard_Boolean AxeProf/* = Standard_True*/, const Standard_Boolean Solid/* = Standard_False*/, const Standard_Boolean ProfOnSpine/* = Standard_False*/, const Standard_Boolean theIsVolume, const Standard_Real Tol/* = Precision::Confusion()*/); + Standard_EXPORT BRepOffsetAPI_MakeEvolved(const TopoDS_Face& Spine, const TopoDS_Wire& Profil, const GeomAbs_JoinType Join/* = GeomAbs_Arc*/, const Standard_Boolean AxeProf/* = Standard_True*/, const Standard_Boolean Solid/* = Standard_False*/, const Standard_Boolean ProfOnSpine/* = Standard_False*/, const Standard_Boolean theIsVolume, const Standard_Real Tol/* = Precision::Confusion()*/, const Standard_Boolean theRunInParallel); Standard_EXPORT const BRepFill_Evolved& Evolved() const; diff --git a/src/BRepTest/BRepTest_SweepCommands.cxx b/src/BRepTest/BRepTest_SweepCommands.cxx index 4d3c1f2c19..64c8e27b8a 100644 --- a/src/BRepTest/BRepTest_SweepCommands.cxx +++ b/src/BRepTest/BRepTest_SweepCommands.cxx @@ -243,6 +243,7 @@ Standard_Integer evolved(Draw_Interpretor& di, Standard_Integer n, const char** Standard_Real aTolerance = 0.0; TopoDS_Shape Base; TopoDS_Wire Prof; + Standard_Boolean isParallel = Standard_True; for (Standard_Integer i = 2; i < n; i++) { @@ -252,12 +253,18 @@ Standard_Integer evolved(Draw_Interpretor& di, Standard_Integer n, const char** return 1; } - if (!Solid && !strcmp(a[i], "-solid")) + if (!strcmp(a[i], "-solid")) { Solid = Standard_True; continue; } + if (!strcmp(a[i], "-stm")) + { + isParallel = Standard_False; + continue; + } + switch (a[i][1]) { case 's': @@ -309,10 +316,12 @@ Standard_Integer evolved(Draw_Interpretor& di, Standard_Integer n, const char** TopoDS_Shape Volevo = IsAFace ? BRepOffsetAPI_MakeEvolved(TopoDS::Face(Base), Prof, GeomAbs_Arc, !hasToComputeAxes, - Solid, Standard_False, isVolume, aTolerance) : + Solid, Standard_False, isVolume, + aTolerance, isParallel) : BRepOffsetAPI_MakeEvolved(TopoDS::Wire(Base), Prof, GeomAbs_Arc, !hasToComputeAxes, - Solid, Standard_False, isVolume, aTolerance); + Solid, Standard_False, isVolume, + aTolerance, isParallel); DBRep::Set(a[1],Volevo); diff --git a/src/QABugs/QABugs_20.cxx b/src/QABugs/QABugs_20.cxx index 5a18f2cca2..7ecd3d212b 100644 --- a/src/QABugs/QABugs_20.cxx +++ b/src/QABugs/QABugs_20.cxx @@ -2550,7 +2550,7 @@ static Standard_Integer myCall(Draw_Interpretor&, Standard_Integer theNbArgs, co } // ################################ Extrude tool ######################################### - BRepOffsetAPI_MakeEvolved mkEvolved = BRepOffsetAPI_MakeEvolved(extrudeWire, toolWire, GeomAbs_Arc, Standard_False, Standard_True, Standard_False, Standard_True, 0); + BRepOffsetAPI_MakeEvolved mkEvolved = BRepOffsetAPI_MakeEvolved(extrudeWire, toolWire, GeomAbs_Arc, Standard_False, Standard_True, Standard_False, Standard_True, 0, Standard_True); DBRep::Set(theArgVec[1], mkEvolved.Shape());