1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

0024639: Parallelization FillDS part of BO

Edge/Edge Interferences

Changes:
1. class BOPAlgo_PaveFiller
  - method:
void BOPAlgo_PaveFiller::PerformEE()
the chages provides the parallel computations of
Edge/Edge interferences.

   - auxiliary classes:
    BOPAlgo_EdgeEdge
    BOPAlgo_EdgeEdgeFunctor
    BOPAlgo_EdgeEdgeCnt
have been added.
The classes are auxiliary classes to provide the parallel computations
of Edge/Edge interferences.

2. class BOPTest
-method:
void BOPTest::PartitionCommands(Draw_Interpretor& theCommands)
- static function:
Standard_Integer bfillds(Draw_Interpretor& di,
                         Standard_Integer n,
                         const char** a)
The syntax of the command "bfillds" has been changed.
> bfillds [-s -t]
options:
-s - launch the algorithm in sequential mode
-t - display CPU time

Test case for issue CR24639
This commit is contained in:
pkv 2014-03-06 15:05:58 +04:00 committed by abv
parent decdfc9499
commit a942f2da6a
4 changed files with 406 additions and 182 deletions

View File

@ -45,6 +45,8 @@
#include <BOPCol_DataMapOfIntegerShape.hxx> #include <BOPCol_DataMapOfIntegerShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeBox.hxx> #include <BOPCol_IndexedDataMapOfShapeBox.hxx>
#include <BOPCol_BoxBndTree.hxx> #include <BOPCol_BoxBndTree.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
// //
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
#include <BOPInt_ShrunkRange.hxx> #include <BOPInt_ShrunkRange.hxx>
@ -62,23 +64,101 @@
// //
#include <BOPAlgo_Tools.hxx> #include <BOPAlgo_Tools.hxx>
//=======================================================================
//class : BOPAlgo_EdgeEdge
//purpose :
//=======================================================================
class BOPAlgo_EdgeEdge : public IntTools_EdgeEdge {
public:
BOPAlgo_EdgeEdge()
: IntTools_EdgeEdge() {
};
//
~BOPAlgo_EdgeEdge(){
};
//
void SetPaveBlock1(const Handle(BOPDS_PaveBlock)& aPB) {
myPB1=aPB;
}
//
Handle(BOPDS_PaveBlock)& PaveBlock1() {
return myPB1;
}
//
void SetPaveBlock2(const Handle(BOPDS_PaveBlock)& aPB) {
myPB2=aPB;
}
//
Handle(BOPDS_PaveBlock)& PaveBlock2() {
return myPB2;
}
//
protected:
Handle(BOPDS_PaveBlock) myPB1;
Handle(BOPDS_PaveBlock) myPB2;
};
//
typedef BOPCol_NCVector<BOPAlgo_EdgeEdge> BOPAlgo_VectorOfEdgeEdge;
//
//
//=======================================================================
//class : BOPAlgo_EdgeEdgeFunctor
//purpose :
//=======================================================================
class BOPAlgo_EdgeEdgeFunctor {
protected:
BOPAlgo_VectorOfEdgeEdge* myPVEE;
//
public:
//
BOPAlgo_EdgeEdgeFunctor(BOPAlgo_VectorOfEdgeEdge& aVEE)
: myPVEE(&aVEE) {
}
//
void operator()( const flexible_range<Standard_Size>& aBR ) const{
Standard_Size i, iBeg, iEnd;
//
BOPAlgo_VectorOfEdgeEdge& aVEE=*myPVEE;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
BOPAlgo_EdgeEdge& aEE=aVEE(i);
//
aEE.Perform();
}
}
};
//=======================================================================
//class : BOPAlgo_EdgeEdgeCnt
//purpose :
//=======================================================================
class BOPAlgo_EdgeEdgeCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT
static void Perform(const Standard_Boolean bRunParallel,
BOPAlgo_VectorOfEdgeEdge& aVEdgeEdge) {
//
BOPAlgo_EdgeEdgeFunctor aEEF(aVEdgeEdge);
Standard_Size aNbEE=aVEdgeEdge.Extent();
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Size>(0,aNbEE), aEEF);
}
else {
aEEF.operator()(flexible_range<Standard_Size>(0,aNbEE));
}
}
};
//======================================================================= //=======================================================================
// function: PerformEE // function: PerformEE
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPAlgo_PaveFiller::PerformEE() void BOPAlgo_PaveFiller::PerformEE()
{ {
Standard_Boolean bJustAdd; Standard_Integer iSize;
Standard_Integer i, iX, iSize, nE1, nE2;
Standard_Integer aNbCPrts;
Standard_Real aTS11, aTS12, aTS21, aTS22,
aT11, aT12, aT21, aT22;
TopAbs_ShapeEnum aType;
BOPDS_ListIteratorOfListOfPaveBlock aIt1, aIt2;
Handle(NCollection_IncAllocator) aAllocator;
BOPDS_MapOfPaveBlock aMPBToUpdate;
BOPDS_MapIteratorOfMapOfPaveBlock aItPB;
// //
myErrorStatus=0; myErrorStatus=0;
// //
@ -88,8 +168,17 @@ void BOPAlgo_PaveFiller::PerformEE()
return; return;
} }
// //
Standard_Boolean bJustAdd;
Standard_Integer i, iX, nE1, nE2, aNbCPrts, k, aNbFdgeEdge;
Standard_Real aTS11, aTS12, aTS21, aTS22, aT11, aT12, aT21, aT22;
TopAbs_ShapeEnum aType;
BOPDS_ListIteratorOfListOfPaveBlock aIt1, aIt2;
Handle(NCollection_IncAllocator) aAllocator;
BOPDS_MapOfPaveBlock aMPBToUpdate;
BOPAlgo_VectorOfEdgeEdge aVEdgeEdge;
BOPDS_MapIteratorOfMapOfPaveBlock aItPB;
//
//-----------------------------------------------------scope f //-----------------------------------------------------scope f
aAllocator=new NCollection_IncAllocator();
BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock aMPBLPB(100, aAllocator); BOPDS_IndexedDataMapOfPaveBlockListOfPaveBlock aMPBLPB(100, aAllocator);
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMVCPB(100, aAllocator); BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aMVCPB(100, aAllocator);
// //
@ -149,162 +238,190 @@ void BOPAlgo_PaveFiller::PerformEE()
continue; continue;
} }
// //
IntTools_EdgeEdge anEdgeEdge;
//
aPB1->Range(aT11, aT12); aPB1->Range(aT11, aT12);
aPB2->Range(aT21, aT22); aPB2->Range(aT21, aT22);
// //
BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge.Append1();
//
anEdgeEdge.SetPaveBlock1(aPB1);
anEdgeEdge.SetPaveBlock2(aPB2);
//
anEdgeEdge.SetEdge1(aE1, aT11, aT12); anEdgeEdge.SetEdge1(aE1, aT11, aT12);
anEdgeEdge.SetEdge2(aE2, aT21, aT22); anEdgeEdge.SetEdge2(aE2, aT21, aT22);
// }//for (; aIt2.More(); aIt2.Next()) {
anEdgeEdge.Perform(); }//for (; aIt1.More(); aIt1.Next()) {
if (!anEdgeEdge.IsDone()) { }//for (; myIterator->More(); myIterator->Next()) {
continue; //
} aNbFdgeEdge=aVEdgeEdge.Extent();
// //======================================================
IntTools_Range aR11(aT11, aTS11), aR12(aTS12, aT12), BOPAlgo_EdgeEdgeCnt::Perform(myRunParallel, aVEdgeEdge);
aR21(aT21, aTS21), aR22(aTS22, aT22); //======================================================
// //
const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts(); for (k=0; k < aNbFdgeEdge; ++k) {
aNbCPrts=aCPrts.Length(); Bnd_Box aBB1, aBB2;
for (i=1; i<=aNbCPrts; ++i) { //
const IntTools_CommonPrt& aCPart=aCPrts(i); BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge(k);
aType=aCPart.Type(); if (!anEdgeEdge.IsDone()) {
switch (aType) { continue;
case TopAbs_VERTEX: { }
Standard_Boolean bIsOnPave[4], bFlag; //
Standard_Integer nV[4], j; //--------------------------------------------
Standard_Real aT1, aT2, aTol; Handle(BOPDS_PaveBlock)& aPB1=anEdgeEdge.PaveBlock1();
TopoDS_Vertex aVnew; nE1=aPB1->OriginalEdge();
IntTools_Range aCR1, aCR2; aPB1->Range(aT11, aT12);
// aPB1->ShrunkData(aTS11, aTS12, aBB1);
BOPInt_Tools::VertexParameters(aCPart, aT1, aT2); //
aTol = Precision::Confusion(); Handle(BOPDS_PaveBlock)& aPB2=anEdgeEdge.PaveBlock2();
aCR1 = aCPart.Range1(); nE2=aPB2->OriginalEdge();
aCR2 = aCPart.Ranges2()(1); aPB2->Range(aT21, aT22);
// aPB2->ShrunkData(aTS21, aTS22, aBB2);
//decide to keep the pave or not //
bIsOnPave[0] = BOPInt_Tools::IsOnPave1(aT1, aR11, aTol) || //--------------------------------------------
BOPInt_Tools::IsOnPave1(aR11.First(), aCR1, aTol); IntTools_Range aR11(aT11, aTS11), aR12(aTS12, aT12),
bIsOnPave[1] = BOPInt_Tools::IsOnPave1(aT1, aR12, aTol) || aR21(aT21, aTS21), aR22(aTS22, aT22);
BOPInt_Tools::IsOnPave1(aR12.Last(), aCR1, aTol); //
bIsOnPave[2] = BOPInt_Tools::IsOnPave1(aT2, aR21, aTol) || const IntTools_SequenceOfCommonPrts& aCPrts = anEdgeEdge.CommonParts();
BOPInt_Tools::IsOnPave1(aR21.First(), aCR2, aTol); aNbCPrts=aCPrts.Length();
bIsOnPave[3] = BOPInt_Tools::IsOnPave1(aT2, aR22, aTol) || for (i=1; i<=aNbCPrts; ++i) {
BOPInt_Tools::IsOnPave1(aR22.Last(), aCR2, aTol); const IntTools_CommonPrt& aCPart=aCPrts(i);
// //
aPB1->Indices(nV[0], nV[1]); const TopoDS_Edge& aE1=aCPart.Edge1();
aPB2->Indices(nV[2], nV[3]); const TopoDS_Edge& aE2=aCPart.Edge2();
// //
if((bIsOnPave[0] && bIsOnPave[2]) || (bIsOnPave[0] && bIsOnPave[3]) || aType=aCPart.Type();
(bIsOnPave[1] && bIsOnPave[2]) || (bIsOnPave[1] && bIsOnPave[3])) { switch (aType) {
continue; case TopAbs_VERTEX: {
} Standard_Boolean bIsOnPave[4], bFlag;
// Standard_Integer nV[4], j;
bFlag = Standard_False; Standard_Real aT1, aT2, aTol;
for (j = 0; j < 4; ++j) { TopoDS_Vertex aVnew;
if (bIsOnPave[j]) { IntTools_Range aCR1, aCR2;
//add interf VE(nV[j], nE) //
Handle(BOPDS_PaveBlock)& aPB = (j < 2) ? aPB2 : aPB1; BOPInt_Tools::VertexParameters(aCPart, aT1, aT2);
ForceInterfVE(nV[j], aPB, aMPBToUpdate); aTol = Precision::Confusion();
bFlag = Standard_True; aCR1 = aCPart.Range1();
break; aCR2 = aCPart.Ranges2()(1);
} //
} //decide to keep the pave or not
if (bFlag) { bIsOnPave[0] = BOPInt_Tools::IsOnPave1(aT1, aR11, aTol) ||
continue; BOPInt_Tools::IsOnPave1(aR11.First(), aCR1, aTol);
} bIsOnPave[1] = BOPInt_Tools::IsOnPave1(aT1, aR12, aTol) ||
// BOPInt_Tools::IsOnPave1(aR12.Last(), aCR1, aTol);
BOPTools_AlgoTools::MakeNewVertex(aE1, aT1, aE2, aT2, aVnew); bIsOnPave[2] = BOPInt_Tools::IsOnPave1(aT2, aR21, aTol) ||
// <-LXBR BOPInt_Tools::IsOnPave1(aR21.First(), aCR2, aTol);
{ bIsOnPave[3] = BOPInt_Tools::IsOnPave1(aT2, aR22, aTol) ||
Standard_Integer nVS[2], iFound, k; BOPInt_Tools::IsOnPave1(aR22.Last(), aCR2, aTol);
Standard_Real aTolVx, aTolVnew, aD2, aDT2; //
BOPCol_MapOfInteger aMV; aPB1->Indices(nV[0], nV[1]);
gp_Pnt aPnew, aPx; aPB2->Indices(nV[2], nV[3]);
// //
iFound=0; if((bIsOnPave[0] && bIsOnPave[2]) ||
j=-1; (bIsOnPave[0] && bIsOnPave[3]) ||
aMV.Add(nV[0]); (bIsOnPave[1] && bIsOnPave[2]) ||
aMV.Add(nV[1]); (bIsOnPave[1] && bIsOnPave[3])) {
// continue;
if (aMV.Contains(nV[2])) { }
++j; //
nVS[j]=nV[2]; bFlag = Standard_False;
} for (j = 0; j < 4; ++j) {
if (aMV.Contains(nV[3])) { if (bIsOnPave[j]) {
++j; //add interf VE(nV[j], nE)
nVS[j]=nV[3]; Handle(BOPDS_PaveBlock)& aPB = (j < 2) ? aPB2 : aPB1;
} ForceInterfVE(nV[j], aPB, aMPBToUpdate);
// bFlag = Standard_True;
aTolVnew=BRep_Tool::Tolerance(aVnew);
aPnew=BRep_Tool::Pnt(aVnew);
//
for (k=0; k<=j; ++k) {
const TopoDS_Vertex& aVx= *(TopoDS_Vertex*)&(myDS->Shape(nVS[k]));
aTolVx=BRep_Tool::Tolerance(aVx);
aPx=BRep_Tool::Pnt(aVx);
aD2=aPnew.SquareDistance(aPx);
//
aDT2=100.*(aTolVnew+aTolVx)*(aTolVnew+aTolVx);
//
if (aD2<aDT2) {
iFound=1;
break;
}
}
//
if (iFound) {
continue;
}
}
// 1
iX=aEEs.Append()-1;
BOPDS_InterfEE& aEE=aEEs(iX);
aEE.SetIndices(nE1, nE2);
aEE.SetCommonPart(aCPart);
// 2
myDS->AddInterf(nE1, nE2);
//
BOPDS_CoupleOfPaveBlocks aCPB;
//
aCPB.SetPaveBlocks(aPB1, aPB2);
aCPB.SetIndexInterf(iX);
aMVCPB.Add(aVnew, aCPB);
}//case TopAbs_VERTEX:
break;
//
case TopAbs_EDGE: {
if (aNbCPrts > 1) {
break;
}
//
Standard_Boolean bHasSameBounds;
bHasSameBounds=aPB1->HasSameBounds(aPB2);
if (!bHasSameBounds) {
break;
}
// 1
iX=aEEs.Append()-1;
BOPDS_InterfEE& aEE=aEEs(iX);
aEE.SetIndices(nE1, nE2);
aEE.SetCommonPart(aCPart);
// 2
myDS->AddInterf(nE1, nE2);
//
BOPAlgo_Tools::FillMap(aPB1, aPB2, aMPBLPB, aAllocator);
}//case TopAbs_EDGE
break;
default:
break; break;
}//switch (aType) { }
}//for (i=1; i<=aNbCPrts; i++) { }
// -----------t if (bFlag) {
// continue;
}// for (; aIt2.More(); aIt2.Next()) { }
}// for (; aIt1.More(); aIt1.Next()) { //
} BOPTools_AlgoTools::MakeNewVertex(aE1, aT1, aE2, aT2, aVnew);
// <-LXBR
{
Standard_Integer nVS[2], iFound, k;
Standard_Real aTolVx, aTolVnew, aD2, aDT2;
BOPCol_MapOfInteger aMV;
gp_Pnt aPnew, aPx;
//
iFound=0;
j=-1;
aMV.Add(nV[0]);
aMV.Add(nV[1]);
//
if (aMV.Contains(nV[2])) {
++j;
nVS[j]=nV[2];
}
if (aMV.Contains(nV[3])) {
++j;
nVS[j]=nV[3];
}
//
aTolVnew=BRep_Tool::Tolerance(aVnew);
aPnew=BRep_Tool::Pnt(aVnew);
//
for (k=0; k<=j; ++k) {
const TopoDS_Vertex& aVx= *(TopoDS_Vertex*)&(myDS->Shape(nVS[k]));
aTolVx=BRep_Tool::Tolerance(aVx);
aPx=BRep_Tool::Pnt(aVx);
aD2=aPnew.SquareDistance(aPx);
//
aDT2=100.*(aTolVnew+aTolVx)*(aTolVnew+aTolVx);
//
if (aD2<aDT2) {
iFound=1;
break;
}
}
//
if (iFound) {
continue;
}
}
// 1
iX=aEEs.Append()-1;
BOPDS_InterfEE& aEE=aEEs(iX);
aEE.SetIndices(nE1, nE2);
aEE.SetCommonPart(aCPart);
// 2
myDS->AddInterf(nE1, nE2);
//
BOPDS_CoupleOfPaveBlocks aCPB;
//
aCPB.SetPaveBlocks(aPB1, aPB2);
aCPB.SetIndexInterf(iX);
aMVCPB.Add(aVnew, aCPB);
}//case TopAbs_VERTEX:
break;
//
case TopAbs_EDGE: {
if (aNbCPrts > 1) {
break;
}
//
Standard_Boolean bHasSameBounds;
bHasSameBounds=aPB1->HasSameBounds(aPB2);
if (!bHasSameBounds) {
break;
}
// 1
iX=aEEs.Append()-1;
BOPDS_InterfEE& aEE=aEEs(iX);
aEE.SetIndices(nE1, nE2);
aEE.SetCommonPart(aCPart);
// 2
myDS->AddInterf(nE1, nE2);
//
BOPAlgo_Tools::FillMap(aPB1, aPB2, aMPBLPB, aAllocator);
}//case TopAbs_EDGE
break;
default:
break;
}//switch (aType) {
}//for (i=1; i<=aNbCPrts; i++) {
}//for (k=0; k < aNbFdgeEdge; ++k) {
// //
//========================================= //=========================================
// post treatment // post treatment
@ -327,7 +444,6 @@ void BOPAlgo_PaveFiller::PerformEE()
aMPBLPB.Clear(); aMPBLPB.Clear();
aMVCPB.Clear(); aMVCPB.Clear();
aMPBToUpdate.Clear(); aMPBToUpdate.Clear();
aAllocator.Nullify();
} }
//======================================================================= //=======================================================================
//function : PerformVertices //function : PerformVertices

