1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-16 10:54:53 +03:00

0024952: Possibility to break Boolean operations algorithm by user request

class: BOPAlgo_Algo
method:
void BOPAlgo_Algo::SetProgressIndicator
  (const Handle(Message_ProgressIndicator)& theObj)
Purpose: Set the Progress Indicator object <theObj>.

method:
void BOPAlgo_Algo::UserBreak() const
Purpose: Breaks the execution if the break signal is indicated.
This commit is contained in:
pkv 2014-06-02 12:09:10 +04:00 committed by apn
parent 9b0fb8cdd0
commit 36f4947b8d
20 changed files with 387 additions and 218 deletions

View File

@ -17,7 +17,8 @@ package BOPAlgo
uses
gp,
Bnd,
Bnd,
Message,
TopAbs,
Geom,
GeomAPI,
@ -73,7 +74,7 @@ is
class SectionAttribute;
class CheckerSI;
class ArgumentAnalyzer;
class CheckResult;
class CheckResult;
--
-- pointers
--

View File

@ -16,53 +16,66 @@
-- commercial license or contractual agreement.
deferred class Algo from BOPAlgo
---Purpose: provides the root interface for algorithms
---Purpose: provides the root interface for algorithms
uses
BaseAllocator from BOPCol
BaseAllocator from BOPCol,
ProgressIndicator from Message
--raises
is
Initialize
returns Algo from BOPAlgo;
returns Algo from BOPAlgo;
---C++: alias "Standard_EXPORT virtual ~BOPAlgo_Algo();"
Initialize (theAllocator: BaseAllocator from BOPCol)
returns Algo from BOPAlgo;
returns Algo from BOPAlgo;
Perform(me:out)
is deferred;
is deferred;
ErrorStatus (me)
returns Integer from Standard;
returns Integer from Standard;
WarningStatus (me)
returns Integer from Standard;
returns Integer from Standard;
CheckData(me:out)
is virtual protected;
is virtual protected;
CheckResult(me:out)
is virtual protected;
is virtual protected;
Allocator(me)
returns BaseAllocator from BOPCol;
---C++: return const &
returns BaseAllocator from BOPCol;
---C++: return const &
SetRunParallel(me:out;
theFlag:Boolean from Standard);
theFlag:Boolean from Standard);
---Purpose: Set the flag of parallel processing
-- if <theFlag> is true the parallel processing is switched on
-- if <theFlag> is false the parallel processing is switched off
--
RunParallel(me)
returns Boolean from Standard;
---Purpose: Returns the flag of parallel processing
returns Boolean from Standard;
---Purpose: Returns the flag of parallel processing
SetProgressIndicator(me:out;
theObj: ProgressIndicator from Message);
---Purpose: Set the Progress Indicator object.
UserBreak(me)
is protected;
---Purpose: Breaks the execution if the break signal
-- is indicated by myProgressIndicator.
fields
myAllocator : BaseAllocator from BOPCol is protected;
myErrorStatus : Integer from Standard is protected;
myWarningStatus : Integer from Standard is protected;
myRunParallel : Boolean from Standard is protected;
myErrorStatus : Integer from Standard is protected;
myWarningStatus : Integer from Standard is protected;
myRunParallel : Boolean from Standard is protected;
myProgressIndicator : ProgressIndicator from Message is protected;
end Algo;

View File

@ -19,6 +19,9 @@
#include <NCollection_BaseAllocator.hxx>
#include <Standard_ProgramError.hxx>
#include <Standard_NotImplemented.hxx>
//=======================================================================
// function:
// purpose:
@ -106,6 +109,30 @@ Standard_Boolean BOPAlgo_Algo::RunParallel()const
{
return myRunParallel;
}
//=======================================================================
//function : SetProgressIndicator
//purpose :
//=======================================================================
void BOPAlgo_Algo::SetProgressIndicator
(const Handle(Message_ProgressIndicator)& theObj)
{
if (!theObj.IsNull()) {
myProgressIndicator=theObj;
}
}
//=======================================================================
//function : UserBreak
//purpose :
//=======================================================================
void BOPAlgo_Algo::UserBreak() const
{
if (myProgressIndicator.IsNull()) {
return;
}
if (myProgressIndicator->UserBreak()) {
Standard_NotImplemented::Raise("");
}
}
// myErrorStatus
//
// 1 - object is just initialized

View File

