mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0025269: Make parallel version of boolean operations avaible from DRAW
new command bsetparallelmode added. usage: bsetparallelmode [1/0]. Documentation for new command "bsetparallelmode" added.
This commit is contained in:
@@ -30,8 +30,14 @@ is
|
||||
---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;
|
||||
|
||||
|
@@ -22,6 +22,30 @@
|
||||
#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:
|
||||
@@ -31,7 +55,7 @@ BOPAlgo_Algo::BOPAlgo_Algo()
|
||||
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
|
||||
myErrorStatus(1),
|
||||
myWarningStatus(0),
|
||||
myRunParallel(Standard_False)
|
||||
myRunParallel(myGlobalRunParallel)
|
||||
{}
|
||||
//=======================================================================
|
||||
// function:
|
||||
@@ -43,7 +67,7 @@ BOPAlgo_Algo::BOPAlgo_Algo
|
||||
myAllocator(theAllocator),
|
||||
myErrorStatus(1),
|
||||
myWarningStatus(0),
|
||||
myRunParallel(Standard_False)
|
||||
myRunParallel(myGlobalRunParallel)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -77,6 +77,8 @@ static Standard_Integer bcommon (Draw_Interpretor&, Standard_Integer, const ch
|
||||
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**);
|
||||
|
||||
//=======================================================================
|
||||
@@ -108,7 +110,7 @@ static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const c
|
||||
//
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -692,6 +694,35 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
|
||||
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 :
|
||||
|
Reference in New Issue
Block a user