new command bsetparallelmode added.
usage: bsetparallelmode [1/0].
Documentation for new command "bsetparallelmode" added.
-Draw Test Harness {#occt_user_guides__test_harness}
+\12Draw Test Harness {#occt_user_guides__test_harness}
===============================
@tableofcontents
The new algorithm of Boolean operations avoids a large number of weak points and limitations presented in the old boolean operation algorithm.
-@subsubsection occt_draw_7_7_1 bop, bopfuse, bopcut, boptuc, bopcommon,
+@subsubsection occt_draw_7_7_1 bparallelmode
+
+* **bparallelmode** enable or disable parallel mode for boolean operations. Sequential computing is used by default.
+
+Syntax:
+~~~~~
+bparallelmode [1/0]
+
+~~~~~
+
+Without arguments, bparallelmode shows current state of parallel mode for boolean operations.
+
+* *0* Disable parallel mode,
+* *1* Enable parallel mode
+
+**Example:**
+~~~~~
+# Enable parallel mode for boolean operations.
+bparallelmode 1
+
+# Show state of parallel mode for boolean operations.
+bparallelmode
+~~~~~
+
+@subsubsection occt_draw_7_7_2 bop, bopfuse, bopcut, boptuc, bopcommon
* **bop** defines *shape1* and *shape2* subject to ulterior Boolean operations
* **bopfuse** creates a new shape by a boolean operation on two existing shapes. The new shape contains both originals intact.
ttranslate s14 0 -40 100
~~~~~
-@subsubsection occt_draw_7_7_2 bopsection
+@subsubsection occt_draw_7_7_3 bopsection
Syntax:
~~~~~
bsection s2 b c
~~~~~
-@subsubsection occt_draw_7_7_3 bopcheck, bopargshape
+@subsubsection occt_draw_7_7_4 bopcheck, bopargshape
Syntax:
~~~~~
---C++: alias "Standard_EXPORT virtual ~BOPAlgo_Algo();"
Initialize (theAllocator: BaseAllocator from BOPCol)
- returns Algo from BOPAlgo;
-
+ returns Algo from BOPAlgo;
+
+ GetParallelMode(myclass)
+ returns Boolean;
+
+ SetParallelMode(myclass;
+ theNewMode: Boolean from Standard);
+
Perform(me:out)
is deferred;
#include <Standard_ProgramError.hxx>
#include <Standard_NotImplemented.hxx>
+namespace
+{
+ Standard_Boolean myGlobalRunParallel = Standard_False;
+}
+
+//=======================================================================
+// function:
+// purpose:
+//=======================================================================
+void BOPAlgo_Algo::SetParallelMode(Standard_Boolean theNewMode)
+{
+ myGlobalRunParallel = theNewMode;
+}
+
+//=======================================================================
+// function:
+// purpose:
+//=======================================================================
+Standard_Boolean BOPAlgo_Algo::GetParallelMode()
+{
+ return myGlobalRunParallel;
+}
+
+
//=======================================================================
// function:
// purpose:
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myErrorStatus(1),
myWarningStatus(0),
- myRunParallel(Standard_False)
+ myRunParallel(myGlobalRunParallel)
{}
//=======================================================================
// function:
myAllocator(theAllocator),
myErrorStatus(1),
myWarningStatus(0),
- myRunParallel(Standard_False)
+ myRunParallel(myGlobalRunParallel)
{}
//=======================================================================
static Standard_Integer bopcurves (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bopnews (Draw_Interpretor&, Standard_Integer, const char**);
//
+static Standard_Integer bparallelmode(Draw_Interpretor&, Standard_Integer, const char**);
+//
static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//
theCommands.Add("bopcurves", "use bopcurves F1 F2 [-2d]", __FILE__, bopcurves, g);
theCommands.Add("bopnews", "use bopnews -v[e,f]" , __FILE__, bopnews, g);
- //
+ theCommands.Add("bparallelmode", "bparallelmode [1/0] : show / set parallel mode for boolean operations", __FILE__, bparallelmode, g);
theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-ni (do not intersect)] [-s (run in non parallel mode)]", __FILE__, mkvolume , g);
}
return 0;
}
+//=======================================================================
+//function : bparallelmode
+//purpose :
+//=======================================================================
+Standard_Integer bparallelmode(Draw_Interpretor& di, Standard_Integer n, const char** a)
+{
+ if (n == 2)
+ {
+ Standard_Boolean isParallelOn = Draw::Atoi (a[1]) == 1;
+ if (isParallelOn == 1)
+ {
+ BOPAlgo_Algo::SetParallelMode(Standard_True);
+ di << "Parallel mode for boolean operations has been enabled";
+ }
+ else
+ {
+ BOPAlgo_Algo::SetParallelMode(Standard_False);
+ di << "Parallel mode for boolean operations has been disabled";
+ }
+ }
+ else
+ {
+ di << "Parallel mode state for boolean operations: "
+ << (BOPAlgo_Algo::GetParallelMode()? "enabled" : "disabled");
+ }
+
+ return 0;
+}
+
//=======================================================================
//function : mkvolume
//purpose :