@ -70,11 +70,11 @@ is
is redefined protected;
---Purpose: Provides preparing actions
PerformInternal(me:out;
PerformInternal1(me:out;
thePF:PaveFiller from BOPAlgo)
is redefined protected;
---Purpose: Performs calculations using prepared Filler
-- object theDSF
-- object <thePF>
BuildResult(me:out;
theType: ShapeEnum from TopAbs)

View File

@ -333,10 +333,10 @@ void BOPAlgo_BOP::Perform()
PerformInternal(*pPF);
}
//=======================================================================
//function : PerformInternal
//function : PerformInternal1
//purpose :
//=======================================================================
void BOPAlgo_BOP::PerformInternal(const BOPAlgo_PaveFiller& theFiller)
void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
{
myErrorStatus=0;
myWarningStatus=0;

View File

@ -116,7 +116,11 @@ is
PerformInternal(me:out;
thePF: PaveFiller from BOPAlgo)
is virtual protected;
PerformInternal1(me:out;
thePF: PaveFiller from BOPAlgo)
is virtual protected;
CheckData(me:out)
is redefined protected;

View File

@ -17,12 +17,14 @@
#include <BOPAlgo_Builder.ixx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <NCollection_IncAllocator.hxx>
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <BOPTools_AlgoTools.hxx>
//=======================================================================
@ -239,6 +241,21 @@ void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller)
//purpose :
//=======================================================================
void BOPAlgo_Builder::PerformInternal(const BOPAlgo_PaveFiller& theFiller)
{
try {
OCC_CATCH_SIGNALS
PerformInternal1(theFiller);
}
//
catch (Standard_Failure) {
myErrorStatus=191;
}
}
//=======================================================================
//function : PerformInternal1
//purpose :
//=======================================================================
void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
{
myErrorStatus=0;
//

View File

@ -17,35 +17,39 @@
// commercial license or contractual agreement.
#include <BOPAlgo_BuilderFace.ixx>
//
#include <NCollection_UBTreeFiller.hxx>
#include <NCollection_DataMap.hxx>
//
#include <TColStd_MapIntegerHasher.hxx>
//
#include <gp_Pnt2d.hxx>
#include <gp_Pln.hxx>
#include <gp_Vec.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
//
#include <Geom_Surface.hxx>
//
#include <TopAbs.hxx>
#include <TopLoc_Location.hxx>
//
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
//
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
//
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <IntTools_FClass2d.hxx>
#include <IntTools_Context.hxx>
//
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
@ -54,11 +58,13 @@
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPTools.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPAlgo_WireSplitter.hxx>
//
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_Box2DBndTree.hxx>
//
#include <BOPAlgo_WireSplitter.hxx>
static
Standard_Boolean IsGrowthWire(const TopoDS_Shape& ,
@ -75,11 +81,7 @@ static
void GetWire(const TopoDS_Shape& ,
TopoDS_Shape& );
//
#include <NCollection_UBTreeFiller.hxx>
#include <BOPCol_Box2DBndTree.hxx>
#include <BRepTools.hxx>
#include <TColStd_MapIntegerHasher.hxx>
#include <NCollection_DataMap.hxx>
//
//=======================================================================
//class : BOPAlgo_ShapeBox2D
@ -215,21 +217,29 @@ void BOPAlgo_BuilderFace::Perform()
return;
}
//
UserBreak();
//
PerformShapesToAvoid();
if (myErrorStatus) {
return;
}
//
UserBreak();
//
PerformLoops();
if (myErrorStatus) {
return;
}
//
UserBreak();
//
PerformAreas();
if (myErrorStatus) {
return;
}
//
UserBreak();
//
PerformInternalShapes();
if (myErrorStatus) {
return;

View File

@ -199,20 +199,29 @@ void BOPAlgo_BuilderSolid::Perform()
aBB.Add(aC, aF);
}
//
UserBreak();
//
PerformShapesToAvoid();
if (myErrorStatus) {
return;
}
//
UserBreak();
//
PerformLoops();
if (myErrorStatus) {
return;
}
//
UserBreak();
//
PerformAreas();
if (myErrorStatus) {
return;
}
//
UserBreak();
//
PerformInternalShapes();
if (myErrorStatus) {
return;

View File

@ -87,10 +87,17 @@ typedef NCollection_IndexedDataMap\
//class : BOPAlgo_PairOfShapeBoolean
//purpose :
//=======================================================================
class BOPAlgo_PairOfShapeBoolean {
class BOPAlgo_PairOfShapeBoolean : public BOPAlgo_Algo {
public:
BOPAlgo_PairOfShapeBoolean()
: myFlag(Standard_False) {
DEFINE_STANDARD_ALLOC
BOPAlgo_PairOfShapeBoolean() :
BOPAlgo_Algo(),
myFlag(Standard_False) {
}
//
virtual ~BOPAlgo_PairOfShapeBoolean() {
}
//
TopoDS_Shape& Shape1() {
@ -105,78 +112,43 @@ class BOPAlgo_PairOfShapeBoolean {
return myFlag;
}
//
void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
const Handle(IntTools_Context)& Context()const {
return myContext;
}
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
//
const TopoDS_Face& aFj=*((TopoDS_Face*)&myShape1);
const TopoDS_Face& aFk=*((TopoDS_Face*)&myShape2);
myFlag=BOPTools_AlgoTools::AreFacesSameDomain(aFj, aFk, myContext);
}
//
protected:
Standard_Boolean myFlag;
TopoDS_Shape myShape1;
TopoDS_Shape myShape2;
Handle(IntTools_Context) myContext;
};
//
typedef BOPCol_NCVector<BOPAlgo_PairOfShapeBoolean> \
BOPAlgo_VectorOfPairOfShapeBoolean;
//
//=======================================================================
//function : BOPAlgo_BuilderSDFaceFunctor
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSDFaceFunctor {
protected:
BOPAlgo_VectorOfPairOfShapeBoolean* myPVPSB;
public:
//
BOPAlgo_BuilderSDFaceFunctor(BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB)
: myPVPSB(&aVPSB){
}
//
void operator()( const flexible_range<Standard_Integer>& aBR ) const {
Standard_Boolean bFlag;
Standard_Integer i, iBeg, iEnd;
Handle(IntTools_Context) aContext;
//
aContext=new IntTools_Context;
//
BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB=*myPVPSB;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
BOPAlgo_PairOfShapeBoolean& aPSB=aVPSB(i);
const TopoDS_Face& aFj=(*(TopoDS_Face*)(&aPSB.Shape1()));
const TopoDS_Face& aFk=(*(TopoDS_Face*)(&aPSB.Shape2()));
bFlag=BOPTools_AlgoTools::AreFacesSameDomain(aFj, aFk, aContext);
if (bFlag) {
aPSB.Flag()=bFlag;
}
}
}
};
typedef BOPCol_TBBContextFunctor
<BOPAlgo_PairOfShapeBoolean,
BOPAlgo_VectorOfPairOfShapeBoolean,
Handle(IntTools_Context),
IntTools_Context> BOPCol_BuilderSDFaceFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPCol_BuilderSDFaceFunctor,
BOPAlgo_VectorOfPairOfShapeBoolean,
Handle(IntTools_Context)> BOPAlgo_BuilderSDFaceCnt;
//
//=======================================================================
//function : BOPAlgo_BuilderSDFaceCnt
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSDFaceCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT static
void Perform(const Standard_Boolean bRunParallel,
BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB) {
Standard_Integer aNbVPSB;
//
aNbVPSB=aVPSB.Extent();
BOPAlgo_BuilderSDFaceFunctor aBFF(aVPSB);
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Integer>(0,aNbVPSB), aBFF);
}
else {
aBFF.operator()(flexible_range<Standard_Integer>(0,aNbVPSB));
}
}
};
//=======================================================================
// BuilderFace
//
@ -194,13 +166,17 @@ typedef BOPCol_TBBCnt
//class : BOPAlgo_VFI
//purpose :
//=======================================================================
class BOPAlgo_VFI {
class BOPAlgo_VFI : public BOPAlgo_Algo {
public:
BOPAlgo_VFI()
: myFlag(-1) {
DEFINE_STANDARD_ALLOC
BOPAlgo_VFI() :
BOPAlgo_Algo(),
myFlag(-1) {
}
//
~BOPAlgo_VFI(){
virtual ~BOPAlgo_VFI(){
}
//
void SetVertex(const TopoDS_Vertex& aV) {
@ -231,9 +207,10 @@ class BOPAlgo_VFI {
return myContext;
}
//
void Perform() {
virtual void Perform() {
Standard_Real aT1, aT2;
//
BOPAlgo_Algo::UserBreak();
myFlag=myContext->ComputeVF(myV, myF, aT1, aT2);
}
//
@ -435,6 +412,7 @@ void BOPAlgo_Builder::BuildSplitFaces()
aBF.SetFace(aF);
aBF.SetShapes(aLE);
aBF.SetRunParallel(myRunParallel);
aBF.SetProgressIndicator(myProgressIndicator);
//
}// for (i=0; i<aNbS; ++i) {
//
@ -619,12 +597,13 @@ void BOPAlgo_Builder::FillSameDomainFaces()
BOPAlgo_PairOfShapeBoolean& aPSB=aVPSB.Append1();
aPSB.Shape1()=aFj;
aPSB.Shape2()=aFk;
aPSB.SetProgressIndicator(myProgressIndicator);
}
}
}
//====================================================
BOPAlgo_BuilderSDFaceCnt::Perform(myRunParallel, aVPSB);
//====================================================
//================================================================
BOPAlgo_BuilderSDFaceCnt::Perform(myRunParallel, aVPSB, myContext);
//================================================================
aAllocator=new NCollection_IncAllocator();
BOPCol_IndexedDataMapOfShapeListOfShape aDMSLS(100, aAllocator);
BOPCol_DataMapOfIntegerListOfShape aMBlocks(100, aAllocator);
@ -747,6 +726,7 @@ void BOPAlgo_Builder::FillImagesFaces1()
BOPAlgo_VFI& aVFI=aVVFI.Append1();
aVFI.SetVertex(aVx);
aVFI.SetFace(aFy);
aVFI.SetProgressIndicator(myProgressIndicator);
}
}
}// for (i=0; i<aNbS; ++i) {

