0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BOPAlgo / BOPAlgo_PaveFiller_5.cxx
index 9b1b320..3f622cb 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <BOPAlgo_PaveFiller.ixx>
 
-#include <NCollection_IncAllocator.hxx>
-//
-#include <GeomAPI_ProjectPointOnSurf.hxx>
-//
 #include <Bnd_Box.hxx>
-//
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Face.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+#include <BOPAlgo_SectionAttribute.hxx>
+#include <BOPAlgo_Tools.hxx>
+#include <BOPCol_MapOfInteger.hxx>
+#include <BOPCol_NCVector.hxx>
+#include <BOPCol_Parallel.hxx>
+#include <BOPDS_CommonBlock.hxx>
+#include <BOPDS_CoupleOfPaveBlocks.hxx>
+#include <BOPDS_Curve.hxx>
+#include <BOPDS_DataMapOfPaveBlockListOfInteger.hxx>
+#include <BOPDS_DS.hxx>
+#include <BOPDS_Interf.hxx>
+#include <BOPDS_Iterator.hxx>
+#include <BOPDS_MapOfPaveBlock.hxx>
+#include <BOPDS_Pave.hxx>
+#include <BOPDS_PaveBlock.hxx>
+#include <BOPTools_AlgoTools.hxx>
+#include <BRep_Builder.hxx>
 #include <BRep_Tool.hxx>
-#include <BRepBndLib.hxx>
 #include <BRepAdaptor_Curve.hxx>
-#include <BRep_Builder.hxx>
-//
+#include <BRepBndLib.hxx>
+#include <GeomAPI_ProjectPointOnSurf.hxx>
+#include <gp_Pnt.hxx>
+#include <IntTools_CommonPrt.hxx>
+#include <IntTools_Context.hxx>
 #include <IntTools_EdgeFace.hxx>
 #include <IntTools_Range.hxx>
 #include <IntTools_SequenceOfCommonPrts.hxx>
-#include <IntTools_CommonPrt.hxx>
+#include <IntTools_Tools.hxx>
+#include <NCollection_IncAllocator.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Vertex.hxx>
+
+//
+//
+//
+//
 //
-#include <BOPCol_MapOfInteger.hxx>
-#include <BOPCol_NCVector.hxx>
-#include <BOPCol_TBB.hxx>
 //
-#include <IntTools_Context.hxx>
-#include <IntTools_Tools.hxx>
 //
-#include <BOPDS_Interf.hxx>
-#include <BOPDS_Iterator.hxx>
-#include <BOPDS_PaveBlock.hxx>
-#include <BOPDS_MapOfPaveBlock.hxx>
-#include <BOPDS_DataMapOfPaveBlockListOfInteger.hxx>
-#include <BOPDS_CommonBlock.hxx>
-#include <BOPDS_Pave.hxx>
-#include <BOPDS_CoupleOfPaveBlocks.hxx>
 //
-#include <BOPTools_AlgoTools.hxx>
 //
-#include <BOPAlgo_Tools.hxx>
-
 //=======================================================================
 //class    : BOPAlgo_EdgeFace
 //purpose  : 
@@ -119,13 +123,13 @@ class BOPAlgo_EdgeFace :
 //=======================================================================
 typedef BOPCol_NCVector<BOPAlgo_EdgeFace> BOPAlgo_VectorOfEdgeFace; 
 //
-typedef BOPCol_TBBContextFunctor 
+typedef BOPCol_ContextFunctor 
   <BOPAlgo_EdgeFace,
   BOPAlgo_VectorOfEdgeFace,
   Handle(IntTools_Context), 
   IntTools_Context> BOPAlgo_EdgeFaceFunctor;
 //
-typedef BOPCol_TBBContextCnt 
+typedef BOPCol_ContextCnt 
   <BOPAlgo_EdgeFaceFunctor,
   BOPAlgo_VectorOfEdgeFace,
   Handle(IntTools_Context)> BOPAlgo_EdgeFaceCnt;
@@ -169,9 +173,7 @@ void BOPAlgo_PaveFiller::PerformEF()
   aDeflection=0.01;
   //
   BOPDS_VectorOfInterfEF& aEFs=myDS->InterfEF();
-  aEFs.SetStartSize(iSize);
   aEFs.SetIncrement(iSize);
-  aEFs.Init();
   //
   for (; myIterator->More(); myIterator->Next()) {
     myIterator->Value(nE, nF, bJustAdd);
@@ -297,10 +299,10 @@ void BOPAlgo_PaveFiller::PerformEF()
             bV[0]=CheckFacePaves(nV[0], aMIFOn, aMIFIn);
             bV[1]=CheckFacePaves(nV[1], aMIFOn, aMIFIn);
             if (bV[0] && bV[1]) {
-              iX=aEFs.Append()-1;
               IntTools_CommonPrt aCP = aCPart;
               aCP.SetType(TopAbs_EDGE);
-              BOPDS_InterfEF& aEF=aEFs(iX);
+              BOPDS_InterfEF& aEF=aEFs.Append1();
+              iX=aEFs.Extent()-1;
               aEF.SetIndices(nE, nF);
               aEF.SetCommonPart(aCP);
               myDS->AddInterf(nE, nF);
@@ -334,18 +336,19 @@ void BOPAlgo_PaveFiller::PerformEF()
             }
             //
             const gp_Pnt& aPnew = BRep_Tool::Pnt(aVnew);
-            if (!myContext->IsValidPointForFace(aPnew, 
-                                                aF, 
-                                                aTolE+aTolF)) {
+            Standard_Real aTolV = BRep_Tool::Tolerance(aVnew);
+            aTolV = Max(aTolV, Max(aTolE, aTolF));
+            //
+            if (!myContext->IsPointInFace(aPnew, aF, aTolV)) {
               continue;
             }
             //
-            aBB.UpdateVertex(aVnew, aTolE);
+            aBB.UpdateVertex(aVnew, aTolV);
             //
             aMIEFC.Add(nF);
             // 1
-            iX=aEFs.Append()-1;
-            BOPDS_InterfEF& aEF=aEFs(iX);
+            BOPDS_InterfEF& aEF=aEFs.Append1();
+            iX=aEFs.Extent()-1;
             aEF.SetIndices(nE, nF);
             aEF.SetCommonPart(aCPart);
             // 2
@@ -363,8 +366,8 @@ void BOPAlgo_PaveFiller::PerformEF()
           aMIEFC.Add(nF);
           //
           // 1
-          iX=aEFs.Append()-1;
-          BOPDS_InterfEF& aEF=aEFs(iX);
+          BOPDS_InterfEF& aEF=aEFs.Append1();
+          iX=aEFs.Extent()-1;
           aEF.SetIndices(nE, nF);
           //
           bV[0]=CheckFacePaves(nV[0], aMIFOn, aMIFIn);
@@ -637,16 +640,12 @@ Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF
   gp_Pnt2d aP2d(U, V);
   bRet = myContext->IsPointInFace (aF, aP2d);
   if (bRet) {
-    Standard_Integer i;
+    //Standard_Integer i;
     BRep_Builder aBB;
     //
     BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
-    if (aVFs.Extent() == 0) {
-      aVFs.Init();
-    }
-    //
-    i=aVFs.Append()-1;
-    BOPDS_InterfVF& aVF=aVFs(i);
+    aVFs.SetIncrement(10);
+    BOPDS_InterfVF& aVF=aVFs.Append1();
     aVF.SetIndices(nV, nF);
     aVF.SetUV(U, V);
     //