1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-16 10:54:53 +03:00

0024157: Parallelization of assembly part of BO

The modifications deal with the parallelization of P-curves computations.
Added test cases bugs/modalg_5/bug24157_1 ... bug24157_9
This commit is contained in:
pkv 2014-05-22 17:49:52 +04:00 committed by apn
parent 945c35291e
commit f1baf495b6
14 changed files with 928 additions and 349 deletions

View File

@ -103,6 +103,9 @@ is
Init(me:out)
is virtual protected;
Prepare(me:out)
is protected;
PerformVV(me:out)
is virtual protected;

View File

@ -168,6 +168,11 @@ void BOPAlgo_PaveFiller::Perform()
if (myErrorStatus) {
return;
}
//
Prepare();
if (myErrorStatus) {
return;
}
// 00
PerformVV();
if (myErrorStatus) {

View File

@ -19,6 +19,11 @@
#include <NCollection_IncAllocator.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Surface.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
@ -29,6 +34,7 @@
#include <BRep_Builder.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
@ -36,9 +42,7 @@
#include <BOPCol_NCVector.hxx>
#include <BOPCol_TBB.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPDS_VectorOfListOfPaveBlock.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
@ -54,6 +58,13 @@
#include <BOPDS_FaceInfo.hxx>
#include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_Curve.hxx>
#include <BOPDS_Iterator.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools2D.hxx>
static
Standard_Boolean IsBasedOnPlane(const TopoDS_Face& aF);
static void UpdateVertices(const TopoDS_Edge& aE,
@ -146,6 +157,109 @@ typedef BOPCol_TBBCnt
BOPAlgo_VectorOfSplitEdge> BOPAlgo_SplitEdgeCnt;
//
//=======================================================================
//class : BOPAlgo_MPC
//purpose :
//=======================================================================
class BOPAlgo_MPC {
public:
BOPAlgo_MPC()
: myFlag(Standard_False) {
};
//
~BOPAlgo_MPC(){
};
//
void SetEdge(const TopoDS_Edge& aE) {
myE=aE;
}
//
const TopoDS_Edge& Edge() const {
return myE;
}
//
void SetFace(const TopoDS_Face& aF) {
myF=aF;
}
//
const TopoDS_Face& Face() const {
return myF;
}
//
void SetFlag(const Standard_Boolean bFlag) {
myFlag=bFlag;
}
//
Standard_Boolean Flag() const {
return myFlag;
}
//
void Perform() {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF);
if (myFlag) {
UpdateVertices(myE, myF);
}
}
//
protected:
Standard_Boolean myFlag;
TopoDS_Edge myE;
TopoDS_Face myF;
};
//
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_MPC> BOPAlgo_VectorOfMPC;
//
typedef BOPCol_TBBFunctor
<BOPAlgo_MPC,
BOPAlgo_VectorOfMPC> BOPAlgo_MPCFunctor;
//
typedef BOPCol_TBBCnt
<BOPAlgo_MPCFunctor,
BOPAlgo_VectorOfMPC> BOPAlgo_MPCCnt;
//
//=======================================================================
//class : BOPAlgo_BPC
//purpose :
//=======================================================================
class BOPAlgo_BPC {
public:
BOPAlgo_BPC(){
};
//
~BOPAlgo_BPC(){
};
//
void SetFace(const TopoDS_Face& aF) {
myF=aF;
}
//
void SetEdge(const TopoDS_Edge& aE) {
myE=aE;
}
//
void Perform() {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnPlane (myE, myF);
};
//
protected:
TopoDS_Edge myE;
TopoDS_Face myF;
};
//=======================================================================
typedef BOPCol_NCVector
<BOPAlgo_BPC> BOPAlgo_VectorOfBPC;
//
typedef BOPCol_TBBFunctor
<BOPAlgo_BPC,
BOPAlgo_VectorOfBPC> BOPAlgo_BPCFunctor;
//
typedef BOPCol_TBBCnt
<BOPAlgo_BPCFunctor,
BOPAlgo_VectorOfBPC> BOPAlgo_BPCCnt;
//
//
//=======================================================================
// function: MakeSplitEdges
// purpose:
//=======================================================================
@ -297,10 +411,12 @@ Standard_Integer BOPAlgo_PaveFiller::SplitEdge(const Standard_Integer nE,
//=======================================================================
void BOPAlgo_PaveFiller::MakePCurves()
{
Standard_Integer i, nF1, nF2, aNbC, k, nE, aNbFF, aNbFI;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
BOPDS_MapIteratorOfMapOfPaveBlock aItMPB;
TopoDS_Face aF1F, aF2F;
BOPAlgo_VectorOfMPC aVMPC;
//
myErrorStatus=0;
//
@ -322,8 +438,11 @@ void BOPAlgo_PaveFiller::MakePCurves()
nE=aPB->Edge();
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
//
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aF1F);
BOPAlgo_MPC& aMPC=aVMPC.Append1();
aMPC.SetEdge(aE);
aMPC.SetFace(aF1F);
}
//
// On
const BOPDS_IndexedMapOfPaveBlock& aMPBOn=aFI.PaveBlocksOn();
aItMPB.Initialize(aMPBOn);
@ -333,27 +452,33 @@ void BOPAlgo_PaveFiller::MakePCurves()
nE=aPB->Edge();
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
//
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aF1F);
BOPAlgo_MPC& aMPC=aVMPC.Append1();
aMPC.SetEdge(aE);
aMPC.SetFace(aF1F);
}
}
}
//
if (!mySectionAttribute.PCurveOnS1() &&
!mySectionAttribute.PCurveOnS2()) {
return;
}
}// for (i=0; i<aNbFI; ++i) {
//
// 2. Process section edges
Standard_Boolean bPCurveOnS[2];
Standard_Integer m;
TopoDS_Face aFf[2];
//
bPCurveOnS[0]=mySectionAttribute.PCurveOnS1();
bPCurveOnS[1]=mySectionAttribute.PCurveOnS2();
//
if (bPCurveOnS[0] || bPCurveOnS[1]) {
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aNbFF=aFFs.Extent();
for (i=0; i<aNbFF; ++i) {
const BOPDS_InterfFF& aFF=aFFs(i);
aFF.Indices(nF1, nF2);
//
aF1F=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
aF1F.Orientation(TopAbs_FORWARD);
aF2F=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
aF2F.Orientation(TopAbs_FORWARD);
aFf[0]=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
aFf[0].Orientation(TopAbs_FORWARD);
//
aFf[1]=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
aFf[1].Orientation(TopAbs_FORWARD);
//
const BOPDS_VectorOfCurve& aVNC=aFF.Curves();
aNbC=aVNC.Extent();
@ -366,18 +491,22 @@ void BOPAlgo_PaveFiller::MakePCurves()
nE=aPB->Edge();
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
//
if (mySectionAttribute.PCurveOnS1()) {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aF1F);
UpdateVertices(aE, aF1F);
for (m=0; m<2; ++m) {
if (bPCurveOnS[m]) {
BOPAlgo_MPC& aMPC=aVMPC.Append1();
aMPC.SetEdge(aE);
aMPC.SetFace(aFf[m]);
aMPC.SetFlag(bPCurveOnS[m]);
}
}
}
}
}// for (i=0; i<aNbFF; ++i) {
}//if (bPCurveOnS1 || bPCurveOnS2 ) {
//
if (mySectionAttribute.PCurveOnS2()) {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aF2F);
UpdateVertices(aE, aF2F);
}
}
}
}
//======================================================
BOPAlgo_MPCCnt::Perform(myRunParallel, aVMPC);
//======================================================
}
//=======================================================================
// function: RefineFaceInfoOn
@ -463,4 +592,79 @@ void UpdateVertices(const TopoDS_Edge& aE,
}
}
}
//=======================================================================
// function: Prepare
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::Prepare()
{
TopAbs_ShapeEnum aType[] = {
TopAbs_VERTEX,
TopAbs_EDGE,
TopAbs_FACE
};
Standard_Boolean bJustAdd, bIsBasedOnPlane;
Standard_Integer i, aNb, n1, nF;
TopExp_Explorer aExp;
BOPCol_MapOfShape aMF;
BOPCol_MapIteratorOfMapOfShape aItMF;
//
myErrorStatus=0;
//
aNb=3;
for(i=0; i<aNb; ++i) {
myIterator->Initialize(aType[i], aType[2]);
for (; myIterator->More(); myIterator->Next()) {
myIterator->Value(n1, nF, bJustAdd);
const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF)));
//
bIsBasedOnPlane=IsBasedOnPlane(aF);
if (bIsBasedOnPlane) {
aMF.Add(aF);
}
}
}
//
if (aMF.IsEmpty()) {
return;
}
//
BOPAlgo_VectorOfBPC aVBPC;
//
aItMF.Initialize(aMF);
for (; aItMF.More(); aItMF.Next()) {
const TopoDS_Face& aF=*((TopoDS_Face *)&aItMF.Key());
aExp.Init(aF, aType[1]);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE=*((TopoDS_Edge *)&aExp.Current());
BOPAlgo_BPC& aBPC=aVBPC.Append1();
aBPC.SetEdge(aE);
aBPC.SetFace(aF);
}
}
//
//======================================================
BOPAlgo_BPCCnt::Perform(myRunParallel, aVBPC);
//======================================================
}
//=======================================================================
//function : IsBasedOnPlane
//purpose :
//=======================================================================
Standard_Boolean IsBasedOnPlane(const TopoDS_Face& aF)
{
TopLoc_Location aLoc;
Handle(Geom_RectangularTrimmedSurface) aGRTS;
Handle(Geom_Plane) aGP;
const Handle(Geom_Surface)& aS = BRep_Tool::Surface(aF, aLoc);
aGRTS = Handle(Geom_RectangularTrimmedSurface)::DownCast(aS);
if(!aGRTS.IsNull()) {
aGP = Handle(Geom_Plane)::DownCast(aGRTS->BasisSurface());
}
else {
aGP = Handle(Geom_Plane)::DownCast(aS);
}
//
return (!aGP.IsNull());
}