View File

@ -255,6 +255,7 @@ void BOPAlgo_Builder::FillIn3DParts
continue;
}
//
UserBreak();
//---------------------------------------------
Handle(NCollection_IncAllocator) aAlr1;
//
@ -564,6 +565,7 @@ void BOPAlgo_Builder::BuildSplitSolids
BOPAlgo_BuilderSolid& aBS=aVBS.Append1();
aBS.SetSolid(aSolid);
aBS.SetShapes(aSFS);
aBS.SetProgressIndicator(myProgressIndicator);
}//for (i=0; i<aNbS; ++i) {
//
Standard_Integer k, aNbBS;
@ -701,6 +703,8 @@ void BOPAlgo_Builder::FillInternalShapes()
continue;
}
//
UserBreak();
//
const TopoDS_Shape& aS=aSI.Shape();
//
aMx.Clear();

View File

@ -96,7 +96,10 @@ is
is redefined;
--
-- protected methods
--
--
PerformInternal (me:out)
is virtual protected;
Clear(me:out)
is virtual protected;

View File

@ -164,72 +164,83 @@ void BOPAlgo_PaveFiller::Perform()
try {
OCC_CATCH_SIGNALS
//
Init();
if (myErrorStatus) {
return;
}
//
Prepare();
if (myErrorStatus) {
return;
}
// 00
PerformVV();
if (myErrorStatus) {
return;
}
// 01
PerformVE();
if (myErrorStatus) {
return;
}
//
myDS->UpdatePaveBlocks();
// 11
PerformEE();
if (myErrorStatus) {
return;
}
// 02
PerformVF();
if (myErrorStatus) {
return;
}
// 12
PerformEF();
if (myErrorStatus) {
return;
}
//
MakeSplitEdges();
if (myErrorStatus) {
return;
}
//
// 22
PerformFF();
if (myErrorStatus) {
return;
}
//
MakeBlocks();
if (myErrorStatus) {
return;
}
//
RefineFaceInfoOn();
//
MakePCurves();
if (myErrorStatus) {
return;
}
//
ProcessDE();
if (myErrorStatus) {
return;
}
} // try {
PerformInternal();
}
//
catch (Standard_Failure) {
myErrorStatus=11;
}
}
}
//=======================================================================
// function: PerformInternal
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::PerformInternal()
{
myErrorStatus=0;
//
Init();
if (myErrorStatus) {
return;
}
//
Prepare();
if (myErrorStatus) {
return;
}
// 00
PerformVV();
if (myErrorStatus) {
return;
}
// 01
PerformVE();
if (myErrorStatus) {
return;
}
//
myDS->UpdatePaveBlocks();
// 11
PerformEE();
if (myErrorStatus) {
return;
}
// 02
PerformVF();
if (myErrorStatus) {
return;
}
// 12
PerformEF();
if (myErrorStatus) {
return;
}
//
MakeSplitEdges();
if (myErrorStatus) {
return;
}
//
// 22
PerformFF();
if (myErrorStatus) {
return;
}
//
MakeBlocks();
if (myErrorStatus) {
return;
}
//
RefineFaceInfoOn();
//
MakePCurves();
if (myErrorStatus) {
return;
}
//
ProcessDE();
if (myErrorStatus) {
return;
}
}

