1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00

0024639: Parallelization FillDS part of BO

Modifications to avoid compilation errors
This commit is contained in:
pkv 2014-03-24 09:34:34 +04:00 committed by bugmaster
parent ca1028006d
commit 505abfb89f
11 changed files with 873 additions and 300 deletions

View File

@ -21,6 +21,7 @@ class PaveFiller from BOPAlgo
uses uses
Pnt from gp, Pnt from gp,
ShapeEnum from TopAbs,
Vertex from TopoDS, Vertex from TopoDS,
Face from TopoDS, Face from TopoDS,
Edge from TopoDS, Edge from TopoDS,
@ -140,6 +141,11 @@ is
thePB:out PaveBlock from BOPDS) thePB:out PaveBlock from BOPDS)
is protected; is protected;
FillShrunkData(me:out;
theType1: ShapeEnum from TopAbs;
theType2: ShapeEnum from TopAbs)
is protected;
PerformVerticesEE(me:out; PerformVerticesEE(me:out;
theMVCPB:out IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS; theMVCPB:out IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS;
theAllocator:out BaseAllocator from BOPCol) theAllocator:out BaseAllocator from BOPCol)

View File

@ -21,6 +21,9 @@
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
#include <BOPDS_Iterator.hxx> #include <BOPDS_Iterator.hxx>
@ -31,20 +34,110 @@
#include <BRepBndLib.hxx> #include <BRepBndLib.hxx>
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
//=======================================================================
//class : BOPAlgo_VertexEdgeEdge
//purpose :
//=======================================================================
class BOPAlgo_VertexEdge {
public:
BOPAlgo_VertexEdge()
: myIV(-1), myIE(-1), myIVx(-1), myFlag(-1), myT(-1.) {
};
//
~BOPAlgo_VertexEdge(){
};
//
void SetIndices(const Standard_Integer nV,
const Standard_Integer nE,
const Standard_Integer nVx) {
myIV=nV;
myIE=nE;
myIVx=nVx;
}
//
void Indices(Standard_Integer& nV,
Standard_Integer& nE,
Standard_Integer& nVx) const {
nV=myIV;
nE=myIE;
nVx=myIVx;
}
//
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;
}
//
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 myIVx;
Standard_Integer myFlag;
Standard_Real myT;
TopoDS_Vertex myV;
TopoDS_Edge myE;
Handle(BOPInt_Context) myContext;
};
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_VertexEdge> BOPAlgo_VectorOfVertexEdge;
//
typedef BOPCol_TBBContextFunctor
<BOPAlgo_VertexEdge,
BOPAlgo_VectorOfVertexEdge,
Handle_BOPInt_Context,
BOPInt_Context> BOPAlgo_VertexEdgeFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_VertexEdgeFunctor,
BOPAlgo_VectorOfVertexEdge,
Handle_BOPInt_Context> BOPAlgo_VertexEdgeCnt;
//
//======================================================================= //=======================================================================
// function: PerformVE // function: PerformVE
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPAlgo_PaveFiller::PerformVE() void BOPAlgo_PaveFiller::PerformVE()
{ {
Standard_Boolean bJustAdd; Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, i; Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, i, k, aNbVE;;
Standard_Real aT, aTolE, aTolV; Standard_Real aT, aTolE, aTolV;
BOPDS_Pave aPave; BOPDS_Pave aPave;
BOPDS_PassKey aPK; BOPDS_PassKey aPK;
BOPDS_MapOfPassKey aMPK; BOPDS_MapOfPassKey aMPK;
BRep_Builder aBB; BRep_Builder aBB;
BOPAlgo_VectorOfVertexEdge aVVE;
// //
myErrorStatus=0; myErrorStatus=0;
// //
@ -92,8 +185,27 @@
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape())); const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape()));
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx))); const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
// //
iFlag=myContext->ComputeVE (aV, aE, aT); BOPAlgo_VertexEdge& aVESolver=aVVE.Append1();
//
aVESolver.SetIndices(nV, nE, nVx);
aVESolver.SetVertex(aV);
aVESolver.SetEdge(aE);
//
}// myIterator->Initialize(TopAbs_VERTEX, TopAbs_EDGE);
//
aNbVE=aVVE.Extent();
//=============================================================
BOPAlgo_VertexEdgeCnt::Perform(myRunParallel, aVVE, myContext);
//=============================================================
//
for (k=0; k < aNbVE; ++k) {
const BOPAlgo_VertexEdge& aVESolver=aVVE(k);
iFlag=aVESolver.Flag();
if (!iFlag) { if (!iFlag) {
aVESolver.Indices(nV, nE, nVx);
aT=aVESolver.Parameter();
const TopoDS_Vertex& aV=aVESolver.Vertex();
const TopoDS_Edge& aE=aVESolver.Edge();
// 1 // 1
i=aVEs.Append()-1; i=aVEs.Append()-1;
BOPDS_InterfVE& aVE=aVEs(i); BOPDS_InterfVE& aVE=aVEs(i);
@ -117,5 +229,5 @@
BRepBndLib::Add(aV, aBoxDS); BRepBndLib::Add(aV, aBoxDS);
} }
} }
}//for (; myIterator->More(); myIterator->Next()) { }//for (k=0; k < aNbVE; ++k) {
} }

View File