View File

@ -163,7 +163,7 @@ class BOPDS_Interf {
* @return true if the interference has index of new shape
*/
Standard_Boolean HasIndexNew() const {
return (myIndexNew>=0);
return (myIndexNew+1);
}
//
protected:

View File

@ -29,11 +29,23 @@
#include <Geom2d_Ellipse.hxx>
#include <Geom2d_Parabola.hxx>
#include <Geom2d_Hyperbola.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2dAdaptor.hxx>
#include <Geom_Curve.hxx>
#include <GeomAdaptor_HCurve.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Plane.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_HCurve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <GeomProjLib.hxx>
#include <TopLoc_Location.hxx>
#include <TopExp.hxx>
@ -41,23 +53,40 @@
#include <ProjLib_ProjectedCurve.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_CurveRepresentation.hxx>
#include <BRep_GCurve.hxx>
#include <BRepAdaptor_HSurface.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRep_Builder.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <BRep_Builder.hxx>
#include <Geom_Surface.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPTools.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRepTools.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPTools.hxx>
static
Standard_Boolean CheckEdgeLength (const TopoDS_Edge& E);
Standard_Boolean CheckEdgeLength (const TopoDS_Edge& );
static
Handle(Geom2d_Curve) BRep_Tool_CurveOnSurface(const TopoDS_Edge& ,
const TopoDS_Face& ,
Standard_Real& ,
Standard_Real& ,
Standard_Boolean& );
static
Handle(Geom2d_Curve) BRep_Tool_CurveOnSurface(const TopoDS_Edge& ,
const Handle(Geom_Surface)& ,
const TopLoc_Location& ,
Standard_Real& ,
Standard_Real& ,
Standard_Boolean& );
//=======================================================================
//function : BuildPCurveForEdgeOnFace
@ -71,7 +100,9 @@ static
Standard_Real aTolPC, aTolFact, aTolEdge, aFirst, aLast;
Standard_Boolean aHasOld;
aHasOld=BOPTools_AlgoTools2D::HasCurveOnSurface (aE, aF, aC2D, aFirst, aLast, aTolEdge);
aHasOld=BOPTools_AlgoTools2D::HasCurveOnSurface (aE, aF, aC2D,
aFirst, aLast,
aTolEdge);
if (aHasOld) {
return;
}
@ -91,7 +122,8 @@ static
//function : EdgeTangent
//purpose :
//=======================================================================
Standard_Boolean BOPTools_AlgoTools2D::EdgeTangent(const TopoDS_Edge& anEdge,
Standard_Boolean BOPTools_AlgoTools2D::EdgeTangent
(const TopoDS_Edge& anEdge,
const Standard_Real aT,
gp_Vec& aTau)
{
@ -137,7 +169,8 @@ static
Handle(Geom2d_Curve) aC2D;
Standard_Real aToler, aFirst, aLast;
BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler);
BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D,
aFirst, aLast, aToler);
aC2D->D0(aParameter, aP2D);
U=aP2D.X();
V=aP2D.Y();
@ -154,9 +187,10 @@ static
Standard_Real& aToler)
{
Standard_Real aFirst, aLast;
BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D, aFirst, aLast, aToler);
//
BOPTools_AlgoTools2D::CurveOnSurface (aE, aF, aC2D,
aFirst, aLast, aToler);
//
return;
}
//=======================================================================
@ -173,7 +207,9 @@ static
Standard_Boolean aHasOld;
Handle(Geom2d_Curve) C2D;
aHasOld=BOPTools_AlgoTools2D::HasCurveOnSurface (aE, aF, C2D, aFirst, aLast, aToler);
aHasOld=BOPTools_AlgoTools2D::HasCurveOnSurface (aE, aF, C2D,
aFirst, aLast,
aToler);
if (aHasOld) {
aC2D=C2D;
return;
@ -183,12 +219,12 @@ static
aC2D=C2D;
return;
}
//=======================================================================
//function : HasCurveOnSurface
//purpose :
//=======================================================================
Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface (const TopoDS_Edge& aE,
Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface
(const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
@ -212,29 +248,32 @@ static
//function : HasCurveOnSurface
//purpose :
//=======================================================================
Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface (const TopoDS_Edge& aE,
Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface
(const TopoDS_Edge& aE,
const TopoDS_Face& aF)
{
Standard_Boolean aHasOld;
Standard_Boolean bHasOld;
Handle(Geom2d_Curve) aC2D;
Standard_Real aFirst, aLast;
//
BRep_Tool::Range(aE, aFirst, aLast);
//
if((aLast - aFirst) < Precision::PConfusion()) {
return Standard_False;
}
//
aC2D=BRep_Tool::CurveOnSurface(aE, aF, aFirst, aLast);
aHasOld=!aC2D.IsNull();
return aHasOld;
bHasOld=!aC2D.IsNull();
//
return bHasOld;
}
//=======================================================================
//function : AdjustPCurveOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::AdjustPCurveOnFace (const TopoDS_Face& aF,
void BOPTools_AlgoTools2D::AdjustPCurveOnFace
(const TopoDS_Face& aF,
const Handle(Geom_Curve)& aC3D,
const Handle(Geom2d_Curve)& aC2D,
Handle(Geom2d_Curve)& aC2DA)
@ -250,7 +289,8 @@ static
//function : AdjustPCurveOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::AdjustPCurveOnFace (const TopoDS_Face& aF,
void BOPTools_AlgoTools2D::AdjustPCurveOnFace
(const TopoDS_Face& aF,
const Standard_Real aFirst,
const Standard_Real aLast,
const Handle(Geom2d_Curve)& aC2D,
@ -402,7 +442,8 @@ static
//function : IntermediatePoint
//purpose :
//=======================================================================
Standard_Real BOPTools_AlgoTools2D::IntermediatePoint (const Standard_Real aFirst,
Standard_Real BOPTools_AlgoTools2D::IntermediatePoint
(const Standard_Real aFirst,
const Standard_Real aLast)
{
//define parameter division number as 10*e^(-PI) = 0.43213918
@ -415,7 +456,8 @@ static
//function : IntermediatePoint
//purpose :
//=======================================================================
Standard_Real BOPTools_AlgoTools2D::IntermediatePoint (const TopoDS_Edge& aE)
Standard_Real BOPTools_AlgoTools2D::IntermediatePoint
(const TopoDS_Edge& aE)
{
Standard_Real aT, aT1, aT2;
@ -432,78 +474,37 @@ static
//function : BuildPCurveForEdgeOnPlane
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnPlane (const TopoDS_Edge& aE,
void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnPlane
(const TopoDS_Edge& aE,
const TopoDS_Face& aF)
{
Standard_Real aTolE;
TopLoc_Location aLoc;
Standard_Boolean bToUpdate;
Standard_Real aTolE, aT1, aT2;
Handle(Geom2d_Curve) aC2D;
Handle(Geom_Plane) aGP;
Handle(Geom_RectangularTrimmedSurface) aGRTS;
BRep_Builder aBB;
//
const Handle(Geom_Surface)& aS = BRep_Tool::Surface(aF, aLoc);
aGRTS=Handle(Geom_RectangularTrimmedSurface)::DownCast(aS);
if(!aGRTS.IsNull()){
aGP=Handle(Geom_Plane)::DownCast(aGRTS->BasisSurface());
}
else {
aGP=Handle(Geom_Plane)::DownCast(aS);
}
//
if (aGP.IsNull()) {
return;
}
//
BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolE);
aC2D=BRep_Tool_CurveOnSurface(aE, aF, aT1, aT2, bToUpdate);
if (bToUpdate) {
aTolE=BRep_Tool::Tolerance(aE);
aBB.UpdateEdge(aE, aC2D, aF, aTolE);
//
return;
}
}
//=======================================================================
// function: BuildPCurveForEdgesOnPlane
// purpose:
//=======================================================================
void BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane
(const BOPCol_ListOfShape& aEdges,
const TopoDS_Face& aFace)
(const BOPCol_ListOfShape& aLE,
const TopoDS_Face& aF)
{
TopLoc_Location aLoc;
Handle(Geom2d_Curve) aC2D;
Handle(Geom_Plane) aGP;
Handle(Geom_RectangularTrimmedSurface) aGRTS;
//
const Handle(Geom_Surface)& aS = BRep_Tool::Surface(aFace, aLoc);
aGRTS=Handle(Geom_RectangularTrimmedSurface)::DownCast(aS);
if(!aGRTS.IsNull()){
aGP=Handle(Geom_Plane)::DownCast(aGRTS->BasisSurface());
}
else {
aGP=Handle(Geom_Plane)::DownCast(aS);
}
//
if (aGP.IsNull()) {
return;
}
//
Standard_Boolean bHasOld;
Standard_Real aTolE, aT1, aT2;
BOPCol_ListIteratorOfListOfShape aIt;
BRep_Builder aBB;
//
aIt.Initialize(aEdges);
aIt.Initialize(aLE);
for(; aIt.More(); aIt.Next()) {
const TopoDS_Edge& aE=(*(TopoDS_Edge *)&aIt.Value());
bHasOld=BOPTools_AlgoTools2D::HasCurveOnSurface
(aE, aFace, aC2D, aT1, aT2, aTolE);
if (!bHasOld) {
BOPTools_AlgoTools2D::CurveOnSurface(aE, aFace, aC2D, aTolE);
aBB.UpdateEdge(aE, aC2D, aFace, aTolE);
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnPlane (aE, aF);
}
}
}
//=======================================================================
//function : Make2D
//purpose :
@ -570,14 +571,16 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
//
TolReached2d=0.;
//
BOPTools_AlgoTools2D::MakePCurveOnFace (aF, aC3D, aFirst, aLast, aC2D, TolReached2d);
BOPTools_AlgoTools2D::MakePCurveOnFace (aF, aC3D, aFirst,
aLast, aC2D, TolReached2d);
}
//=======================================================================
//function : MakePCurveOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::MakePCurveOnFace (const TopoDS_Face& aF,
void BOPTools_AlgoTools2D::MakePCurveOnFace
(const TopoDS_Face& aF,
const Handle(Geom_Curve)& aC3D,
const Standard_Real aFirst,
const Standard_Real aLast,
@ -589,7 +592,8 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
BRepAdaptor_Surface aBAS(aF, Standard_False);
Handle(BRepAdaptor_HSurface) aBAHS = new BRepAdaptor_HSurface(aBAS);
Handle(GeomAdaptor_HCurve) aBAHC = new GeomAdaptor_HCurve(aC3D, aFirst, aLast);
Handle(GeomAdaptor_HCurve) aBAHC = new
GeomAdaptor_HCurve(aC3D, aFirst, aLast);
//when the type of surface is GeomAbs_SurfaceOfRevolution
if (aBAS.GetType() == GeomAbs_SurfaceOfRevolution) {
@ -617,7 +621,8 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
}
TolReached2d=aTolR;
BOPTools_AlgoTools2D::AdjustPCurveOnFace (aF, aFirst, aLast, aC2D, aC2DA);
BOPTools_AlgoTools2D::AdjustPCurveOnFace (aF, aFirst, aLast,
aC2D, aC2DA);
aC2D=aC2DA;
}
@ -625,7 +630,8 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
//function : MakePCurveOfType
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::MakePCurveOfType(const ProjLib_ProjectedCurve& PC,
void BOPTools_AlgoTools2D::MakePCurveOfType
(const ProjLib_ProjectedCurve& PC,
Handle(Geom2d_Curve)& C2D)
{
@ -652,11 +658,11 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE,
case GeomAbs_BezierCurve :
case GeomAbs_OtherCurve :
default :
Standard_NotImplemented::Raise("BOPTools_AlgoTools2D::MakePCurveOfType");
Standard_NotImplemented::Raise
("BOPTools_AlgoTools2D::MakePCurveOfType");
break;
}
}
//=======================================================================
//function : CheckEdgeLength
//purpose :
@ -692,174 +698,124 @@ Standard_Boolean CheckEdgeLength (const TopoDS_Edge& E)
ln+=d;
p1=p2;
}
//
return (ln > Precision::Confusion());
}
/*
//=======================================================================
//function : FaceNormal
//function : BRep_Tool_CurveOnSurface
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::FaceNormal (const TopoDS_Face& aF,
const Standard_Real U,
const Standard_Real V,
gp_Vec& aN)
Handle(Geom2d_Curve) BRep_Tool_CurveOnSurface(const TopoDS_Edge& E,
const TopoDS_Face& F,
Standard_Real& First,
Standard_Real& Last,
Standard_Boolean& bToUpdate)
{
gp_Pnt aPnt ;
gp_Vec aD1U, aD1V;
Handle(Geom_Surface) aSurface;
aSurface=BRep_Tool::Surface(aF);
aSurface->D1 (U, V, aPnt, aD1U, aD1V);
aN=aD1U.Crossed(aD1V);
aN.Normalize();
if (aF.Orientation() == TopAbs_REVERSED){
aN.Reverse();
TopLoc_Location l;
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,l);
TopoDS_Edge aLocalEdge = E;
if (F.Orientation() == TopAbs_REVERSED) {
aLocalEdge.Reverse();
}
return;
}
//=======================================================================
//function : RemovePCurveForEdgeOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::RemovePCurveForEdgeOnFace (const TopoDS_Edge& aE,
const TopoDS_Face& aF)
{
BRep_Builder aBB;
Handle(Geom2d_Curve) aC2D;
Standard_Real aTol;
aTol=BRep_Tool::Tolerance(aE);
aBB.UpdateEdge(aE, aC2D, aF, aTol);
}
//=======================================================================
//function : MakeCurveOnSurface
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::MakeCurveOnSurface (const TopoDS_Edge& aE,
const TopoDS_Face& aF,
Handle(Geom2d_Curve)& aC2D,
Standard_Real& aFirst,
Standard_Real& aLast,
Standard_Real& aToler)
{
BOPTools_AlgoTools2D::Make2D(aE, aF, aC2D, aFirst, aLast, aToler);
}
//=======================================================================
//function : TangentOnEdge
//purpose :
//=======================================================================
Standard_Boolean BOPTools_AlgoTools2D::TangentOnEdge(const Standard_Real par,
const TopoDS_Edge& E,
gp_Vec& Tg)
{
Standard_Boolean isdgE;
isdgE = BRep_Tool::Degenerated(E);
if (isdgE) {
return Standard_False;
}
if (!CheckEdgeLength(E)) {
return Standard_False;
}
BRepAdaptor_Curve BC(E);
//
// Body
Standard_Real f, l, tolE, tolp;
Standard_Boolean onf, onl, inbounds;
f = BC.FirstParameter();
l = BC.LastParameter();
tolE = BC.Tolerance();
tolp = BC.Resolution(tolE);
onf = Abs(f-par)<tolp;
onl = Abs(l-par)<tolp;
inbounds = (f<par) && (par<l);
if ((!inbounds) && (!onf) && (!onl)) {
return Standard_False;
}
gp_Pnt aP;
BC.D1(par, aP, Tg);
Tg.Normalize();
return Standard_True;
return BRep_Tool_CurveOnSurface(aLocalEdge,S,l,First,Last,bToUpdate);
}
//=======================================================================
//function : TangentOnEdge
//function : BRep_Tool_CurveOnSurface
//purpose :
//=======================================================================
Standard_Boolean BOPTools_AlgoTools2D::TangentOnEdge(const TopoDS_Edge& aE,
gp_Dir& DTg)
Handle(Geom2d_Curve) BRep_Tool_CurveOnSurface
(const TopoDS_Edge& E,
const Handle(Geom_Surface)& S,
const TopLoc_Location& L,
Standard_Real& First,
Standard_Real& Last,
Standard_Boolean& bToUpdate)
{
Standard_Real aT;
gp_Vec aTg;
static const Handle(Geom2d_Curve) nullPCurve;
bToUpdate=Standard_False;
TopLoc_Location loc = L.Predivided(E.Location());
Standard_Boolean Eisreversed = (E.Orientation() == TopAbs_REVERSED);
DTg.SetCoord(1.,0.,0.);
// find the representation
BRep_ListIteratorOfListOfCurveRepresentation itcr
((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
aT= BOPTools_AlgoTools2D::IntermediatePoint (aE);
Standard_Boolean bIsFound=BOPTools_AlgoTools2D::TangentOnEdge(aT, aE, aTg);
if (bIsFound) {
gp_Dir aDTmp(aTg);
DTg=aDTmp;
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsCurveOnSurface(S,loc)) {
const Handle(BRep_GCurve)& GC = *((Handle(BRep_GCurve)*)&cr);
GC->Range(First,Last);
if (GC->IsCurveOnClosedSurface() && Eisreversed)
return GC->PCurve2();
else
return GC->PCurve();
}
return bIsFound;
itcr.Next();
}
//=======================================================================
//function : TangentOnVertex
//purpose :
//=======================================================================
Standard_Boolean BOPTools_AlgoTools2D::TangentOnVertex (const TopoDS_Vertex& v,
const TopoDS_Vertex& vl,
const TopoDS_Edge& e,
gp_Vec& aVec)
// tg oriented INSIDE 1d(e)
// vl : last vertex of e
{
Standard_Boolean ok;
Standard_Real par;
gp_Vec tg;
// for planar surface and 3d curve try a projection
// modif 21-05-97 : for RectangularTrimmedSurface, try a projection
Handle(Geom_Plane) GP;
Handle(Geom_RectangularTrimmedSurface) GRTS;
GRTS = Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
if(!GRTS.IsNull())
GP = Handle(Geom_Plane)::DownCast(GRTS->BasisSurface());
else
GP = Handle(Geom_Plane)::DownCast(S);
//fin modif du 21-05-97
par = BRep_Tool::Parameter(v, e);
ok =BOPTools_AlgoTools2D::TangentOnEdge (par, e, tg);
if (!ok) {
return ok;
}
if (v.IsSame(vl)) {
tg.Reverse();
}
aVec=tg;
if (!GP.IsNull()) {
return ok;
Handle(GeomAdaptor_HCurve) HC;
Handle(GeomAdaptor_HSurface) HS;
HC = new GeomAdaptor_HCurve();
HS = new GeomAdaptor_HSurface();
TopLoc_Location LC;
Standard_Real f, l;// for those who call with (u,u).
Handle(Geom_Curve) C3d =
BRep_Tool::Curve(E,/*LC,*/f,l); // transforming plane instead of curve
// we can loose scale factor of Curve transformation (eap 13 May 2002)
LC = L/*.Predivided(LC)*/;
if (C3d.IsNull()) return nullPCurve;
Handle(Geom_Plane) Plane = GP;
if (!LC.IsIdentity()) {
const gp_Trsf& T = LC.Transformation();
Handle(Geom_Geometry) GPT = GP->Transformed(T);
Plane = *((Handle(Geom_Plane)*)&GPT);
}
GeomAdaptor_Surface& GAS = HS->ChangeSurface();
GAS.Load(Plane);
Handle(Geom_Curve) ProjOnPlane =
GeomProjLib::ProjectOnPlane(new Geom_TrimmedCurve(C3d,f,l),
Plane,
Plane->Position().Direction(),
Standard_True);
GeomAdaptor_Curve& GAC = HC->ChangeCurve();
GAC.Load(ProjOnPlane);
ProjLib_ProjectedCurve Proj(HS,HC);
Handle(Geom2d_Curve) pc = Geom2dAdaptor::MakeCurve(Proj);
if (pc->DynamicType() == STANDARD_TYPE(Geom2d_TrimmedCurve)) {
Handle(Geom2d_TrimmedCurve) TC =
(*((Handle(Geom2d_TrimmedCurve)*)&pc));
pc = TC->BasisCurve();
}
First = f; Last = l;
//
bToUpdate=Standard_True;
//
return pc;
}
//=======================================================================
//function : EdgeBounds
//purpose :
//=======================================================================
void BOPTools_AlgoTools2D::EdgeBounds (const TopoDS_Edge& aE,
Standard_Real& aFirst,
Standard_Real& aLast)
{
BRepAdaptor_Curve aBC(aE);
aFirst= aBC.FirstParameter();
aLast = aBC.LastParameter();
return nullPCurve;
}
*/

View File

@ -0,0 +1,26 @@
puts "============"
puts "OCC24157"
puts "============"
puts ""
############################################
# Parallelization of assembly part of BO
############################################
restore [locate_data_file bug24157_x_512_solids_glued] b1
tcopy b1 b2
ttranslate b2 3. 4. 5.
bclearobjects
bcleartools
baddcompound b1
baddcompound b2
bfillds
regexp { +Tps: +([-0-9.+eE]+)} [bbuild result -t] full tps_time
if { $tps_time > 60 } {
puts "Error: low performance"
} else {
puts "OK: high performance"
}
set 2dviewer 1

View File

@ -0,0 +1,29 @@
puts "============"
puts "OCC24157"
puts "============"
puts ""
############################################
# Parallelization of assembly part of BO
############################################
restore [locate_data_file bug24157_x_512_solids_glued] b1
tcopy b1 b2
ttranslate b2 2. 2. 2.
tcopy b1 b3
ttranslate b3 4. 4. 4.
bclearobjects
bcleartools
baddcompound b1
baddcompound b2
baddcompound b3
bfillds
regexp { +Tps: +([-0-9.+eE]+)} [bbuild result -t] full tps_time
if { $tps_time > 200 } {
puts "Error: low performance"
} else {
puts "OK: high performance"
}
set 2dviewer 1

View File

@ -0,0 +1,23 @@
puts "============"
puts "OCC24157"
puts "============"
puts ""
############################################
# Parallelization of assembly part of BO
############################################
restore [locate_data_file bug24157_x_512_solids] b1
bclearobjects
bcleartools
baddcompound b1
bfillds
regexp { +Tps: +([-0-9.+eE]+)} [bbuild result -t] full tps_time
if { $tps_time > 15 } {
puts "Error: low performance"
} else {
puts "OK: high performance"
}
set 2dviewer 1

View File

@ -0,0 +1,68 @@
puts "============"
puts "OCC24157"
puts "============"
puts ""
############################################
# Parallelization of assembly part of BO
############################################
set aN 5
set aR1 10.
set aR2 4.
set aZ 0.
for {set i 0} {$i < $aN} {incr i} {
set aA ${i}*2.*pi/${aN}
set aX ${aR1}*cos(${aA})
set aY ${aR1}*sin(${aA})
vertex v1_${i} ${aX} ${aY} ${aZ}
set aA ${aA}+pi/${aN}
set aX ${aR2}*cos(${aA})
set aY ${aR2}*sin(${aA})
vertex v2_${i} ${aX} ${aY} ${aZ}
}
copy v1_0 v1_${aN}
set q {}
for {set i 0} {$i < $aN} {incr i} {
set j [expr $i + 1]
edge e1_${i} v1_${i} v2_${i}
lappend q e1_${i}
edge e2_${i} v2_${i} v1_${j}
lappend q e2_${i}
}
eval wire w $q
mkplane bs w
#----------------------------
box b 700 820 1
explode b f
copy b_5 b1
set N 41
set q {}
for {set i 1} {$i < $N} {incr i} {
for {set j 1} {$j < $N} {incr j} {
tcopy bs bs_${i}_{$j}
ttranslate bs_${i}_{$j} [expr $i * 17.] [expr $j * 20.] 0.
lappend q bs_${i}_{$j}
}
}
eval compound $q b2
bclearobjects
bcleartools
baddobjects b1
baddcompound b2
bfillds
regexp { +Tps: +([-0-9.+eE]+)} [bbuild result -t] full tps_time
if { $tps_time > 30 } {
puts "Error: low performance"
} else {
puts "OK: high performance"
}
set 2dviewer 1

View File

@ -0,0 +1,75 @@
puts "============"
puts "OCC24157"
puts "============"
puts ""
############################################
# Parallelization of assembly part of BO
############################################
set L 300
set dL 10
set dS 10
box b $L $L 20
explode b f
copy b_5 b1
vertex v1 ${dS} -${dL} 0
vertex v2 ${dS} [expr ${L}+${dL}] 0
edge ex v1 v2
vertex v1 -${dL} $dS 0
vertex v2 [expr ${L}+${dL}] ${dS} 0
edge ey v1 v2
#--------------------------------------------
set cx {}
set N 29
set N1 [expr $N+1]
for {set i 0} {$i < $N} {incr i} {
tcopy ex ex$i
ttranslate ex$i [expr $i*${dS}] 0 0
lappend cx ex$i
}
for {set i 0} {$i < $N} {incr i} {
tcopy ey ey$i
ttranslate ey$i 0 [expr $i*${dS}] 0
lappend cx ey$i
}
pcylinder x 1 2
explode x e
tcopy x_3 ex
for {set i 0} {$i < $N1} {incr i} {
for {set j 0} {$j < $N1} {incr j} {
for {set k 0} {$k < 3} {incr k} {
for {set m 0} {$m < 3} {incr m} {
tcopy ex ex_${i}_${j}_${k}_${m}
ttranslate ex_${i}_${j}_${k}_${m} [expr $i*${dS}] [expr $j*${dS}] 0
ttranslate ex_${i}_${j}_${k}_${m} [expr 2+${k}*3] [expr 2+${m}*3] 0
lappend cx ex_${i}_${j}_${k}_${m}
}
}
}
}
eval compound $cx b2
bclearobjects
bcleartools
baddobjects b1
baddcompound b2
bfillds
bbuild result -t
regexp { +Tps: +([-0-9.+eE]+)} [bbuild result -t] full tps_time
if { $tps_time > 100 } {
puts "Error: low performance"
} else {
puts "OK: high performance"
}
set 2dviewer 1

View File

@ -0,0 +1,52 @@
puts "============"
puts "OCC24157"
puts "============"
puts ""
############################################
# Parallelization of assembly part of BO
############################################
box b1 100 100 100
set cx {}
psphere sp 1.
explode sp f
copy sp_1 sp
set ds 2.5
set dS 10.
set aNbGroups 3
for {set N 0} {$N < ${aNbGroups}} {incr N} {
for {set K 0} {$K < ${aNbGroups}} {incr K} {
for {set M 0} {$M < ${aNbGroups}} {incr M} {
for {set n 0} {$n < 3} {incr n} {
for {set k 0} {$k < 3} {incr k} {
for {set m 0} {$m < 3} {incr m} {
tcopy sp sp_${N}_${K}_${M}_${n}_${k}_${m}
ttranslate sp_${N}_${K}_${M}_${n}_${k}_${m} 2.5 2.5 2.5
ttranslate sp_${N}_${K}_${M}_${n}_${k}_${m} [expr $k*${ds}] [expr $m*${ds}] [expr $n*${ds}]
ttranslate sp_${N}_${K}_${M}_${n}_${k}_${m} [expr $M*${dS}] [expr $K*${dS}] [expr $N*${dS}]
lappend cx sp_${N}_${K}_${M}_${n}_${k}_${m}
}
}
}
}
}
}
eval compound $cx b2
bclearobjects
bcleartools
baddobjects b1
baddcompound b2
bfillds
regexp { +Tps: +([-0-9.+eE]+)} [bbuild result -t] full tps_time
if { $tps_time > 10 } {
puts "Error: low performance"
} else {
puts "OK: high performance"
}
set 2dviewer 1

View File

@ -0,0 +1,52 @@
puts "============"
puts "OCC24157"
puts "============"
puts ""
############################################
# Parallelization of assembly part of BO
############################################
box b1 100 100 100
set cx {}
psphere sp 1.
explode sp f
copy sp_1 sp
set ds 2.5
set dS 10.
set aNbGroups 4
for {set N 0} {$N < ${aNbGroups}} {incr N} {
for {set K 0} {$K < ${aNbGroups}} {incr K} {
for {set M 0} {$M < ${aNbGroups}} {incr M} {
for {set n 0} {$n < 3} {incr n} {
for {set k 0} {$k < 3} {incr k} {
for {set m 0} {$m < 3} {incr m} {
tcopy sp sp_${N}_${K}_${M}_${n}_${k}_${m}
ttranslate sp_${N}_${K}_${M}_${n}_${k}_${m} 2.5 2.5 2.5
ttranslate sp_${N}_${K}_${M}_${n}_${k}_${m} [expr $k*${ds}] [expr $m*${ds}] [expr $n*${ds}]
ttranslate sp_${N}_${K}_${M}_${n}_${k}_${m} [expr $M*${dS}] [expr $K*${dS}] [expr $N*${dS}]
lappend cx sp_${N}_${K}_${M}_${n}_${k}_${m}
}
}
}
}
}
}
eval compound $cx b2
bclearobjects
bcleartools
baddobjects b1
baddcompound b2
bfillds
regexp { +Tps: +([-0-9.+eE]+)} [bbuild result -t] full tps_time
if { $tps_time > 100 } {
puts "Error: low performance"
} else {
puts "OK: high performance"
}
set 2dviewer 1

View File

@ -0,0 +1,53 @@
puts "============"
puts "OCC24157"
puts "============"
puts ""
############################################
# Parallelization of assembly part of BO
############################################
set N 19
set dX 2.
box b 100 100 100
explode b f
copy b_1 fx
copy b_3 fy
copy b_5 fz
set q {}
for {set j 1} {$j < $N} {incr j} {
tcopy fx fx_${j}
ttranslate fx_${j} [expr $j*$dX] 0. 0.
lappend q fx_${j}
}
for {set j 1} {$j < $N} {incr j} {
tcopy fy fy_${j}
ttranslate fy_${j} 0. [expr $j*$dX] 0.
lappend q fy_${j}
}
for {set j 1} {$j < $N} {incr j} {
tcopy fz fz_${j}
ttranslate fz_${j} 0. 0. [expr $j*$dX]
lappend q fz_${j}
}
eval compound $q b1
bclearobjects
bcleartools
baddcompound b1
bfillds -t
regexp { +Tps: +([-0-9.+eE]+)} [bbuild result -t] full tps_time
if { $tps_time > 2.9 } {
puts "Error: low performance"
} else {
puts "OK: high performance"
}
set 2dviewer 1

View File

@ -0,0 +1,33 @@
puts "============"
puts "OCC24157"
puts "============"
puts ""
############################################
# Parallelization of assembly part of BO
############################################
restore [locate_data_file bug24157_fstar] b1
set qs {}
set N 24
for {set i 0} {$i < $N} {incr i} {
tcopy b1 b1_${i}
trotate b1_${i} 0. 0. 0. 0. 0. 1. [expr $i * 15.]
lappend qs b1_${i}
}
eval compound $qs q
bclearobjects
bcleartools
baddcompound q
bfillds
regexp { +Tps: +([-0-9.+eE]+)} [bbuild result -t] full tps_time
if { $tps_time > 15.7 } {
puts "Error: low performance"
} else {
puts "OK: high performance"
}
set 2dviewer 1