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

0024639: Parallelization FillDS part of BO

The contents dealing with the parallel computation of Vertex/Face interferences.
This commit is contained in:
pkv 2014-04-01 07:19:18 +04:00 committed by apn
parent c0ade4c610
commit a0a3f6aca4
6 changed files with 450 additions and 383 deletions

View File

@ -166,11 +166,6 @@ is
FillImagesFaces1 (me:out) FillImagesFaces1 (me:out)
is protected; is protected;
FillInternalVertices(me:out;
theLF:out ListOfShape from BOPCol;
theLIV:out ListOfInteger from BOPCol)
is protected;
-- --
-- solids -- solids
-- --

View File

@ -16,28 +16,30 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <BOPAlgo_Builder.ixx> #include <BOPAlgo_Builder.ixx>
//
#include <NCollection_IncAllocator.hxx> #include <NCollection_IncAllocator.hxx>
//
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx> #include <TopoDS_Compound.hxx>
//
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
//
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
//
#include <BOPCol_ListOfShape.hxx> #include <BOPCol_ListOfShape.hxx>
#include <BOPCol_ListOfInteger.hxx> #include <BOPCol_ListOfInteger.hxx>
#include <BOPCol_MapOfInteger.hxx> #include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_DataMapOfIntegerListOfShape.hxx> #include <BOPCol_DataMapOfIntegerListOfShape.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx> #include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
//
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
//
#include <BOPDS_PaveBlock.hxx> #include <BOPDS_PaveBlock.hxx>
#include <BOPDS_ShapeInfo.hxx> #include <BOPDS_ShapeInfo.hxx>
#include <BOPDS_DS.hxx> #include <BOPDS_DS.hxx>
@ -47,7 +49,7 @@
#include <BOPDS_Interf.hxx> #include <BOPDS_Interf.hxx>
#include <BOPDS_VectorOfCurve.hxx> #include <BOPDS_VectorOfCurve.hxx>
#include <BOPDS_VectorOfPoint.hxx> #include <BOPDS_VectorOfPoint.hxx>
//
#include <BOPTools.hxx> #include <BOPTools.hxx>
#include <BOPTools_AlgoTools.hxx> #include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx> #include <BOPTools_AlgoTools2D.hxx>
@ -57,7 +59,7 @@
#include <BOPTools_ListOfCoupleOfShape.hxx> #include <BOPTools_ListOfCoupleOfShape.hxx>
#include <BOPTools_MapOfSet.hxx> #include <BOPTools_MapOfSet.hxx>
#include <BOPTools_DataMapOfShapeSet.hxx> #include <BOPTools_DataMapOfShapeSet.hxx>
#include <BOPAlgo_Builder_2Cnt.hxx>
static static
Standard_Boolean HasPaveBlocksOnIn(const BOPDS_FaceInfo& aFI1, Standard_Boolean HasPaveBlocksOnIn(const BOPDS_FaceInfo& aFI1,
@ -71,8 +73,190 @@ static
void MakeBlocksCnx(const BOPCol_IndexedDataMapOfShapeListOfShape& aMILI, void MakeBlocksCnx(const BOPCol_IndexedDataMapOfShapeListOfShape& aMILI,
BOPCol_DataMapOfIntegerListOfShape& aMBlocks, BOPCol_DataMapOfIntegerListOfShape& aMBlocks,
Handle(NCollection_IncAllocator)& aAllocator); Handle(NCollection_IncAllocator)& aAllocator);
//
typedef BOPCol_NCVector<TopoDS_Shape> BOPAlgo_VectorOfShape;
//
typedef BOPCol_NCVector<BOPAlgo_VectorOfShape> \
BOPAlgo_VectorOfVectorOfShape;
//
typedef NCollection_IndexedDataMap\
<BOPTools_Set, Standard_Integer, BOPTools_SetMapHasher> \
BOPAlgo_IndexedDataMapOfSetInteger;
//
//=======================================================================
//class : BOPAlgo_PairOfShapeBoolean
//purpose :
//=======================================================================
class BOPAlgo_PairOfShapeBoolean {
public:
BOPAlgo_PairOfShapeBoolean()
: myFlag(Standard_False) {
}
//
TopoDS_Shape& Shape1() {
return myShape1;
}
//
TopoDS_Shape& Shape2() {
return myShape2;
}
//
Standard_Boolean& Flag() {
return myFlag;
}
//
protected:
Standard_Boolean myFlag;
TopoDS_Shape myShape1;
TopoDS_Shape myShape2;
};
//
typedef BOPCol_NCVector<BOPAlgo_PairOfShapeBoolean> \
BOPAlgo_VectorOfPairOfShapeBoolean;
//
//=======================================================================
//function : BOPAlgo_BuilderSDFaceFunctor
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSDFaceFunctor {
protected:
BOPAlgo_VectorOfPairOfShapeBoolean* myPVPSB;
public:
//
BOPAlgo_BuilderSDFaceFunctor(BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB)
: myPVPSB(&aVPSB){
}
//
void operator()( const flexible_range<Standard_Integer>& aBR ) const {
Standard_Boolean bFlag;
Standard_Integer i, iBeg, iEnd;
Handle(BOPInt_Context) aContext;
//
aContext=new BOPInt_Context;
//
BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB=*myPVPSB;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
BOPAlgo_PairOfShapeBoolean& aPSB=aVPSB(i);
const TopoDS_Face& aFj=(*(TopoDS_Face*)(&aPSB.Shape1()));
const TopoDS_Face& aFk=(*(TopoDS_Face*)(&aPSB.Shape2()));
bFlag=BOPTools_AlgoTools::AreFacesSameDomain(aFj, aFk, aContext);
if (bFlag) {
aPSB.Flag()=bFlag;
}
}
}
};
//
//=======================================================================
//function : BOPAlgo_BuilderSDFaceCnt
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSDFaceCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT static
void Perform(const Standard_Boolean bRunParallel,
BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB) {
Standard_Integer aNbVPSB;
//
aNbVPSB=aVPSB.Extent();
BOPAlgo_BuilderSDFaceFunctor aBFF(aVPSB);
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Integer>(0,aNbVPSB), aBFF);
}
else {
aBFF.operator()(flexible_range<Standard_Integer>(0,aNbVPSB));
}
}
};
//=======================================================================
// BuilderFace
//
typedef BOPCol_NCVector<BOPAlgo_BuilderFace> BOPAlgo_VectorOfBuilderFace;
//
typedef BOPCol_TBBFunctor
<BOPAlgo_BuilderFace,
BOPAlgo_VectorOfBuilderFace> BOPAlgo_BuilderFaceFunctor;
//
typedef BOPCol_TBBCnt
<BOPAlgo_BuilderFaceFunctor,
BOPAlgo_VectorOfBuilderFace> BOPAlgo_BuilderFaceCnt;
//
//=======================================================================
//class : BOPAlgo_VFI
//purpose :
//=======================================================================
class BOPAlgo_VFI {
public:
BOPAlgo_VFI()
: myFlag(-1) {
}
//
~BOPAlgo_VFI(){
}
//
void SetVertex(const TopoDS_Vertex& aV) {
myV=aV;
}
//
TopoDS_Vertex& Vertex() {
return myV;
}
//
void SetFace(const TopoDS_Face& aF) {
myF=aF;
}
//
TopoDS_Face& Face() {
return myF;
}
//
Standard_Integer Flag()const {
return myFlag;
}
//
void SetContext(const Handle(BOPInt_Context)& aContext) {
myContext=aContext;
}
//
const Handle(BOPInt_Context)& Context()const {
return myContext;
}
//
void Perform() {
Standard_Real aT1, aT2;
//
myFlag=myContext->ComputeVF(myV, myF, aT1, aT2);
}
//
protected:
Standard_Integer myFlag;
TopoDS_Vertex myV;
TopoDS_Face myF;
Handle(BOPInt_Context) myContext;
};
//
typedef BOPCol_NCVector<BOPAlgo_VFI> BOPAlgo_VectorOfVFI;
//
typedef BOPCol_TBBContextFunctor
<BOPAlgo_VFI,
BOPAlgo_VectorOfVFI,
Handle_BOPInt_Context,
BOPInt_Context> BOPAlgo_VFIFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_VFIFunctor,
BOPAlgo_VectorOfVFI,
Handle_BOPInt_Context> BOPAlgo_VFICnt;
//
//======================================================================= //=======================================================================
//function : FillImagesFaces //function : FillImagesFaces
//purpose : //purpose :
@ -493,11 +677,15 @@ void BOPAlgo_Builder::FillSameDomainFaces()
//======================================================================= //=======================================================================
void BOPAlgo_Builder::FillImagesFaces1() void BOPAlgo_Builder::FillImagesFaces1()
{ {
Standard_Integer i, aNbS, iSense; Standard_Integer i, aNbS, iSense, nVx, aNbVFI, iFlag;
TopoDS_Face aFSD; TopoDS_Face aFSD;
TopoDS_Vertex aVx;
BRep_Builder aBB;
BOPCol_ListOfInteger aLIAV; BOPCol_ListOfInteger aLIAV;
BOPCol_ListOfShape aLFIm; BOPCol_ListOfShape aLFIm;
BOPCol_ListIteratorOfListOfShape aItLS; BOPCol_ListIteratorOfListOfInteger aItV;
BOPCol_ListIteratorOfListOfShape aItLS, aItF;
BOPAlgo_VectorOfVFI aVVFI;
// //
aNbS=myDS->NbSourceShapes(); aNbS=myDS->NbSourceShapes();
for (i=0; i<aNbS; ++i) { for (i=0; i<aNbS; ++i) {
@ -512,6 +700,7 @@ void BOPAlgo_Builder::FillImagesFaces1()
continue; continue;
} }
// //
// 1.
aLIAV.Clear(); aLIAV.Clear();
myDS->AloneVertices(i, aLIAV); myDS->AloneVertices(i, aLIAV);
aLFIm.Clear(); aLFIm.Clear();
@ -533,47 +722,50 @@ void BOPAlgo_Builder::FillImagesFaces1()
} }
} }
// //
FillInternalVertices(aLFIm, aLIAV); //FillInternalVertices(aLFIm, aLIAV);
// //
myImages.Bind(aF, aLFIm); myImages.Bind(aF, aLFIm);
// //
//fill myOrigins // 2. fill myOrigins
aItLS.Initialize(aLFIm); aItLS.Initialize(aLFIm);
for (; aItLS.More(); aItLS.Next()) { for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Face& aFSp=(*(TopoDS_Face*)(&aItLS.Value())); const TopoDS_Face& aFSp=(*(TopoDS_Face*)(&aItLS.Value()));
myOrigins.Bind(aFSp, aF); myOrigins.Bind(aFSp, aF);
} }
}// for (i=0; i<aNbS; ++i) {
}
//=======================================================================
// function: FillInternalVertices
// purpose:
//=======================================================================
void BOPAlgo_Builder::FillInternalVertices(BOPCol_ListOfShape& aLFIm,
BOPCol_ListOfInteger& aLIAV)
{
Standard_Integer nV, iFlag;
Standard_Real aU1, aU2;
TopoDS_Vertex aV;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfInteger aItV;
BOPCol_ListIteratorOfListOfShape aItF;
// //
// 3.
aItV.Initialize(aLIAV); aItV.Initialize(aLIAV);
for (; aItV.More(); aItV.Next()) { for (; aItV.More(); aItV.Next()) {
nV=aItV.Value(); nVx=aItV.Value();
aV=(*(TopoDS_Vertex*)(&myDS->Shape(nV))); aVx=(*(TopoDS_Vertex*)(&myDS->Shape(nVx)));
aV.Orientation(TopAbs_INTERNAL); aVx.Orientation(TopAbs_INTERNAL);
// //
aItF.Initialize(aLFIm); aItF.Initialize(aLFIm);
for (; aItF.More(); aItF.Next()) { for (; aItF.More(); aItF.Next()) {
TopoDS_Face& aF=(*(TopoDS_Face*)(&aItF.Value())); TopoDS_Face& aFy=(*(TopoDS_Face*)(&aItF.Value()));
iFlag=myContext->ComputeVF(aV, aF, aU1, aU2); //
if (!iFlag) { BOPAlgo_VFI& aVFI=aVVFI.Append1();
aBB.Add(aF, aV); aVFI.SetVertex(aVx);
break; aVFI.SetFace(aFy);
} }
} }
}// for (i=0; i<aNbS; ++i) {
//
// 4.
aNbVFI=aVVFI.Extent();
//================================================================
BOPAlgo_VFICnt::Perform(myRunParallel, aVVFI, myContext);
//================================================================
//
for (i=0; i < aNbVFI; ++i) {
BOPAlgo_VFI& aVFI=aVVFI(i);
//
iFlag=aVFI.Flag();
if (!iFlag) {
TopoDS_Vertex& aVx=aVFI.Vertex();
TopoDS_Face& aFy=aVFI.Face();
aBB.Add(aFy, aVx);
}
} }
} }
//======================================================================= //=======================================================================
@ -657,7 +849,6 @@ void MakeBlocksCnx(const BOPCol_IndexedDataMapOfShapeListOfShape& aMILI,
aMEC.Clear(); aMEC.Clear();
aMVS.Clear(); aMVS.Clear();
} }
//======================================================================= //=======================================================================
//function : FillMap //function : FillMap
//purpose : //purpose :
@ -722,6 +913,7 @@ Standard_Boolean HasPaveBlocksOnIn(const BOPDS_FaceInfo& aFI1,
} }
return bRet; return bRet;
} }
/* /*
//DEBf //DEBf
{ {

View File

@ -1,252 +0,0 @@
// Created by: Peter KURNEV
// Copyright (c) 1999-2013 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.
#ifndef BOPAlgo_Builder_2Cnt_HeaderFile
#define BOPAlgo_Builder_2Cnt_HeaderFile
#include <NCollection_IndexedDataMap.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPTools_Set.hxx>
#include <BOPTools_SetMapHasher.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPInt_Context.hxx>
#include <BOPAlgo_BuilderFace.hxx>
#include <BOPAlgo_BuilderSolid.hxx>
typedef BOPCol_NCVector<BOPAlgo_BuilderFace> BOPAlgo_VectorOfBuilderFace;
//
//=======================================================================
//class : BOPAlgo_BuilderFaceFunctor
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderFaceFunctor {
protected:
BOPAlgo_VectorOfBuilderFace* myPVBF;
//
public:
//
BOPAlgo_BuilderFaceFunctor(BOPAlgo_VectorOfBuilderFace& aVBF)
: myPVBF(&aVBF) {
}
//
void operator()( const flexible_range<Standard_Integer>& aBR ) const{
Standard_Integer i, iBeg, iEnd;
//
BOPAlgo_VectorOfBuilderFace& aVBF=*myPVBF;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
BOPAlgo_BuilderFace& aBF=aVBF(i);
//
aBF.Perform();
}
}
};
//=======================================================================
//class : BOPAlgo_BuilderFaceCnt
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderFaceCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT static void Perform(const Standard_Boolean bRunParallel,
BOPAlgo_VectorOfBuilderFace& aVBF) {
//
BOPAlgo_BuilderFaceFunctor aBFF(aVBF);
Standard_Integer aNbBF=aVBF.Extent();
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Integer>(0,aNbBF), aBFF);
}
else {
aBFF.operator()(flexible_range<Standard_Integer>(0,aNbBF));
}
}
//
};
//
typedef BOPCol_NCVector<TopoDS_Shape> BOPAlgo_VectorOfShape;
//
typedef BOPCol_NCVector<BOPAlgo_VectorOfShape> \
BOPAlgo_VectorOfVectorOfShape;
//
typedef NCollection_IndexedDataMap\
<BOPTools_Set, Standard_Integer, BOPTools_SetMapHasher> \
BOPAlgo_IndexedDataMapOfSetInteger;
//
//=======================================================================
//class : BOPAlgo_PairOfShapeBoolean
//purpose :
//=======================================================================
class BOPAlgo_PairOfShapeBoolean {
public:
BOPAlgo_PairOfShapeBoolean()
: myFlag(Standard_False) {
}
//
TopoDS_Shape& Shape1() {
return myShape1;
}
//
TopoDS_Shape& Shape2() {
return myShape2;
}
//
Standard_Boolean& Flag() {
return myFlag;
}
//
protected:
Standard_Boolean myFlag;
TopoDS_Shape myShape1;
TopoDS_Shape myShape2;
};
//
typedef BOPCol_NCVector<BOPAlgo_PairOfShapeBoolean> \
BOPAlgo_VectorOfPairOfShapeBoolean;
//
//=======================================================================
//function : BOPAlgo_BuilderSDFaceFunctor
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSDFaceFunctor {
protected:
BOPAlgo_VectorOfPairOfShapeBoolean* myPVPSB;
public:
//
BOPAlgo_BuilderSDFaceFunctor(BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB)
: myPVPSB(&aVPSB){
}
//
void operator()( const flexible_range<Standard_Integer>& aBR ) const {
Standard_Boolean bFlag;
Standard_Integer i, iBeg, iEnd;
Handle(BOPInt_Context) aContext;
//
aContext=new BOPInt_Context;
//
BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB=*myPVPSB;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
BOPAlgo_PairOfShapeBoolean& aPSB=aVPSB(i);
const TopoDS_Face& aFj=(*(TopoDS_Face*)(&aPSB.Shape1()));
const TopoDS_Face& aFk=(*(TopoDS_Face*)(&aPSB.Shape2()));
bFlag=BOPTools_AlgoTools::AreFacesSameDomain(aFj, aFk, aContext);
if (bFlag) {
aPSB.Flag()=bFlag;
}
}
}
};
//
//=======================================================================
//function : BOPAlgo_BuilderSDFaceCnt
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSDFaceCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT static
void Perform(const Standard_Boolean bRunParallel,
BOPAlgo_VectorOfPairOfShapeBoolean& aVPSB) {
Standard_Integer aNbVPSB;
//
aNbVPSB=aVPSB.Extent();
BOPAlgo_BuilderSDFaceFunctor aBFF(aVPSB);
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Integer>(0,aNbVPSB), aBFF);
}
else {
aBFF.operator()(flexible_range<Standard_Integer>(0,aNbVPSB));
}
}
//
};
//
typedef BOPCol_NCVector<BOPAlgo_BuilderSolid> BOPAlgo_VectorOfBuilderSolid;
//
//=======================================================================
//class : BOPAlgo_BuilderSolidFunctor
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSolidFunctor {
protected:
BOPAlgo_VectorOfBuilderSolid* myPVBS;
//
public:
//
BOPAlgo_BuilderSolidFunctor(BOPAlgo_VectorOfBuilderSolid& aVBS)
: myPVBS(&aVBS) {
}
//
void operator()( const flexible_range<Standard_Integer>& aBR ) const{
Standard_Integer i, iBeg, iEnd;
//
BOPAlgo_VectorOfBuilderSolid& aVBS=*myPVBS;
//
iBeg=aBR.begin();
iEnd=aBR.end();
for(i=iBeg; i!=iEnd; ++i) {
BOPAlgo_BuilderSolid& aBS=aVBS(i);
//
aBS.Perform();
}
}
};
//=======================================================================
//class : BOPAlgo_BuilderSolidCnt
//purpose : The class provides the interface and implementation
// of the parallel computations
//=======================================================================
class BOPAlgo_BuilderSolidCnt {
public:
//-------------------------------
// Perform
Standard_EXPORT static void Perform(const Standard_Boolean bRunParallel,
BOPAlgo_VectorOfBuilderSolid& aVBS) {
Standard_Integer aNbBS=aVBS.Extent();
BOPAlgo_BuilderSolidFunctor aBSF(aVBS);
//
if (bRunParallel) {
flexible_for(flexible_range<Standard_Integer>(0,aNbBS), aBSF);
}
else {
aBSF.operator()(flexible_range<Standard_Integer>(0,aNbBS));
}
}
//
};
#endif

View File

@ -16,13 +16,13 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <BOPAlgo_Builder.hxx> #include <BOPAlgo_Builder.hxx>
//
#include <NCollection_IncAllocator.hxx> #include <NCollection_IncAllocator.hxx>
#include <NCollection_UBTreeFiller.hxx> #include <NCollection_UBTreeFiller.hxx>
//
#include <Bnd_Box.hxx> #include <Bnd_Box.hxx>
#include <TopAbs_State.hxx> #include <TopAbs_State.hxx>
//
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx> #include <TopoDS_Iterator.hxx>
#include <TopoDS_Solid.hxx> #include <TopoDS_Solid.hxx>
@ -33,10 +33,10 @@
#include <TopoDS_Iterator.hxx> #include <TopoDS_Iterator.hxx>
#include <TopoDS_Shell.hxx> #include <TopoDS_Shell.hxx>
#include <TopoDS_Compound.hxx> #include <TopoDS_Compound.hxx>
//
#include <TopExp.hxx> #include <TopExp.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
//
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
#include <BRepTools.hxx> #include <BRepTools.hxx>
#include <BRepClass3d_SolidClassifier.hxx> #include <BRepClass3d_SolidClassifier.hxx>
@ -49,6 +49,8 @@
#include <BOPCol_BoxBndTree.hxx> #include <BOPCol_BoxBndTree.hxx>
#include <BOPCol_ListOfInteger.hxx> #include <BOPCol_ListOfInteger.hxx>
#include <BOPCol_DataMapOfIntegerShape.hxx> #include <BOPCol_DataMapOfIntegerShape.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
// //
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
// //
@ -61,7 +63,6 @@
#include <BOPTools_Set.hxx> #include <BOPTools_Set.hxx>
// //
#include <BOPAlgo_BuilderSolid.hxx> #include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_Builder_2Cnt.hxx>
static static
@ -73,6 +74,20 @@ static
BOPCol_MapOfShape& aMFence, BOPCol_MapOfShape& aMFence,
BOPCol_ListOfShape& theLS); BOPCol_ListOfShape& theLS);
//=======================================================================
// BOPAlgo_BuilderSolid
//
typedef BOPCol_NCVector
<BOPAlgo_BuilderSolid> BOPAlgo_VectorOfBuilderSolid;
//
typedef BOPCol_TBBFunctor
<BOPAlgo_BuilderSolid,
BOPAlgo_VectorOfBuilderSolid> BOPAlgo_BuilderSolidFunctor;
//
typedef BOPCol_TBBCnt
<BOPAlgo_BuilderSolidFunctor,
BOPAlgo_VectorOfBuilderSolid> BOPAlgo_BuilderSolidCnt;
//
//======================================================================= //=======================================================================
//class : BOPAlgo_ShapeBox //class : BOPAlgo_ShapeBox
//purpose : Auxiliary class //purpose : Auxiliary class
@ -156,7 +171,8 @@ void BOPAlgo_Builder::FillImagesSolids()
//function : FillIn3DParts //function : FillIn3DParts
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPAlgo_Builder::FillIn3DParts(BOPCol_DataMapOfShapeListOfShape& theInParts, void BOPAlgo_Builder::FillIn3DParts
(BOPCol_DataMapOfShapeListOfShape& theInParts,
BOPCol_DataMapOfShapeShape& theDraftSolids, BOPCol_DataMapOfShapeShape& theDraftSolids,
const BOPCol_BaseAllocator& ) const BOPCol_BaseAllocator& )
{ {
@ -365,7 +381,6 @@ void BOPAlgo_Builder::FillIn3DParts(BOPCol_DataMapOfShapeListOfShape& theInParts
//--------------------------------------------- //---------------------------------------------
}// for (i=0; i<aNbS; ++i) { }// for (i=0; i<aNbS; ++i) {
} }
//======================================================================= //=======================================================================
//function : BuildDraftSolid //function : BuildDraftSolid
//purpose : //purpose :
@ -419,7 +434,9 @@ void BOPAlgo_Builder::BuildDraftSolid(const TopoDS_Shape& theSolid,
theLIF.Append(aFSDx); theLIF.Append(aFSDx);
} }
else { else {
bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aFSDx, aF, myContext); bToReverse=BOPTools_AlgoTools::IsSplitToReverse(aFSDx,
aF,
myContext);
if (bToReverse) { if (bToReverse) {
aFSDx.Reverse(); aFSDx.Reverse();
} }
@ -461,7 +478,8 @@ void BOPAlgo_Builder::BuildDraftSolid(const TopoDS_Shape& theSolid,
//function : BuildSplitSolids //function : BuildSplitSolids
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPAlgo_Builder::BuildSplitSolids(BOPCol_DataMapOfShapeListOfShape& theInParts, void BOPAlgo_Builder::BuildSplitSolids
(BOPCol_DataMapOfShapeListOfShape& theInParts,
BOPCol_DataMapOfShapeShape& theDraftSolids, BOPCol_DataMapOfShapeShape& theDraftSolids,
const BOPCol_BaseAllocator& ) const BOPCol_BaseAllocator& )
{ {
@ -650,7 +668,9 @@ void BOPAlgo_Builder::FillInternalShapes()
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value(); const TopoDS_Shape& aS=aIt.Value();
aType=aS.ShapeType(); aType=aS.ShapeType();
if (aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||aType==TopAbs_WIRE) { if (aType==TopAbs_VERTEX ||
aType==TopAbs_EDGE ||
aType==TopAbs_WIRE) {
if (aMFence.Add(aS)) { if (aMFence.Add(aS)) {
if (myImages.IsBound(aS)) { if (myImages.IsBound(aS)) {
const BOPCol_ListOfShape &aLSp=myImages.Find(aS); const BOPCol_ListOfShape &aLSp=myImages.Find(aS);

View File

@ -16,27 +16,122 @@
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <BOPAlgo_PaveFiller.ixx> #include <BOPAlgo_PaveFiller.ixx>
//
#include <NCollection_IncAllocator.hxx> #include <NCollection_IncAllocator.hxx>
//
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
#include <BRepBndLib.hxx> #include <BRepBndLib.hxx>
//
#include <BOPCol_MapOfInteger.hxx> #include <BOPCol_MapOfInteger.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>
#include <BOPDS_VectorOfInterfVF.hxx> #include <BOPDS_VectorOfInterfVF.hxx>
#include <BOPDS_Interf.hxx> #include <BOPDS_Interf.hxx>
#include <BOPDS_SubIterator.hxx> #include <BOPDS_SubIterator.hxx>
#include <BOPDS_MapOfPaveBlock.hxx> #include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_FaceInfo.hxx> #include <BOPDS_FaceInfo.hxx>
#include <BOPCol_MapOfInteger.hxx>
//=======================================================================
//class : BOPAlgo_VertexFace
//purpose :
//=======================================================================
class BOPAlgo_VertexFace {
public:
BOPAlgo_VertexFace()
: myIV(-1), myIF(-1), myIVx(-1),
myFlag(-1), myT1(-1.), myT2(-1.) {
}
//
~BOPAlgo_VertexFace(){
}
//
void SetIndices(const Standard_Integer nV,
const Standard_Integer nF,
const Standard_Integer nVx) {
myIV=nV;
myIF=nF;
myIVx=nVx;
}
//
void Indices(Standard_Integer& nV,
Standard_Integer& nF,
Standard_Integer& nVx) const {
nV=myIV;
nF=myIF;
nVx=myIVx;
}
//
void SetVertex(const TopoDS_Vertex& aV) {
myV=aV;
}
//
const TopoDS_Vertex& Vertex()const {
return myV;
}
//
void SetFace(const TopoDS_Face& aF) {
myF=aF;
}
//
const TopoDS_Face& Face()const {
return myF;
}
//
Standard_Integer Flag()const {
return myFlag;
}
//
void Parameters(Standard_Real& aT1,
Standard_Real& aT2)const {
aT1=myT1;
aT2=myT2;
}
//
void SetContext(const Handle(BOPInt_Context)& aContext) {
myContext=aContext;
}
//
const Handle(BOPInt_Context)& Context()const {
return myContext;
}
//
void Perform() {
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2);
}
//
protected:
Standard_Integer myIV;
Standard_Integer myIF;
Standard_Integer myIVx;
Standard_Integer myFlag;
Standard_Real myT1;
Standard_Real myT2;
TopoDS_Vertex myV;
TopoDS_Face myF;
Handle(BOPInt_Context) myContext;
};
//=======================================================================
typedef BOPCol_NCVector<BOPAlgo_VertexFace>
BOPAlgo_VectorOfVertexFace;
//
typedef BOPCol_TBBContextFunctor
<BOPAlgo_VertexFace,
BOPAlgo_VectorOfVertexFace,
Handle_BOPInt_Context,
BOPInt_Context> BOPAlgo_VertexFaceFunctor;
//
typedef BOPCol_TBBContextCnt
<BOPAlgo_VertexFaceFunctor,
BOPAlgo_VectorOfVertexFace,
Handle_BOPInt_Context> BOPAlgo_VertexFaceCnt;
//
//======================================================================= //=======================================================================
// function: PerformVF // function: PerformVF
// purpose: // purpose:
@ -44,9 +139,10 @@
void BOPAlgo_PaveFiller::PerformVF() void BOPAlgo_PaveFiller::PerformVF()
{ {
Standard_Boolean bJustAdd; Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, i; Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, i, aNbVF, k;
Standard_Real aT1, aT2, aTolF, aTolV; Standard_Real aT1, aT2, aTolF, aTolV;
BRep_Builder aBB; BRep_Builder aBB;
BOPAlgo_VectorOfVertexFace aVVF;
// //
myErrorStatus=0; myErrorStatus=0;
// //
@ -83,14 +179,35 @@
continue; continue;
} }
// //
myDS->ChangeFaceInfo(nF);// !
//
const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx))); const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF))); const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
// //
aTolV = BRep_Tool::Tolerance(aV); BOPAlgo_VertexFace& aVertexFace=aVVF.Append1();
aTolF = BRep_Tool::Tolerance(aF);
// //
iFlag=myContext->ComputeVF(aV, aF, aT1, aT2); aVertexFace.SetIndices(nV, nF, nVx);
if (!iFlag) { aVertexFace.SetVertex(aV);
aVertexFace.SetFace(aF);
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbVF=aVVF.Extent();
//================================================================
BOPAlgo_VertexFaceCnt::Perform(myRunParallel, aVVF, myContext);
//================================================================
//
for (k=0; k < aNbVF; ++k) {
const BOPAlgo_VertexFace& aVertexFace=aVVF(k);
//
iFlag=aVertexFace.Flag();
if (iFlag) {
continue;
}
//
aVertexFace.Indices(nV, nF, nVx);
aVertexFace.Parameters(aT1, aT2);
const TopoDS_Vertex& aV=aVertexFace.Vertex();
const TopoDS_Face& aF=aVertexFace.Face();
// 1 // 1
i=aVFs.Append()-1; i=aVFs.Append()-1;
BOPDS_InterfVF& aVF=aVFs(i); BOPDS_InterfVF& aVF=aVFs(i);
@ -98,19 +215,20 @@
aVF.SetUV(aT1, aT2); aVF.SetUV(aT1, aT2);
// 2 // 2
myDS->AddInterf(nVx, nF); myDS->AddInterf(nVx, nF);
// // 3
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF); BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn(); BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nVx); aMVIn.Add(nVx);
// // 4
aTolV = BRep_Tool::Tolerance(aV);
aTolF = BRep_Tool::Tolerance(aF);
if (aTolV < aTolF) { if (aTolV < aTolF) {
aBB.UpdateVertex(aV, aTolF); aBB.UpdateVertex(aV, aTolF);
BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVx); BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVx);
Bnd_Box& aBoxV = aSIV.ChangeBox(); Bnd_Box& aBoxV = aSIV.ChangeBox();
BRepBndLib::Add(aV, aBoxV); BRepBndLib::Add(aV, aBoxV);
} }
} }//for (k=0; k < aNbVF; ++k) {
}// for (; myIterator->More(); myIterator->Next()) {
}// if (iSize) { }// if (iSize) {
else { else {
iSize=10; iSize=10;
@ -122,8 +240,6 @@
// //
TreatVerticesEE(); TreatVerticesEE();
} }
//======================================================================= //=======================================================================
//function : TreatVerticesEE //function : TreatVerticesEE
//purpose : //purpose :
@ -135,7 +251,6 @@
BOPCol_ListIteratorOfListOfInteger aItLI; BOPCol_ListIteratorOfListOfInteger aItLI;
Handle(NCollection_IncAllocator) aAllocator; Handle(NCollection_IncAllocator) aAllocator;
// //
//-----------------------------------------------------scope_1 f
aAllocator=new NCollection_IncAllocator(); aAllocator=new NCollection_IncAllocator();
BOPCol_ListOfInteger aLIV(aAllocator), aLIF(aAllocator); BOPCol_ListOfInteger aLIV(aAllocator), aLIF(aAllocator);
BOPCol_MapOfInteger aMI(100, aAllocator); BOPCol_MapOfInteger aMI(100, aAllocator);
@ -209,5 +324,4 @@
} }
// //
aAllocator.Nullify(); aAllocator.Nullify();
//-----------------------------------------------------scope_1 t
} }

View File

@ -13,7 +13,5 @@ BOPAlgo_Builder_4.cxx
BOPAlgo_BOP_1.cxx BOPAlgo_BOP_1.cxx
BOPAlgo_WireSplitter_1.cxx BOPAlgo_WireSplitter_1.cxx
BOPAlgo_ListOfCheckResult.hxx BOPAlgo_ListOfCheckResult.hxx
BOPAlgo_Builder_2Cnt.hxx
BOPAlgo_CheckerSI_1.cxx BOPAlgo_CheckerSI_1.cxx
BOPAlgo_PaveFiller_9.cxx BOPAlgo_PaveFiller_9.cxx