@ -98,60 +98,18 @@ class BOPAlgo_EdgeEdge : public IntTools_EdgeEdge {
Handle(BOPDS_PaveBlock) myPB2; Handle(BOPDS_PaveBlock) myPB2;
}; };
// //
typedef BOPCol_NCVector<BOPAlgo_EdgeEdge> BOPAlgo_VectorOfEdgeEdge; //=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_EdgeEdge> BOPAlgo_VectorOfEdgeEdge;
// //
typedef BOPCol_TBBFunctor
<BOPAlgo_EdgeEdge,
BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeFunctor;
//
typedef BOPCol_TBBCnt
<BOPAlgo_EdgeEdgeFunctor,
BOPAlgo_VectorOfEdgeEdge> BOPAlgo_EdgeEdgeCnt;
// //
//=======================================================================
//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_Integer>& aBR ) const{
Standard_Integer 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_Integer aNbEE=aVEdgeEdge.Extent();
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Integer>(0,aNbEE), aEEF);
}
else {
aEEF.operator()(flexible_range<Standard_Integer>(0,aNbEE));
}
}
};
//======================================================================= //=======================================================================
// function: PerformEE // function: PerformEE
// purpose: // purpose:
@ -162,6 +120,8 @@ void BOPAlgo_PaveFiller::PerformEE()
// //
myErrorStatus=0; myErrorStatus=0;
// //
FillShrunkData(TopAbs_EDGE, TopAbs_EDGE);
//
myIterator->Initialize(TopAbs_EDGE, TopAbs_EDGE); myIterator->Initialize(TopAbs_EDGE, TopAbs_EDGE);
iSize=myIterator->ExpectedLength(); iSize=myIterator->ExpectedLength();
if (!iSize) { if (!iSize) {
@ -214,11 +174,8 @@ void BOPAlgo_PaveFiller::PerformEE()
// //
Handle(BOPDS_PaveBlock)& aPB1=aIt1.ChangeValue(); Handle(BOPDS_PaveBlock)& aPB1=aIt1.ChangeValue();
if (!aPB1->HasShrunkData()) { if (!aPB1->HasShrunkData()) {
FillShrunkData(aPB1);
if (myWarningStatus) {
continue; continue;
} }
}
aPB1->ShrunkData(aTS11, aTS12, aBB1); aPB1->ShrunkData(aTS11, aTS12, aBB1);
// //
aIt2.Initialize(aLPB2); aIt2.Initialize(aLPB2);
@ -227,11 +184,8 @@ void BOPAlgo_PaveFiller::PerformEE()
// //
Handle(BOPDS_PaveBlock)& aPB2=aIt2.ChangeValue(); Handle(BOPDS_PaveBlock)& aPB2=aIt2.ChangeValue();
if (!aPB2->HasShrunkData()) { if (!aPB2->HasShrunkData()) {
FillShrunkData(aPB2);
if (myWarningStatus) {
continue; continue;
} }
}
aPB2->ShrunkData(aTS21, aTS22, aBB2); aPB2->ShrunkData(aTS21, aTS22, aBB2);
// //
if (aBB1.IsOut(aBB2)) { if (aBB1.IsOut(aBB2)) {
@ -744,7 +698,8 @@ void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
nE=thePB->OriginalEdge(); nE=thePB->OriginalEdge();
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE))); const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
// //
aSR.SetData(aE, aT1, aT2, aV1, aV2, myContext); aSR.SetContext(myContext);
aSR.SetData(aE, aT1, aT2, aV1, aV2);
// //
aSR.Perform(); aSR.Perform();
iErr=aSR.ErrorStatus(); iErr=aSR.ErrorStatus();

View File

@ -34,6 +34,9 @@
#include <Geom_Surface.hxx> #include <Geom_Surface.hxx>
#include <Geom2d_Curve.hxx> #include <Geom2d_Curve.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPTools_AlgoTools.hxx> #include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx> #include <BOPTools_AlgoTools2D.hxx>
@ -52,14 +55,101 @@
#include <BOPDS_MapOfPaveBlock.hxx> #include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_Curve.hxx> #include <BOPDS_Curve.hxx>
static void UpdateVertices(const TopoDS_Edge& aE, static void UpdateVertices(const TopoDS_Edge& aE,
const TopoDS_Face& aF); const TopoDS_Face& aF);
//=======================================================================
//class : BOPAlgo_SplitEdge
//purpose :
//=======================================================================
class BOPAlgo_SplitEdge {
public:
BOPAlgo_SplitEdge() {
myT1=0.;
myT2=0.;
}
//
~BOPAlgo_SplitEdge() {
}
//
void SetData(const TopoDS_Edge& aE,
const TopoDS_Vertex& aV1,
const Standard_Real aT1,
const TopoDS_Vertex& aV2,
const Standard_Real aT2) {
myE=aE;
myV1=aV1;
myT1=aT1;
myV2=aV2;
myT2=aT2;
myESp=aE;
}
//
void SetPaveBlock(const Handle(BOPDS_PaveBlock)& aPB) {
myPB=aPB;
}
//
Handle(BOPDS_PaveBlock)& PaveBlock() {
return myPB;
}
//
void SetCommonBlock(const Handle(BOPDS_CommonBlock)& aCB) {
myCB=aCB;
}
//
Handle(BOPDS_CommonBlock)& CommonBlock() {
return myCB;
}
//
const TopoDS_Edge& SplitEdge() const {
return myESp;
}
//
const Bnd_Box Box() {
return myBox;
}
//
void Perform () {
BOPTools_AlgoTools::MakeSplitEdge(myE,
myV1, myT1,
myV2, myT2,
myESp);
BRepBndLib::Add(myESp, myBox);
}
//
protected:
// ->
TopoDS_Edge myE;
TopoDS_Vertex myV1;
Standard_Real myT1;
TopoDS_Vertex myV2;
Standard_Real myT2;
// <->
Handle(BOPDS_PaveBlock) myPB;
Handle(BOPDS_CommonBlock) myCB;
// <-
TopoDS_Edge myESp;
Bnd_Box myBox;
};
//
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_SplitEdge> BOPAlgo_VectorOfSplitEdge;
//
typedef BOPCol_TBBFunctor
<BOPAlgo_SplitEdge,
BOPAlgo_VectorOfSplitEdge> BOPAlgo_SplitEdgeFunctor;
//
typedef BOPCol_TBBCnt
<BOPAlgo_SplitEdgeFunctor,
BOPAlgo_VectorOfSplitEdge> BOPAlgo_SplitEdgeCnt;
//
//======================================================================= //=======================================================================
// function: MakeSplitEdges // function: MakeSplitEdges
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPAlgo_PaveFiller::MakeSplitEdges() void BOPAlgo_PaveFiller::MakeSplitEdges()
{ {
Standard_Integer aNbPBP; Standard_Integer aNbPBP;
// //
@ -72,26 +162,20 @@ static void UpdateVertices(const TopoDS_Edge& aE,
} }
// //
Standard_Boolean bCB, bV1, bV2; Standard_Boolean bCB, bV1, bV2;
Standard_Integer i, nE, nV1, nV2, nSp, aNbPB; Standard_Integer i, nE, nV1, nV2, nSp, aNbPB, aNbVBSE, k;
Standard_Real aT1, aT2; Standard_Real aT1, aT2;
Handle(NCollection_IncAllocator) aAllocator;
BOPDS_ListIteratorOfListOfPaveBlock aItPB, aItPBCB; BOPDS_ListIteratorOfListOfPaveBlock aItPB, aItPBCB;
Handle(BOPDS_PaveBlock) aPB, aPBx; Handle(BOPDS_PaveBlock) aPB;
//-----------------------------------------------------scope f BOPDS_MapOfPaveBlock aMPB(100);
// TopoDS_Vertex aV1, aV2;
aAllocator=new NCollection_IncAllocator(); TopoDS_Edge aE;
// BOPAlgo_VectorOfSplitEdge aVBSE;
BOPDS_MapOfPaveBlock aMPB(100,aAllocator);
// //
for (i=0; i<aNbPBP; ++i) { for (i=0; i<aNbPBP; ++i) {
BOPDS_ListOfPaveBlock& aLPB=aPBP(i); BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
// //
aNbPB=aLPB.Extent(); aNbPB=aLPB.Extent();
//DEBf
if (aNbPB) {
aPBx=aLPB.First();
}
//DEBt
if (aNbPB==1) { if (aNbPB==1) {
aPB=aLPB.First(); aPB=aLPB.First();
aPB->Indices(nV1, nV2); aPB->Indices(nV1, nV2);
@ -120,23 +204,57 @@ static void UpdateVertices(const TopoDS_Edge& aE,
aPB->Indices(nV1, nV2); aPB->Indices(nV1, nV2);
aPB->Range(aT1, aT2); aPB->Range(aT1, aT2);
// //
nSp = SplitEdge(nE, nV1, aT1, nV2, aT2); aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
aE.Orientation(TopAbs_FORWARD);
// //
aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
aV1.Orientation(TopAbs_FORWARD);
//
aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
aV2.Orientation(TopAbs_REVERSED);
//
BOPAlgo_SplitEdge& aBSE=aVBSE.Append1();
//
aBSE.SetData(aE, aV1, aT1, aV2, aT2);
aBSE.SetPaveBlock(aPB);
if (bCB) { if (bCB) {
aCB->SetEdge(nSp); aBSE.SetCommonBlock(aCB);
}
}
} // for (; aItPB.More(); aItPB.Next()) {
} // for (i=0; i<aNbPBP; ++i) {
//
aNbVBSE=aVBSE.Extent();
//======================================================
BOPAlgo_SplitEdgeCnt::Perform(myRunParallel, aVBSE);
//======================================================
//
BOPDS_ShapeInfo aSI;
//
aSI.SetShapeType(TopAbs_EDGE);
//
for (k=0; k < aNbVBSE; ++k) {
BOPAlgo_SplitEdge& aBSE=aVBSE(k);
//
const TopoDS_Edge& aSp=aBSE.SplitEdge();
const Bnd_Box& aBox=aBSE.Box();
//
Handle(BOPDS_PaveBlock) aPBk=aBSE.PaveBlock();
Handle(BOPDS_CommonBlock)& aCBk=aBSE.CommonBlock();
//
aSI.SetShape(aSp);
aSI.ChangeBox()=aBox;
//
nSp=myDS->Append(aSI);
//
if (!aCBk.IsNull()) {
aCBk->SetEdge(nSp);
} }
else { else {
aPB->SetEdge(nSp); aPBk->SetEdge(nSp);
}
} }
}// if (aMPB.Add(aPB)) {
}// for (; aItPB.More(); aItPB.Next()) {
}// for (i=0; i<aNbPBP; ++i) {
//
//-----------------------------------------------------scope t
aMPB.Clear();
aAllocator.Nullify();
} }
//======================================================================= //=======================================================================
// function: SplitEdge // function: SplitEdge
// purpose: // purpose:
@ -173,12 +291,11 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
nSp=myDS->Append(aSI); nSp=myDS->Append(aSI);
return nSp; return nSp;
} }
//======================================================================= //=======================================================================
// function: MakePCurves // function: MakePCurves
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPAlgo_PaveFiller::MakePCurves() void BOPAlgo_PaveFiller::MakePCurves()
{ {
Standard_Integer i, nF1, nF2, aNbC, k, nE, aNbFF, aNbFI; Standard_Integer i, nF1, nF2, aNbC, k, nE, aNbFF, aNbFI;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB; BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
@ -262,12 +379,11 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
} }
} }
} }
//======================================================================= //=======================================================================
// function: RefineFaceInfoOn // function: RefineFaceInfoOn
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPAlgo_PaveFiller::RefineFaceInfoOn() void BOPAlgo_PaveFiller::RefineFaceInfoOn()
{ {
Standard_Integer aNbPBP; Standard_Integer aNbPBP;
// //
@ -304,13 +420,13 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
}//for (i=0; i<aNbPBP; ++i) { }//for (i=0; i<aNbPBP; ++i) {
myDS->RefineFaceInfoOn(); myDS->RefineFaceInfoOn();
} }
//======================================================================= //=======================================================================
//function : UpdateVertices //function : UpdateVertices
//purpose : update tolerances of vertices comparing extremities of //purpose : update tolerances of vertices comparing extremities of
// 3d and 2d curves // 3d and 2d curves
//======================================================================= //=======================================================================
void UpdateVertices(const TopoDS_Edge& aE, const TopoDS_Face& aF) void UpdateVertices(const TopoDS_Edge& aE,
const TopoDS_Face& aF)
{ {
Standard_Integer j; Standard_Integer j;
Standard_Real aT[2], aUx, aVx, aTolV2, aD2, aD; Standard_Real aT[2], aUx, aVx, aTolV2, aD2, aD;

View File

@ -0,0 +1,179 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// 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
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPAlgo_PaveFiller.ixx>
//
#include <Bnd_Box.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPDS_ShapeInfo.hxx>
#include <BOPDS_PaveBlock.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPInt_ShrunkRange.hxx>
//=======================================================================
//class : BOPAlgo_ShrunkRange
//purpose :
//=======================================================================
class BOPAlgo_ShrunkRange : public BOPInt_ShrunkRange {
public:
BOPAlgo_ShrunkRange()
: BOPInt_ShrunkRange(),
myWarningStatus(0) {
}
//
virtual ~BOPAlgo_ShrunkRange() {
}
//
void SetPaveBlock(const Handle(BOPDS_PaveBlock)& aPB) {
myPB=aPB;
}
//
Handle(BOPDS_PaveBlock)& PaveBlock() {
return myPB;
}
//
virtual void Perform() {
//
myWarningStatus=0;
//
BOPInt_ShrunkRange::Perform();
if (myErrorStatus) {
myWarningStatus=1;
}
}
//
Standard_Integer WarningStatus() const {
return myWarningStatus;
}
//
protected:
Standard_Integer myWarningStatus;
Handle(BOPDS_PaveBlock) myPB;
};
//
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_ShrunkRange> BOPAlgo_VectorOfShrunkRange;
//
typedef BOPCol_TBBContextFunctor
<BOPAlgo_ShrunkRange,
BOPAlgo_VectorOfShrunkRange,
Handle_BOPInt_Context,
BOPInt_Context> BOPAlgo_ShrunkRangeFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_ShrunkRangeFunctor,
BOPAlgo_VectorOfShrunkRange,
Handle_BOPInt_Context> BOPAlgo_ShrunkRangeCnt;
//
//=======================================================================
// function: FillShrunkData
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
const TopAbs_ShapeEnum aType2)
{
Standard_Integer iSize;
//
myErrorStatus=0;
//
myIterator->Initialize(aType1, aType2);
iSize=myIterator->ExpectedLength();
if (!iSize) {
return;
}
//
Standard_Boolean bJustAdd;
Standard_Integer i, iEnd, nS[2], nE, nV1, nV2, aNbVSD, k, iWrn;
Standard_Real aT1, aT2, aTS1, aTS2;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
BOPCol_MapOfInteger aMI;
BOPAlgo_VectorOfShrunkRange aVSD;
//
iEnd=(aType2==TopAbs_EDGE) ? 2 : 1;
//
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(nS[0], nS[1], bJustAdd);
if(bJustAdd) {
continue;
}
//
for (i=0; i<iEnd; ++i) {
nE=nS[i];
if (!aMI.Add(nE)) {
continue;
}
//
const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
if (aSIE.HasFlag()){
continue;
}
//
BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE);
aItLPB.Initialize(aLPB);
for (; aItLPB.More(); aItLPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItLPB.ChangeValue();
if (aPB->HasShrunkData()) {
continue;
}
//
// FillShrunkData(aPB);
aPB->Indices(nV1, nV2);
aPB->Range(aT1, aT2);
//
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape()));
//
const TopoDS_Vertex& aV1=
(*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
//
const TopoDS_Vertex& aV2=
(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
//
BOPAlgo_ShrunkRange& aSD=aVSD.Append1();
//
aSD.SetPaveBlock(aPB);
aSD.SetData(aE, aT1, aT2, aV1, aV2);
}
}
}
//
aNbVSD=aVSD.Extent();
//=============================================================
BOPAlgo_ShrunkRangeCnt::Perform(myRunParallel, aVSD, myContext);
//=============================================================
//
for (k=0; k < aNbVSD; ++k) {
BOPAlgo_ShrunkRange& aSD=aVSD(k);
iWrn=aSD.WarningStatus();
if (iWrn==1) {
continue;
}
//
Handle(BOPDS_PaveBlock)& aPB=aSD.PaveBlock();
aSD.ShrunkRange(aTS1, aTS2);
const Bnd_Box& aBox=aSD.BndBox();
//
aPB->SetShrunkData(aTS1, aTS2, aBox);
}
}

