mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0024639: Parallelization FillDS part of BO
Modifications to avoid compilation errors
This commit is contained in:
@@ -20,7 +20,8 @@ class PaveFiller from BOPAlgo
|
||||
---Purpose:
|
||||
|
||||
uses
|
||||
Pnt from gp,
|
||||
Pnt from gp,
|
||||
ShapeEnum from TopAbs,
|
||||
Vertex from TopoDS,
|
||||
Face from TopoDS,
|
||||
Edge from TopoDS,
|
||||
@@ -139,7 +140,12 @@ is
|
||||
FillShrunkData(me:out;
|
||||
thePB:out PaveBlock from BOPDS)
|
||||
is protected;
|
||||
|
||||
|
||||
FillShrunkData(me:out;
|
||||
theType1: ShapeEnum from TopAbs;
|
||||
theType2: ShapeEnum from TopAbs)
|
||||
is protected;
|
||||
|
||||
PerformVerticesEE(me:out;
|
||||
theMVCPB:out IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS;
|
||||
theAllocator:out BaseAllocator from BOPCol)
|
||||
|
@@ -21,6 +21,9 @@
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
#include <BOPCol_TBB.hxx>
|
||||
|
||||
#include <BOPInt_Context.hxx>
|
||||
|
||||
#include <BOPDS_Iterator.hxx>
|
||||
@@ -31,20 +34,110 @@
|
||||
#include <BRepBndLib.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
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::PerformVE()
|
||||
void BOPAlgo_PaveFiller::PerformVE()
|
||||
{
|
||||
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;
|
||||
BOPDS_Pave aPave;
|
||||
BOPDS_PassKey aPK;
|
||||
BOPDS_MapOfPassKey aMPK;
|
||||
BRep_Builder aBB;
|
||||
BOPAlgo_VectorOfVertexEdge aVVE;
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
@@ -92,8 +185,27 @@
|
||||
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape()));
|
||||
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) {
|
||||
aVESolver.Indices(nV, nE, nVx);
|
||||
aT=aVESolver.Parameter();
|
||||
const TopoDS_Vertex& aV=aVESolver.Vertex();
|
||||
const TopoDS_Edge& aE=aVESolver.Edge();
|
||||
// 1
|
||||
i=aVEs.Append()-1;
|
||||
BOPDS_InterfVE& aVE=aVEs(i);
|
||||
@@ -117,5 +229,5 @@
|
||||
BRepBndLib::Add(aV, aBoxDS);
|
||||
}
|
||||
}
|
||||
}//for (; myIterator->More(); myIterator->Next()) {
|
||||
}//for (k=0; k < aNbVE; ++k) {
|
||||
}
|
||||
|
@@ -98,60 +98,18 @@ class BOPAlgo_EdgeEdge : public IntTools_EdgeEdge {
|
||||
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
|
||||
// purpose:
|
||||
@@ -162,6 +120,8 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
//
|
||||
myErrorStatus=0;
|
||||
//
|
||||
FillShrunkData(TopAbs_EDGE, TopAbs_EDGE);
|
||||
//
|
||||
myIterator->Initialize(TopAbs_EDGE, TopAbs_EDGE);
|
||||
iSize=myIterator->ExpectedLength();
|
||||
if (!iSize) {
|
||||
@@ -214,10 +174,7 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
//
|
||||
Handle(BOPDS_PaveBlock)& aPB1=aIt1.ChangeValue();
|
||||
if (!aPB1->HasShrunkData()) {
|
||||
FillShrunkData(aPB1);
|
||||
if (myWarningStatus) {
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
aPB1->ShrunkData(aTS11, aTS12, aBB1);
|
||||
//
|
||||
@@ -227,10 +184,7 @@ void BOPAlgo_PaveFiller::PerformEE()
|
||||
//
|
||||
Handle(BOPDS_PaveBlock)& aPB2=aIt2.ChangeValue();
|
||||
if (!aPB2->HasShrunkData()) {
|
||||
FillShrunkData(aPB2);
|
||||
if (myWarningStatus) {
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
aPB2->ShrunkData(aTS21, aTS22, aBB2);
|
||||
//
|
||||
@@ -744,7 +698,8 @@ void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
|
||||
nE=thePB->OriginalEdge();
|
||||
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();
|
||||
iErr=aSR.ErrorStatus();
|
||||
|
@@ -34,6 +34,9 @@
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
|
||||
#include <BOPCol_NCVector.hxx>
|
||||
#include <BOPCol_TBB.hxx>
|
||||
|
||||
#include <BOPTools_AlgoTools.hxx>
|
||||
#include <BOPTools_AlgoTools2D.hxx>
|
||||
|
||||
@@ -52,14 +55,101 @@
|
||||
#include <BOPDS_MapOfPaveBlock.hxx>
|
||||
#include <BOPDS_Curve.hxx>
|
||||
|
||||
|
||||
static void UpdateVertices(const TopoDS_Edge& aE,
|
||||
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
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::MakeSplitEdges()
|
||||
void BOPAlgo_PaveFiller::MakeSplitEdges()
|
||||
{
|
||||
Standard_Integer aNbPBP;
|
||||
//
|
||||
@@ -72,26 +162,20 @@ static void UpdateVertices(const TopoDS_Edge& aE,
|
||||
}
|
||||
//
|
||||
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;
|
||||
Handle(NCollection_IncAllocator) aAllocator;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItPB, aItPBCB;
|
||||
Handle(BOPDS_PaveBlock) aPB, aPBx;
|
||||
//-----------------------------------------------------scope f
|
||||
//
|
||||
aAllocator=new NCollection_IncAllocator();
|
||||
//
|
||||
BOPDS_MapOfPaveBlock aMPB(100,aAllocator);
|
||||
Handle(BOPDS_PaveBlock) aPB;
|
||||
BOPDS_MapOfPaveBlock aMPB(100);
|
||||
TopoDS_Vertex aV1, aV2;
|
||||
TopoDS_Edge aE;
|
||||
BOPAlgo_VectorOfSplitEdge aVBSE;
|
||||
|
||||
//
|
||||
for (i=0; i<aNbPBP; ++i) {
|
||||
BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
|
||||
//
|
||||
aNbPB=aLPB.Extent();
|
||||
//DEBf
|
||||
if (aNbPB) {
|
||||
aPBx=aLPB.First();
|
||||
}
|
||||
//DEBt
|
||||
if (aNbPB==1) {
|
||||
aPB=aLPB.First();
|
||||
aPB->Indices(nV1, nV2);
|
||||
@@ -120,23 +204,57 @@ static void UpdateVertices(const TopoDS_Edge& aE,
|
||||
aPB->Indices(nV1, nV2);
|
||||
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) {
|
||||
aCB->SetEdge(nSp);
|
||||
aBSE.SetCommonBlock(aCB);
|
||||
}
|
||||
else {
|
||||
aPB->SetEdge(nSp);
|
||||
}
|
||||
}// if (aMPB.Add(aPB)) {
|
||||
}// for (; aItPB.More(); aItPB.Next()) {
|
||||
}// for (i=0; i<aNbPBP; ++i) {
|
||||
}
|
||||
} // for (; aItPB.More(); aItPB.Next()) {
|
||||
} // for (i=0; i<aNbPBP; ++i) {
|
||||
//
|
||||
//-----------------------------------------------------scope t
|
||||
aMPB.Clear();
|
||||
aAllocator.Nullify();
|
||||
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 {
|
||||
aPBk->SetEdge(nSp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: SplitEdge
|
||||
// purpose:
|
||||
@@ -173,12 +291,11 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
|
||||
nSp=myDS->Append(aSI);
|
||||
return nSp;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: MakePCurves
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::MakePCurves()
|
||||
void BOPAlgo_PaveFiller::MakePCurves()
|
||||
{
|
||||
Standard_Integer i, nF1, nF2, aNbC, k, nE, aNbFF, aNbFI;
|
||||
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
|
||||
@@ -262,12 +379,11 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function: RefineFaceInfoOn
|
||||
// purpose:
|
||||
//=======================================================================
|
||||
void BOPAlgo_PaveFiller::RefineFaceInfoOn()
|
||||
void BOPAlgo_PaveFiller::RefineFaceInfoOn()
|
||||
{
|
||||
Standard_Integer aNbPBP;
|
||||
//
|
||||
@@ -304,13 +420,13 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
|
||||
}//for (i=0; i<aNbPBP; ++i) {
|
||||
myDS->RefineFaceInfoOn();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateVertices
|
||||
//purpose : update tolerances of vertices comparing extremities of
|
||||
// 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_Real aT[2], aUx, aVx, aTolV2, aD2, aD;
|
||||
|
179
src/BOPAlgo/BOPAlgo_PaveFiller_9.cxx
Normal file
179
src/BOPAlgo/BOPAlgo_PaveFiller_9.cxx
Normal 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);
|
||||
}
|
||||
}
|
@@ -16,3 +16,4 @@ BOPAlgo_ListOfCheckResult.hxx
|
||||
BOPAlgo_Builder_2Cnt.hxx
|
||||
BOPAlgo_CheckerSI_1.cxx
|
||||
|
||||
BOPAlgo_PaveFiller_9.cxx
|
||||
|
Reference in New Issue
Block a user