1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0024157: Parallelization of assembly part of BO

The branch CR24157_12 deals with the parallelization of building the solids in case of lot internal faces.
Test case for issue CR24157
This commit is contained in:
pkv 2014-06-26 13:00:17 +04:00 committed by apn
parent 2d2aa6f1a6
commit 465d1fba7c
10 changed files with 501 additions and 145 deletions

View File

@ -14,7 +14,7 @@
// //
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
//
#include <BOPAlgo_BuilderSolid.ixx> #include <BOPAlgo_BuilderSolid.ixx>
// //
#include <NCollection_List.hxx> #include <NCollection_List.hxx>
@ -61,10 +61,13 @@
#include <BOPCol_MapOfShape.hxx> #include <BOPCol_MapOfShape.hxx>
#include <BOPCol_BoxBndTree.hxx> #include <BOPCol_BoxBndTree.hxx>
#include <BOPCol_ListOfInteger.hxx> #include <BOPCol_ListOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
// //
#include <BOPTools.hxx> #include <BOPTools.hxx>
#include <BOPTools_CoupleOfShape.hxx> #include <BOPTools_CoupleOfShape.hxx>
#include <BOPTools_AlgoTools.hxx> #include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools3D.hxx>
// //
#include <IntTools_Context.hxx> #include <IntTools_Context.hxx>
// //
@ -127,14 +130,143 @@ class BOPAlgo_BuilderSolid_ShapeBox {
Bnd_Box myBox; Bnd_Box myBox;
}; };
// //
typedef NCollection_DataMap\ typedef NCollection_DataMap
<Standard_Integer, BOPAlgo_BuilderSolid_ShapeBox, TColStd_MapIntegerHasher> \ <Standard_Integer,
BOPAlgo_DataMapOfIntegerBSSB; BOPAlgo_BuilderSolid_ShapeBox,
TColStd_MapIntegerHasher> BOPAlgo_DataMapOfIntegerBSSB;
// //
typedef BOPAlgo_DataMapOfIntegerBSSB::Iterator \ typedef BOPAlgo_DataMapOfIntegerBSSB::Iterator
BOPAlgo_DataMapIteratorOfDataMapOfIntegerBSSB; BOPAlgo_DataMapIteratorOfDataMapOfIntegerBSSB;
// //
//======================================================================= //=======================================================================
//function : BOPAlgo_FacePnt
//purpose :
//=======================================================================
class BOPAlgo_FacePnt {
public:
BOPAlgo_FacePnt() {
}
//
virtual ~BOPAlgo_FacePnt() {
}
//
void SetFace(const TopoDS_Face& aFace) {
myFace=aFace;
}
//
const TopoDS_Face& Face()const {
return myFace;
}
//
void SetPnt(const gp_Pnt& aPnt) {
myPnt=aPnt;
}
//
const gp_Pnt& Pnt()const {
return myPnt;
}
//
protected:
gp_Pnt myPnt;
TopoDS_Face myFace;
};
//
typedef BOPCol_NCVector
<BOPAlgo_FacePnt> BOPAlgo_VectorOfFacePnt;
//
//=======================================================================
//function : BOPAlgo_FaceSolid
//purpose :
//=======================================================================
class BOPAlgo_FaceSolid : public BOPAlgo_Algo {
public:
DEFINE_STANDARD_ALLOC
BOPAlgo_FaceSolid() :
myIsInternalFace(Standard_False) {
}
//
virtual ~BOPAlgo_FaceSolid() {
}
//
void SetFace(const TopoDS_Face& aFace) {
myFace=aFace;
}
//
const TopoDS_Face& Face()const {
return myFace;
}
//
void SetSolid(const TopoDS_Solid& aSolid) {
mySolid=aSolid;
}
//
const TopoDS_Solid& Solid()const {
return mySolid;
}
//
void SetPnt(const gp_Pnt& aPnt) {
myPnt=aPnt;
}
//
const gp_Pnt& Pnt()const {
return myPnt;
}
void SetContext(const Handle(IntTools_Context)& aContext) {
myContext=aContext;
}
//
const Handle(IntTools_Context)& Context()const {
return myContext;
}
//
Standard_Boolean IsInternalFace() const {
return myIsInternalFace;
}
//
virtual void Perform () {
TopAbs_State aState;
//
BOPAlgo_Algo::UserBreak();
//
aState=BOPTools_AlgoTools::ComputeState(myPnt, mySolid,
1.e-14, myContext);
//
myIsInternalFace=(aState==TopAbs_IN);
}
//
protected:
Standard_Boolean myIsInternalFace;
gp_Pnt myPnt;
TopoDS_Face myFace;
TopoDS_Solid mySolid;
Handle(IntTools_Context) myContext;
};
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_FaceSolid> BOPAlgo_VectorOfFaceSolid;
//
typedef BOPCol_TBBContextFunctor
<BOPAlgo_FaceSolid,
BOPAlgo_VectorOfFaceSolid,
Handle(IntTools_Context),
IntTools_Context> BOPAlgo_FaceSolidFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_FaceSolidFunctor,
BOPAlgo_VectorOfFaceSolid,
Handle(IntTools_Context)> BOPAlgo_FaceSolidCnt;
//
//=======================================================================
typedef NCollection_DataMap
<TopoDS_Shape,
gp_Pnt,
TopTools_ShapeMapHasher> BOPAlgo_DataMapOfShapePnt;
typedef BOPAlgo_DataMapOfShapePnt::Iterator
BOPAlgo_DataMapIteratorOfDataMapOfShapePnt;
//
//=======================================================================
//function : //function :
//purpose : //purpose :
//======================================================================= //=======================================================================
@ -252,7 +384,10 @@ void BOPAlgo_BuilderSolid::PerformShapesToAvoid()
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value(); const TopoDS_Shape& aF=aIt.Value();
if (!myShapesToAvoid.Contains(aF)) { if (!myShapesToAvoid.Contains(aF)) {
BOPTools::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF); BOPTools::MapShapesAndAncestors(aF,
TopAbs_EDGE,
TopAbs_FACE,
aMEF);
} }
} }
aNbE=aMEF.Extent(); aNbE=aMEF.Extent();
@ -442,7 +577,8 @@ void BOPAlgo_BuilderSolid::PerformAreas()
BOPCol_ListIteratorOfListOfInteger aItLI; BOPCol_ListIteratorOfListOfInteger aItLI;
BOPCol_BoxBndTreeSelector aSelector; BOPCol_BoxBndTreeSelector aSelector;
BOPCol_BoxBndTree aBBTree; BOPCol_BoxBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree); NCollection_UBTreeFiller
<Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
BOPAlgo_DataMapOfIntegerBSSB aDMISB(100); BOPAlgo_DataMapOfIntegerBSSB aDMISB(100);
BOPAlgo_DataMapIteratorOfDataMapOfIntegerBSSB aItDMISB; BOPAlgo_DataMapIteratorOfDataMapOfIntegerBSSB aItDMISB;
BOPCol_DataMapOfShapeListOfShape aMSH; BOPCol_DataMapOfShapeListOfShape aMSH;
@ -628,101 +764,206 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes()
return; return;
} }
// //
Standard_Boolean bIsInternalFace;
Standard_Integer k, aNbVFS, aNbSLF, aNbVFP, aNbF, aNbA;
BRep_Builder aBB; BRep_Builder aBB;
TopoDS_Iterator aIt; TopoDS_Iterator aIt;
BOPCol_ListIteratorOfListOfShape aShellIt, aSolidIt; TopExp_Explorer aExp;
BOPCol_MapIteratorOfMapOfShape aItMF; BOPCol_ListIteratorOfListOfShape aItLS;
// BOPCol_MapOfShape aMFs;
BOPCol_MapOfShape aMF, aMFP, aMFx;
BOPCol_IndexedDataMapOfShapeListOfShape aMEF;
BOPCol_ListOfShape aLSI; BOPCol_ListOfShape aLSI;
BOPAlgo_VectorOfFaceSolid aVFS;
BOPAlgo_VectorOfFacePnt aVFP;
BOPCol_ListIteratorOfListOfInteger aItLI;
BOPCol_BoxBndTreeSelector aSelector;
BOPCol_BoxBndTree aBBTree;
NCollection_UBTreeFiller
<Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
// //
// 1. All internal faces aNbA=myAreas.Extent();
aShellIt.Initialize(myLoopsInternal); //
for (; aShellIt.More(); aShellIt.Next()) { // 1. aVFP
const TopoDS_Shape& aShell=aShellIt.Value(); aItLS.Initialize(myLoopsInternal);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aShell=aItLS.Value();
aIt.Initialize(aShell); aIt.Initialize(aShell);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aF=aIt.Value(); const TopoDS_Face& aF=*((TopoDS_Face*)&aIt.Value());
aMF.Add(aF);
}
}
aNbFI=aMF.Extent();
//
// 2 Process solids
aSolidIt.Initialize(myAreas);
for ( ; aSolidIt.More(); aSolidIt.Next()) {
TopoDS_Solid& aSolid=(*(TopoDS_Solid*)(&aSolidIt.Value()));
//
TopExp_Explorer anExpSol(aSolid, TopAbs_FACE);;
for (; anExpSol.More(); anExpSol.Next()) {
const TopoDS_Shape& aF = anExpSol.Current();
TopoDS_Shape aFF=aF;
// //
aFF.Orientation(TopAbs_FORWARD); if (aMFs.Add(aF)) {
aMFx.Add(aFF); gp_Pnt aP;
aFF.Orientation(TopAbs_REVERSED); gp_Pnt2d aP2D;
aMFx.Add(aFF); //
} if (aNbA) {
aMEF.Clear(); BOPTools_AlgoTools3D::PointInFace(aF, aP, aP2D, myContext);
BOPTools::MapShapesAndAncestors(aSolid,
TopAbs_EDGE, TopAbs_FACE,
aMEF);
//
// 2.1 Separate faces to process aMFP
aMFP.Clear();
aItMF.Initialize(aMF);
for (; aItMF.More(); aItMF.Next()) {
const TopoDS_Face& aF=(*(TopoDS_Face*)(&aItMF.Key()));
if (!aMFx.Contains(aF)) {
if (BOPTools_AlgoTools::IsInternalFace(aF,
aSolid,
aMEF,
1.e-14,
myContext)) {
aMFP.Add(aF);
} }
//
BOPAlgo_FacePnt& aFP=aVFP.Append1();
aFP.SetFace(aF);
aFP.SetPnt(aP);
} }
} }
aMFx.Clear(); }
//
if (!aNbA) {
// 7b. "Rest" faces treatment
TopoDS_Solid aSolid;
aBB.MakeSolid(aSolid);
//
MakeInternalShells(aMFs, aLSI);
//
aItLS.Initialize(aLSI);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSI=aItLS.Value();
aBB.Add (aSolid, aSI);
}
myAreas.Append(aSolid);
//
return; // =>
}//if (!aNbA) {
//
// 2. Prepare TreeFiller
aNbVFP=aVFP.Extent();
for(k=0; k<aNbVFP; ++k) {
Bnd_Box aBox;
//
const BOPAlgo_FacePnt& aFP=aVFP(k);
const TopoDS_Face& aF=aFP.Face();
//
BRepBndLib::Add(aF, aBox);
aTreeFiller.Add(k, aBox);
}
//
aTreeFiller.Fill();
//
// 3. Face/Solid candidates: aVFS
aItLS.Initialize(myAreas);
for (; aItLS.More(); aItLS.Next()) {
Bnd_Box aBox;
//
TopoDS_Solid& aSolid=(*(TopoDS_Solid*)(&aItLS.Value()));
BRepBndLib::Add(aSolid, aBox);
//
aMFs.Clear();
aExp.Init(aSolid, TopAbs_FACE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aFs=aExp.Current();
aMFs.Add(aFs);
}
//
aSelector.Clear();
aSelector.SetBox(aBox);
//
aNbF=aBBTree.Select(aSelector);
//
const BOPCol_ListOfInteger& aLI=aSelector.Indices();
aItLI.Initialize(aLI);
for (; aItLI.More(); aItLI.Next()) {
k=aItLI.Value();
const BOPAlgo_FacePnt& aFP=aVFP(k);
const TopoDS_Face& aF=aFP.Face();
if (aMFs.Contains(aF)) {
continue;
}
//
const gp_Pnt& aP=aFP.Pnt();
//
BOPAlgo_FaceSolid& aFS=aVFS.Append1();
aFS.SetPnt(aP);
aFS.SetFace(aF);
aFS.SetSolid(aSolid);
}
}
//
aNbVFS=aVFS.Extent();
if (!aNbVFS) {
return;
}
// 4. Refine candidares
//=============================================================
BOPAlgo_FaceSolidCnt::Perform(myRunParallel, aVFS, myContext);
//=============================================================
//
// 5. Solid/Faces: aMSLF
BOPCol_IndexedDataMapOfShapeListOfShape aMSLF;
BOPCol_MapOfShape aMFProcessed;
//
for (k=0; k < aNbVFS; ++k) {
const BOPAlgo_FaceSolid& aFS=aVFS(k);
//
const TopoDS_Solid& aSolid=aFS.Solid();
const TopoDS_Face& aF=aFS.Face();
//
bIsInternalFace=aFS.IsInternalFace();
if (!bIsInternalFace) {
continue;
}
//
if (aMSLF.Contains(aSolid)) {
BOPCol_ListOfShape& aLF=aMSLF.ChangeFromKey(aSolid);
aLF.Append(aF);
}
else {
BOPCol_ListOfShape aLF;
//
aLF.Append(aF);
aMSLF.Add(aSolid, aLF);
}
}// for (k=0; k < aNbVE; ++k) {
//
// 6. Update Solids by internal Faces
aNbSLF=aMSLF.Extent();
for (k=1; k <= aNbSLF; ++k) {
const TopoDS_Shape& aSolid=aMSLF.FindKey(k);
TopoDS_Shape *pSolid=(TopoDS_Shape*)&aSolid;
//
const BOPCol_ListOfShape& aLF=aMSLF(k);
//
aMFs.Clear();
aItLS.Initialize(aLF);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aF=aItLS.Value();
aMFs.Add(aF);
aMFProcessed.Add(aF);
}
// //
// 2.2 Make Internal Shells
aLSI.Clear(); aLSI.Clear();
MakeInternalShells(aMFP, aLSI); MakeInternalShells(aMFs, aLSI);
// //
// 2.3 Add them to aSolid aItLS.Initialize(aLSI);
aShellIt.Initialize(aLSI); for (; aItLS.More(); aItLS.Next()) {
for (; aShellIt.More(); aShellIt.Next()) { const TopoDS_Shape& aSI=aItLS.Value();
const TopoDS_Shape& aSI=aShellIt.Value(); aBB.Add (*pSolid, aSI);
aBB.Add (aSolid, aSI);
} }
}
//
// 7. "Rest" faces treatment (if there are)
aMFs.Clear();
for (k=0; k < aNbVFS; ++k) {
const BOPAlgo_FaceSolid& aFS=aVFS(k);
// //
// 2.4 Remove faces aMFP from aMF const TopoDS_Face& aF=aFS.Face();
aItMF.Initialize(aMFP); if (!aMFProcessed.Contains(aF)) {
for (; aItMF.More(); aItMF.Next()) { aMFs.Add(aF);
const TopoDS_Shape& aF=aItMF.Key();
aMF.Remove(aF);
} }
// }
aNbFI=aMF.Extent(); //
if (!aNbFI) { aNbFI=aMFs.Extent();
break;
}
} //for ( ; aSolidIt.More(); aSolidIt.Next()) {
if (aNbFI) { if (aNbFI) {
TopoDS_Solid aSolid; TopoDS_Solid aSolid;
aBB.MakeSolid(aSolid); aBB.MakeSolid(aSolid);
// //
MakeInternalShells(aMF, aLSI); aLSI.Clear();
aShellIt.Initialize(aLSI); MakeInternalShells(aMFs, aLSI);
for (; aShellIt.More(); aShellIt.Next()) { //
const TopoDS_Shape& aSI=aShellIt.Value(); aItLS.Initialize(aLSI);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSI=aItLS.Value();
aBB.Add (aSolid, aSI); aBB.Add (aSolid, aSI);
} }
myAreas.Append(aSolid); myAreas.Append(aSolid);
} }
} }
//======================================================================= //=======================================================================
//function : MakeInternalShells //function : MakeInternalShells
//purpose : //purpose :