View File

@ -16,3 +16,4 @@ BOPAlgo_ListOfCheckResult.hxx
BOPAlgo_Builder_2Cnt.hxx BOPAlgo_Builder_2Cnt.hxx
BOPAlgo_CheckerSI_1.cxx BOPAlgo_CheckerSI_1.cxx
BOPAlgo_PaveFiller_9.cxx

View File

@ -72,5 +72,149 @@ static void serial_for( const Range& range, const Body& body ) {
body.operator()(range); body.operator()(range);
}; };
#endif // not HAVE_TBB #endif // not HAVE_TBB
//
// 2. Implementation of Functors/Starters
//
// 2.1. Pure version
//
//=======================================================================
//class : BOPCol_TBBFunctor
//purpose :
//=======================================================================
template <class TypeSolver,
class TypeSolverVector> class BOPCol_TBBFunctor {
public:
BOPCol_TBBFunctor(TypeSolverVector& aV)
: myPV(&aV) {
}
//
~BOPCol_TBBFunctor() {
}
//
void operator()( const flexible_range<Standard_Size>& aBR ) const{
Standard_Size i, iBeg, iEnd;
//
TypeSolverVector& aV=*myPV;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
TypeSolver& aSolver=aV(i);
//
aSolver.Perform();
}
}
//
protected:
TypeSolverVector* myPV;
};
//=======================================================================
//class : BOPCol_TBBCnt
//purpose :
//=======================================================================
template <class TypeFunctor,
class TypeSolverVector> class BOPCol_TBBCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT
static void Perform(const Standard_Boolean bRunParallel,
TypeSolverVector& aV) {
//
TypeFunctor aFunctor(aV);
Standard_Size aNb=aV.Extent();
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Size>(0,aNb), aFunctor);
}
else {
aFunctor.operator()(flexible_range<Standard_Size>(0,aNb));
}
}
};
//
// 2.2. Context dependent version
//
#include <Standard_Macro.hxx>
//=======================================================================
//class : BOPCol_TBBContextFunctor
//purpose :
//=======================================================================
template <class TypeSolver,
class TypeSolverVector,
class TypeContext,
typename TN> class BOPCol_TBBContextFunctor {
public:
BOPCol_TBBContextFunctor(TypeSolverVector& aV)
: myPV(&aV) {
}
//
~BOPCol_TBBContextFunctor() {
}
//
void SetContext(TypeContext& aCtx) {
myContext=aCtx;
}
//
void operator()( const flexible_range<Standard_Size>& aBR ) const{
Standard_Size i, iBeg, iEnd;
TypeContext aCtx;
//
if (myContext.IsNull()) {
aCtx=new TN
(NCollection_BaseAllocator::CommonBaseAllocator());
}
else {
aCtx=myContext;
}
//
TypeSolverVector& aV=*myPV;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
TypeSolver& aSolver=aV(i);
//
aSolver.SetContext(aCtx);
aSolver.Perform();
}
}
//
protected:
TypeSolverVector* myPV;
TypeContext myContext;
//
};
//=======================================================================
//class : BOPCol_TBBContextCnt
//purpose :
//=======================================================================
template <class TypeFunctor,
class TypeSolverVector,
class TypeContext> class BOPCol_TBBContextCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT
static void Perform(const Standard_Boolean bRunParallel,
TypeSolverVector& aV,
TypeContext& aCtx) {
//
TypeFunctor aFunctor(aV);
Standard_Size aNb=aV.Extent();
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Size>(0,aNb), aFunctor);
}
else {
aFunctor.SetContext(aCtx);
aFunctor.operator()(flexible_range<Standard_Size>(0,aNb));
}
}
};
#endif #endif