View File

@ -38,13 +38,17 @@
//class : BOPAlgo_VertexEdgeEdge
//purpose :
//=======================================================================
class BOPAlgo_VertexEdge {
class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
public:
BOPAlgo_VertexEdge()
: myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.) {
DEFINE_STANDARD_ALLOC
BOPAlgo_VertexEdge() :
BOPAlgo_Algo(),
myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.) {
};
//
~BOPAlgo_VertexEdge(){
virtual ~BOPAlgo_VertexEdge(){
};
//
void SetIndices(const Standard_Integer nV,
@ -95,7 +99,8 @@ class BOPAlgo_VertexEdge {
return myContext;
}
//
void Perform() {
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
myFlag=myContext->ComputeVE (myV, myE, myT);
};
//
@ -190,8 +195,9 @@ void BOPAlgo_PaveFiller::PerformVE()
aVESolver.SetIndices(nV, nE, nVx);
aVESolver.SetVertex(aV);
aVESolver.SetEdge(aE);
aVESolver.SetProgressIndicator(myProgressIndicator);
//
}// myIterator->Initialize(TopAbs_VERTEX, TopAbs_EDGE);
}// for (; myIterator->More(); myIterator->Next()) {
//
aNbVE=aVVE.Extent();
//=============================================================

View File

