Salome HOME
Mantis issue 0020894: EDF 1421 GEOM: Partition Bug with big geometrical objects....
[modules/geom.git] / src / NMTTools / NMTTools_PaveFiller_7.cxx
index ef23a7e29b74b506cb1f636e75789390bf98ea37..08d365f6a97df1495c92319b9b9333ece9fc77fe 100644 (file)
@@ -1,28 +1,30 @@
-// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either 
-// version 2.1 of the License.
-// 
-// This library is distributed in the hope that it will be useful 
-// but WITHOUT ANY WARRANTY; without even the implied warranty of 
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-// Lesser General Public License for more details.
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// File:       NMTTools_PaveFiller_7.cxx
-// Created:    Thu Dec 18 15:14:55 2003
-// Author:     Peter KURNEV
-//             <pkv@irinox>
-
 
+// File:        NMTTools_PaveFiller_7.cxx
+// Created:     Thu Dec 18 15:14:55 2003
+// Author:      Peter KURNEV
+//              <pkv@irinox>
+//
 #include <NMTTools_PaveFiller.ixx>
 
 #include <Bnd_HArray1OfBox.hxx>
@@ -84,7 +86,7 @@
 // Contribution of Samtech www.samcef.com BEGIN
 static 
   void FuseVertices(const TopoDS_Shape& aCompound,
-                   TopTools_DataMapOfShapeShape& aDMVV);
+                    TopTools_DataMapOfShapeShape& aDMVV);
 // Contribution of Samtech www.samcef.com END
 
 //=======================================================================
@@ -140,12 +142,12 @@ static
       aV2.Orientation(TopAbs_REVERSED);
       //xx
       if (aNbPaveBlocks==1) {
-       bIsNewVertex1=myDS->IsNewShape (nV1);
-       bIsNewVertex2=myDS->IsNewShape (nV2);
-       if (!bIsNewVertex1 && !bIsNewVertex2) {
-         aPB.SetEdge(i);
-         continue;
-       }
+        bIsNewVertex1=myDS->IsNewShape (nV1);
+        bIsNewVertex2=myDS->IsNewShape (nV2);
+        if (!bIsNewVertex1 && !bIsNewVertex2) {
+          aPB.SetEdge(i);
+          continue;
+        }
       }
       //xx
       BOPTools_Tools::MakeSplitEdge(aE, aV1, t1, aV2, t2, aESplit);  
@@ -160,8 +162,8 @@ static
       anASSeq.SetNewOrientation(aV2.Orientation());
       //
       if (anOri==TopAbs_INTERNAL) {
-       anASSeq.SetNewAncestor(i);
-       aESplit.Orientation(anOri);
+        anASSeq.SetNewAncestor(i);
+        aESplit.Orientation(anOri);
       }
       //
       myDS->InsertShapeAndAncestorsSuccessors(aESplit, anASSeq);
@@ -208,28 +210,28 @@ static
       // Among all PBs of aCB the first PB will be one
       // that have max tolerance value 
       {
-       Standard_Real aTolEx, aTolExMax;
-       BOPTools_ListOfPaveBlock *pLPB, aLPBx;
-       //
-       aTolExMax=-1.;
-       pLPB=(BOPTools_ListOfPaveBlock *)&aCB.PaveBlocks();
-       aPBIt.Initialize(*pLPB);
-       for (; aPBIt.More(); aPBIt.Next()) {
-         const BOPTools_PaveBlock& aPBx=aPBIt.Value();
-         nEx=aPBx.OriginalEdge();
-         const TopoDS_Edge& aEx=TopoDS::Edge(myDS->Shape(nEx));
-         aTolEx=BRep_Tool::Tolerance(aEx);
-         if (aTolEx>aTolExMax) {
-           aTolExMax=aTolEx;
-           aLPBx.Prepend(aPBx);
-         }
-         else{
-           aLPBx.Append(aPBx);
-         }
-       }
-       //
-       pLPB->Clear();
-       *pLPB=aLPBx;
+        Standard_Real aTolEx, aTolExMax;
+        BOPTools_ListOfPaveBlock *pLPB, aLPBx;
+        //
+        aTolExMax=-1.;
+        pLPB=(BOPTools_ListOfPaveBlock *)&aCB.PaveBlocks();
+        aPBIt.Initialize(*pLPB);
+        for (; aPBIt.More(); aPBIt.Next()) {
+          const BOPTools_PaveBlock& aPBx=aPBIt.Value();
+          nEx=aPBx.OriginalEdge();
+          const TopoDS_Edge& aEx=TopoDS::Edge(myDS->Shape(nEx));
+          aTolEx=BRep_Tool::Tolerance(aEx);
+          if (aTolEx>aTolExMax) {
+            aTolExMax=aTolEx;
+            aLPBx.Prepend(aPBx);
+          }
+          else{
+            aLPBx.Append(aPBx);
+          }
+        }
+        //
+        pLPB->Clear();
+        *pLPB=aLPBx;
       }
       //modified by NIZNHY-PKV Wed Nov  8 15:59:50 2006t
       //
