//
// 2.myIterator
myIterator=new BOPDS_Iterator(myAllocator);
+ myIterator->SetRunParallel(myRunParallel);
myIterator->SetDS(myDS);
myIterator->Prepare();
//
#include <BOPTools_AlgoTools.hxx>
//
#include <BOPCol_DataMapOfShapeInteger.hxx>
+#include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_DataMapOfIntegerShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
#include <BOPCol_BoxBndTree.hxx>
//
#include <BOPAlgo_Tools.hxx>
+/////////////////////////////////////////////////////////////////////////
//=======================================================================
//class : BOPAlgo_EdgeEdge
//purpose :
<BOPAlgo_EdgeEdgeFunctor,
BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeCnt;
//
+/////////////////////////////////////////////////////////////////////////
+//=======================================================================
+//class : BOPAlgo_TNV
+//purpose :
+//=======================================================================
+class BOPAlgo_TNV : public BOPCol_BoxBndTreeSelector{
+ public:
+ BOPAlgo_TNV()
+ : BOPCol_BoxBndTreeSelector(), myTree(NULL) {
+ };
+ //
+ ~BOPAlgo_TNV(){
+ };
+ //
+ void SetVertex(const TopoDS_Vertex& aV) {
+ myV=aV;
+ }
+ //
+ const TopoDS_Vertex& Vertex()const {
+ return myV;
+ }
+ //
+ void SetTree(BOPCol_BoxBndTree& aTree) {
+ myTree=&aTree;
+ }
+ //
+ void Perform() {
+ myTree->Select(*this);
+ }
+ //
+ protected:
+ TopoDS_Vertex myV;
+ BOPCol_BoxBndTree *myTree;
+};
+//
+//=======================================================================
+typedef BOPCol_NCVector
+ <BOPAlgo_TNV> BOPAlgo_VectorOfTNV;
+//
+typedef BOPCol_TBBFunctor
+ <BOPAlgo_TNV,
+ BOPAlgo_VectorOfTNV> BOPAlgo_TNVFunctor;
+//
+typedef BOPCol_TBBCnt
+ <BOPAlgo_TNVFunctor,
+ BOPAlgo_VectorOfTNV> BOPAlgo_TNVCnt;
+/////////////////////////////////////////////////////////////////////////
+//=======================================================================
+//class : BOPAlgo_PVE
+//purpose :
+//=======================================================================
+class BOPAlgo_PVE {
+ public:
+ BOPAlgo_PVE()
+ : myIV(-1), myIE(-1), myFlag(-1), myT(-1.) {
+ };
+ //
+ ~BOPAlgo_PVE(){
+ };
+ //
+ void SetIndices(const Standard_Integer nV,
+ const Standard_Integer nE){
+ myIV=nV;
+ myIE=nE;
+ }
+ //
+ void Indices(Standard_Integer& nV,
+ Standard_Integer& nE) const {
+ nV=myIV;
+ nE=myIE;
+ }
+ //
+ void SetVertex(const TopoDS_Vertex& aV) {
+ myV=aV;
+ }
+ //
+ const TopoDS_Vertex& Vertex()const {
+ return myV;
+ }
+ //
+ void SetEdge(const TopoDS_Edge& aE) {
+ myE=aE;
+ }
+ //
+ const TopoDS_Edge& Edge()const {
+ return myE;
+ }
+ //
+ void SetPaveBlock(const Handle(BOPDS_PaveBlock)& aPB) {
+ myPB=aPB;
+ }
+ //
+ Handle(BOPDS_PaveBlock)& PaveBlock() {
+ return myPB;
+ }
+ //
+ Standard_Integer Flag()const {
+ return myFlag;
+ }
+ //
+ Standard_Real Parameter()const {
+ return myT;
+ }
+ //
+ void SetContext(const Handle(BOPInt_Context)& aContext) {
+ myContext=aContext;
+ }
+ //
+ const Handle(BOPInt_Context)& Context()const {
+ return myContext;
+ }
+ //
+ void Perform() {
+ myFlag=myContext->ComputeVE (myV, myE, myT);
+ };
+ //
+ protected:
+ Standard_Integer myIV;
+ Standard_Integer myIE;
+ Standard_Integer myFlag;
+ Standard_Real myT;
+ TopoDS_Vertex myV;
+ TopoDS_Edge myE;
+ Handle(BOPDS_PaveBlock) myPB;
+ Handle(BOPInt_Context) myContext;
+};
+//=======================================================================
+typedef BOPCol_NCVector
+ <BOPAlgo_PVE> BOPAlgo_VectorOfPVE;
+//
+typedef BOPCol_TBBContextFunctor
+ <BOPAlgo_PVE,
+ BOPAlgo_VectorOfPVE,
+ Handle_BOPInt_Context,
+ BOPInt_Context> BOPAlgo_PVEFunctor;
+//
+typedef BOPCol_TBBContextCnt
+ <BOPAlgo_PVEFunctor,
+ BOPAlgo_VectorOfPVE,
+ Handle_BOPInt_Context> BOPAlgo_PVECnt;
+/////////////////////////////////////////////////////////////////////////
//=======================================================================
// function: PerformEE
// purpose:
}
}
}
- //
// 5
// 5.1 Compute Extra Paves and
// 5.2. Add Extra Paves to the PaveBlocks
+ //-------------------------------------------------------------
+ Standard_Integer k, aNbVPVE;
+ BOPAlgo_VectorOfPVE aVPVE;
+ //
aNb=aMPBLI.Extent();
for(i=1; i<=aNb; ++i) {
Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
nVx=aItLI.Value();
const TopoDS_Vertex& aVx=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
//
- iFlag=myContext->ComputeVE (aVx, aE, aT);
- if (!iFlag) {
- aPave.SetIndex(nVx);
- aPave.SetParameter(aT);
- aPB->AppendExtPave(aPave);
- }
+ BOPAlgo_PVE& aPVE=aVPVE.Append1();
+ aPVE.SetIndices(nVx, nE);
+ aPVE.SetVertex(aVx);
+ aPVE.SetEdge(aE);
+ aPVE.SetPaveBlock(aPB);
+ }
+ }
+ //
+ aNbVPVE=aVPVE.Extent();
+ //=============================================================
+ BOPAlgo_PVECnt::Perform(myRunParallel, aVPVE, myContext);
+ //=============================================================
+ //
+ for (k=0; k < aNbVPVE; ++k) {
+ BOPAlgo_PVE& aPVE=aVPVE(k);
+ iFlag=aPVE.Flag();
+ if (!iFlag) {
+ aPVE.Indices(nVx, nE);
+ aT=aPVE.Parameter();
+ Handle(BOPDS_PaveBlock)& aPB=aPVE.PaveBlock();
+ //
+ aPave.SetIndex(nVx);
+ aPave.SetParameter(aT);
+ aPB->AppendExtPave(aPave);
}
}
// 6 Split PaveBlocksa
//
return iRet;
}
-
//=======================================================================
//function : TreatNewVertices
//purpose :
(const BOPCol_IndexedDataMapOfShapeInteger& aMapVI,
BOPCol_IndexedDataMapOfShapeListOfShape& myImages)
{
- Standard_Integer j, i, aNbV, aNbVSD;
+ Standard_Integer i, aNbV;//, aNbVSD;
Standard_Real aTol;
- TopoDS_Shape aVF;
TopoDS_Vertex aVnew;
+ TopoDS_Shape aVF;
BOPCol_IndexedMapOfShape aMVProcessed;
-
+ BOPCol_MapOfInteger aMFence;
BOPCol_ListIteratorOfListOfInteger aIt;
- BOPCol_IndexedDataMapOfShapeListOfShape aMVLV;
- BOPCol_DataMapOfIntegerShape aMIS;
- BOPCol_IndexedDataMapOfShapeBox aMSB;
+ BOPCol_DataMapOfShapeListOfShape aDMVLV;
+ BOPCol_DataMapIteratorOfDataMapOfShapeListOfShape aItDMVLV;
//
BOPCol_BoxBndTreeSelector aSelector;
BOPCol_BoxBndTree aBBTree;
- NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
+ NCollection_UBTreeFiller <Standard_Integer,
+ Bnd_Box> aTreeFiller(aBBTree);
+ BOPAlgo_VectorOfTNV aVTNV;
//
aNbV = aMapVI.Extent();
for (i=1; i<=aNbV; ++i) {
- const TopoDS_Shape& aV=aMapVI.FindKey(i);
+ const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMapVI.FindKey(i));
Bnd_Box aBox;
//
- aTol=BRep_Tool::Tolerance(*(TopoDS_Vertex*)(&aV));
+ aTol=BRep_Tool::Tolerance(aV);
aBox.SetGap(aTol);
- BRepBndLib::Add(aV, aBox);
+ aBox.Add(BRep_Tool::Pnt(aV));
+ aBox.Enlarge(aTol);
//
aTreeFiller.Add(i, aBox);
//
- aMIS.Bind(i, aV);
- aMSB.Add(aV, aBox);
+ BOPAlgo_TNV& aTNV=aVTNV.Append1();
+ aTNV.SetTree(aBBTree);
+ aTNV.SetBox(aBox);
+ aTNV.SetVertex(aV);
}
//
aTreeFiller.Fill();
-
+ //
+ //===========================================
+ BOPAlgo_TNVCnt::Perform(myRunParallel, aVTNV);
+ //===========================================
+ //
// Chains
for (i=1; i<=aNbV; ++i) {
- const TopoDS_Shape& aV=aMapVI.FindKey(i);
- //
- if (aMVProcessed.Contains(aV)) {
+ if (!aMFence.Add(i)) {
continue;
}
//
- Standard_Integer aNbIP, aIP, aNbIP1, aIP1;
+ Standard_Integer aIP, aNbIP1, aIP1;
BOPCol_ListOfShape aLVSD;
- BOPCol_MapOfInteger aMIP, aMIP1, aMIPC;
- BOPCol_MapIteratorOfMapOfInteger aIt1;
+ BOPCol_MapIteratorOfMapOfInteger aItMI;
+ BOPCol_ListOfInteger aLIP, aLIP1, aLIPC;
+ BOPCol_ListIteratorOfListOfInteger aItLIP;
//
- aMIP.Add(i);
+ aLIPC.Append(i);
+ aLIP.Append(i);
for(;;) {
- aNbIP=aMIP.Extent();
- aIt1.Initialize(aMIP);
- for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- if (aMIPC.Contains(aIP)) {
- continue;
- }
- //
- const TopoDS_Shape& aVP=aMIS.Find(aIP);
- const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
+ aItLIP.Initialize(aLIP);
+ for(; aItLIP.More(); aItLIP.Next()) {
+ aIP=aItLIP.Value();
//
- aSelector.Clear();
- aSelector.SetBox(aBoxVP);
- //
- aNbVSD=aBBTree.Select(aSelector);
- if (!aNbVSD) {
- continue; // it must not be
- }
- //
- const BOPCol_ListOfInteger& aLI=aSelector.Indices();
+ BOPAlgo_TNV& aTNV=aVTNV(aIP-1);
+ const BOPCol_ListOfInteger& aLI=aTNV.Indices();
aIt.Initialize(aLI);
for (; aIt.More(); aIt.Next()) {
aIP1=aIt.Value();
- if (aMIP.Contains(aIP1)) {
+ if (!aMFence.Add(aIP1)) {
continue;
}
- aMIP1.Add(aIP1);
+ aLIP1.Append(aIP1);
} //for (; aIt.More(); aIt.Next()) {
}//for(; aIt1.More(); aIt1.Next()) {
//
- aNbIP1=aMIP1.Extent();
+ aNbIP1=aLIP1.Extent();
if (!aNbIP1) {
- break; // from while(1)
+ break; // from for(;;)
}
//
- aIt1.Initialize(aMIP);
- for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- aMIPC.Add(aIP);
+ aLIP.Clear();
+ aItLIP.Initialize(aLIP1);
+ for(; aItLIP.More(); aItLIP.Next()) {
+ aIP=aItLIP.Value();
+ aLIP.Append(aIP);
+ aLIPC.Append(aIP);
}
- //
- aMIP.Clear();
- aIt1.Initialize(aMIP1);
- for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- aMIP.Add(aIP);
- }
- aMIP1.Clear();
- }// while(1)
- //...
- aNbIP=aMIPC.Extent();
- if (!aNbIP) {
- aMIPC.Add(i);
- }
+ aLIP1.Clear();
+ }// for(;;) {
//
- aIt1.Initialize(aMIPC);
- for(j=0; aIt1.More(); aIt1.Next(), ++j) {
- aIP=aIt1.Key();
- const TopoDS_Shape& aVP=aMIS.Find(aIP);
- if (!j) {
- aVF=aVP;
- }
+ aItLIP.Initialize(aLIPC);
+ for(; aItLIP.More(); aItLIP.Next()) {
+ aIP=aItLIP.Value();
+ const TopoDS_Vertex& aVP=aVTNV(aIP-1).Vertex();
aLVSD.Append(aVP);
- aMVProcessed.Add(aVP);
}
- aMVLV.Add(aVF, aLVSD);
+ aVF=aLVSD.First();
+ aDMVLV.Bind(aVF, aLVSD);
}// for (i=1; i<=aNbV; ++i) {
// Make new vertices
- aNbV=aMVLV.Extent();
- for (i=1; i<=aNbV; ++i) {
- const TopoDS_Shape& aV=aMVLV.FindKey(i);
- BOPCol_ListOfShape& aLVSD=aMVLV.ChangeFromIndex(i);
- aNbVSD=aLVSD.Extent();
- if (aNbVSD>1) {
- BOPTools_AlgoTools::MakeVertex(aLVSD, aVnew);
- myImages.Add(aVnew, aLVSD);
- } else {
+ aItDMVLV.Initialize(aDMVLV);
+ for(; aItDMVLV.More(); aItDMVLV.Next()) {
+ const TopoDS_Shape& aV=aItDMVLV.Key();
+ const BOPCol_ListOfShape& aLVSD=aItDMVLV.Value();
+ if (aLVSD.IsEmpty()) {
myImages.Add(aV, aLVSD);
}
+ else {
+ BOPCol_ListOfShape* pLVSD=(BOPCol_ListOfShape*)&aLVSD;
+ BOPTools_AlgoTools::MakeVertex(*pLVSD, aVnew);
+ myImages.Add(aVnew, aLVSD);
+ }
}
}
-
//=======================================================================
//function : FillShrunkData
//purpose :
#include <BOPCol_ListOfInteger.hxx>
#include <BOPCol_IndexedMapOfInteger.hxx>
#include <BOPCol_DataMapOfIntegerReal.hxx>
+#include <BOPCol_NCVector.hxx>
+#include <BOPCol_TBB.hxx>
#include <BOPInt_Context.hxx>
#include <BOPInt_Tools.hxx>
const BRepAdaptor_Surface& aBAS2,
Standard_Real& aTolFF);
+/////////////////////////////////////////////////////////////////////////
+//=======================================================================
+//class : BOPAlgo_FaceFace
+//purpose :
+//=======================================================================
+class BOPAlgo_FaceFace : public IntTools_FaceFace {
+ public:
+ BOPAlgo_FaceFace()
+ : IntTools_FaceFace(), myIF1(-1), myIF2(-1), myTolFF(1.e-7) {
+ }
+ //
+ ~BOPAlgo_FaceFace() {
+ }
+ //
+ void SetIndices(const Standard_Integer nF1,
+ const Standard_Integer nF2) {
+ myIF1=nF1;
+ myIF2=nF2;
+ }
+ //
+ void Indices(Standard_Integer& nF1,
+ Standard_Integer& nF2) const {
+ nF1=myIF1;
+ nF2=myIF2;
+ }
+ //
+ void SetFaces(const TopoDS_Face& aF1,
+ const TopoDS_Face& aF2) {
+ myF1=aF1;
+ myF2=aF2;
+ }
+ //
+ const TopoDS_Face& Face1()const {
+ return myF1;
+ }
+ //
+ const TopoDS_Face& Face2()const {
+ return myF2;
+ }
+ //
+ void SetTolFF(const Standard_Real aTolFF) {
+ myTolFF=aTolFF;
+ }
+ //
+ Standard_Real TolFF() const{
+ return myTolFF;
+ }
+ //
+ void Perform() {
+ IntTools_FaceFace::Perform(myF1, myF2);
+ }
+ //
+ protected:
+ Standard_Integer myIF1;
+ Standard_Integer myIF2;
+ Standard_Real myTolFF;
+ TopoDS_Face myF1;
+ TopoDS_Face myF2;
+};
+//
+//=======================================================================
+typedef BOPCol_NCVector
+ <BOPAlgo_FaceFace> BOPAlgo_VectorOfFaceFace;
+//
+typedef BOPCol_TBBFunctor
+ <BOPAlgo_FaceFace,
+ BOPAlgo_VectorOfFaceFace> BOPAlgo_FaceFaceFunctor;
+//
+typedef BOPCol_TBBCnt
+ <BOPAlgo_FaceFaceFunctor,
+ BOPAlgo_VectorOfFaceFace> BOPAlgo_FaceFaceCnt;
+/////////////////////////////////////////////////////////////////////////
//=======================================================================
//function : PerformFF
//purpose :
Standard_Boolean bJustAdd, bApp, bCompC2D1, bCompC2D2, bIsDone;
Standard_Boolean bToSplit, bTangentFaces;
Standard_Integer nF1, nF2, aNbCurves, aNbPoints, iX, i, iP, iC, aNbLP;
+ Standard_Integer aNbFaceFace, k;
Standard_Real aApproxTol, aTolR3D, aTolR2D, aTolFF;
BRepAdaptor_Surface aBAS1, aBAS2;
BOPCol_MapOfInteger aMI;
+ BOPAlgo_VectorOfFaceFace aVFaceFace;
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aFFs.SetStartSize(iSize);
}
}
//
- IntTools_FaceFace aFaceFace;
+ ToleranceFF(aBAS1, aBAS2, aTolFF);
+ //
+ BOPAlgo_FaceFace& aFaceFace=aVFaceFace.Append1();
+ //
+ aFaceFace.SetIndices(nF1, nF2);
+ aFaceFace.SetFaces(aF1, aF2);
+ aFaceFace.SetTolFF(aTolFF);
//
IntSurf_ListOfPntOn2S aListOfPnts;
GetEFPnts(nF1, nF2, aListOfPnts);
if (aNbLP) {
aFaceFace.SetList(aListOfPnts);
}
-
+ //
aFaceFace.SetParameters(bApp, bCompC2D1, bCompC2D2, aApproxTol);
//
- aFaceFace.Perform(aF1, aF2);
+ //aFaceFace.Perform(aF1, aF2);
+ }//for (; myIterator->More(); myIterator->Next()) {
+ //
+ aNbFaceFace=aVFaceFace.Extent();
+ //======================================================
+ BOPAlgo_FaceFaceCnt::Perform(myRunParallel, aVFaceFace);
+ //======================================================
+ //
+ for (k=0; k < aNbFaceFace; ++k) {
+ BOPAlgo_FaceFace& aFaceFace=aVFaceFace(k);
+ //
+ aFaceFace.Indices(nF1, nF2);
+ aTolFF=aFaceFace.TolFF();
//
bIsDone=aFaceFace.IsDone();
if (bIsDone) {
aTolR2D=aFaceFace.TolReached2d();
bTangentFaces=aFaceFace.TangentFaces();
//
- ToleranceFF(aBAS1, aBAS2, aTolFF);
- //
if (aTolR3D < aTolFF){
aTolR3D=aTolFF;
}
aNbPoints=0;
aFF.Init(aNbCurves, aNbPoints);
}
- }// for (; myIterator->More(); myIterator->Next()) {
+ }// for (k=0; k < aNbFaceFace; ++k) {
}
//=======================================================================
//function : MakeBlocks
class Iterator from BOPDS
- ---Purpose:
- -- The class BOPDS_Iterator is
- -- 1.to compute intersections between BRep sub-shapes
- -- of arguments of an operation (see the class BOPDS_DS)
- -- in terms of theirs bounding boxes
- -- 2.provides interface to iterare the pairs of
- -- intersected sub-shapes of given type
+ ---Purpose:
+ -- The class BOPDS_Iterator is
+ -- 1.to compute intersections between BRep sub-shapes
+ -- of arguments of an operation (see the class BOPDS_DS)
+ -- in terms of theirs bounding boxes
+ -- 2.provides interface to iterare the pairs of
+ -- intersected sub-shapes of given type
uses
BaseAllocator from BOPCol,
ListIteratorOfListOfPassKeyBoolean from BOPDS,
VectorOfListOfPassKeyBoolean from BOPDS
---raises
is
Create
- returns Iterator from BOPDS;
+ returns Iterator from BOPDS;
---C++: alias "Standard_EXPORT virtual ~BOPDS_Iterator();"
- ---Purpose:
- --- Empty contructor
- ---
-
+ ---Purpose:
+ --- Empty contructor
+ ---
+
Create (theAllocator: BaseAllocator from BOPCol)
- returns Iterator from BOPDS;
- ---Purpose:
- --- Contructor
- --- theAllocator - the allocator to manage the memory
- ---
-
+ returns Iterator from BOPDS;
+ ---Purpose:
+ --- Contructor
+ --- theAllocator - the allocator to manage the memory
+ ---
+
SetDS(me:out;
- pDS:PDS from BOPDS);
- ---Purpose:
- --- Modifier
- --- Sets the data structure <pDS> to process
-
+ pDS:PDS from BOPDS);
+ ---Purpose:
+ --- Modifier
+ --- Sets the data structure <pDS> to process
+
DS(me)
returns DS from BOPDS;
---C++:return const &
- ---Purpose:
- --- Selector
- --- Returns the data structure
+ ---Purpose:
+ --- Selector
+ --- Returns the data structure
Initialize(me: out;
- theType1: ShapeEnum from TopAbs;
- theType2: ShapeEnum from TopAbs);
- ---Purpose:
- --- Initializes the iterator
- --- theType1 - the first type of shape
- --- theType2 - the second type of shape
+ theType1: ShapeEnum from TopAbs;
+ theType2: ShapeEnum from TopAbs);
+ ---Purpose:
+ --- Initializes the iterator
+ --- theType1 - the first type of shape
+ --- theType2 - the second type of shape
More(me)
- returns Boolean from Standard;
- ---Purpose:
- --- Returns true if still there are pairs
+ returns Boolean from Standard;
+ ---Purpose:
+ --- Returns true if still there are pairs
-- of intersected shapes
Next(me:out);
- ---Purpose:
- --- Moves iterations ahead
+ ---Purpose:
+ --- Moves iterations ahead
Value(me;
- theIndex1:out Integer from Standard;
- theIndex2:out Integer from Standard;
- theWithSubShape: out Boolean from Standard);
- ---Purpose:
- --- Returns indices (DS) of intersected shapes
- --- theIndex1 - the index of the first shape
- --- theIndex2 - the index of the second shape
- --- theWithSubShape - flag. True if the sub-shapes of
- --- shapes are intersected
-
+ theIndex1:out Integer from Standard;
+ theIndex2:out Integer from Standard;
+ theWithSubShape: out Boolean from Standard);
+ ---Purpose:
+ --- Returns indices (DS) of intersected shapes
+ --- theIndex1 - the index of the first shape
+ --- theIndex2 - the index of the second shape
+ --- theWithSubShape - flag. True if the sub-shapes of
+ --- shapes are intersected
+
Prepare(me:out)
- is virtual;
- ---Purpose:
- --- Perform the intersection algorithm and prepare
- --- the results to be used
+ is virtual;
+ ---Purpose:
+ --- Perform the intersection algorithm and prepare
+ --- the results to be used
ExpectedLength(me)
- returns Integer from Standard;
- ---Purpose:
- --- Returns the number of intersections founded
-
+ returns Integer from Standard;
+ ---Purpose:
+ --- Returns the number of intersections founded
+
BlockLength(me)
- returns Integer from Standard;
- ---Purpose:
- --- Returns the block length
+ returns Integer from Standard;
+ ---Purpose:
+ --- Returns the block length
Intersect(me:out)
- is virtual protected;
-
+ is virtual protected;
+
+ SetRunParallel(me:out;
+ 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
+
fields
myAllocator: BaseAllocator from BOPCol is protected;
myLength : Integer from Standard is protected;
myDS : PDS from BOPDS is protected;
myLists : VectorOfListOfPassKeyBoolean from BOPDS is protected;
- myIterator : ListIteratorOfListOfPassKeyBoolean from BOPDS is protected;
-
+ myIterator : ListIteratorOfListOfPassKeyBoolean from BOPDS is protected;
+ myRunParallel : Boolean from Standard is protected;
+
end Iterator;
#include <NCollection_BaseAllocator.hxx>
#include <NCollection_UBTreeFiller.hxx>
//
-#include <TopoDS.hxx>
-#include <TopoDS_Vertex.hxx>
#include <TopoDS_Shape.hxx>
//
-#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
-#include <BOPCol_DataMapOfIntegerInteger.hxx>
-#include <BOPCol_DataMapOfIntegerMapOfInteger.hxx>
-#include <BOPCol_MapOfInteger.hxx>
-//
+#include <BOPCol_NCVector.hxx>
+#include <BOPCol_TBB.hxx>
#include <BOPCol_BoxBndTree.hxx>
+//
#include <BOPDS_IndexRange.hxx>
#include <BOPDS_PassKeyBoolean.hxx>
#include <BOPDS_MapOfPassKeyBoolean.hxx>
#include <BOPDS_Tools.hxx>
-#include <BOPDS_MapOfPassKeyBoolean.hxx>
+
+/////////////////////////////////////////////////////////////////////////
+//=======================================================================
+//class : BOPDS_TreeSelector
+//purpose :
+//=======================================================================
+class BOPDS_TSR : public BOPCol_BoxBndTreeSelector{
+ public:
+ BOPDS_TSR() :
+ BOPCol_BoxBndTreeSelector(),
+ myHasBRep(Standard_False),
+ myTree(NULL) {
+ }
+ //
+ virtual ~BOPDS_TSR() {
+ }
+ //
+ void SetHasBRep(const Standard_Boolean bFlag) {
+ myHasBRep=bFlag;
+ }
+ //
+ void SetTree(BOPCol_BoxBndTree& aTree) {
+ myTree=&aTree;
+ }
+ //
+ void Perform() {
+ if (myHasBRep) {
+ myTree->Select(*this);
+ }
+ }
+ //
+ protected:
+ Standard_Boolean myHasBRep;
+ BOPCol_BoxBndTree *myTree;
+};
+//
+//=======================================================================
+typedef BOPCol_NCVector <BOPDS_TSR> BOPDS_VectorOfTSR;
+typedef BOPCol_TBBFunctor <BOPDS_TSR,BOPDS_VectorOfTSR> BOPDS_TSRFunctor;
+typedef BOPCol_TBBCnt <BOPDS_TSRFunctor, BOPDS_VectorOfTSR> BOPDS_TSRCnt;
+/////////////////////////////////////////////////////////////////////////
//=======================================================================
//=======================================================================
BOPDS_Iterator::BOPDS_Iterator()
:
- myAllocator(NCollection_BaseAllocator::CommonBaseAllocator())
+ myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
+ myRunParallel(Standard_False)
{
myDS=NULL;
myLength=0;
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
myAllocator(theAllocator),
- myLists(theAllocator)
+ myLists(theAllocator),
+ myRunParallel(Standard_False)
{
myDS=NULL;
myLength=0;
{
}
//=======================================================================
+//function : SetRunParallel
+//purpose :
+//=======================================================================
+void BOPDS_Iterator::SetRunParallel(const Standard_Boolean theFlag)
+{
+ myRunParallel=theFlag;
+}
+//=======================================================================
+//function : RunParallel
+//purpose :
+//=======================================================================
+Standard_Boolean BOPDS_Iterator::RunParallel()const
+{
+ return myRunParallel;
+}
+//=======================================================================
// function: SetDS
// purpose:
//=======================================================================
// purpose:
//=======================================================================
void BOPDS_Iterator::Initialize(const TopAbs_ShapeEnum aType1,
- const TopAbs_ShapeEnum aType2)
+ const TopAbs_ShapeEnum aType2)
{
Standard_Integer iX;
//
// function: Value
// purpose:
//=======================================================================
-void BOPDS_Iterator::Value(Standard_Integer& theI1,
- Standard_Integer& theI2,
- Standard_Boolean& theWithSubShape) const
+void BOPDS_Iterator::Value
+ (Standard_Integer& theI1,
+ Standard_Integer& theI2,
+ Standard_Boolean& theWithSubShape) const
{
Standard_Integer iT1, iT2, n1, n2;
//
//
theWithSubShape=aPKB.Flag();
}
-
//=======================================================================
// function: Prepare
// purpose:
}
Intersect();
}
+//
//=======================================================================
// function: Intersect
// purpose:
void BOPDS_Iterator::Intersect()
{
Standard_Boolean bFlag;
- Standard_Integer aNb, i, aNbB, aNbR, iTi, iTj;
- Standard_Integer i1, i2, aNbSD, iX, j, iDS, jB, iR;
+ Standard_Integer aNb, i, aNbR, iTi, iTj;
+ Standard_Integer i1, i2, aNbSD, iX, j, iR;
TopAbs_ShapeEnum aTi, aTj;
Handle(NCollection_IncAllocator) aAllocator;
- //
BOPCol_ListIteratorOfListOfInteger aIt;
//
//-----------------------------------------------------scope_1 f
aAllocator=new NCollection_IncAllocator();
//
- BOPCol_DataMapOfShapeInteger aMSI(100, aAllocator);
- BOPCol_DataMapOfIntegerInteger aMII(100, aAllocator);
BOPDS_MapOfPassKeyBoolean aMPKXB(100, aAllocator);
- BOPCol_IndexedDataMapOfShapeBox aMSB(100, aAllocator);
BOPDS_PassKeyBoolean aPKXB;
//
BOPCol_BoxBndTreeSelector aSelector;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
//
aNb=myDS->NbSourceShapes();
+ BOPDS_VectorOfTSR aVTSR(aNb, aAllocator);
+ //
for (i=0; i<aNb; ++i) {
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
- if (aSI.HasBRep()) {
- const TopoDS_Shape& aS=aSI.Shape();
- const Bnd_Box& aBoxEx=aSI.Box();
- aMSI.Bind(aS, i);
- aMSB.Add(aS, aBoxEx);
+ bFlag=aSI.HasBRep();
+ //
+ BOPDS_TSR& aTSR=aVTSR.Append1();
+ //
+ aTSR.SetHasBRep(bFlag);
+ if (!bFlag) {
+ continue;
}
- }
- //
- aNbB=aMSB.Extent();
- for (i=1; i<=aNbB; ++i) {
- const TopoDS_Shape& aS=aMSB.FindKey(i);
- const Bnd_Box& aBoxEx=aMSB(i);
//
- aTreeFiller.Add(i, aBoxEx);
+ const Bnd_Box& aBoxEx=aSI.Box();
+ aTSR.SetTree(aBBTree);
+ aTSR.SetBox(aBoxEx);
//
- iDS=aMSI.Find(aS);
- aMII.Bind(i, iDS);
+ aTreeFiller.Add(i, aBoxEx);
}
//
aTreeFiller.Fill();
//
+ //===========================================
+ BOPDS_TSRCnt::Perform(myRunParallel, aVTSR);
+ //===========================================
+ //
aNbR=myDS->NbRanges()-1;
for (iR=0; iR<aNbR; ++iR) {
const BOPDS_IndexRange& aR=myDS->Range(iR);
const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
//
if (!aSI.HasBRep()){
- continue;
+ continue;
}
//
aTi=aSI.ShapeType();
- const TopoDS_Shape& aSi=aSI.Shape();
- const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi);
- aSelector.Clear();
- aSelector.SetBox(aBoxEx);
+ const Bnd_Box& aBoxi=aSI.Box();
//
- aNbSD=aBBTree.Select(aSelector);
+ BOPDS_TSR& aTSRi=aVTSR(i);
+ const BOPCol_ListOfInteger& aLI=aTSRi.Indices();
+ aNbSD=aLI.Extent();
if (!aNbSD){
- continue;
+ continue;
}
//
- const Bnd_Box& aBoxi=myDS->ShapeInfo(i).Box();
- //
- const BOPCol_ListOfInteger& aLI=aSelector.Indices();
aIt.Initialize(aLI);
for (; aIt.More(); aIt.Next()) {
- jB=aIt.Value(); // box index in MII
- j=aMII.Find(jB); // DS index
- if (j>=i1 && j<=i2) {
- continue;// same range
- }
- //
- const BOPDS_ShapeInfo& aSIj=myDS->ShapeInfo(j);
- aTj=aSIj.ShapeType();
- iTi=BOPDS_Tools::TypeToInteger(aTi);
- iTj=BOPDS_Tools::TypeToInteger(aTj);
- bFlag=Standard_False;
- if (iTi<iTj) {
- bFlag=aSI.HasSubShape(j);
- }
- else if (iTj<iTi) {
- bFlag=aSIj.HasSubShape(i);
- }
- if (bFlag) {
- continue;
- }
- //
- aPKXB.SetIds(i, j);
- if (aMPKXB.Add(aPKXB)) {
- bFlag=Standard_False;// Bounding boxes are intersected
- const Bnd_Box& aBoxj=myDS->ShapeInfo(j).Box();
- if (aBoxi.IsOut(aBoxj)) {
- bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected
- }
- //
- iX=BOPDS_Tools::TypeToInteger(aTi, aTj);
- aPKXB.SetFlag(bFlag);
- myLists(iX).Append(aPKXB);
- }// if (aMPKXB.Add(aPKXB)) {
+ j=aIt.Value(); // DS index
+ if (j>=i1 && j<=i2) {
+ continue;// same range
+ }
+ //
+ const BOPDS_ShapeInfo& aSIj=myDS->ShapeInfo(j);
+ aTj=aSIj.ShapeType();
+ iTi=BOPDS_Tools::TypeToInteger(aTi);
+ iTj=BOPDS_Tools::TypeToInteger(aTj);
+ //
+ bFlag=Standard_False;
+ if (iTi<iTj) {
+ bFlag=aSI.HasSubShape(j);
+ }
+ else if (iTj<iTi) {
+ bFlag=aSIj.HasSubShape(i);
+ }
+ if (bFlag) {
+ continue;
+ }
+ //
+ aPKXB.SetIds(i, j);
+ if (aMPKXB.Add(aPKXB)) {
+ bFlag=Standard_False;// Bounding boxes are intersected
+ const Bnd_Box& aBoxj=aSIj.Box();
+ if (aBoxi.IsOut(aBoxj)) {
+ bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected
+ }
+ //
+ iX=BOPDS_Tools::TypeToInteger(aTi, aTj);
+ aPKXB.SetFlag(bFlag);
+ myLists(iX).Append(aPKXB);
+ }// if (aMPKXB.Add(aPKXB)) {
}// for (; aIt.More(); aIt.Next()) {
}//for (i=i1; i<=i2; ++i) {
}//for (iR=1; iR<aNbR; ++iR) {
//
- aMSI.Clear();
- aMII.Clear();
aMPKXB.Clear();
- aMSB.Clear();
- //
+ aVTSR.Clear();
aAllocator.Nullify();
//-----------------------------------------------------scope_1 t
}