@ -70,13 +70,20 @@
//class : BOPAlgo_EdgeEdge
//purpose :
//=======================================================================
class BOPAlgo_EdgeEdge : public IntTools_EdgeEdge {
class BOPAlgo_EdgeEdge :
public IntTools_EdgeEdge,
public BOPAlgo_Algo {
public:
BOPAlgo_EdgeEdge()
: IntTools_EdgeEdge() {
DEFINE_STANDARD_ALLOC
//
BOPAlgo_EdgeEdge():
IntTools_EdgeEdge(),
BOPAlgo_Algo() {
};
//
~BOPAlgo_EdgeEdge(){
virtual ~BOPAlgo_EdgeEdge(){
};
//
void SetPaveBlock1(const Handle(BOPDS_PaveBlock)& aPB) {
@ -94,6 +101,11 @@ class BOPAlgo_EdgeEdge : public IntTools_EdgeEdge {
Handle(BOPDS_PaveBlock)& PaveBlock2() {
return myPB2;
}
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
IntTools_EdgeEdge::Perform();
}
//
protected:
Handle(BOPDS_PaveBlock) myPB1;
@ -345,6 +357,7 @@ void BOPAlgo_PaveFiller::PerformEE()
//
anEdgeEdge.SetEdge1(aE1, aT11, aT12);
anEdgeEdge.SetEdge2(aE2, aT21, aT22);
anEdgeEdge.SetProgressIndicator(myProgressIndicator);
}//for (; aIt2.More(); aIt2.Next()) {
}//for (; aIt1.More(); aIt1.Next()) {
}//for (; myIterator->More(); myIterator->Next()) {

View File

@ -42,14 +42,17 @@
//class : BOPAlgo_VertexFace
//purpose :
//=======================================================================
class BOPAlgo_VertexFace {
class BOPAlgo_VertexFace : public BOPAlgo_Algo {
public:
BOPAlgo_VertexFace()
: myIV(-1), myIF(-1), myIVx(-1),
DEFINE_STANDARD_ALLOC
BOPAlgo_VertexFace() :
BOPAlgo_Algo(),
myIV(-1), myIF(-1), myIVx(-1),
myFlag(-1), myT1(-1.), myT2(-1.) {
}
//
~BOPAlgo_VertexFace(){
virtual ~BOPAlgo_VertexFace(){
}
//
void SetIndices(const Standard_Integer nV,
@ -102,7 +105,8 @@ class BOPAlgo_VertexFace {
return myContext;
}
//
void Perform() {
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2);
}
//
@ -189,6 +193,7 @@ void BOPAlgo_PaveFiller::PerformVF()
aVertexFace.SetIndices(nV, nF, nVx);
aVertexFace.SetVertex(aV);
aVertexFace.SetFace(aF);
aVertexFace.SetProgressIndicator(myProgressIndicator);
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbVF=aVVF.Extent();

View File

@ -60,13 +60,20 @@
//class : BOPAlgo_EdgeFace
//purpose :
//=======================================================================
class BOPAlgo_EdgeFace : public IntTools_EdgeFace {
class BOPAlgo_EdgeFace :
public IntTools_EdgeFace,
public BOPAlgo_Algo {
public:
BOPAlgo_EdgeFace()
: IntTools_EdgeFace(), myIE(-1), myIF(-1) {
DEFINE_STANDARD_ALLOC
BOPAlgo_EdgeFace() :
IntTools_EdgeFace(),
BOPAlgo_Algo(),
myIE(-1), myIF(-1) {
};
//
~BOPAlgo_EdgeFace(){
virtual ~BOPAlgo_EdgeFace(){
};
//
void SetIndices(const Standard_Integer nE,
@ -97,6 +104,11 @@ class BOPAlgo_EdgeFace : public IntTools_EdgeFace {
return myPB;
}
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
IntTools_EdgeFace::Perform();
}
//
protected:
Standard_Integer myIE;
Standard_Integer myIF;
@ -225,6 +237,7 @@ void BOPAlgo_PaveFiller::PerformEF()
aSR = aPBRange;
BOPTools_AlgoTools::CorrectRange(aE, aF, aSR, aPBRange);
aEdgeFace.SetRange (aPBRange);
aEdgeFace.SetProgressIndicator(myProgressIndicator);
//
}//for (; aIt.More(); aIt.Next()) {
}//for (; myIterator->More(); myIterator->Next()) {

View File

@ -101,13 +101,20 @@ static void ToleranceFF(const BRepAdaptor_Surface& aBAS1,
//class : BOPAlgo_FaceFace
//purpose :
//=======================================================================
class BOPAlgo_FaceFace : public IntTools_FaceFace {
class BOPAlgo_FaceFace :
public IntTools_FaceFace,
public BOPAlgo_Algo {
public:
BOPAlgo_FaceFace()
: IntTools_FaceFace(), myIF1(-1), myIF2(-1), myTolFF(1.e-7) {
DEFINE_STANDARD_ALLOC
BOPAlgo_FaceFace() :
IntTools_FaceFace(),
BOPAlgo_Algo(),
myIF1(-1), myIF2(-1), myTolFF(1.e-7) {
}
//
~BOPAlgo_FaceFace() {
virtual ~BOPAlgo_FaceFace() {
}
//
void SetIndices(const Standard_Integer nF1,
@ -144,7 +151,8 @@ class BOPAlgo_FaceFace : public IntTools_FaceFace {
return myTolFF;
}
//
void Perform() {
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
IntTools_FaceFace::Perform(myF1, myF2);
}
//
@ -257,8 +265,7 @@ void BOPAlgo_PaveFiller::PerformFF()
}
//
aFaceFace.SetParameters(bApp, bCompC2D1, bCompC2D2, aApproxTol);
//
//aFaceFace.Perform(aF1, aF2);
aFaceFace.SetProgressIndicator(myProgressIndicator);
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbFaceFace=aVFaceFace.Extent();
@ -387,6 +394,9 @@ void BOPAlgo_PaveFiller::MakeBlocks()
BOPCol_DataMapOfIntegerInteger aDMI(100, aAllocator);
//
for (i=0; i<aNbFF; ++i) {
//
UserBreak();
//
BOPDS_InterfFF& aFF=aFFs(i);
aFF.Indices(nF1, nF2);
//
@ -679,6 +689,7 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
}
//
// 2 Fuse shapes
aPF.SetProgressIndicator(myProgressIndicator);
aPF.SetRunParallel(myRunParallel);
aPF.SetArguments(aLS);
aPF.Perform();

View File

@ -74,14 +74,18 @@ static void UpdateVertices(const TopoDS_Edge& aE,
//class : BOPAlgo_SplitEdge
//purpose :
//=======================================================================
class BOPAlgo_SplitEdge {
class BOPAlgo_SplitEdge : public BOPAlgo_Algo {
public:
BOPAlgo_SplitEdge() {
DEFINE_STANDARD_ALLOC
BOPAlgo_SplitEdge() :
BOPAlgo_Algo() {
myT1=0.;
myT2=0.;
}
//
~BOPAlgo_SplitEdge() {
virtual ~BOPAlgo_SplitEdge() {
}
//
void SetData(const TopoDS_Edge& aE,
@ -121,7 +125,8 @@ class BOPAlgo_SplitEdge {
return myBox;
}
//
void Perform () {
virtual void Perform () {
BOPAlgo_Algo::UserBreak();
BOPTools_AlgoTools::MakeSplitEdge(myE,
myV1, myT1,
myV2, myT2,
@ -160,13 +165,17 @@ typedef BOPCol_TBBCnt
//class : BOPAlgo_MPC
//purpose :
//=======================================================================
class BOPAlgo_MPC {
class BOPAlgo_MPC : public BOPAlgo_Algo {
public:
BOPAlgo_MPC()
: myFlag(Standard_False) {
DEFINE_STANDARD_ALLOC
BOPAlgo_MPC() :
BOPAlgo_Algo(),
myFlag(Standard_False) {
};
//
~BOPAlgo_MPC(){
virtual ~BOPAlgo_MPC(){
};
//
void SetEdge(const TopoDS_Edge& aE) {
@ -193,7 +202,8 @@ class BOPAlgo_MPC {
return myFlag;
}
//
void Perform() {
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF);
if (myFlag) {
UpdateVertices(myE, myF);
@ -334,6 +344,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
if (bCB) {
aBSE.SetCommonBlock(aCB);
}
aBSE.SetProgressIndicator(myProgressIndicator);
}
} // for (; aItPB.More(); aItPB.Next()) {
} // for (i=0; i<aNbPBP; ++i) {
@ -441,6 +452,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
BOPAlgo_MPC& aMPC=aVMPC.Append1();
aMPC.SetEdge(aE);
aMPC.SetFace(aF1F);
aMPC.SetProgressIndicator(myProgressIndicator);
}
//
// On
@ -455,6 +467,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
BOPAlgo_MPC& aMPC=aVMPC.Append1();
aMPC.SetEdge(aE);
aMPC.SetFace(aF1F);
aMPC.SetProgressIndicator(myProgressIndicator);
}
}
}// for (i=0; i<aNbFI; ++i) {
@ -497,6 +510,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
aMPC.SetEdge(aE);
aMPC.SetFace(aFf[m]);
aMPC.SetFlag(bPCurveOnS[m]);
aMPC.SetProgressIndicator(myProgressIndicator);
}
}
}

View File

@ -15,8 +15,10 @@
#ifndef _BOPDS_Col_HeaderFile
#define _BOPDS_Col_HeaderFile
#ifdef HAVE_TBB
#include <Standard_Macro.hxx>
#include <Standard_NotImplemented.hxx>
#ifdef HAVE_TBB
// On Windows, function TryEnterCriticalSection has appeared in Windows NT
// and is surrounded by #ifdef in MS VC++ 7.1 headers.
// Thus to use it we need to define appropriate macro saying that we wil
@ -126,7 +128,20 @@ template <class TypeFunctor,
Standard_Integer aNb=aV.Extent();
//
if (bRunParallel) {
#ifdef HAVE_TBB
try {
flexible_for(flexible_range<Standard_Integer>(0,aNb), aFunctor);
}
//
catch( captured_exception& ) {
Standard_NotImplemented::Raise("");
}
catch( ... ) {
Standard_NotImplemented::Raise("");
}
#else // not HAVE_TBB
flexible_for(flexible_range<Standard_Integer>(0,aNb), aFunctor);
#endif
}
else {
aFunctor.operator()(flexible_range<Standard_Integer>(0,aNb));
@ -136,7 +151,6 @@ template <class TypeFunctor,
//
// 2.2. Context dependent version
//
#include <Standard_Macro.hxx>
//=======================================================================
//class : BOPCol_TBBContextFunctor
@ -208,7 +222,21 @@ template <class TypeFunctor,
Standard_Integer aNb=aV.Extent();
//
if (bRunParallel) {
#ifdef HAVE_TBB
try {
flexible_for(flexible_range<Standard_Integer>(0,aNb), aFunctor);
}
//
catch(captured_exception& ) {
//cout<<" captured_exception: " << ex.what() << endl;
Standard_NotImplemented::Raise("");
}
catch( ... ) {
Standard_NotImplemented::Raise("");
}
#else // not HAVE_TBB
flexible_for(flexible_range<Standard_Integer>(0,aNb), aFunctor);
#endif
}
else {
aFunctor.SetContext(aCtx);