@@ -240,14 +242,14 @@ static
       const BOPTools_ListOfPaveBlock& aCBLPB=aCB.PaveBlocks();
       aPBIt.Initialize(aCBLPB);
       for (; aPBIt.More(); aPBIt.Next()) {
-       BOPTools_PaveBlock& aPBx=aPBIt.Value();
-       nEx=aPBx.OriginalEdge();
-       if (nEx==nE) {
-         continue;
-       }
-       //
-       nSpx=SplitIndex(aPBx);
-       aPBx.SetEdge(nSpx);
+        BOPTools_PaveBlock& aPBx=aPBIt.Value();
+        nEx=aPBx.OriginalEdge();
+        if (nEx==nE) {
+          continue;
+        }
+        //
+        nSpx=SplitIndex(aPBx);
+        aPBx.SetEdge(nSpx);
       }
       //
     }
@@ -313,20 +315,20 @@ static
       aE=TopoDS::Edge(aExp.Current());
       //
       if (BRep_Tool::Degenerated(aE)) {
-       continue;
+        continue;
       }
       //
       nE=myDS->ShapeIndex(aE, iRankF);
       //
       if (aME.Contains(nE)) {
-       continue;
+        continue;
       }
       aME.Add(nE);
       //
       BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
       aNbPB=aLPB.Extent();
       if (aNbPB) {
-       continue;
+        continue;
       }
       TopExp::Vertices(aE, aV1, aV2);
       //
@@ -428,15 +430,15 @@ static
       const TopoDS_Shape& aVy=aDMVV.Find(aVx);
       
       if (aDMVFF1.IsBound(aVy)) {
-       TColStd_ListOfInteger& aLIy=aDMVFF1.ChangeFind(aVy);
-       aIt.Initialize(aLIx);
-       for(; aIt.More(); aIt.Next()) {
-         nFx=aIt.Value();
-         aLIy.Append(nFx);
-       }
+        TColStd_ListOfInteger& aLIy=aDMVFF1.ChangeFind(aVy);
+        aIt.Initialize(aLIx);
+        for(; aIt.More(); aIt.Next()) {
+          nFx=aIt.Value();
+          aLIy.Append(nFx);
+        }
       }
       else { 
-       aDMVFF1.Bind(aVy, aLIx);
+        aDMVFF1.Bind(aVy, aLIx);
       }
     }
   }
@@ -454,7 +456,7 @@ static
     for(; aIt.More(); aIt.Next()) {
       nFx=aIt.Value();
       if (aMIy.Add(nFx)) {
-       aLIy.Append(nFx);
+        aLIy.Append(nFx);
       }
     }
     aLIx.Clear();
@@ -539,16 +541,16 @@ static
       //
       aIt.Initialize(aLIFF);
       for (; aIt.More(); aIt.Next()) {
-       nFx=aIt.Value();
-       if (myAloneVertices.Contains(nFx)) {
-         TColStd_IndexedMapOfInteger& aMVx=myAloneVertices.ChangeFromKey(nFx);
-         aMVx.Add(nV);
-       }
-       else {
-         TColStd_IndexedMapOfInteger aMVx;
-         aMVx.Add(nV);
-         myAloneVertices.Add(nFx, aMVx);
-       }
+        nFx=aIt.Value();
+        if (myAloneVertices.Contains(nFx)) {
+          TColStd_IndexedMapOfInteger& aMVx=myAloneVertices.ChangeFromKey(nFx);
+          aMVx.Add(nV);
+        }
+        else {
+          TColStd_IndexedMapOfInteger aMVx;
+          aMVx.Add(nV);
+          myAloneVertices.Add(nFx, aMVx);
+        }
       }
     }
   }
@@ -568,16 +570,16 @@ static
       const TColStd_IndexedMapOfInteger& aMAV=myAloneVertices(i);
       aNbAV=aMAV.Extent();
       for(j=1; j<=aNbAV; ++j) {
-       nV=aMAV(j);
-       if (aMAVF.Contains(nV)) {
-         TColStd_IndexedMapOfInteger& aMF=aMAVF.ChangeFromKey(nV);
-         aMF.Add(nF);
-       }
-       else{
-         TColStd_IndexedMapOfInteger aMF;
-         aMF.Add(nF);
-         aMAVF.Add(nV, aMF);
-       }
+        nV=aMAV(j);
+        if (aMAVF.Contains(nV)) {
+          TColStd_IndexedMapOfInteger& aMF=aMAVF.ChangeFromKey(nV);
+          aMF.Add(nF);
+        }
+        else{
+          TColStd_IndexedMapOfInteger aMF;
+          aMF.Add(nF);
+          aMAVF.Add(nV, aMF);
+        }
       }
     }
     //
@@ -587,11 +589,11 @@ static
       const TColStd_IndexedMapOfInteger& aMF=aMAVF(i);
       aNbF=aMF.Extent();
       for(j=1; j<aNbF; ++j) {
-       nF1=aMF(j);
-       for(k=j+1; k<=aNbF; ++k) {
-         nF2=aMF(k);
-         myIP->Add(nF1, nF2, Standard_True, NMTDS_TI_FF);
-       }
+        nF1=aMF(j);
+        for(k=j+1; k<=aNbF; ++k) {
+          nF2=aMF(k);
+          myIP->Add(nF1, nF2, Standard_True, NMTDS_TI_FF);
+        }
       }
     }
   }
@@ -610,7 +612,7 @@ static
 // purpose: 
 //=======================================================================
   void NMTTools_PaveFiller::FuseVertices(const TopoDS_Shape& aCompound,
-                                        TopTools_DataMapOfShapeShape& aDMVV)const
+                                         TopTools_DataMapOfShapeShape& aDMVV)const
 {
   Standard_Integer i, aNbVV, n1, n2, nX;
   NMTTools_PaveFiller tPF;