// commercial license or contractual agreement.
#include <BOPAlgo_PaveFiller.ixx>
-
+//
#include <Precision.hxx>
#include <NCollection_IncAllocator.hxx>
#include <Bnd_Box.hxx>
#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>
+#include <IntTools_Context.hxx>
+#include <IntTools_Tools.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TopExp.hxx>
-#include <BOPInt_ShrunkRange.hxx>
+#include <IntTools_ShrunkRange.hxx>
#include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
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_Algo {
+
+ public:
+ DEFINE_STANDARD_ALLOC
+
+ BOPAlgo_FaceFace() :
+ IntTools_FaceFace(),
+ BOPAlgo_Algo(),
+ myIF1(-1), myIF2(-1), myTolFF(1.e-7) {
+ }
+ //
+ virtual ~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;
+ }
+ //
+ virtual void Perform() {
+ BOPAlgo_Algo::UserBreak();
+ 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.SetProgressIndicator(myProgressIndicator);
+ }//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.Perform(aF1, aF2);
+ 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;
}
aNbCurves=aCvsX.Length();
aNbPoints=aPntsX.Length();
//
- myDS->AddInterf(nF1, nF2);
+ if (aNbCurves || aNbPoints) {
+ myDS->AddInterf(nF1, nF2);
+ }
//
iX=aFFs.Append()-1;
BOPDS_InterfFF& aFF=aFFs(iX);
//
const IntTools_Curve& aIC=aCvsX(i);
const Handle(Geom_Curve)& aC3D= aIC.Curve();
- bValid=BOPInt_Tools::CheckCurve(aC3D, aTolR3D, aBox);
+ bValid=IntTools_Tools::CheckCurve(aC3D, aTolR3D, aBox);
if (bValid) {
iC=aVNC.Append()-1;
BOPDS_Curve& aNC=aVNC(iC);
aNbPoints=0;
aFF.Init(aNbCurves, aNbPoints);
}
- }// for (; myIterator->More(); myIterator->Next()) {
+ }// for (k=0; k < aNbFaceFace; ++k) {
}
//=======================================================================
//function : MakeBlocks
BOPCol_DataMapOfIntegerInteger aDMI(100, aAllocator);
//
for (i=0; i<aNbFF; ++i) {
+ //
+ UserBreak();
+ //
BOPDS_InterfFF& aFF=aFFs(i);
aFF.Indices(nF1, nF2);
//
}
//
if (aIC.HasBounds()) {
- PutBoundPaveOnCurve(aF1, aF2, aTolR3D, aNC, aMVOnIn, aMVB);
+ PutBoundPaveOnCurve(aF1, aF2, aTolR3D, aNC, aMVB);
}
}//for (j=0; j<aNbC; ++j) {
//
continue;
}
//
- bValid2D=myContext->IsValidBlockForFaces(aT1, aT2, aIC, aF1, aF2, aTolR3D);
+ bValid2D=myContext->IsValidBlockForFaces(aT1, aT2, aIC,
+ aF1, aF2, aTolR3D);
if (!bValid2D) {
continue;
}
const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
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,
mySectionAttribute.PCurveOnS1(),
mySectionAttribute.PCurveOnS2());
aTol = aItMV.Value();
//
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);
}
//
//function : PostTreatFF
//purpose :
//=======================================================================
- Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
+Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
BOPCol_DataMapOfShapeInteger& aMVI,
BOPDS_DataMapOfPaveBlockListOfPaveBlock& aDMExEdges,
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
//
- // <-DEB f
- //
// 0
if (aNbS==1) {
const TopoDS_Shape& aS=theMSCPB.FindKey(1);
}
//
// 2 Fuse shapes
+ aPF.SetProgressIndicator(myProgressIndicator);
+ aPF.SetRunParallel(myRunParallel);
aPF.SetArguments(aLS);
aPF.Perform();
iErr=aPF.ErrorStatus();
if (iErr) {
- iRet=1;
+ //iRet=1; //PKVft
return iRet;
}
aPDS=aPF.PDS();
nV=aPave[j].Index();
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.SetShape(aV);
iV=myDS->Append(aSI);
}
}
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);
+ myDS->AddShapeSD(aP1.Index(), iV);
}
//
aPave[j].SetIndex(iV);
//function : UpdateFaceInfo
//purpose :
//=======================================================================
-void BOPAlgo_PaveFiller::UpdateFaceInfo(BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME)
+void BOPAlgo_PaveFiller::UpdateFaceInfo
+ (BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME)
{
Standard_Integer i, j, nV1, nF1, nF2,
aNbFF, aNbC, aNbP, aNbS, aNbPBIn;
const TopoDS_Edge& aSp=(*(TopoDS_Edge *)(&aSISp.Shape()));
const Bnd_Box& aBoxSp=aSISp.Box();
//
- iFlag1 = (nV11 == nV21 || nV11 == nV22) ? 2 : (!aBoxSp.IsOut(aBoxP1) ? 1 : 0);
- iFlag2 = (nV12 == nV21 || nV12 == nV22) ? 2 : (!aBoxSp.IsOut(aBoxP2) ? 1 : 0);
+ iFlag1 = (nV11 == nV21 || nV11 == nV22) ? 2 :
+ (!aBoxSp.IsOut(aBoxP1) ? 1 : 0);
+ iFlag2 = (nV12 == nV21 || nV12 == nV22) ? 2 :
+ (!aBoxSp.IsOut(aBoxP2) ? 1 : 0);
if (iFlag1 && iFlag2) {
- if (aBoxSp.IsOut(aBoxPm) || myContext->ComputePE(aPm, theTolR3D, aSp, aTx)) {
+ if (aBoxSp.IsOut(aBoxPm) || myContext->ComputePE(aPm,
+ theTolR3D,
+ aSp,
+ aTx)) {
continue;
}
//
}
return bRet;
}
-
//=======================================================================
//function : PutBoundPaveOnCurve
//purpose :
const TopoDS_Face& aF2,
const Standard_Real aTolR3D,
BOPDS_Curve& aNC,
- BOPCol_MapOfInteger& aMVOnIn,
BOPCol_MapOfInteger& aMVB)
{
Standard_Boolean bVF;
BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVn);
Bnd_Box& aBoxDS=aSIDS.ChangeBox();
BRepBndLib::Add(aVn, aBoxDS);
- aMVOnIn.Add(nVn);
aMVB.Add(nVn);
}
}
//function : PutPavesOnCurve
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::PutPavesOnCurve(const BOPCol_MapOfInteger& aMVOnIn,
- const Standard_Real aTolR3D,
- BOPDS_Curve& aNC,
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- const BOPCol_MapOfInteger& aMI,
- const BOPCol_MapOfInteger& aMVEF,
- BOPCol_DataMapOfIntegerReal& aMVTol)
+ void BOPAlgo_PaveFiller::PutPavesOnCurve
+ (const BOPCol_MapOfInteger& aMVOnIn,
+ const Standard_Real aTolR3D,
+ BOPDS_Curve& aNC,
+ const Standard_Integer nF1,
+ const Standard_Integer nF2,
+ const BOPCol_MapOfInteger& aMI,
+ const BOPCol_MapOfInteger& aMVEF,
+ BOPCol_DataMapOfIntegerReal& aMVTol)
{
Standard_Boolean bInBothFaces;
Standard_Integer nV;
//function : ExtendedTolerance
//purpose :
//=======================================================================
-Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance(const Standard_Integer nV,
- const BOPCol_MapOfInteger& aMI,
- Standard_Real& aTolVExt,
- const Standard_Integer aType)
+Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance
+ (const Standard_Integer nV,
+ const BOPCol_MapOfInteger& aMI,
+ Standard_Real& aTolVExt,
+ const Standard_Integer aType)
{
Standard_Boolean bFound = Standard_False;
if (!(myDS->IsNewShape(nV))) {
BOPDS_Interf *aInt = !k ? (BOPDS_Interf*) (&aEEs(i)) :
(BOPDS_Interf*) (&aEFs(i));
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() :
aEFs(i).CommonPart();
//
const IntTools_CommonPrt& aCP = aEF.CommonPart();
Standard_Real aPar = aCP.VertexParameter1();
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);
//
nF = (nFOpposite == nF1) ? nF2 : nF1;
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;
aCurve->D0(aPar, aPoint);
//function : ProcessUnUsedVertices
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::PutEFPavesOnCurve(BOPDS_Curve& aNC,
- const BOPCol_MapOfInteger& aMI,
- const BOPCol_MapOfInteger& aMVEF,
- BOPCol_DataMapOfIntegerReal& aMVTol)
+ void BOPAlgo_PaveFiller::PutEFPavesOnCurve
+ (BOPDS_Curve& aNC,
+ const BOPCol_MapOfInteger& aMI,
+ const BOPCol_MapOfInteger& aMVEF,
+ BOPCol_DataMapOfIntegerReal& aMVTol)
{
if (!aMVEF.Extent()) {
return;
//function : ProcessUnUsedVertices
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::PutStickPavesOnCurve(const TopoDS_Face& aF1,
- const TopoDS_Face& aF2,
- const BOPCol_MapOfInteger& aMI,
- BOPDS_Curve& aNC,
- const BOPCol_MapOfInteger& aMVStick,
- BOPCol_DataMapOfIntegerReal& aMVTol)
+ void BOPAlgo_PaveFiller::PutStickPavesOnCurve
+ (const TopoDS_Face& aF1,
+ const TopoDS_Face& aF2,
+ const BOPCol_MapOfInteger& aMI,
+ BOPDS_Curve& aNC,
+ const BOPCol_MapOfInteger& aMVStick,
+ BOPCol_DataMapOfIntegerReal& aMVTol)
{
BOPCol_MapOfInteger aMV;
aMV.Assign(aMVStick);
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF();
//
- Standard_Integer aNbLines[5] = {aVVs.Extent(), aVEs.Extent(), aEEs.Extent(),
- aVFs.Extent(), aEFs.Extent()};
+ Standard_Integer aNbLines[5] = {
+ aVVs.Extent(), aVEs.Extent(), aEEs.Extent(),
+ aVFs.Extent(), aEFs.Extent()
+ };
//collect indices of all shapes from nF1 and nF2.
aMI.Clear();
GetFullShapeMap(nF1, aMI);
for (i = 0; i < aNbLines[aTypeInt]; ++i) {
BOPDS_Interf* aInt = (aTypeInt==0) ? (BOPDS_Interf*)(&aVVs(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()) {
aInt->Indices(nS1, nS2);
if(aMI.Contains(nS1) && aMI.Contains(nS2)) {
//function : PutPaveOnCurve
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::PutPaveOnCurve(const Standard_Integer nV,
- const Standard_Real aTolR3D,
- BOPDS_Curve& aNC,
- const BOPCol_MapOfInteger& aMI,
- BOPCol_DataMapOfIntegerReal& aMVTol,
- const Standard_Integer iCheckExtend)
+ void BOPAlgo_PaveFiller::PutPaveOnCurve
+ (const Standard_Integer nV,
+ const Standard_Real aTolR3D,
+ BOPDS_Curve& aNC,
+ const BOPCol_MapOfInteger& aMI,
+ BOPCol_DataMapOfIntegerReal& aMVTol,
+ const Standard_Integer iCheckExtend)
{
Standard_Boolean bIsVertexOnLine;
Standard_Real aT, aTol, aTolNew;
}
}
}
-
//=======================================================================
//function : UpdateExistingPaveBlocks
//purpose :
Standard_Integer nF = (aMPBOn1.Contains(aPBf) ||
aMPBIn1.Contains(aPBf)) ? nF2 : nF1;
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());
//
- Standard_Boolean bCom = BOPTools_AlgoTools::IsBlockInOnFace(aShrR, aF, aE, myContext);
+ Standard_Boolean bCom =
+ BOPTools_AlgoTools::IsBlockInOnFace(aShrR, aF, aE, myContext);
if (bCom) {
if (bCB) {
aCB = myDS->CommonBlock(aPB);
}
}
}
-
//=======================================================================
// function: PutClosingPaveOnCurve
// purpose:
}
}
}
-
//=======================================================================
//function : PreparePostTreatFF
//purpose :
//function : CheckPlanes
//purpose :
//=======================================================================
-Standard_Boolean
- BOPAlgo_PaveFiller::CheckPlanes(const Standard_Integer nF1,
- const Standard_Integer nF2)const
+Standard_Boolean BOPAlgo_PaveFiller::CheckPlanes
+ (const Standard_Integer nF1,
+ const Standard_Integer nF2)const
{
Standard_Boolean bToIntersect;
Standard_Integer i, nV2, iCnt;
//function : UpdatePaveBlocks
//purpose :
//=======================================================================
-void BOPAlgo_PaveFiller::UpdatePaveBlocks(const BOPCol_DataMapOfIntegerInteger& aDMI)
+void BOPAlgo_PaveFiller::UpdatePaveBlocks
+ (const BOPCol_DataMapOfIntegerInteger& aDMI)
{
if (aDMI.IsEmpty()) {
return;