View File

@ -14,7 +14,7 @@
// //
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
//
#include <BOPAlgo_Builder.hxx> #include <BOPAlgo_Builder.hxx>
// //
#include <NCollection_IncAllocator.hxx> #include <NCollection_IncAllocator.hxx>
@ -121,11 +121,12 @@ class BOPAlgo_ShapeBox {
Bnd_Box myBox; Bnd_Box myBox;
}; };
// //
typedef NCollection_DataMap\ typedef NCollection_DataMap
<Standard_Integer, BOPAlgo_ShapeBox, TColStd_MapIntegerHasher> \ <Standard_Integer,
BOPAlgo_DataMapOfIntegerShapeBox; BOPAlgo_ShapeBox,
TColStd_MapIntegerHasher> BOPAlgo_DataMapOfIntegerShapeBox;
// //
typedef BOPAlgo_DataMapOfIntegerShapeBox::Iterator \ typedef BOPAlgo_DataMapOfIntegerShapeBox::Iterator
BOPAlgo_DataMapIteratorOfDataMapOfIntegerShapeBox; BOPAlgo_DataMapIteratorOfDataMapOfIntegerShapeBox;
// //
@ -565,6 +566,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.SetRunParallel(myRunParallel);
aBS.SetProgressIndicator(myProgressIndicator); aBS.SetProgressIndicator(myProgressIndicator);
}//for (i=0; i<aNbS; ++i) { }//for (i=0; i<aNbS; ++i) {
// //

