]> OCCT Git - occt-copy.git/commitdiff
Parallel mode
authornbv <nbv@opencascade.com>
Thu, 7 Jun 2018 14:08:05 +0000 (17:08 +0300)
committernbv <nbv@opencascade.com>
Thu, 7 Jun 2018 14:08:05 +0000 (17:08 +0300)
src/BRepFill/BRepFill_Voluved.cxx
src/BRepFill/BRepFill_Voluved.hxx
src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.cxx
src/BRepOffsetAPI/BRepOffsetAPI_MakeEvolved.hxx
src/BRepTest/BRepTest_SweepCommands.cxx
src/QABugs/QABugs_20.cxx

index df425dcbe7fc20ed293363223fa49f2862ba29e0..05393eb811afa4ecfb3f60fa835f2f247b8acdc2 100644 (file)
@@ -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())
index 5675cc9c751e1d62ec8bb0c766a4e54e47548448..39c1ca72954e1b351efb676b44264fed827e7560 100644 (file)
@@ -25,6 +25,7 @@
 #include <TopTools_IndexedMapOfShape.hxx>
 #include <TopTools_ListOfShape.hxx>
 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;
 
 };
 
index 88f20c46da630728bb3397e23778cd7822b606f0..50e4b0ca2c7bf91fc7f485c7c0659cde736ca56a 100644 (file)
@@ -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
index 1a16adb5d946d6c597c235e6ea7d39869996463c..3a5129bdf430ab70bb233d3a63c58a482da1e208 100644 (file)
@@ -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;
   
index 4d3c1f2c1988ace9f4a020fb098cbb5396f43a19..64c8e27b8a06f2c17266f7fa31140b3c98892b19 100644 (file)
@@ -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);
 
index 5a18f2cca202a40fc6319520023d1776197d42f4..7ecd3d212b7b3aa8fc6376cf63da482a9ec79aea 100644 (file)
@@ -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());