View File

@ -508,7 +508,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
//function : PostTreatFF //function : PostTreatFF
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer BOPAlgo_PaveFiller::PostTreatFF Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB, (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
BOPCol_DataMapOfShapeInteger& aMVI, BOPCol_DataMapOfShapeInteger& aMVI,
BOPDS_DataMapOfPaveBlockListOfPaveBlock& aDMExEdges, BOPDS_DataMapOfPaveBlockListOfPaveBlock& aDMExEdges,
@ -587,6 +587,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
} }
// //
// 2 Fuse shapes // 2 Fuse shapes
aPF.SetRunParallel(myRunParallel);
aPF.SetArguments(aLS); aPF.SetArguments(aLS);
aPF.Perform(); aPF.Perform();
iErr=aPF.ErrorStatus(); iErr=aPF.ErrorStatus();

View File

@ -3,8 +3,8 @@
// //
// This file is part of Open CASCADE Technology software library. // This file is part of Open CASCADE Technology software library.
// //
// This library is free software; you can redistribute it and/or modify it under // This library is free software; you can redistribute it and / or modify it
// the terms of the GNU Lesser General Public License version 2.1 as published // under the terms of the GNU Lesser General Public version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file // by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty. // distribution for complete text of the license and disclaimer of any warranty.
@ -100,17 +100,16 @@ class BOPTime_Chronometer {
}; };
#endif #endif
static Standard_Integer bfillds (Draw_Interpretor&, Standard_Integer, const char**); static Standard_Integer bfillds (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bbuild (Draw_Interpretor&, Standard_Integer, const char**); static Standard_Integer bbuild (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bbop (Draw_Interpretor&, Standard_Integer, const char**); static Standard_Integer bbop (Draw_Interpretor&, Standard_Integer, const char**);
static Standard_Integer bclear (Draw_Interpretor&, Standard_Integer, const char**); static Standard_Integer bclear (Draw_Interpretor&, Standard_Integer, const char**);
//======================================================================= //=======================================================================
//function : PartitionCommands //function : PartitionCommands
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPTest::PartitionCommands(Draw_Interpretor& theCommands) void BOPTest::PartitionCommands(Draw_Interpretor& theCommands)
{ {
static Standard_Boolean done = Standard_False; static Standard_Boolean done = Standard_False;
if (done) return; if (done) return;
@ -118,17 +117,19 @@ static Standard_Integer bclear (Draw_Interpretor&, Standard_Integer, const cha
// Chapter's name // Chapter's name
const char* g = "Partition commands"; const char* g = "Partition commands";
// Commands // Commands
theCommands.Add("bfillds" , "use bfillds" , __FILE__, bfillds , g); theCommands.Add("bfillds" , "use bfillds [-s -t]" , __FILE__, bfillds, g);
theCommands.Add("bbuild" , " use bbuild r [-s -t]" , __FILE__, bbuild, g); theCommands.Add("bbuild" , "use bbuild r [-s -t]", __FILE__, bbuild, g);
theCommands.Add("bbop" , "use bbop r op" , __FILE__, bbop, g); theCommands.Add("bbop" , "use bbop r op" , __FILE__, bbop, g);
theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g); theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g);
} }
//======================================================================= //=======================================================================
//function : bclear //function : bclear
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer bclear(Draw_Interpretor& di, Standard_Integer n, const char** ) Standard_Integer bclear(Draw_Interpretor& di,
Standard_Integer n,
const char** )
{ {
if (n!=1) { if (n!=1) {
di << " use bclear\n"; di << " use bclear\n";
@ -142,17 +143,21 @@ Standard_Integer bclear(Draw_Interpretor& di, Standard_Integer n, const char** )
//function : bfillds //function : bfillds
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer bfillds(Draw_Interpretor& di, Standard_Integer n, const char** ) Standard_Integer bfillds(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{ {
if (n!=1) { if (n>3) {
di << " Use bfillds\n"; di << " use bfillds [-s -t]\n";
return 0; return 0;
} }
// //
char buf[32]; char buf[32];
Standard_Integer aNbS, iErr; Standard_Boolean bRunParallel, bShowTime;
Standard_Integer i, aNbS, iErr;
BOPCol_ListIteratorOfListOfShape aIt; BOPCol_ListIteratorOfListOfShape aIt;
BOPCol_ListOfShape aLC; BOPCol_ListOfShape aLC;
BOPTime_Chronometer aChrono;
BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes(); BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes();
aNbS=aLS.Extent(); aNbS=aLS.Extent();
@ -161,6 +166,17 @@ Standard_Integer bfillds(Draw_Interpretor& di, Standard_Integer n, const char**
return 0; return 0;
} }
// //
bShowTime=Standard_False;
bRunParallel=Standard_True;
for (i=1; i<n; ++i) {
if (!strcmp(a[i], "-s")) {
bRunParallel=Standard_False;
}
else if (!strcmp(a[i], "-t")) {
bShowTime=Standard_True;
}
}
//
BOPCol_ListOfShape& aLT=BOPTest_Objects::Tools(); BOPCol_ListOfShape& aLT=BOPTest_Objects::Tools();
// //
aIt.Initialize(aLS); aIt.Initialize(aLS);
@ -178,6 +194,9 @@ Standard_Integer bfillds(Draw_Interpretor& di, Standard_Integer n, const char**
BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller(); BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
// //
aPF.SetArguments(aLC); aPF.SetArguments(aLC);
aPF.SetRunParallel(bRunParallel);
//
aChrono.Start();
// //
aPF.Perform(); aPF.Perform();
iErr=aPF.ErrorStatus(); iErr=aPF.ErrorStatus();
@ -187,13 +206,25 @@ Standard_Integer bfillds(Draw_Interpretor& di, Standard_Integer n, const char**
return 0; return 0;
} }
// //
aChrono.Stop();
//
if (bShowTime) {
Standard_Real aTime;
//
aTime=aChrono.Time();
Sprintf(buf, " Tps: %7.2lf\n", aTime);
di << buf;
}
//
return 0; return 0;
} }
//======================================================================= //=======================================================================
//function : bbuild //function : bbuild
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer bbuild(Draw_Interpretor& di, Standard_Integer n, const char** a) Standard_Integer bbuild(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{ {
if (n<2) { if (n<2) {
di << " use bbuild r [-s -t]\n"; di << " use bbuild r [-s -t]\n";
@ -212,8 +243,6 @@ Standard_Integer bbuild(Draw_Interpretor& di, Standard_Integer n, const char** a
BOPTime_Chronometer aChrono; BOPTime_Chronometer aChrono;
BOPCol_ListIteratorOfListOfShape aIt; BOPCol_ListIteratorOfListOfShape aIt;
//
// //
BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller(); BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
// //
@ -281,7 +310,9 @@ Standard_Integer bbuild(Draw_Interpretor& di, Standard_Integer n, const char** a
//function : bbop //function : bbop
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer bbop(Draw_Interpretor& di, Standard_Integer n, const char** a) Standard_Integer bbop(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{ {
if (n!=3) { if (n!=3) {
di << " use bbop r op\n"; di << " use bbop r op\n";

View File

@ -0,0 +1,76 @@
puts "========="
puts "OCC24639"
puts "========="
puts ""
###########################################################
# Parallelization FillDS part of BO
###########################################################
set N 5
set dC 1.
set aC [expr $N + $dC]
#------------------------------------------
# z
vertex v1 0 0 0
vertex v2 0 0 $aC
edge ez v1 v2
set qz {}
for {set i 0} {$i < $N} {incr i} {
for {set j 0} {$j < $N} {incr j} {
tcopy ez ez_${i}_{$j}
ttranslate ez_${i}_{$j} [expr $i + ${dC}] [expr $j + $dC] 0.
lappend qz ez_${i}_{$j}
}
}
eval compound $qz bz
#------------------------------------------
# x
vertex v1 0. 0. 0.
vertex v2 $aC 0. 0.
edge ex v1 v2
set qx {}
for {set i 0} {$i < $N} {incr i} {
for {set j 0} {$j < $N} {incr j} {
tcopy ex ex_${i}_{$j}
ttranslate ex_${i}_{$j} 0. [expr $i + $dC] [expr $j + $dC]
lappend qx ex_${i}_{$j}
}
}
eval compound $qx bx
#------------------------------------------
# y
vertex v1 0. 0. 0.
vertex v2 0. $aC 0.
edge ey v1 v2
set qy {}
for {set i 0} {$i < $N} {incr i} {
for {set j 0} {$j < $N} {incr j} {
tcopy ey ey_${i}_{$j}
ttranslate ey_${i}_{$j} [expr $i + $dC] 0. [expr $j + $dC]
lappend qy ey_${i}_{$j}
}
}
eval compound $qy by
nurbsconvert bx bx
nurbsconvert by by
nurbsconvert bz bz
# add the arguments
bclearobjects
bcleartools
baddcompound bx
baddcompound by
baddcompound bz
# intersection step
bfillds -t
# intersection step
bfillds -t -s