View File

@ -16,7 +16,7 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <BOPAlgo_PaveFiller.ixx> #include <BOPAlgo_PaveFiller.ixx>
//
#include <Precision.hxx> #include <Precision.hxx>
#include <NCollection_IncAllocator.hxx> #include <NCollection_IncAllocator.hxx>
#include <Bnd_Box.hxx> #include <Bnd_Box.hxx>
@ -501,7 +501,8 @@ void BOPAlgo_PaveFiller::MakeBlocks()
continue; continue;
} }
// //
bValid2D=myContext->IsValidBlockForFaces(aT1, aT2, aIC, aF1, aF2, aTolR3D); bValid2D=myContext->IsValidBlockForFaces(aT1, aT2, aIC,
aF1, aF2, aTolR3D);
if (!bValid2D) { if (!bValid2D) {
continue; continue;
} }
@ -543,7 +544,8 @@ void BOPAlgo_PaveFiller::MakeBlocks()
const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1))); const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2))); const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
// //
BOPTools_AlgoTools::MakeEdge (aIC, aV1, aT1, aV2, aT2, aTolR3D, aES); BOPTools_AlgoTools::MakeEdge (aIC, aV1, aT1,
aV2, aT2, aTolR3D, aES);
BOPTools_AlgoTools::MakePCurve(aES, aF1, aF2, aIC, BOPTools_AlgoTools::MakePCurve(aES, aF1, aF2, aIC,
mySectionAttribute.PCurveOnS1(), mySectionAttribute.PCurveOnS1(),
mySectionAttribute.PCurveOnS2()); mySectionAttribute.PCurveOnS2());
@ -578,7 +580,8 @@ void BOPAlgo_PaveFiller::MakeBlocks()
aTol = aItMV.Value(); aTol = aItMV.Value();
// //
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV1); const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV1);
const Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*)&aV.TShape()); const Handle(BRep_TVertex)& TV =
*((Handle(BRep_TVertex)*)&aV.TShape());
TV->Tolerance(aTol); TV->Tolerance(aTol);
} }
// //
@ -643,8 +646,6 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
// //
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF(); BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
// //
// <-DEB f
//
// 0 // 0
if (aNbS==1) { if (aNbS==1) {
const TopoDS_Shape& aS=theMSCPB.FindKey(1); const TopoDS_Shape& aS=theMSCPB.FindKey(1);
@ -695,7 +696,7 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
aPF.Perform(); aPF.Perform();
iErr=aPF.ErrorStatus(); iErr=aPF.ErrorStatus();
if (iErr) { if (iErr) {
iRet=1; //iRet=1; //PKVft
return iRet; return iRet;
} }
aPDS=aPF.PDS(); aPDS=aPF.PDS();
@ -833,7 +834,8 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
nV=aPave[j].Index(); nV=aPave[j].Index();
aV=aPDS->Shape(nV); aV=aPDS->Shape(nV);
// //
if (!aMVI.IsBound(aV)) {// index of new vertex in theDS -> iV if (!aMVI.IsBound(aV)) {
// index of new vertex in theDS -> iV
aSI.SetShapeType(TopAbs_VERTEX); aSI.SetShapeType(TopAbs_VERTEX);
aSI.SetShape(aV); aSI.SetShape(aV);
iV=myDS->Append(aSI); iV=myDS->Append(aSI);
@ -844,7 +846,8 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
} }
} }
const BOPDS_Pave& aP1 = !j ? aPB1->Pave1() : aPB1->Pave2(); const BOPDS_Pave& aP1 = !j ? aPB1->Pave1() : aPB1->Pave2();
if (aP1.Parameter() == aPave[j].Parameter() && aP1.Index() != iV) { if (aP1.Parameter() == aPave[j].Parameter() &&
aP1.Index() != iV) {
aDMI.Bind(aP1.Index(), iV); aDMI.Bind(aP1.Index(), iV);
myDS->AddShapeSD(aP1.Index(), iV); myDS->AddShapeSD(aP1.Index(), iV);
} }
@ -889,7 +892,8 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
//function : UpdateFaceInfo //function : UpdateFaceInfo
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPAlgo_PaveFiller::UpdateFaceInfo(BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME) void BOPAlgo_PaveFiller::UpdateFaceInfo
(BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME)
{ {
Standard_Integer i, j, nV1, nF1, nF2, Standard_Integer i, j, nV1, nF1, nF2,
aNbFF, aNbC, aNbP, aNbS, aNbPBIn; aNbFF, aNbC, aNbP, aNbS, aNbPBIn;
@ -1107,10 +1111,15 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo(BOPDS_DataMapOfPaveBlockListOfPaveBlock&
const TopoDS_Edge& aSp=(*(TopoDS_Edge *)(&aSISp.Shape())); const TopoDS_Edge& aSp=(*(TopoDS_Edge *)(&aSISp.Shape()));
const Bnd_Box& aBoxSp=aSISp.Box(); const Bnd_Box& aBoxSp=aSISp.Box();
// //
iFlag1 = (nV11 == nV21 || nV11 == nV22) ? 2 : (!aBoxSp.IsOut(aBoxP1) ? 1 : 0); iFlag1 = (nV11 == nV21 || nV11 == nV22) ? 2 :
iFlag2 = (nV12 == nV21 || nV12 == nV22) ? 2 : (!aBoxSp.IsOut(aBoxP2) ? 1 : 0); (!aBoxSp.IsOut(aBoxP1) ? 1 : 0);
iFlag2 = (nV12 == nV21 || nV12 == nV22) ? 2 :
(!aBoxSp.IsOut(aBoxP2) ? 1 : 0);
if (iFlag1 && iFlag2) { if (iFlag1 && iFlag2) {
if (aBoxSp.IsOut(aBoxPm) || myContext->ComputePE(aPm, theTolR3D, aSp, aTx)) { if (aBoxSp.IsOut(aBoxPm) || myContext->ComputePE(aPm,
theTolR3D,
aSp,
aTx)) {
continue; continue;
} }
// //
@ -1131,7 +1140,6 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo(BOPDS_DataMapOfPaveBlockListOfPaveBlock&
} }
return bRet; return bRet;
} }
//======================================================================= //=======================================================================
//function : PutBoundPaveOnCurve //function : PutBoundPaveOnCurve
//purpose : //purpose :
@ -1237,14 +1245,15 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo(BOPDS_DataMapOfPaveBlockListOfPaveBlock&
//function : PutPavesOnCurve //function : PutPavesOnCurve
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPAlgo_PaveFiller::PutPavesOnCurve(const BOPCol_MapOfInteger& aMVOnIn, void BOPAlgo_PaveFiller::PutPavesOnCurve
const Standard_Real aTolR3D, (const BOPCol_MapOfInteger& aMVOnIn,
BOPDS_Curve& aNC, const Standard_Real aTolR3D,
const Standard_Integer nF1, BOPDS_Curve& aNC,
const Standard_Integer nF2, const Standard_Integer nF1,
const BOPCol_MapOfInteger& aMI, const Standard_Integer nF2,
const BOPCol_MapOfInteger& aMVEF, const BOPCol_MapOfInteger& aMI,
BOPCol_DataMapOfIntegerReal& aMVTol) const BOPCol_MapOfInteger& aMVEF,
BOPCol_DataMapOfIntegerReal& aMVTol)
{ {
Standard_Boolean bInBothFaces; Standard_Boolean bInBothFaces;
Standard_Integer nV; Standard_Integer nV;
@ -1293,10 +1302,11 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo(BOPDS_DataMapOfPaveBlockListOfPaveBlock&
//function : ExtendedTolerance //function : ExtendedTolerance
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance(const Standard_Integer nV, Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance
const BOPCol_MapOfInteger& aMI, (const Standard_Integer nV,
Standard_Real& aTolVExt, const BOPCol_MapOfInteger& aMI,
const Standard_Integer aType) Standard_Real& aTolVExt,
const Standard_Integer aType)
{ {
Standard_Boolean bFound = Standard_False; Standard_Boolean bFound = Standard_False;
if (!(myDS->IsNewShape(nV))) { if (!(myDS->IsNewShape(nV))) {
@ -1328,7 +1338,8 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance(const Standard_Integer nV
BOPDS_Interf *aInt = !k ? (BOPDS_Interf*) (&aEEs(i)) : BOPDS_Interf *aInt = !k ? (BOPDS_Interf*) (&aEEs(i)) :
(BOPDS_Interf*) (&aEFs(i)); (BOPDS_Interf*) (&aEFs(i));
if (aInt->IndexNew() == nV) { if (aInt->IndexNew() == nV) {
if (aMI.Contains(aInt->Index1()) && aMI.Contains(aInt->Index2())) { if (aMI.Contains(aInt->Index1()) &&
aMI.Contains(aInt->Index2())) {
const IntTools_CommonPrt& aComPrt = !k ? aEEs(i).CommonPart() : const IntTools_CommonPrt& aComPrt = !k ? aEEs(i).CommonPart() :
aEFs(i).CommonPart(); aEFs(i).CommonPart();
// //
@ -1377,15 +1388,17 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance(const Standard_Integer nV
const IntTools_CommonPrt& aCP = aEF.CommonPart(); const IntTools_CommonPrt& aCP = aEF.CommonPart();
Standard_Real aPar = aCP.VertexParameter1(); Standard_Real aPar = aCP.VertexParameter1();
const TopoDS_Edge& aE = (*(TopoDS_Edge*)(&myDS->Shape(nE))); const TopoDS_Edge& aE = (*(TopoDS_Edge*)(&myDS->Shape(nE)));
const TopoDS_Face& aFOpposite = (*(TopoDS_Face*)(&myDS->Shape(nFOpposite))); const TopoDS_Face& aFOpposite =
(*(TopoDS_Face*)(&myDS->Shape(nFOpposite)));
// //
const Handle(Geom_Curve)& aCurve = BRep_Tool::Curve(aE, f, l); const Handle(Geom_Curve)& aCurve = BRep_Tool::Curve(aE, f, l);
// //
nF = (nFOpposite == nF1) ? nF2 : nF1; nF = (nFOpposite == nF1) ? nF2 : nF1;
const TopoDS_Face& aF = (*(TopoDS_Face*)(&myDS->Shape(nF))); const TopoDS_Face& aF = (*(TopoDS_Face*)(&myDS->Shape(nF)));
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(aE, aF, f, l); Handle(Geom2d_Curve) aPCurve =
BRep_Tool::CurveOnSurface(aE, aF, f, l);
// //
GeomAPI_ProjectPointOnSurf& aProj = myContext->ProjPS(aFOpposite); GeomAPI_ProjectPointOnSurf& aProj=myContext->ProjPS(aFOpposite);
// //
gp_Pnt aPoint; gp_Pnt aPoint;
aCurve->D0(aPar, aPoint); aCurve->D0(aPar, aPoint);
@ -1427,10 +1440,11 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance(const Standard_Integer nV
//function : ProcessUnUsedVertices //function : ProcessUnUsedVertices
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPAlgo_PaveFiller::PutEFPavesOnCurve(BOPDS_Curve& aNC, void BOPAlgo_PaveFiller::PutEFPavesOnCurve
const BOPCol_MapOfInteger& aMI, (BOPDS_Curve& aNC,
const BOPCol_MapOfInteger& aMVEF, const BOPCol_MapOfInteger& aMI,
BOPCol_DataMapOfIntegerReal& aMVTol) const BOPCol_MapOfInteger& aMVEF,
BOPCol_DataMapOfIntegerReal& aMVTol)
{ {
if (!aMVEF.Extent()) { if (!aMVEF.Extent()) {
return; return;
@ -1477,12 +1491,13 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance(const Standard_Integer nV
//function : ProcessUnUsedVertices //function : ProcessUnUsedVertices
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPAlgo_PaveFiller::PutStickPavesOnCurve(const TopoDS_Face& aF1, void BOPAlgo_PaveFiller::PutStickPavesOnCurve
const TopoDS_Face& aF2, (const TopoDS_Face& aF1,
const BOPCol_MapOfInteger& aMI, const TopoDS_Face& aF2,
BOPDS_Curve& aNC, const BOPCol_MapOfInteger& aMI,
const BOPCol_MapOfInteger& aMVStick, BOPDS_Curve& aNC,
BOPCol_DataMapOfIntegerReal& aMVTol) const BOPCol_MapOfInteger& aMVStick,
BOPCol_DataMapOfIntegerReal& aMVTol)
{ {
BOPCol_MapOfInteger aMV; BOPCol_MapOfInteger aMV;
aMV.Assign(aMVStick); aMV.Assign(aMVStick);
@ -1581,8 +1596,10 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance(const Standard_Integer nV
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF(); BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF(); BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF();
// //
Standard_Integer aNbLines[5] = {aVVs.Extent(), aVEs.Extent(), aEEs.Extent(), Standard_Integer aNbLines[5] = {
aVFs.Extent(), aEFs.Extent()}; aVVs.Extent(), aVEs.Extent(), aEEs.Extent(),
aVFs.Extent(), aEFs.Extent()
};
//collect indices of all shapes from nF1 and nF2. //collect indices of all shapes from nF1 and nF2.
aMI.Clear(); aMI.Clear();
GetFullShapeMap(nF1, aMI); GetFullShapeMap(nF1, aMI);
@ -1593,7 +1610,8 @@ Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance(const Standard_Integer nV
for (i = 0; i < aNbLines[aTypeInt]; ++i) { for (i = 0; i < aNbLines[aTypeInt]; ++i) {
BOPDS_Interf* aInt = (aTypeInt==0) ? (BOPDS_Interf*)(&aVVs(i)) : BOPDS_Interf* aInt = (aTypeInt==0) ? (BOPDS_Interf*)(&aVVs(i)) :
((aTypeInt==1) ? (BOPDS_Interf*)(&aVEs(i)) : ((aTypeInt==1) ? (BOPDS_Interf*)(&aVEs(i)) :
((aTypeInt==2) ? (BOPDS_Interf*)(&aEEs(i)) : (BOPDS_Interf*)(&aVFs(i)))); ((aTypeInt==2) ? (BOPDS_Interf*)(&aEEs(i)) :
(BOPDS_Interf*)(&aVFs(i))));
if (aInt->HasIndexNew()) { if (aInt->HasIndexNew()) {
aInt->Indices(nS1, nS2); aInt->Indices(nS1, nS2);
if(aMI.Contains(nS1) && aMI.Contains(nS2)) { if(aMI.Contains(nS1) && aMI.Contains(nS2)) {
@ -1666,12 +1684,13 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
//function : PutPaveOnCurve //function : PutPaveOnCurve
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPAlgo_PaveFiller::PutPaveOnCurve(const Standard_Integer nV, void BOPAlgo_PaveFiller::PutPaveOnCurve
const Standard_Real aTolR3D, (const Standard_Integer nV,
BOPDS_Curve& aNC, const Standard_Real aTolR3D,
const BOPCol_MapOfInteger& aMI, BOPDS_Curve& aNC,
BOPCol_DataMapOfIntegerReal& aMVTol, const BOPCol_MapOfInteger& aMI,
const Standard_Integer iCheckExtend) BOPCol_DataMapOfIntegerReal& aMVTol,
const Standard_Integer iCheckExtend)
{ {
Standard_Boolean bIsVertexOnLine; Standard_Boolean bIsVertexOnLine;
Standard_Real aT, aTol, aTolNew; Standard_Real aT, aTol, aTolNew;
@ -1769,7 +1788,6 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
} }
} }
} }
//======================================================================= //=======================================================================
//function : UpdateExistingPaveBlocks //function : UpdateExistingPaveBlocks
//purpose : //purpose :
@ -1878,10 +1896,12 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
Standard_Integer nF = (aMPBOn1.Contains(aPBf) || Standard_Integer nF = (aMPBOn1.Contains(aPBf) ||
aMPBIn1.Contains(aPBf)) ? nF2 : nF1; aMPBIn1.Contains(aPBf)) ? nF2 : nF1;
const TopoDS_Face& aF = *(TopoDS_Face*)&myDS->Shape(nF); const TopoDS_Face& aF = *(TopoDS_Face*)&myDS->Shape(nF);
IntTools_Range aShrR(aPB->Pave1().Parameter(), aPB->Pave2().Parameter()); IntTools_Range aShrR(aPB->Pave1().Parameter(),
aPB->Pave2().Parameter());
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(aPB->Edge()); const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(aPB->Edge());
// //
Standard_Boolean bCom = BOPTools_AlgoTools::IsBlockInOnFace(aShrR, aF, aE, myContext); Standard_Boolean bCom =
BOPTools_AlgoTools::IsBlockInOnFace(aShrR, aF, aE, myContext);
if (bCom) { if (bCom) {
if (bCB) { if (bCB) {
aCB = myDS->CommonBlock(aPB); aCB = myDS->CommonBlock(aPB);
@ -1919,7 +1939,6 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
} }
} }
} }
//======================================================================= //=======================================================================
// function: PutClosingPaveOnCurve // function: PutClosingPaveOnCurve
// purpose: // purpose:
@ -1975,7 +1994,6 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
} }
} }
} }
//======================================================================= //=======================================================================
//function : PreparePostTreatFF //function : PreparePostTreatFF
//purpose : //purpose :
@ -2012,9 +2030,9 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC,
//function : CheckPlanes //function : CheckPlanes
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean Standard_Boolean BOPAlgo_PaveFiller::CheckPlanes
BOPAlgo_PaveFiller::CheckPlanes(const Standard_Integer nF1, (const Standard_Integer nF1,
const Standard_Integer nF2)const const Standard_Integer nF2)const
{ {
Standard_Boolean bToIntersect; Standard_Boolean bToIntersect;
Standard_Integer i, nV2, iCnt; Standard_Integer i, nV2, iCnt;
@ -2052,7 +2070,8 @@ Standard_Boolean
//function : UpdatePaveBlocks //function : UpdatePaveBlocks
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPAlgo_PaveFiller::UpdatePaveBlocks(const BOPCol_DataMapOfIntegerInteger& aDMI) void BOPAlgo_PaveFiller::UpdatePaveBlocks
(const BOPCol_DataMapOfIntegerInteger& aDMI)
{ {
if (aDMI.IsEmpty()) { if (aDMI.IsEmpty()) {
return; return;

View File

@ -3,4 +3,4 @@ restore [locate_data_file CTO908_topo106-n.brep] nervure
bfuse result poche nervure bfuse result poche nervure
set square 108943 set square 105275

View File

@ -1,3 +1,4 @@
puts "TODO ?OCC24157 ALL: Error : The area of the resulting shape is"
# cts17861 # cts17861
restore [locate_data_file CTO900_cts17861a.rle] a restore [locate_data_file CTO900_cts17861a.rle] a

View File

@ -1,3 +1,5 @@
puts "TODO ?OCC24925 ALL: Error : The area of the resulting shape is"
restore [locate_data_file a102] a restore [locate_data_file a102] a
restore [locate_data_file b136] b restore [locate_data_file b136] b

View File

@ -1,4 +1,4 @@
puts "TODO OCC24861 ALL: Faulty shapes in variables faulty_1 to faulty_" puts "TODO ?OCC24861 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO OCC24861 ALL: Error : The square of result shape is" puts "TODO OCC24861 ALL: Error : The square of result shape is"
puts "=========" puts "========="

View File

@ -9,7 +9,7 @@ if {[string compare $os "MacOS"] == 0} {
#puts "TODO #23828 MacOS: TEST INCOMPLETE" #puts "TODO #23828 MacOS: TEST INCOMPLETE"
} else { } else {
#puts "TODO OCC12345 ALL: Faulty shapes in variables faulty_1 to faulty_" #puts "TODO OCC12345 ALL: Faulty shapes in variables faulty_1 to faulty_"
#puts "TODO OCC12345 ALL: Error : The square of result shape is" puts "TODO ?OCC12345 ALL: Error : The square of result shape is"
} }
puts "================" puts "================"

View File

@ -0,0 +1,91 @@
puts "============"
puts "OCC24157"
puts "============"
puts ""
############################################
# Parallelization of assembly part of BO
############################################
box b0 10 10 10
box b 12 12 12
explode b f
#--------------------------
# 1
copy b_1 f
ttranslate f 0 -1 -1
set q1 {}
for {set i 1} {$i < 5} {incr i} {
tcopy f fx_$i
ttranslate fx_$i [expr ($i*2)] 0. 0.
lappend q1 fx_$i
}
eval compound $q1 b1
donly b0 b1
#--------------------------
# 2
copy b_3 f
ttranslate f -1 0 -1
set q2 {}
for {set i 1} {$i < 5} {incr i} {
tcopy f fy_$i
ttranslate fy_$i 0. [expr ($i*2)] 0.
lappend q2 fy_$i
}
eval compound $q2 b2
donly b0 b1 b2
#--------------------------
# 3
copy b_5 f
ttranslate f -1 -1 0
set q3 {}
for {set i 1} {$i < 5} {incr i} {
tcopy f fz_$i
ttranslate fz_$i 0. 0. [expr ($i*2)]
lappend q3 fz_$i
}
eval compound $q3 b3
#--------------------------
# 4
box bx .2 .2 .2 1.6 1.6 1.6
explode bx f
set q4 {}
for {set i 0} {$i < 5} {incr i} {
for {set j 0} {$j < 5} {incr j} {
for {set k 0} {$k < 5} {incr k} {
for {set m 1} {$m < 6} {incr m} {
tcopy bx_${m} sx1_${i}_${j}_${k}_${m}
ttranslate sx1_${i}_${j}_${k}_${m} [expr ($i)*2] [expr ($j)*2] [expr ($k)*2].
lappend q4 sx1_${i}_${j}_${k}_${m}
}
}
}
}
eval compound $q4 b4
#--------------------------
bclearobjects; bcleartools;
baddobjects b0
baddcompound b1
baddcompound b2
baddcompound b3
baddcompound b4
bfillds
regexp { +Tps: +([-0-9.+eE]+)} [bbuild result -t] full tps_time
if { $tps_time > 5. } {
puts "Error: low performance"
} else {
puts "OK: high performance"
}
set 2dviewer 1

View File

@ -25,10 +25,10 @@ set nb_v_good 109
set nb_e_good 189 set nb_e_good 189
set nb_w_good 95 set nb_w_good 95
set nb_f_good 88 set nb_f_good 88
set nb_sh_good 11 set nb_sh_good 13
set nb_sol_good 5 set nb_sol_good 5
set nb_compsol_good 0 set nb_compsol_good 0
set nb_compound_good 1 set nb_compound_good 1
set nb_shape_good 498 set nb_shape_good 500
set 2dviewer 1 set 2dviewer 1