1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-21 10:55:33 +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

@ -18,6 +18,7 @@ package BOPAlgo
uses uses
gp, gp,
Bnd, Bnd,
Message,
TopAbs, TopAbs,
Geom, Geom,
GeomAPI, GeomAPI,

View File

@ -19,7 +19,8 @@ deferred class Algo from BOPAlgo
---Purpose: provides the root interface for algorithms ---Purpose: provides the root interface for algorithms
uses uses
BaseAllocator from BOPCol BaseAllocator from BOPCol,
ProgressIndicator from Message
--raises --raises
@ -60,9 +61,21 @@ is
returns Boolean from Standard; returns Boolean from Standard;
---Purpose: Returns the flag of parallel processing ---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 fields
myAllocator : BaseAllocator from BOPCol is protected; myAllocator : BaseAllocator from BOPCol is protected;
myErrorStatus : Integer from Standard is protected; myErrorStatus : Integer from Standard is protected;
myWarningStatus : Integer from Standard is protected; myWarningStatus : Integer from Standard is protected;
myRunParallel : Boolean from Standard is protected; myRunParallel : Boolean from Standard is protected;
myProgressIndicator : ProgressIndicator from Message is protected;
end Algo; end Algo;

View File

@ -19,6 +19,9 @@
#include <NCollection_BaseAllocator.hxx> #include <NCollection_BaseAllocator.hxx>
#include <Standard_ProgramError.hxx>
#include <Standard_NotImplemented.hxx>
//======================================================================= //=======================================================================
// function: // function:
// purpose: // purpose:
@ -106,6 +109,30 @@ Standard_Boolean BOPAlgo_Algo::RunParallel()const
{ {
return myRunParallel; 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 // myErrorStatus
// //
// 1 - object is just initialized // 1 - object is just initialized

View File

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

View File

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

View File

@ -117,6 +117,10 @@ is
thePF: PaveFiller from BOPAlgo) thePF: PaveFiller from BOPAlgo)
is virtual protected; is virtual protected;
PerformInternal1(me:out;
thePF: PaveFiller from BOPAlgo)
is virtual protected;
CheckData(me:out) CheckData(me:out)
is redefined protected; is redefined protected;

View File

@ -17,12 +17,14 @@
#include <BOPAlgo_Builder.ixx> #include <BOPAlgo_Builder.ixx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <NCollection_IncAllocator.hxx> #include <NCollection_IncAllocator.hxx>
#include <TopoDS_Compound.hxx> #include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
#include <BOPTools_AlgoTools.hxx> #include <BOPTools_AlgoTools.hxx>
//======================================================================= //=======================================================================
@ -239,6 +241,21 @@ void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller)
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPAlgo_Builder::PerformInternal(const BOPAlgo_PaveFiller& theFiller) 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; myErrorStatus=0;
// //

View File

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

View File

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

View File

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

View File

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

View File

@ -97,6 +97,9 @@ is
-- --
-- protected methods -- protected methods
-- --
PerformInternal (me:out)
is virtual protected;
Clear(me:out) Clear(me:out)
is virtual protected; is virtual protected;

View File

@ -164,6 +164,21 @@ void BOPAlgo_PaveFiller::Perform()
try { try {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
// //
PerformInternal();
}
//
catch (Standard_Failure) {
myErrorStatus=11;
}
}
//=======================================================================
// function: PerformInternal
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::PerformInternal()
{
myErrorStatus=0;
//
Init(); Init();
if (myErrorStatus) { if (myErrorStatus) {
return; return;
@ -228,8 +243,4 @@ void BOPAlgo_PaveFiller::Perform()
if (myErrorStatus) { if (myErrorStatus) {
return; return;
} }
} // try {
catch (Standard_Failure) {
myErrorStatus=11;
}
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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