mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0024639: Parallelization FillDS part of BO
The contents dealing with: Parallel computation of Face/Face interferences; Parallel computation of Edge/Edge interferences (Post-Treatment Level); Parallel intersection of bounding boxes (BOPDS_Iterator Level).
This commit is contained in:
@@ -145,6 +145,7 @@ void BOPAlgo_PaveFiller::Init()
|
||||
//
|
||||
// 2.myIterator
|
||||
myIterator=new BOPDS_Iterator(myAllocator);
|
||||
myIterator->SetRunParallel(myRunParallel);
|
||||
myIterator->SetDS(myDS);
|
||||
myIterator->Prepare();
|
||||
//
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
//
|
||||
#include <BOPCol_DataMapOfShapeInteger.hxx>
|
||||
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
|
||||
#include <BOPCol_DataMapOfIntegerShape.hxx>
|
||||
#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
|
||||
#include <BOPCol_BoxBndTree.hxx>
|
||||
@@ -64,6 +65,7 @@
|
||||
//
|
||||
#include <BOPAlgo_Tools.hxx>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//=======================================================================
|
||||
//class : BOPAlgo_EdgeEdge
|
||||
//purpose :
|
||||
@@ -110,6 +112,147 @@ typedef BOPCol_TBBCnt
|
||||
<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:
|
||||
@@ -492,10 +635,13 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// 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);
|
||||
@@ -508,14 +654,32 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
|
||||
nVx=aItLI.Value();
|
||||
const TopoDS_Vertex& aVx=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
|
||||
//
|
||||
iFlag=myContext->ComputeVE (aVx, aE, aT);
|
||||
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
|
||||
aNb=aMPBLI.Extent();
|
||||
for(i=1; i<=aNb; ++i) {
|
||||
@@ -533,7 +697,6 @@ Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE
|
||||
//
|
||||
return iRet;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TreatNewVertices
|
||||
//purpose :
|
||||
@@ -542,136 +705,117 @@ void BOPAlgo_PaveFiller::TreatNewVertices
|
||||
(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;
|
||||
}
|
||||
aItLIP.Initialize(aLIP);
|
||||
for(; aItLIP.More(); aItLIP.Next()) {
|
||||
aIP=aItLIP.Value();
|
||||
//
|
||||
const TopoDS_Shape& aVP=aMIS.Find(aIP);
|
||||
const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
|
||||
//
|
||||
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);
|
||||
}
|
||||
aLIP1.Clear();
|
||||
}// for(;;) {
|
||||
//
|
||||
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);
|
||||
}
|
||||
//
|
||||
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 :
|
||||
|
@@ -62,6 +62,8 @@
|
||||
#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>
|
||||
@@ -94,6 +96,78 @@ static void ToleranceFF(const BRepAdaptor_Surface& aBAS1,
|
||||
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 :
|
||||
@@ -114,9 +188,11 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
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);
|
||||
@@ -165,7 +241,13 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
}
|
||||
}
|
||||
//
|
||||
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);
|
||||
@@ -173,10 +255,22 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
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) {
|
||||
@@ -184,8 +278,6 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
aTolR2D=aFaceFace.TolReached2d();
|
||||
bTangentFaces=aFaceFace.TangentFaces();
|
||||
//
|
||||
ToleranceFF(aBAS1, aBAS2, aTolFF);
|
||||
//
|
||||
if (aTolR3D < aTolFF){
|
||||
aTolR3D=aTolFF;
|
||||
}
|
||||
@@ -250,7 +342,7 @@ void BOPAlgo_PaveFiller::PerformFF()
|
||||
aNbPoints=0;
|
||||
aFF.Init(aNbCurves, aNbPoints);
|
||||
}
|
||||
}// for (; myIterator->More(); myIterator->Next()) {
|
||||
}// for (k=0; k < aNbFaceFace; ++k) {
|
||||
}
|
||||
//=======================================================================
|
||||
//function : MakeBlocks
|
||||
|
@@ -35,7 +35,6 @@ uses
|
||||
ListIteratorOfListOfPassKeyBoolean from BOPDS,
|
||||
VectorOfListOfPassKeyBoolean from BOPDS
|
||||
|
||||
--raises
|
||||
|
||||
is
|
||||
Create
|
||||
@@ -113,11 +112,22 @@ is
|
||||
Intersect(me:out)
|
||||
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;
|
||||
myRunParallel : Boolean from Standard is protected;
|
||||
|
||||
end Iterator;
|
||||
|
@@ -22,21 +22,57 @@
|
||||
#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;
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//=======================================================================
|
||||
@@ -45,7 +81,8 @@
|
||||
//=======================================================================
|
||||
BOPDS_Iterator::BOPDS_Iterator()
|
||||
:
|
||||
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator())
|
||||
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
|
||||
myRunParallel(Standard_False)
|
||||
{
|
||||
myDS=NULL;
|
||||
myLength=0;
|
||||
@@ -61,7 +98,8 @@ BOPDS_Iterator::BOPDS_Iterator
|
||||
(const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
:
|
||||
myAllocator(theAllocator),
|
||||
myLists(theAllocator)
|
||||
myLists(theAllocator),
|
||||
myRunParallel(Standard_False)
|
||||
{
|
||||
myDS=NULL;
|
||||
myLength=0;
|
||||
@@ -77,6 +115,22 @@ BOPDS_Iterator::~BOPDS_Iterator()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//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:
|
||||
//=======================================================================
|
||||
@@ -154,7 +208,8 @@ void BOPDS_Iterator::Next()
|
||||
// function: Value
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPDS_Iterator::Value(Standard_Integer& theI1,
|
||||
void BOPDS_Iterator::Value
|
||||
(Standard_Integer& theI1,
|
||||
Standard_Integer& theI2,
|
||||
Standard_Boolean& theWithSubShape) const
|
||||
{
|
||||
@@ -175,7 +230,6 @@ void BOPDS_Iterator::Value(Standard_Integer& theI1,
|
||||
//
|
||||
theWithSubShape=aPKB.Flag();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: Prepare
|
||||
// purpose:
|
||||
@@ -195,6 +249,7 @@ void BOPDS_Iterator::Prepare()
|
||||
}
|
||||
Intersect();
|
||||
}
|
||||
//
|
||||
//=======================================================================
|
||||
// function: Intersect
|
||||
// purpose:
|
||||
@@ -202,20 +257,16 @@ void BOPDS_Iterator::Prepare()
|
||||
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;
|
||||
@@ -223,29 +274,32 @@ void BOPDS_Iterator::Intersect()
|
||||
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);
|
||||
const Bnd_Box& aBoxEx=aSI.Box();
|
||||
aTSR.SetTree(aBBTree);
|
||||
aTSR.SetBox(aBoxEx);
|
||||
//
|
||||
aTreeFiller.Add(i, aBoxEx);
|
||||
//
|
||||
iDS=aMSI.Find(aS);
|
||||
aMII.Bind(i, iDS);
|
||||
}
|
||||
//
|
||||
aTreeFiller.Fill();
|
||||
//
|
||||
//===========================================
|
||||
BOPDS_TSRCnt::Perform(myRunParallel, aVTSR);
|
||||
//===========================================
|
||||
//
|
||||
aNbR=myDS->NbRanges()-1;
|
||||
for (iR=0; iR<aNbR; ++iR) {
|
||||
const BOPDS_IndexRange& aR=myDS->Range(iR);
|
||||
@@ -259,23 +313,18 @@ void BOPDS_Iterator::Intersect()
|
||||
}
|
||||
//
|
||||
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;
|
||||
}
|
||||
//
|
||||
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
|
||||
j=aIt.Value(); // DS index
|
||||
if (j>=i1 && j<=i2) {
|
||||
continue;// same range
|
||||
}
|
||||
@@ -284,6 +333,7 @@ void BOPDS_Iterator::Intersect()
|
||||
aTj=aSIj.ShapeType();
|
||||
iTi=BOPDS_Tools::TypeToInteger(aTi);
|
||||
iTj=BOPDS_Tools::TypeToInteger(aTj);
|
||||
//
|
||||
bFlag=Standard_False;
|
||||
if (iTi<iTj) {
|
||||
bFlag=aSI.HasSubShape(j);
|
||||
@@ -298,7 +348,7 @@ void BOPDS_Iterator::Intersect()
|
||||
aPKXB.SetIds(i, j);
|
||||
if (aMPKXB.Add(aPKXB)) {
|
||||
bFlag=Standard_False;// Bounding boxes are intersected
|
||||
const Bnd_Box& aBoxj=myDS->ShapeInfo(j).Box();
|
||||
const Bnd_Box& aBoxj=aSIj.Box();
|
||||
if (aBoxi.IsOut(aBoxj)) {
|
||||
bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected
|
||||
}
|
||||
@@ -311,11 +361,8 @@ void BOPDS_Iterator::Intersect()
|
||||
}//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
|
||||
}
|
||||
|
Reference in New Issue
Block a user