View File

@ -30,14 +30,21 @@ uses
is is
Create Create
returns ShrunkRange from BOPInt; returns ShrunkRange from BOPInt;
---C++: alias "Standard_EXPORT virtual ~BOPInt_ShrunkRange();"
SetData (me:out; SetData (me:out;
aE : Edge from TopoDS; aE : Edge from TopoDS;
aT1 : Real from Standard; aT1 : Real from Standard;
aT2 : Real from Standard; aT2 : Real from Standard;
aV1 : Vertex from TopoDS; aV1 : Vertex from TopoDS;
aV2 : Vertex from TopoDS; aV2 : Vertex from TopoDS);
ICtx: Context from BOPInt);
SetContext(me:out;
aCtx: Context from BOPInt);
Context(me)
returns Context from BOPInt;
---C++: return const &
SetShrunkRange(me:out; SetShrunkRange(me:out;
aT1 : Real from Standard; aT1 : Real from Standard;

View File

@ -42,30 +42,50 @@
myErrorStatus=1; myErrorStatus=1;
} }
//======================================================================= //=======================================================================
//function : ~
//purpose :
//=======================================================================
BOPInt_ShrunkRange::~BOPInt_ShrunkRange ()
{
}
//=======================================================================
//function : SetData //function : SetData
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPInt_ShrunkRange::SetData(const TopoDS_Edge& aE, void BOPInt_ShrunkRange::SetData(const TopoDS_Edge& aE,
const Standard_Real aT1, const Standard_Real aT1,
const Standard_Real aT2, const Standard_Real aT2,
const TopoDS_Vertex& aV1, const TopoDS_Vertex& aV1,
const TopoDS_Vertex& aV2, const TopoDS_Vertex& aV2)
const Handle(BOPInt_Context)& aCtx)
{ {
myEdge=aE; myEdge=aE;
myV1=aV1; myV1=aV1;
myV2=aV2; myV2=aV2;
myT1=aT1; myT1=aT1;
myT2=aT2; myT2=aT2;
//myRange=aR;
myCtx=aCtx;
myErrorStatus=1; myErrorStatus=1;
} }
//======================================================================= //=======================================================================
//function : SetContext
//purpose :
//=======================================================================
void BOPInt_ShrunkRange::SetContext(const Handle(BOPInt_Context)& aCtx)
{
myCtx=aCtx;
}
//=======================================================================
//function : Context
//purpose :
//=======================================================================
const Handle(BOPInt_Context)& BOPInt_ShrunkRange::Context()const
{
return myCtx;
}
//=======================================================================
//function : Edge //function : Edge
//purpose : //purpose :
//======================================================================= //=======================================================================
const TopoDS_Edge& BOPInt_ShrunkRange::Edge() const const TopoDS_Edge& BOPInt_ShrunkRange::Edge() const
{ {
return myEdge; return myEdge;
} }
@ -73,7 +93,7 @@
//function : ShrunkRange //function : ShrunkRange
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPInt_ShrunkRange::ShrunkRange(Standard_Real& aT1, void BOPInt_ShrunkRange::ShrunkRange(Standard_Real& aT1,
Standard_Real& aT2) const Standard_Real& aT2) const
{ {
aT1=myTS1; aT1=myTS1;
@ -83,7 +103,7 @@
//function : BndBox //function : BndBox
//purpose : //purpose :
//======================================================================= //=======================================================================
const Bnd_Box& BOPInt_ShrunkRange::BndBox() const const Bnd_Box& BOPInt_ShrunkRange::BndBox() const
{ {
return myBndBox; return myBndBox;
} }
@ -91,7 +111,7 @@
//function : ErrorStatus //function : ErrorStatus
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer BOPInt_ShrunkRange::ErrorStatus() const Standard_Integer BOPInt_ShrunkRange::ErrorStatus() const
{ {
return myErrorStatus; return myErrorStatus;
} }
@ -100,7 +120,7 @@
//function : SetShrunkRange //function : SetShrunkRange
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPInt_ShrunkRange::SetShrunkRange(const Standard_Real aT1, void BOPInt_ShrunkRange::SetShrunkRange(const Standard_Real aT1,
const Standard_Real aT2) const Standard_Real aT2)
{ {
myTS1=aT1; myTS1=aT1;
@ -114,9 +134,10 @@
//function : Perform //function : Perform
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPInt_ShrunkRange::Perform() void BOPInt_ShrunkRange::Perform()
{ {
Standard_Real aCF, aCL, aTolE, aTolV1, aTolV2, t1, t11, t1C, t2, t12, t2C; Standard_Real aCF, aCL, aTolE, aTolV1;
Standard_Real aTolV2, t1, t11, t1C, t2, t12, t2C;
Standard_Real aCoeff1, aCoeff2, aTol1, aTol2, dt1, dt2, aR, anEps; Standard_Real aCoeff1, aCoeff2, aTol1, aTol2, dt1, dt2, aR, anEps;
Standard_Integer pri; Standard_Integer pri;
Standard_Boolean bInf1, bInf2, bAppr; Standard_Boolean bInf1, bInf2, bAppr;
@ -155,7 +176,7 @@
return; return;
} }
// //
bAppr = (fabs(t2 - t1) > 100) ? Standard_False : Standard_True; bAppr = !(fabs(t2 - t1) > 100);
if (fabs(t2 - t1) < anEps) { if (fabs(t2 - t1) < anEps) {
myErrorStatus=7; myErrorStatus=7;
return; return;
@ -426,8 +447,7 @@
} }
} }
} // else { } // else {
//
if (t1C>t2){ if (t1C>t2){
t1C=0.5*(t2+t1); t1C=0.5*(t2+t1);
t2C=t1C+0.1*(t2-t1C); t2C=t1C+0.1*(t2-t1C);

View File

@ -104,7 +104,8 @@ static
// function: MakeConnexityBlocks // function: MakeConnexityBlocks
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::MakeConnexityBlocks (const TopoDS_Shape& theS, void BOPTools_AlgoTools::MakeConnexityBlocks
(const TopoDS_Shape& theS,
const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType1,
const TopAbs_ShapeEnum theType2, const TopAbs_ShapeEnum theType2,
BOPCol_ListOfShape& theLCB) BOPCol_ListOfShape& theLCB)
@ -203,7 +204,9 @@ void BOPTools_AlgoTools::OrientFacesOnShell (TopoDS_Shape& aShell)
// //
BOPTools_AlgoTools::MakeContainer(TopAbs_SHELL, aShellNew); BOPTools_AlgoTools::MakeContainer(TopAbs_SHELL, aShellNew);
// //
BOPTools::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aEFMap); BOPTools::MapShapesAndAncestors(aShell,
TopAbs_EDGE, TopAbs_FACE,
aEFMap);
aNbE=aEFMap.Extent(); aNbE=aEFMap.Extent();
// //
// One seam edge in aEFMap contains 2 equivalent faces. // One seam edge in aEFMap contains 2 equivalent faces.
@ -334,15 +337,12 @@ TopAbs_Orientation Orientation(const TopoDS_Edge& anE,
} }
return anOr; return anOr;
} }
////////////
//======================================================================= //=======================================================================
// function: MakeConnexityBlock. // function: MakeConnexityBlock.
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::MakeConnexityBlock (BOPCol_ListOfShape& theLFIn, void BOPTools_AlgoTools::MakeConnexityBlock
(BOPCol_ListOfShape& theLFIn,
BOPCol_IndexedMapOfShape& theMEAvoid, BOPCol_IndexedMapOfShape& theMEAvoid,
BOPCol_ListOfShape& theLCB, BOPCol_ListOfShape& theLCB,
const Handle(NCollection_BaseAllocator)& theAllocator) const Handle(NCollection_BaseAllocator)& theAllocator)
@ -422,7 +422,8 @@ void BOPTools_AlgoTools::MakeConnexityBlock (BOPCol_ListOfShape& theLFIn,
// function: ComputeStateByOnePoint // function: ComputeStateByOnePoint
// purpose: // purpose:
//======================================================================= //=======================================================================
TopAbs_State BOPTools_AlgoTools::ComputeStateByOnePoint(const TopoDS_Shape& theS, TopAbs_State BOPTools_AlgoTools::ComputeStateByOnePoint
(const TopoDS_Shape& theS,
const TopoDS_Solid& theRef, const TopoDS_Solid& theRef,
const Standard_Real theTol, const Standard_Real theTol,
Handle(BOPInt_Context)& theContext) Handle(BOPInt_Context)& theContext)
@ -447,7 +448,8 @@ TopAbs_State BOPTools_AlgoTools::ComputeStateByOnePoint(const TopoDS_Shape& theS
// function: ComputeState // function: ComputeState
// purpose: // purpose:
//======================================================================= //=======================================================================
TopAbs_State BOPTools_AlgoTools::ComputeState(const TopoDS_Face& theF, TopAbs_State BOPTools_AlgoTools::ComputeState
(const TopoDS_Face& theF,
const TopoDS_Solid& theRef, const TopoDS_Solid& theRef,
const Standard_Real theTol, const Standard_Real theTol,
BOPCol_IndexedMapOfShape& theBounds, BOPCol_IndexedMapOfShape& theBounds,
@ -470,7 +472,8 @@ TopAbs_State BOPTools_AlgoTools::ComputeState(const TopoDS_Face& theF,
// //
if (!theBounds.Contains(aSE)) { if (!theBounds.Contains(aSE)) {
const TopoDS_Edge& aE=(*(TopoDS_Edge*)(&aSE)); const TopoDS_Edge& aE=(*(TopoDS_Edge*)(&aSE));
aState=BOPTools_AlgoTools::ComputeState(aE, theRef, theTol, theContext); aState=BOPTools_AlgoTools::ComputeState(aE, theRef, theTol,
theContext);
return aState; return aState;
} }
if (aE1.IsNull()) { if (aE1.IsNull()) {
@ -479,8 +482,10 @@ TopAbs_State BOPTools_AlgoTools::ComputeState(const TopoDS_Face& theF,
} }
// !!<- process edges that are all on theRef // !!<- process edges that are all on theRef
if (!aE1.IsNull()) { if (!aE1.IsNull()) {
BOPTools_AlgoTools3D::PointNearEdge(aE1, theF, aP2D, aP3D, theContext); BOPTools_AlgoTools3D::PointNearEdge(aE1, theF,
aState=BOPTools_AlgoTools::ComputeState(aP3D, theRef, theTol, theContext); aP2D, aP3D, theContext);
aState=BOPTools_AlgoTools::ComputeState(aP3D, theRef, theTol,
theContext);
} }
// //
return aState; return aState;
@ -489,7 +494,8 @@ TopAbs_State BOPTools_AlgoTools::ComputeState(const TopoDS_Face& theF,
// function: ComputeState // function: ComputeState
// purpose: // purpose:
//======================================================================= //=======================================================================
TopAbs_State BOPTools_AlgoTools::ComputeState(const TopoDS_Vertex& theV, TopAbs_State BOPTools_AlgoTools::ComputeState
(const TopoDS_Vertex& theV,
const TopoDS_Solid& theRef, const TopoDS_Solid& theRef,
const Standard_Real theTol, const Standard_Real theTol,
Handle(BOPInt_Context)& theContext) Handle(BOPInt_Context)& theContext)
@ -498,14 +504,16 @@ TopAbs_State BOPTools_AlgoTools::ComputeState(const TopoDS_Vertex& theV,
gp_Pnt aP3D; gp_Pnt aP3D;
// //
aP3D=BRep_Tool::Pnt(theV); aP3D=BRep_Tool::Pnt(theV);
aState=BOPTools_AlgoTools::ComputeState(aP3D, theRef, theTol, theContext); aState=BOPTools_AlgoTools::ComputeState(aP3D, theRef, theTol,
theContext);
return aState; return aState;
} }
//======================================================================= //=======================================================================
// function: ComputeState // function: ComputeState
// purpose: // purpose:
//======================================================================= //=======================================================================
TopAbs_State BOPTools_AlgoTools::ComputeState(const TopoDS_Edge& theE, TopAbs_State BOPTools_AlgoTools::ComputeState
(const TopoDS_Edge& theE,
const TopoDS_Solid& theRef, const TopoDS_Solid& theRef,
const Standard_Real theTol, const Standard_Real theTol,
Handle(BOPInt_Context)& theContext) Handle(BOPInt_Context)& theContext)
@ -547,7 +555,8 @@ TopAbs_State BOPTools_AlgoTools::ComputeState(const TopoDS_Edge& theE,
aC3D->D0(aT, aP3D); aC3D->D0(aT, aP3D);
} }
// //
aState=BOPTools_AlgoTools::ComputeState(aP3D, theRef, theTol, theContext); aState=BOPTools_AlgoTools::ComputeState(aP3D, theRef, theTol,
theContext);
// //
return aState; return aState;
} }
@ -555,7 +564,8 @@ TopAbs_State BOPTools_AlgoTools::ComputeState(const TopoDS_Edge& theE,
// function: ComputeState // function: ComputeState
// purpose: // purpose:
//======================================================================= //=======================================================================
TopAbs_State BOPTools_AlgoTools::ComputeState(const gp_Pnt& theP, TopAbs_State BOPTools_AlgoTools::ComputeState
(const gp_Pnt& theP,
const TopoDS_Solid& theRef, const TopoDS_Solid& theRef,
const Standard_Real theTol, const Standard_Real theTol,
Handle(BOPInt_Context)& theContext) Handle(BOPInt_Context)& theContext)
@ -633,7 +643,8 @@ Standard_Integer BOPTools_AlgoTools::IsInternalFace
break; break;
} }
// //
iRet=BOPTools_AlgoTools::IsInternalFace(theFace, aE, aF1, aF1, theContext); iRet=BOPTools_AlgoTools::IsInternalFace(theFace, aE, aF1, aF1,
theContext);
break; break;
} }
// //
@ -643,7 +654,8 @@ Standard_Integer BOPTools_AlgoTools::IsInternalFace
// //
if (aF2.IsSame(aF1) && BRep_Tool::IsClosed(aE, aF1)) { if (aF2.IsSame(aF1) && BRep_Tool::IsClosed(aE, aF1)) {
// treat as it was for 1 face // treat as it was for 1 face
iRet=BOPTools_AlgoTools::IsInternalFace(theFace, aE, aF1, aF2, theContext); iRet=BOPTools_AlgoTools::IsInternalFace(theFace, aE, aF1, aF2,
theContext);
break; break;
} }
} }
@ -653,7 +665,8 @@ Standard_Integer BOPTools_AlgoTools::IsInternalFace
return iRet; // it can not be so return iRet; // it can not be so
} }
else { // aNbF=2,4,6,8,... else { // aNbF=2,4,6,8,...
iRet=BOPTools_AlgoTools::IsInternalFace(theFace, aE, aLF, theContext); iRet=BOPTools_AlgoTools::IsInternalFace(theFace, aE, aLF,
theContext);
break; break;
} }
}//for(; aExp.More(); aExp.Next()) { }//for(; aExp.More(); aExp.Next()) {
@ -675,7 +688,8 @@ Standard_Integer BOPTools_AlgoTools::IsInternalFace
// //
BOPTools::MapShapes(theSolid, TopAbs_EDGE, aBounds); BOPTools::MapShapes(theSolid, TopAbs_EDGE, aBounds);
// //
aState=BOPTools_AlgoTools::ComputeState(theFace, theSolid, theTol, aBounds, theContext); aState=BOPTools_AlgoTools::ComputeState(theFace, theSolid,
theTol, aBounds, theContext);
// //
iRet=(aState==TopAbs_IN)? 1 : 0; iRet=(aState==TopAbs_IN)? 1 : 0;
// //
@ -685,7 +699,8 @@ Standard_Integer BOPTools_AlgoTools::IsInternalFace
//function : IsInternalFace //function : IsInternalFace
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer BOPTools_AlgoTools::IsInternalFace(const TopoDS_Face& theFace, Standard_Integer BOPTools_AlgoTools::IsInternalFace
(const TopoDS_Face& theFace,
const TopoDS_Edge& theEdge, const TopoDS_Edge& theEdge,
BOPCol_ListOfShape& theLF, BOPCol_ListOfShape& theLF,
Handle(BOPInt_Context)& theContext) Handle(BOPInt_Context)& theContext)
@ -698,7 +713,8 @@ Standard_Integer BOPTools_AlgoTools::IsInternalFace(const TopoDS_Face& theFace,
if (aNbF==2) { if (aNbF==2) {
const TopoDS_Face& aF1=(*(TopoDS_Face*)(&theLF.First())); const TopoDS_Face& aF1=(*(TopoDS_Face*)(&theLF.First()));
const TopoDS_Face& aF2=(*(TopoDS_Face*)(&theLF.Last())); const TopoDS_Face& aF2=(*(TopoDS_Face*)(&theLF.Last()));
iRet=BOPTools_AlgoTools::IsInternalFace(theFace, theEdge, aF1, aF2, theContext); iRet=BOPTools_AlgoTools::IsInternalFace(theFace, theEdge, aF1, aF2,
theContext);
return iRet; return iRet;
} }
// //
@ -714,7 +730,8 @@ Standard_Integer BOPTools_AlgoTools::IsInternalFace(const TopoDS_Face& theFace,
// //
const TopoDS_Face& aF1=(*(TopoDS_Face*)(&aCSFF.Shape1())); const TopoDS_Face& aF1=(*(TopoDS_Face*)(&aCSFF.Shape1()));
const TopoDS_Face& aF2=(*(TopoDS_Face*)(&aCSFF.Shape2())); const TopoDS_Face& aF2=(*(TopoDS_Face*)(&aCSFF.Shape2()));
iRet=BOPTools_AlgoTools::IsInternalFace(theFace, theEdge, aF1, aF2, theContext); iRet=BOPTools_AlgoTools::IsInternalFace(theFace, theEdge, aF1, aF2,
theContext);
if (iRet) { if (iRet) {
return iRet; return iRet;
} }
@ -813,7 +830,8 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
aPL->Bounds(aUmin, aUsup, aVmin, aVsup); aPL->Bounds(aUmin, aUsup, aVmin, aVsup);
aProjPL.Init(aPL, aUmin, aUsup, aVmin, aVsup); aProjPL.Init(aPL, aUmin, aUsup, aVmin, aVsup);
// //
GetFaceDir(theE1, theF1, aPx, aT, aDTgt, aDN1, aDBF, theContext, aProjPL); GetFaceDir(theE1, theF1, aPx, aT, aDTgt, aDN1, aDBF, theContext,
aProjPL);
// //
aDTF=aDN1^aDBF; aDTF=aDN1^aDBF;
// //
@ -825,7 +843,8 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
const TopoDS_Face& aF2=(*(TopoDS_Face*)(&aCS.Shape2())); const TopoDS_Face& aF2=(*(TopoDS_Face*)(&aCS.Shape2()));
// //
aDTgt2 = (aE2.Orientation()==aOr) ? aDTgt : aDTgt.Reversed(); aDTgt2 = (aE2.Orientation()==aOr) ? aDTgt : aDTgt.Reversed();
GetFaceDir(aE2, aF2, aPx, aT, aDTgt2, aDN2, aDBF2, theContext, aProjPL); GetFaceDir(aE2, aF2, aPx, aT, aDTgt2, aDN2, aDBF2, theContext,
aProjPL);
//Angle //Angle
aAngle=AngleWithRef(aDBF, aDBF2, aDTF); aAngle=AngleWithRef(aDBF, aDBF2, aDTF);
// //
@ -888,7 +907,8 @@ Standard_Boolean BOPTools_AlgoTools::GetEdgeOff(const TopoDS_Edge& theE1,
//function : AreFacesSameDomain //function : AreFacesSameDomain
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean BOPTools_AlgoTools::AreFacesSameDomain(const TopoDS_Face& theF1, Standard_Boolean BOPTools_AlgoTools::AreFacesSameDomain
(const TopoDS_Face& theF1,
const TopoDS_Face& theF2, const TopoDS_Face& theF2,
Handle(BOPInt_Context)& theContext) Handle(BOPInt_Context)& theContext)
{ {
@ -922,7 +942,8 @@ Standard_Boolean BOPTools_AlgoTools::AreFacesSameDomain(const TopoDS_Face& theF1
aTolF2=BRep_Tool::Tolerance(aF2); aTolF2=BRep_Tool::Tolerance(aF2);
aTol=aTolF1+aTolF2; aTol=aTolF1+aTolF2;
// //
iErr = BOPTools_AlgoTools3D::PointInFace(aF1, aP, aP2D, theContext); iErr = BOPTools_AlgoTools3D::PointInFace(aF1, aP, aP2D,
theContext);
if (!iErr) { if (!iErr) {
bFlag=theContext->IsValidPointForFace(aP, aF2, aTol); bFlag=theContext->IsValidPointForFace(aP, aF2, aTol);
} }
@ -934,7 +955,8 @@ Standard_Boolean BOPTools_AlgoTools::AreFacesSameDomain(const TopoDS_Face& theF1
//function : CheckSameGeom //function : CheckSameGeom
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean BOPTools_AlgoTools::CheckSameGeom(const TopoDS_Face& theF1, Standard_Boolean BOPTools_AlgoTools::CheckSameGeom
(const TopoDS_Face& theF1,
const TopoDS_Face& theF2, const TopoDS_Face& theF2,
Handle(BOPInt_Context)& theContext) Handle(BOPInt_Context)& theContext)
{ {
@ -1009,7 +1031,8 @@ Standard_Integer BOPTools_AlgoTools::Sense (const TopoDS_Face& theF1,
// function: IsSplitToReverse // function: IsSplitToReverse
// purpose: // purpose:
//======================================================================= //=======================================================================
Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse(const TopoDS_Shape& theSp, Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse
(const TopoDS_Shape& theSp,
const TopoDS_Shape& theSr, const TopoDS_Shape& theSr,
Handle(BOPInt_Context)& theContext) Handle(BOPInt_Context)& theContext)
{ {
@ -1043,7 +1066,8 @@ Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse(const TopoDS_Shape& theSp,
//function :IsSplitToReverse //function :IsSplitToReverse
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse(const TopoDS_Face& theFSp, Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse
(const TopoDS_Face& theFSp,
const TopoDS_Face& theFSr, const TopoDS_Face& theFSr,
Handle(BOPInt_Context)& theContext) Handle(BOPInt_Context)& theContext)
{ {
@ -1084,7 +1108,8 @@ Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse(const TopoDS_Face& theFSp,
Standard_Integer iErr; Standard_Integer iErr;
gp_Pnt2d aP2DFSp; gp_Pnt2d aP2DFSp;
// //
iErr=BOPTools_AlgoTools3D::PointInFace(theFSp, aPFSp, aP2DFSp, theContext); iErr=BOPTools_AlgoTools3D::PointInFace(theFSp, aPFSp, aP2DFSp,
theContext);
if (iErr) { if (iErr) {
return bRet; return bRet;
} }
@ -1098,7 +1123,9 @@ Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse(const TopoDS_Face& theFSp,
else { else {
BRep_Tool::Range(aESp, aT1, aT2); BRep_Tool::Range(aESp, aT1, aT2);
aT=BOPTools_AlgoTools2D::IntermediatePoint(aT1, aT2); aT=BOPTools_AlgoTools2D::IntermediatePoint(aT1, aT2);
BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge(aESp, theFSp, aT, aPFSp, aDNFSp, theContext); BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge(aESp, theFSp, aT,
aPFSp, aDNFSp,
theContext);
} }
// //
// Parts of theContext->ComputeVS(..) // Parts of theContext->ComputeVS(..)
@ -1132,7 +1159,8 @@ Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse(const TopoDS_Face& theFSp,
//function :IsSplitToReverse //function :IsSplitToReverse
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse(const TopoDS_Edge& aEF1, Standard_Boolean BOPTools_AlgoTools::IsSplitToReverse
(const TopoDS_Edge& aEF1,
const TopoDS_Edge& aEF2, const TopoDS_Edge& aEF2,
Handle(BOPInt_Context)& theContext) Handle(BOPInt_Context)& theContext)
{ {
@ -1322,7 +1350,8 @@ void BOPTools_AlgoTools::MakePCurve(const TopoDS_Edge& aE,
aTolE=BRep_Tool::Tolerance(aE); aTolE=BRep_Tool::Tolerance(aE);
// //
const Handle(Geom_Curve)& aC3DE=BRep_Tool::Curve(aE, aT1, aT2); const Handle(Geom_Curve)& aC3DE=BRep_Tool::Curve(aE, aT1, aT2);
Handle(Geom_TrimmedCurve)aC3DETrim=new Geom_TrimmedCurve(aC3DE, aT1, aT2); Handle(Geom_TrimmedCurve)aC3DETrim=
new Geom_TrimmedCurve(aC3DE, aT1, aT2);
// //
for (i=0; i<2; ++i) { for (i=0; i<2; ++i) {
bPC = !i ? bPC1 : bPC2; bPC = !i ? bPC1 : bPC2;
@ -1350,10 +1379,12 @@ void BOPTools_AlgoTools::MakePCurve(const TopoDS_Edge& aE,
} }
// //
if (aC3DE->IsPeriodic()) { if (aC3DE->IsPeriodic()) {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D, aC2DA); BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aT1, aT2, aC2D,
aC2DA);
} }
else { else {
BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D, aC2DA); BOPTools_AlgoTools2D::AdjustPCurveOnFace(aFFWD, aC3DETrim, aC2D,
aC2DA);
} }
// //
aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolE); aBB.UpdateEdge(aE, aC2DA, aFFWD, aTolE);
@ -1376,7 +1407,8 @@ void BOPTools_AlgoTools::MakeEdge(const IntTools_Curve& theIC,
Standard_Real aTolV; Standard_Real aTolV;
BRep_Builder aBB; BRep_Builder aBB;
// //
BOPTools_AlgoTools::MakeSectEdge (theIC, theV1, theT1, theV2, theT2, theE); BOPTools_AlgoTools::MakeSectEdge (theIC, theV1, theT1, theV2, theT2,
theE);
// //
aBB.UpdateEdge(theE, theTolR3D); aBB.UpdateEdge(theE, theTolR3D);
// //
@ -1486,7 +1518,8 @@ void BOPTools_AlgoTools::MakeVertex(BOPCol_ListOfShape& aLV,
//function : GetEdgeOnFace //function : GetEdgeOnFace
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean BOPTools_AlgoTools::GetEdgeOnFace(const TopoDS_Edge& theE1, Standard_Boolean BOPTools_AlgoTools::GetEdgeOnFace
(const TopoDS_Edge& theE1,
const TopoDS_Face& theF2, const TopoDS_Face& theF2,
TopoDS_Edge& theE2) TopoDS_Edge& theE2)
{ {
@ -1639,7 +1672,8 @@ Standard_Real AngleWithRef(const gp_Dir& theD1,
// function: IsBlockInOnFace // function: IsBlockInOnFace
// purpose: // purpose:
//======================================================================= //=======================================================================
Standard_Boolean BOPTools_AlgoTools::IsBlockInOnFace (const IntTools_Range& aShrR, Standard_Boolean BOPTools_AlgoTools::IsBlockInOnFace
(const IntTools_Range& aShrR,
const TopoDS_Face& aF, const TopoDS_Face& aF,
const TopoDS_Edge& aE1, const TopoDS_Edge& aE1,
Handle(BOPInt_Context)& aContext) Handle(BOPInt_Context)& aContext)
@ -1729,7 +1763,8 @@ Standard_Boolean BOPTools_AlgoTools::IsBlockInOnFace (const IntTools_Range& aShr
//function : IsMicroEdge //function : IsMicroEdge
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean BOPTools_AlgoTools::IsMicroEdge(const TopoDS_Edge& aE, Standard_Boolean BOPTools_AlgoTools::IsMicroEdge
(const TopoDS_Edge& aE,
const Handle(BOPInt_Context)& aCtx) const Handle(BOPInt_Context)& aCtx)
{ {
Standard_Boolean bRet; Standard_Boolean bRet;
@ -1755,7 +1790,8 @@ Standard_Boolean BOPTools_AlgoTools::IsMicroEdge(const TopoDS_Edge& aE,
} }
// //
BOPInt_ShrunkRange aSR; BOPInt_ShrunkRange aSR;
aSR.SetData(aE, aT1, aT2, aV1, aV2, aCtx); aSR.SetContext(aCtx);
aSR.SetData(aE, aT1, aT2, aV1, aV2);
aSR.Perform(); aSR.Perform();
iErr=aSR.ErrorStatus(); iErr=aSR.ErrorStatus();
bRet = !(iErr==0); bRet = !(iErr==0);
@ -1785,7 +1821,8 @@ void GetFaceDir(const TopoDS_Edge& aE,
// //
gp_Pnt aPx; gp_Pnt aPx;
if (!FindPointInFace(aE, aF, aP, aDB, aPx, theContext, aProjPL)) { if (!FindPointInFace(aE, aF, aP, aDB, aPx, theContext, aProjPL)) {
BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge(aE, aF, aT, aPx, aDN, theContext); BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge(aE, aF, aT, aPx,
aDN, theContext);
aProjPL.Perform(aPx); aProjPL.Perform(aPx);
aPx = aProjPL.NearestPoint(); aPx = aProjPL.NearestPoint();
gp_Vec aVec(aP, aPx); gp_Vec aVec(aP, aPx);
@ -1882,8 +1919,7 @@ Standard_Boolean FindPointInFace(const TopoDS_Edge& aE,
//function : IsOpenShell //function : IsOpenShell
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean Standard_Boolean BOPTools_AlgoTools::IsOpenShell(const TopoDS_Shell& aSh)
BOPTools_AlgoTools::IsOpenShell(const TopoDS_Shell& aSh)
{ {
Standard_Boolean bRet; Standard_Boolean bRet;
Standard_Integer i, aNbE, aNbF; Standard_Integer i, aNbE, aNbF;

View File

@ -40,7 +40,8 @@ static
// function: UpdateVertex // function: UpdateVertex
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::UpdateVertex (const TopoDS_Vertex& aVF, void BOPTools_AlgoTools::UpdateVertex
(const TopoDS_Vertex& aVF,
const TopoDS_Vertex& aNewVertex) const TopoDS_Vertex& aNewVertex)
{ {
Standard_Real aTolVF, aTolNewVertex, aDist, aDTol=1.e-12, aNewTol; Standard_Real aTolVF, aTolNewVertex, aDist, aDTol=1.e-12, aNewTol;
@ -63,7 +64,7 @@ static
// function: UpdateVertex // function: UpdateVertex
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::UpdateVertex (const TopoDS_Edge& aE, void BOPTools_AlgoTools::UpdateVertex (const TopoDS_Edge& aE,
const Standard_Real aT, const Standard_Real aT,
const TopoDS_Vertex& aV) const TopoDS_Vertex& aV)
{ {
@ -86,7 +87,7 @@ static
// function: UpdateVertex // function: UpdateVertex
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::UpdateVertex (const IntTools_Curve& aC, void BOPTools_AlgoTools::UpdateVertex (const IntTools_Curve& aC,
const Standard_Real aT, const Standard_Real aT,
const TopoDS_Vertex& aV) const TopoDS_Vertex& aV)
{ {
@ -108,7 +109,7 @@ static
// function: MakeSectEdge // function: MakeSectEdge
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::MakeSectEdge(const IntTools_Curve& aIC, void BOPTools_AlgoTools::MakeSectEdge(const IntTools_Curve& aIC,
const TopoDS_Vertex& aV1, const TopoDS_Vertex& aV1,
const Standard_Real aP1, const Standard_Real aP1,
const TopoDS_Vertex& aV2, const TopoDS_Vertex& aV2,
@ -133,23 +134,19 @@ static
// function: MakeSplitEdge // function: MakeSplitEdge
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::MakeSplitEdge(const TopoDS_Edge& aE, void BOPTools_AlgoTools::MakeSplitEdge(const TopoDS_Edge& aE,
const TopoDS_Vertex& aV1, const TopoDS_Vertex& aV1,
const Standard_Real aP1, const Standard_Real aP1,
const TopoDS_Vertex& aV2, const TopoDS_Vertex& aV2,
const Standard_Real aP2, const Standard_Real aP2,
TopoDS_Edge& aNewEdge) TopoDS_Edge& aNewEdge)
{ {
Standard_Real f, l, aTol; Standard_Real aTol;//f, l,
Handle(Geom_Curve) aC=BRep_Tool::Curve (aE, f, l);
aTol=BRep_Tool::Tolerance(aE); aTol=BRep_Tool::Tolerance(aE);
// //
// MakeEdge is used for chechking all input data only
BRepBuilderAPI_MakeEdge aMakeEdge(aC, aV1, aV2, aP1, aP2);
//ZZ const TopoDS_Edge& E1=TopoDS::Edge(aMakeEdge.Shape());
TopoDS_Edge E=aE; TopoDS_Edge E=aE;
E.EmptyCopy(); E.EmptyCopy();
//
BRep_Builder BB; BRep_Builder BB;
BB.Add (E, aV1); BB.Add (E, aV1);
BB.Add (E, aV2); BB.Add (E, aV2);
@ -162,7 +159,7 @@ static
// function: MakeNewVertex // function: MakeNewVertex
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::MakeNewVertex(const TopoDS_Vertex& aV1, void BOPTools_AlgoTools::MakeNewVertex(const TopoDS_Vertex& aV1,
const TopoDS_Vertex& aV2, const TopoDS_Vertex& aV2,
TopoDS_Vertex& aNewVertex) TopoDS_Vertex& aNewVertex)
{ {
@ -190,7 +187,7 @@ static
// function: MakeNewVertex // function: MakeNewVertex
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::MakeNewVertex(const gp_Pnt& aP, void BOPTools_AlgoTools::MakeNewVertex(const gp_Pnt& aP,
const Standard_Real aTol, const Standard_Real aTol,
TopoDS_Vertex& aNewVertex) TopoDS_Vertex& aNewVertex)
{ {
@ -202,7 +199,7 @@ static
// function: MakeNewVertex // function: MakeNewVertex
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::MakeNewVertex(const TopoDS_Edge& aE1, void BOPTools_AlgoTools::MakeNewVertex(const TopoDS_Edge& aE1,
const Standard_Real aParm1, const Standard_Real aParm1,
const TopoDS_Edge& aE2, const TopoDS_Edge& aE2,
const Standard_Real aParm2, const Standard_Real aParm2,
@ -233,7 +230,7 @@ static
// function: MakeNewVertex // function: MakeNewVertex
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::MakeNewVertex(const TopoDS_Edge& aE1, void BOPTools_AlgoTools::MakeNewVertex(const TopoDS_Edge& aE1,
const Standard_Real aParm1, const Standard_Real aParm1,
const TopoDS_Face& aF1, const TopoDS_Face& aF1,
TopoDS_Vertex& aNewVertex) TopoDS_Vertex& aNewVertex)
@ -257,7 +254,7 @@ static
// function: PointOnEdge // function: PointOnEdge
// purpose: // purpose:
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::PointOnEdge(const TopoDS_Edge& aE, void BOPTools_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
const Standard_Real aParm, const Standard_Real aParm,
gp_Pnt& aPnt) gp_Pnt& aPnt)
{ {
@ -270,7 +267,7 @@ static
//function : CorrectRange //function : CorrectRange
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::CorrectRange(const TopoDS_Edge& aE1, void BOPTools_AlgoTools::CorrectRange(const TopoDS_Edge& aE1,
const TopoDS_Edge& aE2, const TopoDS_Edge& aE2,
const IntTools_Range& aSR, const IntTools_Range& aSR,
IntTools_Range& aNewSR) IntTools_Range& aNewSR)
@ -342,7 +339,7 @@ static
//function : CorrectRange //function : CorrectRange
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPTools_AlgoTools::CorrectRange(const TopoDS_Edge& aE, void BOPTools_AlgoTools::CorrectRange(const TopoDS_Edge& aE,
const TopoDS_Face& aF, const TopoDS_Face& aF,
const IntTools_Range& aSR, const IntTools_Range& aSR,
IntTools_Range& aNewSR) IntTools_Range& aNewSR)
@ -408,7 +405,7 @@ static
//function : Dimension //function : Dimension
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer BOPTools_AlgoTools::Dimension(const TopoDS_Shape& theS) Standard_Integer BOPTools_AlgoTools::Dimension(const TopoDS_Shape& theS)
{ {
Standard_Integer i, iRet, iRx0 = 0, iRx = 0; Standard_Integer i, iRet, iRx0 = 0, iRx = 0;
TopAbs_ShapeEnum aTS; TopAbs_ShapeEnum aTS;
@ -462,7 +459,7 @@ static
//function : TreatCompound //function : TreatCompound
//purpose : //purpose :
//======================================================================= //=======================================================================
void TreatCompound(const TopoDS_Shape& theC1, void TreatCompound(const TopoDS_Shape& theC1,
BOPCol_ListOfShape& theLSX) BOPCol_ListOfShape& theLSX)
{ {
Standard_Integer aNbC1; Standard_Integer aNbC1;