From f1baf495b61db30adb0db198413104588c9ac9c2 Mon Sep 17 00:00:00 2001 From: pkv Date: Thu, 22 May 2014 17:49:52 +0400 Subject: [PATCH] 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 --- src/BOPAlgo/BOPAlgo_PaveFiller.cdl | 5 +- src/BOPAlgo/BOPAlgo_PaveFiller.cxx | 5 + src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx | 292 +++++++++++--- src/BOPDS/BOPDS_Interf.hxx | 16 +- src/BOPTools/BOPTools_AlgoTools2D.cxx | 548 ++++++++++++-------------- tests/bugs/modalg_5/bug24157_1 | 26 ++ tests/bugs/modalg_5/bug24157_2 | 29 ++ tests/bugs/modalg_5/bug24157_3 | 23 ++ tests/bugs/modalg_5/bug24157_4 | 68 ++++ tests/bugs/modalg_5/bug24157_5 | 75 ++++ tests/bugs/modalg_5/bug24157_6 | 52 +++ tests/bugs/modalg_5/bug24157_7 | 52 +++ tests/bugs/modalg_5/bug24157_8 | 53 +++ tests/bugs/modalg_5/bug24157_9 | 33 ++ 14 files changed, 928 insertions(+), 349 deletions(-) create mode 100644 tests/bugs/modalg_5/bug24157_1 create mode 100644 tests/bugs/modalg_5/bug24157_2 create mode 100644 tests/bugs/modalg_5/bug24157_3 create mode 100644 tests/bugs/modalg_5/bug24157_4 create mode 100644 tests/bugs/modalg_5/bug24157_5 create mode 100644 tests/bugs/modalg_5/bug24157_6 create mode 100644 tests/bugs/modalg_5/bug24157_7 create mode 100644 tests/bugs/modalg_5/bug24157_8 create mode 100644 tests/bugs/modalg_5/bug24157_9 diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.cdl b/src/BOPAlgo/BOPAlgo_PaveFiller.cdl index 32cc1d616b..8486a8445d 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.cdl +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.cdl @@ -102,7 +102,10 @@ is Init(me:out) is virtual protected; - + + Prepare(me:out) + is protected; + PerformVV(me:out) is virtual protected; diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller.cxx index 37f58c5661..cb12233a4a 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.cxx @@ -168,6 +168,11 @@ void BOPAlgo_PaveFiller::Perform() if (myErrorStatus) { return; } + // + Prepare(); + if (myErrorStatus) { + return; + } // 00 PerformVV(); if (myErrorStatus) { diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx index fd7fc794f5..012893927d 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx @@ -19,6 +19,11 @@ #include +#include +#include +#include +#include + #include #include #include @@ -29,6 +34,7 @@ #include #include +#include #include #include @@ -36,9 +42,7 @@ #include #include - -#include -#include +#include #include #include @@ -54,6 +58,13 @@ #include #include #include +#include + +#include +#include + +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_VectorOfMPC; +// +typedef BOPCol_TBBFunctor + BOPAlgo_MPCFunctor; +// +typedef BOPCol_TBBCnt + 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_VectorOfBPC; +// +typedef BOPCol_TBBFunctor + BOPAlgo_BPCFunctor; +// +typedef BOPCol_TBBCnt + 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,51 +452,61 @@ 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; iInterfFF(); - aNbFF=aFFs.Extent(); - for (i=0; iShape(nF1))); - aF1F.Orientation(TopAbs_FORWARD); - aF2F=(*(TopoDS_Face *)(&myDS->Shape(nF2))); - aF2F.Orientation(TopAbs_FORWARD); - // - const BOPDS_VectorOfCurve& aVNC=aFF.Curves(); - aNbC=aVNC.Extent(); - for (k=0; kEdge(); - const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE))); - // - if (mySectionAttribute.PCurveOnS1()) { - BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aF1F); - UpdateVertices(aE, aF1F); - } - // - if (mySectionAttribute.PCurveOnS2()) { - BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aE, aF2F); - UpdateVertices(aE, aF2F); + 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; iShape(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(); + for (k=0; kEdge(); + const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE))); + // + 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; iInitialize(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()); +} diff --git a/src/BOPDS/BOPDS_Interf.hxx b/src/BOPDS/BOPDS_Interf.hxx index 2b7eb146d6..1ad97975d8 100644 --- a/src/BOPDS/BOPDS_Interf.hxx +++ b/src/BOPDS/BOPDS_Interf.hxx @@ -41,7 +41,7 @@ class BOPDS_Interf { * index of the second shape */ void SetIndices(const Standard_Integer theIndex1, - const Standard_Integer theIndex2) { + const Standard_Integer theIndex2) { myIndex1=theIndex1; myIndex2=theIndex2; } @@ -54,10 +54,10 @@ class BOPDS_Interf { * index of the second shape */ void Indices(Standard_Integer& theIndex1, - Standard_Integer& theIndex2) const { - theIndex1=myIndex1; - theIndex2=myIndex2; - } + Standard_Integer& theIndex2) const { + theIndex1=myIndex1; + theIndex2=myIndex2; + } // /** * Sets the index of the first interferred shape @@ -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: @@ -184,7 +184,7 @@ class BOPDS_Interf { virtual ~BOPDS_Interf() { } - protected: + protected: Standard_Integer myIndex1; Standard_Integer myIndex2; Standard_Integer myIndexNew; @@ -336,7 +336,7 @@ class BOPDS_InterfVF : public BOPDS_Interf { * value of U parameter */ void SetUV(const Standard_Real theU, - const Standard_Real theV) { + const Standard_Real theV) { myU=theU; myV=theV; } diff --git a/src/BOPTools/BOPTools_AlgoTools2D.cxx b/src/BOPTools/BOPTools_AlgoTools2D.cxx index b6b1087b64..c0542888ae 100644 --- a/src/BOPTools/BOPTools_AlgoTools2D.cxx +++ b/src/BOPTools/BOPTools_AlgoTools2D.cxx @@ -29,11 +29,23 @@ #include #include #include +#include + +#include #include -#include #include #include +#include + +#include +#include +#include +#include +#include +#include + +#include #include #include @@ -41,37 +53,56 @@ #include #include -#include +#include +#include +#include +#include +#include + #include + #include -#include #include -#include -#include -#include -#include -#include -#include -#include #include +#include + +#include + +#include 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 //purpose : //======================================================================= - void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE, - const TopoDS_Face& aF) +void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace (const TopoDS_Edge& aE, + const TopoDS_Face& aF) { BRep_Builder aBB; Handle(Geom2d_Curve) aC2D; 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,9 +122,10 @@ static //function : EdgeTangent //purpose : //======================================================================= - Standard_Boolean BOPTools_AlgoTools2D::EdgeTangent(const TopoDS_Edge& anEdge, - const Standard_Real aT, - gp_Vec& aTau) +Standard_Boolean BOPTools_AlgoTools2D::EdgeTangent + (const TopoDS_Edge& anEdge, + const Standard_Real aT, + gp_Vec& aTau) { Standard_Boolean isdgE; Standard_Real first, last; @@ -127,17 +159,18 @@ static //function : PointOnOnSurface //purpose : //======================================================================= - void BOPTools_AlgoTools2D::PointOnSurface (const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Standard_Real aParameter, - Standard_Real& U, - Standard_Real& V) +void BOPTools_AlgoTools2D::PointOnSurface (const TopoDS_Edge& aE, + const TopoDS_Face& aF, + const Standard_Real aParameter, + Standard_Real& U, + Standard_Real& V) { gp_Pnt2d aP2D; 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(); @@ -148,32 +181,35 @@ static //function : CurveOnSurface //purpose : //======================================================================= - void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE, - const TopoDS_Face& aF, - Handle(Geom2d_Curve)& aC2D, - Standard_Real& aToler) +void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE, + const TopoDS_Face& aF, + Handle(Geom2d_Curve)& aC2D, + 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; } //======================================================================= //function : CurveOnSurface //purpose : //======================================================================= - void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE, - const TopoDS_Face& aF, - Handle(Geom2d_Curve)& aC2D, - Standard_Real& aFirst, - Standard_Real& aLast, - Standard_Real& aToler) +void BOPTools_AlgoTools2D::CurveOnSurface (const TopoDS_Edge& aE, + const TopoDS_Face& aF, + Handle(Geom2d_Curve)& aC2D, + Standard_Real& aFirst, + Standard_Real& aLast, + Standard_Real& aToler) { 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,17 +219,17 @@ static aC2D=C2D; return; } - //======================================================================= //function : HasCurveOnSurface //purpose : //======================================================================= - Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface (const TopoDS_Edge& aE, - const TopoDS_Face& aF, - Handle(Geom2d_Curve)& aC2D, - Standard_Real& aFirst, - Standard_Real& aLast, - Standard_Real& aToler) +Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface + (const TopoDS_Edge& aE, + const TopoDS_Face& aF, + Handle(Geom2d_Curve)& aC2D, + Standard_Real& aFirst, + Standard_Real& aLast, + Standard_Real& aToler) { Standard_Boolean aHasOld; @@ -204,7 +240,7 @@ static return Standard_False; } - aC2D =BRep_Tool::CurveOnSurface(aE, aF, aFirst, aLast); + aC2D=BRep_Tool::CurveOnSurface(aE, aF, aFirst, aLast); aHasOld=!aC2D.IsNull(); return aHasOld; } @@ -212,32 +248,35 @@ static //function : HasCurveOnSurface //purpose : //======================================================================= - Standard_Boolean BOPTools_AlgoTools2D::HasCurveOnSurface (const TopoDS_Edge& aE, - const TopoDS_Face& aF) +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; + // + aC2D=BRep_Tool::CurveOnSurface(aE, aF, aFirst, aLast); + bHasOld=!aC2D.IsNull(); + // + return bHasOld; } - //======================================================================= //function : AdjustPCurveOnFace //purpose : //======================================================================= - void BOPTools_AlgoTools2D::AdjustPCurveOnFace (const TopoDS_Face& aF, - const Handle(Geom_Curve)& aC3D, - const Handle(Geom2d_Curve)& aC2D, - Handle(Geom2d_Curve)& aC2DA) +void BOPTools_AlgoTools2D::AdjustPCurveOnFace + (const TopoDS_Face& aF, + const Handle(Geom_Curve)& aC3D, + const Handle(Geom2d_Curve)& aC2D, + Handle(Geom2d_Curve)& aC2DA) { Standard_Real first, last; @@ -250,11 +289,12 @@ static //function : AdjustPCurveOnFace //purpose : //======================================================================= - void BOPTools_AlgoTools2D::AdjustPCurveOnFace (const TopoDS_Face& aF, - const Standard_Real aFirst, - const Standard_Real aLast, - const Handle(Geom2d_Curve)& aC2D, - Handle(Geom2d_Curve)& aC2DA) +void BOPTools_AlgoTools2D::AdjustPCurveOnFace + (const TopoDS_Face& aF, + const Standard_Real aFirst, + const Standard_Real aLast, + const Handle(Geom2d_Curve)& aC2D, + Handle(Geom2d_Curve)& aC2DA) { Standard_Boolean mincond, maxcond, decalu, decalv; Standard_Integer k, iCnt; @@ -402,8 +442,9 @@ static //function : IntermediatePoint //purpose : //======================================================================= - Standard_Real BOPTools_AlgoTools2D::IntermediatePoint (const Standard_Real aFirst, - const Standard_Real aLast) +Standard_Real BOPTools_AlgoTools2D::IntermediatePoint + (const Standard_Real aFirst, + const Standard_Real aLast) { //define parameter division number as 10*e^(-PI) = 0.43213918 const Standard_Real PAR_T = 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,88 +474,47 @@ static //function : BuildPCurveForEdgeOnPlane //purpose : //======================================================================= -void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnPlane (const TopoDS_Edge& aE, - const TopoDS_Face& aF) -{ - Standard_Real aTolE; - TopLoc_Location aLoc; +void BOPTools_AlgoTools2D::BuildPCurveForEdgeOnPlane + (const TopoDS_Edge& aE, + const TopoDS_Face& aF) +{ + 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); + aC2D=BRep_Tool_CurveOnSurface(aE, aF, aT1, aT2, bToUpdate); + if (bToUpdate) { + aTolE=BRep_Tool::Tolerance(aE); + aBB.UpdateEdge(aE, aC2D, aF, aTolE); } - // - if (aGP.IsNull()) { - return; - } - // - BOPTools_AlgoTools2D::CurveOnSurface(aE, aF, aC2D, aTolE); - 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 : //======================================================================= void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE, - const TopoDS_Face& aF, - Handle(Geom2d_Curve)& aC2D, - Standard_Real& aFirst, - Standard_Real& aLast, - Standard_Real& aToler) + const TopoDS_Face& aF, + Handle(Geom2d_Curve)& aC2D, + Standard_Real& aFirst, + Standard_Real& aLast, + Standard_Real& aToler) { Standard_Boolean aLocIdentity; Standard_Real f3d, l3d; @@ -558,10 +559,10 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE, //function : MakePCurveOnFace //purpose : //======================================================================= - void BOPTools_AlgoTools2D::MakePCurveOnFace (const TopoDS_Face& aF, - const Handle(Geom_Curve)& aC3D, - Handle(Geom2d_Curve)& aC2D, //-> - Standard_Real& TolReached2d) +void BOPTools_AlgoTools2D::MakePCurveOnFace (const TopoDS_Face& aF, + const Handle(Geom_Curve)& aC3D, + Handle(Geom2d_Curve)& aC2D, //-> + Standard_Real& TolReached2d) { Standard_Real aFirst, aLast; @@ -570,26 +571,29 @@ 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, - const Handle(Geom_Curve)& aC3D, - const Standard_Real aFirst, - const Standard_Real aLast, - Handle(Geom2d_Curve)& aC2D, - Standard_Real& TolReached2d) +void BOPTools_AlgoTools2D::MakePCurveOnFace + (const TopoDS_Face& aF, + const Handle(Geom_Curve)& aC3D, + const Standard_Real aFirst, + const Standard_Real aLast, + Handle(Geom2d_Curve)& aC2D, + Standard_Real& TolReached2d) { Standard_Real aTolR; Handle(Geom2d_Curve) aC2DA; 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,8 +630,9 @@ void BOPTools_AlgoTools2D::Make2D (const TopoDS_Edge& aE, //function : MakePCurveOfType //purpose : //======================================================================= - void BOPTools_AlgoTools2D::MakePCurveOfType(const ProjLib_ProjectedCurve& PC, - Handle(Geom2d_Curve)& C2D) +void BOPTools_AlgoTools2D::MakePCurveOfType + (const ProjLib_ProjectedCurve& PC, + Handle(Geom2d_Curve)& C2D) { switch (PC.GetType()) { @@ -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)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(); + } + itcr.Next(); + } + + // 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 + + if (!GP.IsNull()) { + + 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; } - return bIsFound; -} -//======================================================================= -//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; - - 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; - - return ok; + return nullPCurve; } - -//======================================================================= -//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(); -} - - -*/ diff --git a/tests/bugs/modalg_5/bug24157_1 b/tests/bugs/modalg_5/bug24157_1 new file mode 100644 index 0000000000..fa8c894b14 --- /dev/null +++ b/tests/bugs/modalg_5/bug24157_1 @@ -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 diff --git a/tests/bugs/modalg_5/bug24157_2 b/tests/bugs/modalg_5/bug24157_2 new file mode 100644 index 0000000000..0972f60e21 --- /dev/null +++ b/tests/bugs/modalg_5/bug24157_2 @@ -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 diff --git a/tests/bugs/modalg_5/bug24157_3 b/tests/bugs/modalg_5/bug24157_3 new file mode 100644 index 0000000000..82f85a9ed9 --- /dev/null +++ b/tests/bugs/modalg_5/bug24157_3 @@ -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 diff --git a/tests/bugs/modalg_5/bug24157_4 b/tests/bugs/modalg_5/bug24157_4 new file mode 100644 index 0000000000..c2bf875b94 --- /dev/null +++ b/tests/bugs/modalg_5/bug24157_4 @@ -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 diff --git a/tests/bugs/modalg_5/bug24157_5 b/tests/bugs/modalg_5/bug24157_5 new file mode 100644 index 0000000000..f2f76de5e8 --- /dev/null +++ b/tests/bugs/modalg_5/bug24157_5 @@ -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 diff --git a/tests/bugs/modalg_5/bug24157_6 b/tests/bugs/modalg_5/bug24157_6 new file mode 100644 index 0000000000..4ec968f899 --- /dev/null +++ b/tests/bugs/modalg_5/bug24157_6 @@ -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 diff --git a/tests/bugs/modalg_5/bug24157_7 b/tests/bugs/modalg_5/bug24157_7 new file mode 100644 index 0000000000..9dd6cd992a --- /dev/null +++ b/tests/bugs/modalg_5/bug24157_7 @@ -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 diff --git a/tests/bugs/modalg_5/bug24157_8 b/tests/bugs/modalg_5/bug24157_8 new file mode 100644 index 0000000000..a3d938646e --- /dev/null +++ b/tests/bugs/modalg_5/bug24157_8 @@ -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 diff --git a/tests/bugs/modalg_5/bug24157_9 b/tests/bugs/modalg_5/bug24157_9 new file mode 100644 index 0000000000..67601835c6 --- /dev/null +++ b/tests/bugs/modalg_5/bug24157_9 @@ -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