]> OCCT Git - occt-copy.git/commitdiff
0028284: Avoid classification of sub-shapes of arguments of BOPs relatively solids...
authoremv <emv@opencascade.com>
Mon, 9 Jan 2017 06:50:03 +0000 (09:50 +0300)
committerapn <apn@opencascade.com>
Thu, 26 Jan 2017 10:39:02 +0000 (13:39 +0300)
1. The methods PerformVZ, PerformEZ, PerformFZ and PerformZZ have been transferred from BOPAlgo_PaveFiller to BOPAlgo_CheckerSI class
to perform intersection of sub-shapes with solids only in self-intersection mode.

2. The checks for solids built from the same (shared) faces have been added into methods building the result of Boolean operations -
BOPAlgo_BOP::BuildRC() and BOPAlgo_BOP::BuildSolid().

3. Since the NonDestructive mode is now natively supported by the BOPAlgo_PaveFiller the methods providing the support of this mode by CheckerSI
(BOPAlgo_CheckerSI::PrepareCopy() and BOPAlgo_CheckerSI::PostTreatCopy()) are not needed and have been removed.

4. The pairs of sub-shapes with interfering bounding boxes are now sorted before real intersection to guarantee the constant order of
intersection of sub-shapes and produce more stable result. The class BOPDS_PassKey has been replaced with simpler class BOPDS_Pair.

5. The class BOPDS_SubIterator has been refactored.

6. Test cases for the issue.

7. Adjustment of the test case boolean volumemaker D2.

40 files changed:
dox/dev_guides/upgrade/upgrade.md
src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx
src/BOPAlgo/BOPAlgo_BOP.cxx
src/BOPAlgo/BOPAlgo_CheckerSI.cxx
src/BOPAlgo/BOPAlgo_CheckerSI.hxx
src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx [new file with mode: 0644]
src/BOPAlgo/BOPAlgo_PaveFiller.cxx
src/BOPAlgo/BOPAlgo_PaveFiller.hxx
src/BOPAlgo/BOPAlgo_PaveFiller_1.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_10.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx [deleted file]
src/BOPAlgo/BOPAlgo_PaveFiller_2.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_4.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx
src/BOPAlgo/BOPAlgo_PaveFiller_9.cxx
src/BOPAlgo/FILES
src/BOPDS/BOPDS_DS.cxx
src/BOPDS/BOPDS_DS.hxx
src/BOPDS/BOPDS_DS.lxx
src/BOPDS/BOPDS_Iterator.cxx
src/BOPDS/BOPDS_Iterator.hxx
src/BOPDS/BOPDS_IteratorSI.cxx
src/BOPDS/BOPDS_MapOfPair.hxx [new file with mode: 0644]
src/BOPDS/BOPDS_Pair.hxx [new file with mode: 0644]
src/BOPDS/BOPDS_PairMapHasher.hxx [new file with mode: 0644]
src/BOPDS/BOPDS_SubIterator.cxx
src/BOPDS/BOPDS_SubIterator.hxx
src/BOPDS/BOPDS_VectorOfPair.hxx [new file with mode: 0644]
src/BOPDS/BOPDS_VectorOfVectorOfPair.hxx [new file with mode: 0644]
src/BOPDS/FILES
src/BOPTest/BOPTest_CheckCommands.cxx
src/BOPTest/BOPTest_DebugCommands.cxx
tests/boolean/volumemaker/D2
tests/bugs/modalg_1/bug10232
tests/bugs/modalg_6/bug28284_1 [new file with mode: 0644]
tests/bugs/modalg_6/bug28284_2 [new file with mode: 0644]
tests/bugs/modalg_6/bug28284_3 [new file with mode: 0644]

index f60cdcdf724fc93aa0edb6de9632113edaf9be9b..710c9d8de25320ce15150b3f569ff63183602c0f 100644 (file)
@@ -1209,3 +1209,9 @@ The follow AIS_InteractiveContext methods have been changed:
 * Class GeomPlate_BuildPlateSurface accepts base class Adaptor3d_HCurve (instead of inherited Adaptor3d_HCurveOnSurface accepted earlier).
 
 * Types GeomPlate_Array1OfHCurveOnSurface and GeomPlate_HArray1OfHCurveOnSurface have been replaced with GeomPlate_Array1OfHCurve and GeomPlate_HArray1OfHCurve correspondingly (accept base class Adaptor3d_HCurve instead of Adaptor3d_HCurveOnSurface).
+
+@subsection upgrade_720_BOP_DataStructure BOP - Pairs of interfering indices
+
+* The classes *BOPDS_PassKey* and *BOPDS_PassKeyBoolean* are too excessive and not used any more in Boolean Operations. To replace them the new *BOPDS_Pair* class has been implemented. Thus:
+  - The method *BOPDS_DS::Interferences()* now returns the *BOPDS_MapOfPair*;
+  - The method *BOPDS_Iterator::Value()* takes now only two parameters - the indices of interfering sub-shapes.
index 78ee759ffd8cd712438a246167d23f640cf17c85..6138f91bdaf3fdddb1d9574dcbcdfed22cafb69d 100644 (file)
@@ -21,7 +21,7 @@
 #include <BOPCol_IndexedMapOfShape.hxx>
 #include <BOPCol_SequenceOfShape.hxx>
 #include <BOPDS_DS.hxx>
-#include <BOPDS_MapOfPassKey.hxx>
+#include <BOPDS_MapOfPair.hxx>
 #include <BOPTools.hxx>
 #include <BOPTools_AlgoTools.hxx>
 #include <BOPTools_AlgoTools3D.hxx>
@@ -352,7 +352,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
     }
     //
     Standard_Integer iErr, n1, n2;
-    BOPDS_MapIteratorMapOfPassKey aItMPK;
+    BOPDS_MapIteratorOfMapOfPair aItMPK;
     BOPCol_ListOfShape anArgs;
     BOPAlgo_CheckerSI aChecker;
     //
@@ -367,12 +367,12 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
     iErr=aChecker.ErrorStatus();
     //
     const BOPDS_DS& aDS=*(aChecker.PDS());
-    const BOPDS_MapOfPassKey& aMPK=aDS.Interferences();
+    const BOPDS_MapOfPair& aMPK=aDS.Interferences();
     //
     aItMPK.Initialize(aMPK);
     for (; aItMPK.More(); aItMPK.Next()) {
-      const BOPDS_PassKey& aPK=aItMPK.Value();
-      aPK.Ids(n1, n2);
+      const BOPDS_Pair& aPK=aItMPK.Value();
+      aPK.Indices(n1, n2);
       if(aDS.IsNewShape(n1) || aDS.IsNewShape(n2)) {
         continue;
       }
index 301267e9c9a1db6897b9aca11b240852ed31ba22..55a43db2e34a5947bbc2d63ebc01c3bcfa5ca485 100644 (file)
@@ -59,7 +59,11 @@ static
 static
   Standard_Integer NbCommonItemsInMap(const BOPCol_MapOfShape& theM1,
                                       const BOPCol_MapOfShape& theM2);
-
+//
+static
+  void MapFacesToBuildSolids(const TopoDS_Shape& theSol,
+                             BOPCol_IndexedDataMapOfShapeListOfShape& theMFS,
+                             BOPCol_IndexedMapOfShape& theMFI);
 
 //=======================================================================
 //function : 
@@ -556,10 +560,10 @@ void BOPAlgo_BOP::BuildRC()
   //
   Standard_Integer i, j, aNb, iDim;
   Standard_Boolean bCheckEdges, bContains, bCut21, bCommon;
-  BOPCol_IndexedMapOfShape aMArgs, aMTools;
-  BOPCol_IndexedMapOfShape aMArgsIm, aMToolsIm;
   BOPCol_ListIteratorOfListOfShape aItLS;
   //
+  // prepare the building elements of arguments to get its splits
+  BOPCol_IndexedMapOfShape aMArgs, aMTools;
   for (i = 0; i < 2; ++i) {
     const BOPCol_ListOfShape& aLS = !i ? myArguments : myTools;
     BOPCol_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
@@ -574,9 +578,14 @@ void BOPAlgo_BOP::BuildRC()
   //
   bCheckEdges = Standard_False;
   //
+  // get splits of building elements
+  BOPCol_IndexedMapOfShape aMArgsIm, aMToolsIm;
+  BOPTools_IndexedDataMapOfSetShape aMSetArgs, aMSetTools;
+
   for (i = 0; i < 2; ++i) {
     const BOPCol_IndexedMapOfShape& aMS = !i ? aMArgs : aMTools;
     BOPCol_IndexedMapOfShape& aMSIm = !i ? aMArgsIm : aMToolsIm;
+    BOPTools_IndexedDataMapOfSetShape& aMSet = !i ? aMSetArgs : aMSetTools;
     //
     aNb = aMS.Extent();
     for (j = 1; j <= aNb; ++j) {
@@ -600,6 +609,13 @@ void BOPAlgo_BOP::BuildRC()
       }
       else {
         aMSIm.Add(aS);
+        if (aS.ShapeType() == TopAbs_SOLID) {
+          BOPTools_Set aST;
+          aST.Add(aS, TopAbs_FACE);
+          if (!aMSet.Contains(aST)) {
+            aMSet.Add(aST, aS);
+          }
+        }
       }
     }
   }
@@ -614,6 +630,7 @@ void BOPAlgo_BOP::BuildRC()
   //
   const BOPCol_IndexedMapOfShape& aMIt = bCut21 ? aMToolsIm : aMArgsIm;
   const BOPCol_IndexedMapOfShape& aMCheck = bCut21 ? aMArgsIm : aMToolsIm;
+  const BOPTools_IndexedDataMapOfSetShape& aMSetCheck = bCut21 ? aMSetArgs : aMSetTools;
   //
   BOPCol_IndexedMapOfShape aMCheckExp, aMItExp;
   //
@@ -649,6 +666,12 @@ void BOPAlgo_BOP::BuildRC()
     const TopoDS_Shape& aS = aMItExp(i);
     //
     bContains = aMCheckExp.Contains(aS);
+    if (!bContains && aS.ShapeType() == TopAbs_SOLID) {
+      BOPTools_Set aST;
+      aST.Add(aS, TopAbs_FACE);
+      bContains = aMSetCheck.Contains(aST);
+    }
+    //
     if (bCommon) {
       if (bContains) {
         aBB.Add(aC, aS);
@@ -870,126 +893,107 @@ void BOPAlgo_BOP::BuildShape()
 //=======================================================================
 void BOPAlgo_BOP::BuildSolid()
 {
-  Standard_Boolean bHasInterf, bHasSharedFaces;
-  Standard_Integer i, aNbF, aNbSx, iX, iErr, aNbZ;
-  TopAbs_Orientation aOr, aOr1;
-  TopoDS_Iterator aIt;
-  TopoDS_Shape aRC;
-  BRep_Builder aBB;
-  TopExp_Explorer aExp;
-  BOPCol_IndexedMapOfShape aMFI;
-  BOPCol_IndexedDataMapOfShapeListOfShape aMFS, aMEF;
-  BOPCol_ListIteratorOfListOfShape aItLS;
-  BOPCol_ListOfShape aSFS;
-  BOPAlgo_BuilderSolid aSB; 
-  BOPCol_MapOfShape aMSA, aMZ;
-  BOPTools_IndexedDataMapOfSetShape aDMSTS;
+  // Containers
   BOPCol_ListOfShape aLSC;
   //
+  BOPCol_ListIteratorOfListOfShape aItLS;
+  TopExp_Explorer aExp;
+  BRep_Builder aBB;
+  //
   myErrorStatus=0;
   //
-  // Map of of Solids of Arguments
-  for (i=0; i<2; ++i) {
-    const BOPCol_ListOfShape& aLSA=(i) ? myArguments : myTools;
+  // Get solids from input arguments
+  BOPCol_MapOfShape aMSA;
+  // Map the arguments to find shared faces
+  BOPCol_IndexedDataMapOfShapeListOfShape aMFS;
+  for (Standard_Integer i = 0; i < 2; ++i) {
+    const BOPCol_ListOfShape& aLSA = (i) ? myArguments : myTools;
     aItLS.Initialize(aLSA);
     for (; aItLS.More(); aItLS.Next()) {
-      const TopoDS_Shape& aSA=aItLS.Value();
-      //
-      CollectContainers(aSA, aLSC);
-      //
+      const TopoDS_Shape& aSA = aItLS.Value();
       aExp.Init(aSA, TopAbs_SOLID);
       for (; aExp.More(); aExp.Next()) {
-        const TopoDS_Shape& aZA=aExp.Current();
-        aMSA.Add(aZA);
-        //
-        BOPTools::MapShapesAndAncestors(aZA, 
-                                        TopAbs_FACE, 
-                                        TopAbs_SOLID, 
-                                        aMFS);
+        const TopoDS_Shape& aSol = aExp.Current();
+        aMSA.Add(aSol);
+        BOPTools::MapShapesAndAncestors(aSol, TopAbs_FACE, TopAbs_SOLID, aMFS);
       }
+      //
+      // get Compsolids from input arguments
+      CollectContainers(aSA, aLSC);
     }
   }
   //
-  aNbF=aMFS.Extent();
-  for (i=1; i<aNbF; ++i) {
-    //const TopoDS_Shape& aFA=aMFZA.FindKey(i);
-    const BOPCol_ListOfShape& aLZA=aMFS(i);
-    aNbZ=aLZA.Extent();
-    if (aNbZ > 1) {
-      aItLS.Initialize(aLZA);
+  // Find solids in input arguments sharing faces with other solids
+  BOPCol_MapOfShape aMTSols;
+  Standard_Integer i, aNb = aMFS.Extent();
+  for (i = 1; i < aNb; ++i) {
+    const BOPCol_ListOfShape& aLSols = aMFS(i);
+    if (aLSols.Extent() > 1) {
+      aItLS.Initialize(aLSols);
       for(; aItLS.More(); aItLS.Next()) {
-        const TopoDS_Shape& aZA=aItLS.Value();
-        aMZ.Add(aZA);
+        aMTSols.Add(aItLS.Value());
       }
     }
   }
   //
+  // Possibly untouched solids - to be added to results as is
+  BOPCol_IndexedMapOfShape aMUSols;
+  // Use map to chose the most outer faces to build result solids
   aMFS.Clear();
+  // Internal faces
+  BOPCol_IndexedMapOfShape aMFI;
   //
-  aIt.Initialize(myRC);
+  TopoDS_Iterator aIt(myRC);
   for (; aIt.More(); aIt.Next()) {
-    const TopoDS_Shape& aSx=aIt.Value(); 
+    const TopoDS_Shape& aSx = aIt.Value();
     if (aMSA.Contains(aSx)) {
-      iX=myDS->Index(aSx);
-      bHasInterf=myDS->HasInterf(iX);
-      bHasSharedFaces=aMZ.Contains(aSx);
-      //
-      if (!bHasInterf && !bHasSharedFaces) {
-        // It means that the solid aSx will be added
-        // to the result as is. 
-        // The solid aSx will not participate 
-        // in creation of a new solid(s).
-        BOPTools_Set aST;
-        //
-        aST.Add(aSx, TopAbs_FACE);
-        //
-        if (!aDMSTS.Contains(aST)) {
-          aDMSTS.Add(aST, aSx);
-        }
-        
-        continue; 
+      if (!aMTSols.Contains(aSx)) {
+        aMUSols.Add(aSx);
+        continue;
       }
-    } 
+    }
+    //
+    MapFacesToBuildSolids(aSx, aMFS, aMFI);
+  } // for (; aIt.More(); aIt.Next()) {
+  //
+  // Process possibly untouched solids.
+  // Really untouched solids will be added into result as is.
+  // Others will be processed by BuilderSolid.
+  BOPTools_IndexedDataMapOfSetShape aDMSTS;
+  //
+  aNb = aMUSols.Extent();
+  for (i = 1; i <= aNb; ++i) {
+    const TopoDS_Shape& aSx = aMUSols(i);
     //
     aExp.Init(aSx, TopAbs_FACE);
     for (; aExp.More(); aExp.Next()) {
-      const TopoDS_Shape& aFx=aExp.Current();
-      //
-      aOr=aFx.Orientation();
-      if (aOr==TopAbs_INTERNAL) {
-        aMFI.Add(aFx);
-        continue;
-      }
-      //
-      if (!aMFS.Contains(aFx)) {
-        BOPCol_ListOfShape aLSx;
-        //
-        aLSx.Append(aSx);
-        aMFS.Add(aFx, aLSx);
+      if (aMFS.Contains(aExp.Current())) {
+        break;
       }
-      else {
-        iX=aMFS.FindIndex(aFx);
-        const TopoDS_Shape& aFx1=aMFS.FindKey(iX);
-        aOr1=aFx1.Orientation();
-        if (aOr1!=aOr) {
-          BOPCol_ListOfShape& aLSx=aMFS.ChangeFromKey(aFx);
-          aLSx.Append(aSx);
-          aMFS.Add(aFx, aLSx);
-        }
+    }
+    //
+    if (aExp.More()) {
+      MapFacesToBuildSolids(aSx, aMFS, aMFI);
+    }
+    else {
+      BOPTools_Set aST;
+      aST.Add(aSx, TopAbs_FACE);
+      if (!aDMSTS.Contains(aST)) {
+        aDMSTS.Add(aST, aSx);
       }
     }
-  } // for (; aIt.More(); aIt.Next()) {
-  //faces that will be added in the end;
-  BOPCol_ListOfShape aLF, aLFx; 
-  // SFS
-  aNbF=aMFS.Extent();
-  for (i=1; i<=aNbF; ++i) {
-    const TopoDS_Shape& aFx=aMFS.FindKey(i);
-    const BOPCol_ListOfShape& aLSx=aMFS(i);
-    aNbSx=aLSx.Extent();
-    if (aNbSx==1) {
-      BOPTools::MapShapesAndAncestors
-        (aFx,TopAbs_EDGE, TopAbs_FACE, aMEF);
+  }
+  //
+  BOPCol_IndexedDataMapOfShapeListOfShape aMEF;
+  // Split faces will be added in the end
+  // to avoid errors in BuilderSolid algorithm
+  BOPCol_ListOfShape aLF, aLFx;
+  aNb = aMFS.Extent();
+  for (i = 1; i <= aNb; ++i) {
+    const BOPCol_ListOfShape& aLSx = aMFS(i);
+    if (aLSx.Extent() == 1) {
+      const TopoDS_Shape& aFx = aMFS.FindKey(i);
+      BOPTools::MapShapesAndAncestors(aFx, TopAbs_EDGE, TopAbs_FACE, aMEF);
       if (IsBoundSplits(aFx, aMEF)){
         aLFx.Append(aFx);
         continue;
@@ -997,59 +1001,63 @@ void BOPAlgo_BOP::BuildSolid()
       aLF.Append(aFx);
     }
   }
-
+  //
+  // Faces to build result solids
+  BOPCol_ListOfShape aSFS;
   aItLS.Initialize(aLF);
   for(; aItLS.More(); aItLS.Next()) {
-    const TopoDS_Shape& aFx=aItLS.Value();
+    const TopoDS_Shape& aFx = aItLS.Value();
     aSFS.Append(aFx);
   }
-  // add faces from aLFx to aSFS;
+  //
+  // Split faces
   aItLS.Initialize(aLFx);
   for (; aItLS.More(); aItLS.Next()) {
-    const TopoDS_Shape& aFx=aItLS.Value();
-    aSFS.Append(aFx);
-  }
-  //
-  aNbF=aMFI.Extent();
-  for (i=1; i<=aNbF; ++i) {
-    TopoDS_Shape aFx;
-    //
-    aFx=aMFI.FindKey(i);
-    aFx.Orientation(TopAbs_FORWARD);
-    aSFS.Append(aFx);
-    aFx.Orientation(TopAbs_REVERSED);
+    const TopoDS_Shape& aFx = aItLS.Value();
     aSFS.Append(aFx);
   }
   //
-  // BuilderSolid
-  BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);  
-  //
-  aSB.SetContext(myContext);
-  aSB.SetShapes(aSFS);
-  aSB.Perform();
-  iErr=aSB.ErrorStatus();
-  if (iErr) {
-    myErrorStatus=30; // SolidBuilder failed
-    return;
+  // Internal faces
+  aNb = aMFI.Extent();
+  for (i = 1; i <= aNb; ++i) {
+    TopoDS_Shape aFx = aMFI.FindKey(i);
+    aSFS.Append(aFx.Oriented(TopAbs_FORWARD));
+    aSFS.Append(aFx.Oriented(TopAbs_REVERSED));
   }
   //
-  const BOPCol_ListOfShape& aLSR=aSB.Areas();
-  //
-  aItLS.Initialize(aLSR);
-  for (; aItLS.More(); aItLS.Next()) {
-    const TopoDS_Shape& aSR=aItLS.Value();
-    aBB.Add(aRC, aSR);
+  TopoDS_Shape aRC;
+  BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
+  if (aSFS.Extent()) {
+    // Build solids from set of faces
+    BOPAlgo_BuilderSolid aSB;
+    aSB.SetContext(myContext);
+    aSB.SetShapes(aSFS);
+    aSB.Perform();
+    if (aSB.ErrorStatus()) {
+      myErrorStatus = 30; // SolidBuilder failed
+      return;
+    }
+    // new solids
+    const BOPCol_ListOfShape& aLSR = aSB.Areas();
+    //
+    // add new solids to result
+    aItLS.Initialize(aLSR);
+    for (; aItLS.More(); aItLS.Next()) {
+      const TopoDS_Shape& aSR = aItLS.Value();
+      aBB.Add(aRC, aSR);
+    }
   }
   //
-  aNbSx = aDMSTS.Extent();
-  for (i = 1; i <= aNbSx; ++i) {
+  // add untouched solids to result
+  aNb = aDMSTS.Extent();
+  for (i = 1; i <= aNb; ++i) {
     const TopoDS_Shape& aSx = aDMSTS(i);
     aBB.Add(aRC, aSx);
   }
   //
   if (aLSC.IsEmpty()) {
     // no Compsolids in arguments
-    myShape=aRC;
+    myShape = aRC;
     return;
   }
   //
@@ -1059,11 +1067,21 @@ void BOPAlgo_BOP::BuildSolid()
   TopoDS_Shape aResult;
   BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aResult);
   //
+  aIt.Initialize(aRC);
+  if (!aIt.More()) {
+    // no solids in the result
+    myShape = aRC;
+    return;
+  }
+  //
+  const TopoDS_Shape& aSol1 = aIt.Value();
+  aIt.Next();
+  //
   // optimization for one solid in the result
-  if (aLSR.Extent() == 1 && !aNbSx) {
+  if (!aIt.More()) {
     TopoDS_Shape aCS;
     BOPTools_AlgoTools::MakeContainer(TopAbs_COMPSOLID, aCS);
-    aBB.Add(aCS, aLSR.First());
+    aBB.Add(aCS, aSol1);
     //
     aBB.Add(aResult, aCS);
     myShape = aResult;
@@ -1350,3 +1368,35 @@ Standard_Integer NbCommonItemsInMap(const BOPCol_MapOfShape& theM1,
   }
   return iCommon;
 }
+//=======================================================================
+//function : MapFacesToBuildSolids
+//purpose  : Stores the faces of the given solid into outgoing maps:
+//           <theMFS> - not internal faces with reference to solid;
+//           <theMFI> - internal faces.
+//=======================================================================
+void MapFacesToBuildSolids(const TopoDS_Shape& theSol,
+                           BOPCol_IndexedDataMapOfShapeListOfShape& theMFS,
+                           BOPCol_IndexedMapOfShape& theMFI)
+{
+  TopExp_Explorer aExp(theSol, TopAbs_FACE);
+  for (; aExp.More(); aExp.Next()) {
+    const TopoDS_Shape& aF = aExp.Current();
+    //
+    if (aF.Orientation() == TopAbs_INTERNAL) {
+      theMFI.Add(aF);
+      continue;
+    }
+    //
+    BOPCol_ListOfShape* pLSol = theMFS.ChangeSeek(aF);
+    if (!pLSol) {
+      pLSol = &theMFS(theMFS.Add(aF, BOPCol_ListOfShape()));
+      pLSol->Append(theSol);
+    }
+    else {
+      const TopoDS_Shape& aF1 = theMFS.FindKey(theMFS.FindIndex(aF));
+      if (aF1.Orientation() != aF.Orientation()) {
+        pLSol->Append(theSol);
+      }
+    }
+  }
+}
index d038073a4885607bafe4de93cb2dfae7eb70fee9..323b5af6f079b700d1f7a822bb267de05f2d24f6 100644 (file)
@@ -22,8 +22,8 @@
 #include <BOPDS_DS.hxx>
 #include <BOPDS_Interf.hxx>
 #include <BOPDS_IteratorSI.hxx>
-#include <BOPDS_MapOfPassKey.hxx>
-#include <BOPDS_PassKey.hxx>
+#include <BOPDS_MapOfPair.hxx>
+#include <BOPDS_Pair.hxx>
 #include <BOPDS_PIteratorSI.hxx>
 #include <BOPDS_VectorOfInterfEF.hxx>
 #include <BOPDS_VectorOfInterfFF.hxx>
@@ -105,49 +105,36 @@ void BOPAlgo_CheckerSI::Init()
 void BOPAlgo_CheckerSI::Perform()
 {
   try {
-    Standard_Integer iErr;
-    //
     OCC_CATCH_SIGNALS
     //
-    myErrorStatus=0;
-    if (myArguments.Extent()!=1) {
-      myErrorStatus=10;
+    myErrorStatus = 0;
+    if (myArguments.Extent() != 1) {
+      myErrorStatus = 10;
       return;
     }
     //
-    if (myNonDestructive) {
-      PrepareCopy();
-      if (myErrorStatus) {
-        return; 
-      }
-    }
-    //
+    // Perform intersection of sub shapes
     BOPAlgo_PaveFiller::Perform();
-    iErr=myErrorStatus; 
     //
-    PostTreat();
-    if (myErrorStatus) {
-      iErr=myErrorStatus; 
-    }
+    // Perform intersection with solids
+    if (!myErrorStatus)
+      PerformVZ();
     //
-    if (myNonDestructive) {
-      PostTreatCopy();
-      if (myErrorStatus) {
-        iErr=myErrorStatus; 
-      }
-    }
+    if (!myErrorStatus)
+      PerformEZ();
     //
-    if (iErr) {
-      myErrorStatus=iErr;
-    }
+    if (!myErrorStatus)
+      PerformFZ();
+    //
+    if (!myErrorStatus)
+      PerformZZ();
+    //
+    // Treat the intersection results
+    PostTreat();
   }
   //
   catch (Standard_Failure) {
-    if (myNonDestructive) { 
-      PostTreatCopy();
-    }
-    //
-    myErrorStatus=11;
+    myErrorStatus = 11;
   }
 }
 //=======================================================================
@@ -157,12 +144,12 @@ void BOPAlgo_CheckerSI::Perform()
 void BOPAlgo_CheckerSI::PostTreat()
 {
   Standard_Integer i, aNb, n1, n2; 
-  BOPDS_PassKey aPK;
+  BOPDS_Pair aPK;
   //
   myErrorStatus=0;
   //
-  BOPDS_MapOfPassKey& aMPK=
-    *((BOPDS_MapOfPassKey*)&myDS->Interferences());
+  BOPDS_MapOfPair& aMPK=
+    *((BOPDS_MapOfPair*)&myDS->Interferences());
   aMPK.Clear();
   //
   // 0
@@ -174,7 +161,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
       continue;
     }
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -187,7 +174,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
       continue;
     }
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -200,7 +187,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
       continue;
     }
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -213,7 +200,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
       continue;
     }
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -229,7 +216,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
       continue;
     }
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -276,7 +263,7 @@ void BOPAlgo_CheckerSI::PostTreat()
       continue;
     }
     //
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -291,7 +278,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     if (myDS->IsNewShape(n1) || myDS->IsNewShape(n2)) {
       continue;
     }
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -302,7 +289,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     //
     const BOPDS_InterfEZ& aEZ=aEZs(i);
     aEZ.Indices(n1, n2);
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -313,7 +300,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     //
     const BOPDS_InterfFZ& aFZ=aFZs(i);
     aFZ.Indices(n1, n2);
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
   //
@@ -324,76 +311,7 @@ void BOPAlgo_CheckerSI::PostTreat()
     //
     const BOPDS_InterfZZ& aZZ=aZZs(i);
     aZZ.Indices(n1, n2);
-    aPK.SetIds(n1, n2);
+    aPK.SetIndices(n1, n2);
     aMPK.Add(aPK);
   }
 }
-//=======================================================================
-//function : PrepareCopy
-//purpose  : 
-//=======================================================================
-void BOPAlgo_CheckerSI::PrepareCopy()
-{
-  Standard_Boolean bIsDone;
-  BRepBuilderAPI_Copy aCopier;
-  BOPCol_MapOfShape aMSA;
-  BOPCol_MapIteratorOfMapOfShape aItMS;
-  //
-  myErrorStatus=0;
-  //
-  myNewOldMap.Clear();
-  //
-  const TopoDS_Shape& aSA=myArguments.First();
-  //
-  BOPTools::MapShapes(aSA, aMSA);
-  //
-  aCopier.Perform(aSA, Standard_False);
-  bIsDone=aCopier.IsDone();
-  if (!bIsDone) {
-    myErrorStatus=12; 
-    return;
-  }
-  //
-  const TopoDS_Shape& aSC=aCopier.Shape();
-  //
-  aItMS.Initialize(aMSA);
-  for(; aItMS.More(); aItMS.Next()) {
-    const TopoDS_Shape& aSAx=aItMS.Value();
-    const TopoDS_Shape& aSCx=aCopier.Modified(aSAx).First();
-    myNewOldMap.Bind(aSCx, aSAx);
-  }
-  //
-  myArguments.Clear();
-  myArguments.Append(aSC);
-}
-//=======================================================================
-//function : PostTreatCopy
-//purpose  : 
-//=======================================================================
-void BOPAlgo_CheckerSI::PostTreatCopy() 
-{
-  Standard_Integer i, aNb;
-  //
-  myErrorStatus=0;
-  //
-  aNb=myDS->NbSourceShapes();
-  for (i=0; i!=aNb; ++i) {
-    BOPDS_ShapeInfo& aSI=myDS->ChangeShapeInfo(i);
-    const TopoDS_Shape& aSCi=aSI.Shape();
-    if (!myNewOldMap.IsBound(aSCi)) {
-      myErrorStatus=13;
-      return;
-    }
-    //
-    const TopoDS_Shape& aSAi=myNewOldMap.Find(aSCi);
-    aSI.SetShape(aSAi);
-  }
-}
-//
-// myErrorStatus:
-//
-// 10 - The number of the arguments is not 1
-// 11 - Exception is caught
-// 12 - BRepBuilderAPI_Copy is not done
-// 13 - myNewOldMap doe not contain DS shape 
-
index acb766278d45fb3f0254e886fe68e8c1a5a3a792..69cdf70786cfddcc496c07909ebd0ebd88b25f69 100644 (file)
 
 #include <Standard_Integer.hxx>
 #include <Standard_Boolean.hxx>
-#include <BOPCol_DataMapOfShapeShape.hxx>
 #include <BOPAlgo_PaveFiller.hxx>
 
 
-//! Checks shape on self-interference.
+//! Checks the shape on self-interference.<br>
+//! In case of error the algorithm may return the following ErrorStatus:<br>
+//! 10 - The number of the input arguments is not one;<br>
+//! 11 - The check has been aborted during intersection of sub-shapes.<br>
+//! In case the error has occurred during intersection of sub-shapes, i.e.
+//! in BOPAlgo_PaveFiller::PerformInternal() method, the ErrorStatus from this method
+//! directly will be returned.
+
 class BOPAlgo_CheckerSI  : public BOPAlgo_PaveFiller
 {
 public:
 
   DEFINE_STANDARD_ALLOC
 
-  
+
   Standard_EXPORT BOPAlgo_CheckerSI();
-Standard_EXPORT virtual ~BOPAlgo_CheckerSI();
+  Standard_EXPORT virtual ~BOPAlgo_CheckerSI();
   
   Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
   
-  //! Sets the level of checking shape on self-interference.
-  //! It defines which interferferences will be checked:
-  //! 0 - only V/V;
-  //! 1 - V/V and V/E;
-  //! 2 - V/V, V/E and E/E;
-  //! 3 - V/V, V/E, E/E and V/F;
-  //! 4 - V/V, V/E, E/E, V/F and E/F;
-  //! 5 - all interferences, default value.
+  //! Sets the level of checking shape on self-interference.<br>
+  //! It defines which interferences will be checked:<br>
+  //! 0 - only V/V;<br>
+  //! 1 - V/V and V/E;<br>
+  //! 2 - V/V, V/E and E/E;<br>
+  //! 3 - V/V, V/E, E/E and V/F;<br>
+  //! 4 - V/V, V/E, E/E, V/F and E/F;<br>
+  //! 5 - V/V, V/E, E/E, V/F, E/F and F/F;<br>
+  //! 6 - V/V, V/E, E/E, V/F, E/F, F/F and V/S;<br>
+  //! 7 - V/V, V/E, E/E, V/F, E/F, F/F, V/S and E/S;<br>
+  //! 8 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S and F/S;<br>
+  //! 9 - V/V, V/E, E/E, V/F, E/F, F/F, V/S, E/S, F/S and S/S - all interferences (Default value)
   Standard_EXPORT void SetLevelOfCheck (const Standard_Integer theLevel);
 
 protected:
 
-  
   Standard_EXPORT virtual void Init() Standard_OVERRIDE;
-  
-  //! Provides post-treatment actions
+
+  //! Treats the intersection results
   Standard_EXPORT void PostTreat();
-  
-  Standard_EXPORT virtual void PrepareCopy();
-  
-  //! Provides post-treatment actions for the copy
-  Standard_EXPORT void PostTreatCopy();
 
+  //! Methods for intersection with solids
 
-  Standard_Integer myLevelOfCheck;
-  BOPCol_DataMapOfShapeShape myNewOldMap;
+  //! Vertex/Solid intersection
+  Standard_EXPORT virtual void PerformVZ();
 
+  //! Edge/Solid intersection
+  Standard_EXPORT virtual void PerformEZ();
 
-private:
+  //! Face/Solid intersection
+  Standard_EXPORT virtual void PerformFZ();
 
+  //! Solid/Solid intersection
+  Standard_EXPORT virtual void PerformZZ();
 
+  //! Used for intersection of edges and faces with solids
+  Standard_EXPORT virtual void PerformSZ(const TopAbs_ShapeEnum aTS);
 
+  Standard_Integer myLevelOfCheck;
 
+private:
 
 };
 
-
-
-
-
-
-
 #endif // _BOPAlgo_CheckerSI_HeaderFile
diff --git a/src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx b/src/BOPAlgo/BOPAlgo_CheckerSI_1.cxx
new file mode 100644 (file)
index 0000000..1214605
--- /dev/null
@@ -0,0 +1,430 @@
+// Created by: Peter KURNEV
+// Copyright (c) 2010-2014 OPEN CASCADE SAS
+// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
+//                         EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+
+#include <BOPAlgo_CheckerSI.hxx>
+
+#include <BOPDS_DS.hxx>
+#include <BOPDS_Interf.hxx>
+#include <BOPDS_IteratorSI.hxx>
+
+#include <BOPCol_NCVector.hxx>
+#include <BOPCol_Parallel.hxx>
+
+#include <BRep_Tool.hxx>
+#include <BRepClass3d_SolidClassifier.hxx>
+
+#include <IntTools_Context.hxx>
+
+#include <gp_Pnt.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopAbs_State.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Solid.hxx>
+
+/////////////////////////////////////////////////////////////////////////
+//=======================================================================
+//class    : BOPAlgo_VertexSolid
+//purpose  : 
+//=======================================================================
+class BOPAlgo_VertexSolid  {
+ public:
+  DEFINE_STANDARD_ALLOC
+  
+  BOPAlgo_VertexSolid()
+    : myIV(-1), myIZ(-1), myState(TopAbs_UNKNOWN) {
+  };
+  //
+  virtual ~BOPAlgo_VertexSolid(){
+  };
+  //
+  void SetIndices(const Standard_Integer nV,
+                  const Standard_Integer nZ){
+    myIV=nV;
+    myIZ=nZ;
+  }
+  //
+  void Indices(Standard_Integer& nV,
+               Standard_Integer& nZ) const {
+    nV=myIV;
+    nZ=myIZ;
+  }
+  //
+  void SetVertex(const TopoDS_Vertex& aV) {
+    myV=aV;
+  }
+  //
+  const TopoDS_Vertex& Vertex()const {
+    return myV;
+  }
+  //
+  void SetSolid(const TopoDS_Solid& aZ) {
+    myZ=aZ;
+  }
+  //
+  const TopoDS_Solid& Solid()const {
+    return myZ;
+  }
+  //
+  void SetContext(const Handle(IntTools_Context)& aContext) {
+    myContext=aContext;
+  }
+  //
+  const Handle(IntTools_Context)& Context()const {
+    return myContext;
+  }
+  //
+  TopAbs_State State() const{
+    return myState;
+  };
+  //
+  void Perform() {
+    Standard_Real aTol;
+    gp_Pnt aPV;
+    //
+    BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(myZ);
+    //
+    aPV=BRep_Tool::Pnt(myV);
+    aTol=BRep_Tool::Tolerance(myV);
+    //
+    aSC.Perform(aPV, aTol);
+    //
+    myState=aSC.State();
+  };
+  //
+ protected:
+  Standard_Integer myIV;
+  Standard_Integer myIZ;
+  TopAbs_State myState;
+  TopoDS_Vertex myV;
+  TopoDS_Solid myZ;
+  Handle(IntTools_Context) myContext;
+};
+//=======================================================================
+typedef BOPCol_NCVector
+  <BOPAlgo_VertexSolid> BOPAlgo_VectorOfVertexSolid; 
+//
+typedef BOPCol_ContextFunctor 
+  <BOPAlgo_VertexSolid,
+  BOPAlgo_VectorOfVertexSolid,
+  Handle(IntTools_Context), 
+  IntTools_Context> BOPAlgo_VertexSolidFunctor;
+//
+typedef BOPCol_ContextCnt 
+  <BOPAlgo_VertexSolidFunctor,
+  BOPAlgo_VectorOfVertexSolid,
+  Handle(IntTools_Context)> BOPAlgo_VertexSolidCnt;
+/////////////////////////////////////////////////////////////////////////
+//=======================================================================
+//class    : BOPAlgo_ShapeSolid
+//purpose  : 
+//=======================================================================
+class BOPAlgo_ShapeSolid  {
+ public:
+  DEFINE_STANDARD_ALLOC
+
+  BOPAlgo_ShapeSolid() : 
+    myIE(-1), 
+    myIZ(-1), 
+    myHasInterf(Standard_False), 
+    myDS(NULL) {
+  };
+  //
+  virtual ~BOPAlgo_ShapeSolid(){
+  };
+  //
+  void SetIndices(const Standard_Integer nE,
+                  const Standard_Integer nZ){
+    myIE=nE;
+    myIZ=nZ;
+  }
+  //
+  void Indices(Standard_Integer& nE,
+               Standard_Integer& nZ) const {
+    nE=myIE;
+    nZ=myIZ;
+  }
+  //
+  void SetDS(BOPDS_DS* pDS) {
+    myDS=pDS;
+  }
+  //
+  Standard_Boolean HasInterf() const{
+    return myHasInterf;
+  };
+  //
+  virtual void Perform() {
+    Standard_Boolean bHasInterf;
+    //
+    myHasInterf=Standard_False;
+    //
+    bHasInterf=myDS->HasInterfShapeSubShapes(myIE, myIZ);
+    if (!bHasInterf) {
+      myHasInterf=myDS->HasInterfShapeSubShapes(myIZ, myIE);
+    }
+  };
+  //
+ protected:
+  Standard_Integer myIE;
+  Standard_Integer myIZ;
+  Standard_Boolean myHasInterf;
+  BOPDS_DS* myDS;
+};
+//=======================================================================
+typedef BOPCol_NCVector
+  <BOPAlgo_ShapeSolid> BOPAlgo_VectorOfShapeSolid; 
+//
+typedef BOPCol_Functor 
+  <BOPAlgo_ShapeSolid,
+  BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidFunctor;
+//
+typedef BOPCol_Cnt 
+  <BOPAlgo_ShapeSolidFunctor,
+  BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidCnt;
+//
+/////////////////////////////////////////////////////////////////////////
+//=======================================================================
+//class    : BOPAlgo_SolidSolid
+//purpose  : 
+//=======================================================================
+class BOPAlgo_SolidSolid : public  BOPAlgo_ShapeSolid {
+ public:
+  DEFINE_STANDARD_ALLOC
+
+  BOPAlgo_SolidSolid() : 
+    BOPAlgo_ShapeSolid() {
+  };
+  //
+  virtual ~BOPAlgo_SolidSolid(){
+  };
+  //
+  virtual void Perform() {
+    Standard_Boolean bFlag;
+    //
+    bFlag=Standard_False;
+    myHasInterf=Standard_False;
+    //
+    myHasInterf=myDS->HasInterfShapeSubShapes(myIZ, myIE, bFlag);
+    if (!myHasInterf) {
+      myHasInterf=myDS->HasInterfShapeSubShapes(myIE, myIZ, bFlag);
+    }
+  };
+};
+//=======================================================================
+typedef BOPCol_NCVector
+  <BOPAlgo_SolidSolid> BOPAlgo_VectorOfSolidSolid; 
+//
+typedef BOPCol_Functor 
+  <BOPAlgo_SolidSolid,
+  BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidFunctor;
+//
+typedef BOPCol_Cnt 
+  <BOPAlgo_SolidSolidFunctor,
+  BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidCnt;
+//
+/////////////////////////////////////////////////////////////////////////
+
+//=======================================================================
+//function : PerformVZ
+//purpose  : 
+//=======================================================================
+void BOPAlgo_CheckerSI::PerformVZ()
+{
+  Standard_Integer iSize, nV, nZ, k, aNbVVS;
+  TopAbs_State aState;
+  BOPDS_MapOfPair aMPK;
+  //
+  myErrorStatus=0;
+  //
+  myIterator->Initialize(TopAbs_VERTEX, TopAbs_SOLID);
+  iSize=myIterator->ExpectedLength();
+  if (!iSize) {
+    return; 
+  }
+  //
+  BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ();
+  aVZs.SetIncrement(iSize);
+  //
+  BOPAlgo_VectorOfVertexSolid aVVS;
+  //
+  for (; myIterator->More(); myIterator->Next()) {
+    myIterator->Value(nV, nZ);
+    //
+    if (myDS->HasInterfShapeSubShapes(nV, nZ)) {
+      continue;
+    }
+    //
+    Standard_Integer nVSD = nV;
+    myDS->HasShapeSD(nV, nVSD);
+    //
+    BOPDS_Pair aPK;
+    aPK.SetIndices(nVSD, nZ);
+    if (!aMPK.Add(aPK)) {
+      continue;
+    }
+    //
+    const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&myDS->Shape(nVSD));
+    const TopoDS_Solid& aZ=*((TopoDS_Solid*)&myDS->Shape(nZ));
+    //
+    BOPAlgo_VertexSolid& aVertexSolid=aVVS.Append1();
+    aVertexSolid.SetIndices(nV, nZ);
+    aVertexSolid.SetVertex(aV);
+    aVertexSolid.SetSolid(aZ);
+  }
+  //
+  aNbVVS=aVVS.Extent();
+  //=============================================================
+  BOPAlgo_VertexSolidCnt::Perform(myRunParallel, aVVS, myContext);
+  //=============================================================
+  for (k=0; k < aNbVVS; ++k) {
+    const BOPAlgo_VertexSolid& aVertexSolid=aVVS(k);
+    aState=aVertexSolid.State();
+    if (aState==TopAbs_IN)  {
+      aVertexSolid.Indices(nV, nZ);
+      //
+      BOPDS_InterfVZ& aVZ=aVZs.Append1();
+      aVZ.SetIndices(nV, nZ);
+      //
+      myDS->AddInterf(nV, nZ);
+    }
+  }
+}
+//=======================================================================
+//function : PerformEZ
+//purpose  : 
+//=======================================================================
+void BOPAlgo_CheckerSI::PerformEZ()
+{ 
+  PerformSZ(TopAbs_EDGE);
+}
+//=======================================================================
+//function : PerformFZ
+//purpose  : 
+//=======================================================================
+void BOPAlgo_CheckerSI::PerformFZ()
+{ 
+  PerformSZ(TopAbs_FACE);
+}
+//=======================================================================
+//function : PerformZZ
+//purpose  : 
+//=======================================================================
+void BOPAlgo_CheckerSI::PerformZZ()
+{
+  Standard_Boolean bHasInterf;
+  Standard_Integer iSize, nZ1, nZ, k, aNbSolidSolid;
+  //
+  myErrorStatus=0;
+  //
+  myIterator->Initialize(TopAbs_SOLID, TopAbs_SOLID);
+  iSize=myIterator->ExpectedLength();
+  if (!iSize) {
+    return; 
+  }
+  //
+  BOPAlgo_VectorOfSolidSolid aVSolidSolid;
+  //
+  for (; myIterator->More(); myIterator->Next()) {
+    myIterator->Value(nZ1, nZ);
+    //
+    BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid.Append1();
+    aSolidSolid.SetIndices(nZ1, nZ);
+    aSolidSolid.SetDS(myDS);
+  }
+  //
+  aNbSolidSolid=aVSolidSolid.Extent();
+  //======================================================
+  BOPAlgo_SolidSolidCnt::Perform(myRunParallel, aVSolidSolid);
+  //======================================================
+  //
+  BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
+  //
+  aZZs.SetIncrement(iSize);
+  //
+  for (k=0; k < aNbSolidSolid; ++k) {
+    const BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid(k);
+    bHasInterf=aSolidSolid.HasInterf();
+    if (bHasInterf) {
+      aSolidSolid.Indices(nZ1, nZ);
+      //
+      BOPDS_InterfZZ& aZZ=aZZs.Append1();
+      aZZ.SetIndices(nZ1, nZ);
+      //
+      myDS->AddInterf(nZ1, nZ);
+    }
+  }
+}
+//=======================================================================
+//function : PerformSZ
+//purpose  : 
+//=======================================================================
+void BOPAlgo_CheckerSI::PerformSZ(const TopAbs_ShapeEnum aTS)
+{
+  Standard_Boolean bHasInterf;
+  Standard_Integer iSize, nS, nZ, k, aNbShapeSolid;
+  //
+  myErrorStatus=0;
+  //
+  myIterator->Initialize(aTS, TopAbs_SOLID);
+  iSize=myIterator->ExpectedLength();
+  if (!iSize) {
+    return; 
+  }
+  //
+  BOPAlgo_VectorOfShapeSolid aVShapeSolid;
+  //
+  for (; myIterator->More(); myIterator->Next()) {
+    myIterator->Value(nS, nZ);
+    //
+    BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid.Append1();
+    aShapeSolid.SetIndices(nS, nZ);
+    aShapeSolid.SetDS(myDS);
+  }
+  //
+  aNbShapeSolid=aVShapeSolid.Extent();
+  //======================================================
+  BOPAlgo_ShapeSolidCnt::Perform(myRunParallel, aVShapeSolid);
+  //======================================================
+  //
+  BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
+  BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ();
+  //
+  if (aTS==TopAbs_EDGE) {
+    aEZs.SetIncrement(iSize);
+  }
+  else {//if (aTS==TopAbs_FACE)
+    aFZs.SetIncrement(iSize);
+  }
+  //
+  for (k=0; k < aNbShapeSolid; ++k) {
+    const BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid(k);
+    bHasInterf=aShapeSolid.HasInterf();
+    if (bHasInterf) {
+      aShapeSolid.Indices(nS, nZ);
+      //
+      if (aTS==TopAbs_EDGE) {
+        BOPDS_InterfEZ& aEZ=aEZs.Append1();
+        aEZ.SetIndices(nS, nZ);
+      }
+      else  {//if (aTS==TopAbs_FACE)
+        BOPDS_InterfFZ& aFZ=aFZs.Append1();
+        aFZ.SetIndices(nS, nZ);
+      }
+      //
+      myDS->AddInterf(nS, nZ);
+    }
+  }
+}
index c3247e4466553aa266cb1b30a1f2dc4ab790d363..36554151fa6a9ac77481dea71ee8f2330e556694 100644 (file)
@@ -315,28 +315,4 @@ void BOPAlgo_PaveFiller::PerformInternal()
   if (myErrorStatus) {
     return; 
   }
-  //
-  if (myGlue != BOPAlgo_GlueOff) {
-    return;
-  }
-  // 03
-  PerformVZ();
-  if (myErrorStatus) {
-    return;
-  }
-  // 13
-  PerformEZ();
-  if (myErrorStatus) {
-    return;
-  }
-  // 23
-  PerformFZ();
-  if (myErrorStatus) {
-    return;
-  }
-  // 33
-  PerformZZ();
-  if (myErrorStatus) {
-    return;
-  }
-} 
+}
index 1d66c94f69b3b14ae99ee7a0915e9fb7e93b9320..9abf7bc75fada991c7b3320cd514580aed28c2cf 100644 (file)
@@ -156,16 +156,6 @@ protected:
   
   Standard_EXPORT virtual void PerformFF();
   
-  Standard_EXPORT virtual void PerformVZ();
-  
-  Standard_EXPORT virtual void PerformEZ();
-  
-  Standard_EXPORT virtual void PerformFZ();
-  
-  Standard_EXPORT virtual void PerformZZ();
-
-  Standard_EXPORT virtual void PerformSZ(const TopAbs_ShapeEnum aTS);
-  
   Standard_EXPORT void TreatVerticesEE();
   
   Standard_EXPORT void MakeSDVerticesFF(const BOPCol_DataMapOfIntegerListOfInteger& aDMVLV,
index 686d9073f52e530104790194fa2c71ac4356e43c..7cb90da0961108bccfcda2068600b6673252e768 100644 (file)
@@ -48,7 +48,6 @@
 //=======================================================================
 void BOPAlgo_PaveFiller::PerformVV() 
 {
-  Standard_Boolean bWithSubShape;
   Standard_Integer n1, n2, iFlag, aSize, k, aNbBlocks;
   Handle(NCollection_BaseAllocator) aAllocator;
   //
@@ -71,7 +70,7 @@ void BOPAlgo_PaveFiller::PerformVV()
   //
   // 1. Map V/LV
   for (; myIterator->More(); myIterator->Next()) {
-    myIterator->Value(n1, n2, bWithSubShape);
+    myIterator->Value(n1, n2);
     //
     const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(n1))); 
     const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(n2))); 
index da6781af7c4a70625c3bd3669f7191c84a4d49ce..742155a146c7586a94380bab0c9d13cd7bd9617a 100644 (file)
 // commercial license or contractual agreement.
 
 #include <BOPAlgo_PaveFiller.hxx>
-#include <BOPAlgo_SectionAttribute.hxx>
-#include <BOPDS_Curve.hxx>
-#include <BOPDS_DS.hxx>
-#include <BOPDS_Interf.hxx>
-#include <BOPDS_IteratorSI.hxx>
-#include <BOPDS_PaveBlock.hxx>
-#include <BRep_Tool.hxx>
-#include <BRepClass3d_SolidClassifier.hxx>
-#include <IntTools_Context.hxx>
-#include <TopoDS_Vertex.hxx>
+
+#include <Precision.hxx>
+
 #include <gp_Pnt.hxx>
-#include <BOPCol_NCVector.hxx>
-#include <TopAbs_State.hxx>
-#include <BOPCol_Parallel.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Solid.hxx>
-/////////////////////////////////////////////////////////////////////////
+#include <Bnd_Box.hxx>
+
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Edge.hxx>
+
+#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepBndLib.hxx>
+
+#include <BOPDS_ShapeInfo.hxx>
+#include <BOPDS_VectorOfListOfPaveBlock.hxx>
+#include <BOPDS_MapOfCommonBlock.hxx>
+#include <BOPDS_ListOfPaveBlock.hxx>
+#include <BOPDS_CommonBlock.hxx>
+#include <BOPDS_DS.hxx>
+
 //=======================================================================
-//class    : BOPAlgo_VertexSolid
+//function : SetNonDestructive
 //purpose  : 
 //=======================================================================
-class BOPAlgo_VertexSolid  {
- public:
-  DEFINE_STANDARD_ALLOC
-  
-  BOPAlgo_VertexSolid()
-    : myIV(-1), myIZ(-1), myState(TopAbs_UNKNOWN) {
-  };
-  //
-  virtual ~BOPAlgo_VertexSolid(){
-  };
-  //
-  void SetIndices(const Standard_Integer nV,
-                  const Standard_Integer nZ){
-    myIV=nV;
-    myIZ=nZ;
-  }
-  //
-  void Indices(Standard_Integer& nV,
-               Standard_Integer& nZ) const {
-    nV=myIV;
-    nZ=myIZ;
-  }
-  //
-  void SetVertex(const TopoDS_Vertex& aV) {
-    myV=aV;
-  }
-  //
-  const TopoDS_Vertex& Vertex()const {
-    return myV;
-  }
-  //
-  void SetSolid(const TopoDS_Solid& aZ) {
-    myZ=aZ;
+void BOPAlgo_PaveFiller::SetNonDestructive() 
+{
+  if (!myIsPrimary || myNonDestructive) {
+    return;
   }
   //
-  const TopoDS_Solid& Solid()const {
-    return myZ;
-  }
+  Standard_Boolean bFlag;
+  BOPCol_ListIteratorOfListOfShape aItLS;
   //
-  void SetContext(const Handle(IntTools_Context)& aContext) {
-    myContext=aContext;
+  bFlag=Standard_False;
+  aItLS.Initialize(myArguments);
+  for(; aItLS.More() && (!bFlag); aItLS.Next()) {
+    const TopoDS_Shape& aS=aItLS.Value();
+    bFlag=aS.Locked();
   }
-  //
-  const Handle(IntTools_Context)& Context()const {
-    return myContext;
-  }
-  //
-  TopAbs_State State() const{
-    return myState;
-  };
-  //
-  void Perform() {
-    Standard_Real aTol;
-    gp_Pnt aPV;
-    //
-    BRepClass3d_SolidClassifier& aSC=myContext->SolidClassifier(myZ);
-    //
-    aPV=BRep_Tool::Pnt(myV);
-    aTol=BRep_Tool::Tolerance(myV);
-    //
-    aSC.Perform(aPV, aTol);
-    //
-    myState=aSC.State();
-  };
-  //
- protected:
-  Standard_Integer myIV;
-  Standard_Integer myIZ;
-  TopAbs_State myState;
-  TopoDS_Vertex myV;
-  TopoDS_Solid myZ;
-  Handle(IntTools_Context) myContext;
-};
-//=======================================================================
-typedef BOPCol_NCVector
-  <BOPAlgo_VertexSolid> BOPAlgo_VectorOfVertexSolid; 
-//
-typedef BOPCol_ContextFunctor 
-  <BOPAlgo_VertexSolid,
-  BOPAlgo_VectorOfVertexSolid,
-  Handle(IntTools_Context), 
-  IntTools_Context> BOPAlgo_VertexSolidFunctor;
-//
-typedef BOPCol_ContextCnt 
-  <BOPAlgo_VertexSolidFunctor,
-  BOPAlgo_VectorOfVertexSolid,
-  Handle(IntTools_Context)> BOPAlgo_VertexSolidCnt;
-/////////////////////////////////////////////////////////////////////////
+  myNonDestructive=bFlag;
+}
 //=======================================================================
-//class    : BOPAlgo_ShapeSolid
+//function : UpdateEdgeTolerance
 //purpose  : 
 //=======================================================================
-class BOPAlgo_ShapeSolid  {
- public:
-  DEFINE_STANDARD_ALLOC
-
-  BOPAlgo_ShapeSolid() : 
-    myIE(-1), 
-    myIZ(-1), 
-    myHasInterf(Standard_False), 
-    myDS(NULL) {
-  };
-  //
-  virtual ~BOPAlgo_ShapeSolid(){
-  };
-  //
-  void SetIndices(const Standard_Integer nE,
-                  const Standard_Integer nZ){
-    myIE=nE;
-    myIZ=nZ;
-  }
-  //
-  void Indices(Standard_Integer& nE,
-               Standard_Integer& nZ) const {
-    nE=myIE;
-    nZ=myIZ;
-  }
-  //
-  void SetDS(BOPDS_DS* pDS) {
-    myDS=pDS;
-  }
-  //
-  Standard_Boolean HasInterf() const{
-    return myHasInterf;
-  };
-  //
-  virtual void Perform() {
-    Standard_Boolean bHasInterf;
-    //
-    myHasInterf=Standard_False;
+void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
+                                              const Standard_Real aTol)
+{
+  Standard_Boolean bIsNewShape, bHasShapeSD;
+  Standard_Integer nV, nVx;
+  Standard_Real aTolV;
+  BRep_Builder aBB;
+  BOPCol_ListIteratorOfListOfInteger aIt;
+  //
+  BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE);
+  const BOPCol_ListOfInteger& aLI=aSIE.SubShapes();
+  //
+  if (myNonDestructive) {
+    bIsNewShape=myDS->IsNewShape(nE);
+    if (!bIsNewShape) {
+      return;
+    }
     //
-    bHasInterf=myDS->HasInterfShapeSubShapes(myIE, myIZ);
-    if (!bHasInterf) {
-      myHasInterf=myDS->HasInterfShapeSubShapes(myIZ, myIE);
+    aIt.Initialize(aLI);
+    for (; aIt.More(); aIt.Next()) {
+      nV = aIt.Value();
+      bHasShapeSD=myDS->HasShapeSD(nV, nVx);
+      if (bHasShapeSD) {
+        continue;
+      }
+      bIsNewShape=myDS->IsNewShape(nV);
+      if (!bIsNewShape) {
+        return;
+      }
     }
-  };
-  //
- protected:
-  Standard_Integer myIE;
-  Standard_Integer myIZ;
-  Standard_Boolean myHasInterf;
-  BOPDS_DS* myDS;
-};
-//=======================================================================
-typedef BOPCol_NCVector
-  <BOPAlgo_ShapeSolid> BOPAlgo_VectorOfShapeSolid; 
-//
-typedef BOPCol_Functor 
-  <BOPAlgo_ShapeSolid,
-  BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidFunctor;
-//
-typedef BOPCol_Cnt 
-  <BOPAlgo_ShapeSolidFunctor,
-  BOPAlgo_VectorOfShapeSolid> BOPAlgo_ShapeSolidCnt;
-//
-/////////////////////////////////////////////////////////////////////////
-//=======================================================================
-//class    : BOPAlgo_SolidSolid
-//purpose  : 
-//=======================================================================
-class BOPAlgo_SolidSolid : public  BOPAlgo_ShapeSolid {
- public:
-  DEFINE_STANDARD_ALLOC
-
-  BOPAlgo_SolidSolid() : 
-    BOPAlgo_ShapeSolid() {
-  };
-  //
-  virtual ~BOPAlgo_SolidSolid(){
-  };
+  }
   //
-  virtual void Perform() {
-    Standard_Boolean bFlag;
-    //
-    bFlag=Standard_False;
-    myHasInterf=Standard_False;
-    //
-    myHasInterf=myDS->HasInterfShapeSubShapes(myIZ, myIE, bFlag);
-    if (!myHasInterf) {
-      myHasInterf=myDS->HasInterfShapeSubShapes(myIE, myIZ, bFlag);
+  const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
+  aBB.UpdateEdge(aE, aTol);
+  Bnd_Box& aBoxE=aSIE.ChangeBox();
+  BRepBndLib::Add(aE, aBoxE);
+  aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
+  //
+  aIt.Initialize(aLI);
+  for (; aIt.More(); aIt.Next()) {
+    nV = aIt.Value();
+    bHasShapeSD=myDS->HasShapeSD(nV, nVx);
+    if (bHasShapeSD) {
+      nV=nVx;
     }
-  };
-};
-//=======================================================================
-typedef BOPCol_NCVector
-  <BOPAlgo_SolidSolid> BOPAlgo_VectorOfSolidSolid; 
-//
-typedef BOPCol_Functor 
-  <BOPAlgo_SolidSolid,
-  BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidFunctor;
-//
-typedef BOPCol_Cnt 
-  <BOPAlgo_SolidSolidFunctor,
-  BOPAlgo_VectorOfSolidSolid> BOPAlgo_SolidSolidCnt;
-//
-/////////////////////////////////////////////////////////////////////////
-
+    const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
+    aTolV = BRep_Tool::Tolerance(aV);
+    if (aTolV < aTol) {
+      aBB.UpdateVertex(aV, aTol);
+      BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV);
+      Bnd_Box& aBoxV = aSIV.ChangeBox();
+      BRepBndLib::Add(aV, aBoxV);
+      aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
+    }
+  }
+}
 //=======================================================================
-//function : PerformVZ
+//function : UpdateVertex
 //purpose  : 
 //=======================================================================
-void BOPAlgo_PaveFiller::PerformVZ()
+Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
+  (const Standard_Integer nV,
+   const Standard_Real aTolNew)
 {
-  Standard_Boolean bJustAdd;
-  Standard_Integer iSize, nV, nZ, k, aNbVVS;
-  TopAbs_State aState;
-  BOPDS_MapOfPassKey aMPK;
+  Standard_Integer nVNew;
+  Standard_Real aTolV;
+  BRep_Builder aBB;
+  
+  nVNew = nV;
+  if (myDS->IsNewShape(nVNew) || 
+      myDS->HasShapeSD(nV, nVNew) ||
+      !myNonDestructive) {
+    // nV is a new vertex, it has SD or non-destructive mode is not in force
+    const TopoDS_Vertex& aVSD = *(TopoDS_Vertex*)&myDS->Shape(nVNew);
+    aTolV = BRep_Tool::Tolerance(aVSD);
+    if (aTolV < aTolNew) {
+      aBB.UpdateVertex(aVSD, aTolNew);
+      BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVNew);
+      Bnd_Box& aBoxV = aSIV.ChangeBox();
+      BRepBndLib::Add(aVSD, aBoxV);
+      aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
+    }
+    return nVNew;
+  }
   //
-  myErrorStatus=0;
+  // nV is old vertex
+  const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
+  aTolV = BRep_Tool::Tolerance(aV);
   //
-  myIterator->Initialize(TopAbs_VERTEX, TopAbs_SOLID);
-  iSize=myIterator->ExpectedLength();
-  if (!iSize) {
-    return; 
-  }
+  // create new vertex
+  TopoDS_Vertex aVNew;
+  gp_Pnt aPV = BRep_Tool::Pnt(aV);
+  aBB.MakeVertex(aVNew, aPV, Max(aTolV, aTolNew));
   //
-  BOPDS_VectorOfInterfVZ& aVZs=myDS->InterfVZ();
-  aVZs.SetIncrement(iSize);
+  // append new vertex to DS
+  BOPDS_ShapeInfo aSIV;
+  aSIV.SetShapeType(TopAbs_VERTEX);
+  aSIV.SetShape(aVNew);
+  nVNew = myDS->Append(aSIV);
   //
-  BOPAlgo_VectorOfVertexSolid aVVS;
+  // bounding box for the new vertex
+  BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nVNew);
+  Bnd_Box& aBoxDS = aSIDS.ChangeBox();
+  BRepBndLib::Add(aVNew, aBoxDS);
+  aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
   //
-  for (; myIterator->More(); myIterator->Next()) {
-    myIterator->Value(nV, nZ, bJustAdd);
-    if(bJustAdd) {
-      continue;
-    }
-    //
-    if (myDS->HasInterfShapeSubShapes(nV, nZ)) {
-      continue;
-    }
-    //
-    Standard_Integer nVSD = nV;
-    myDS->HasShapeSD(nV, nVSD);
-    //
-    BOPDS_PassKey aPK;
-    aPK.SetIds(nVSD, nZ);
-    if (!aMPK.Add(aPK)) {
-      continue;
-    }
-    //
-    const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&myDS->Shape(nVSD));
-    const TopoDS_Solid& aZ=*((TopoDS_Solid*)&myDS->Shape(nZ));
-    //
-    BOPAlgo_VertexSolid& aVertexSolid=aVVS.Append1();
-    aVertexSolid.SetIndices(nV, nZ);
-    aVertexSolid.SetVertex(aV);
-    aVertexSolid.SetSolid(aZ);
-  }
+  // add vertex to SD map
+  myDS->AddShapeSD(nV, nVNew);
   //
-  aNbVVS=aVVS.Extent();
-  //=============================================================
-  BOPAlgo_VertexSolidCnt::Perform(myRunParallel, aVVS, myContext);
-  //=============================================================
-  for (k=0; k < aNbVVS; ++k) {
-    const BOPAlgo_VertexSolid& aVertexSolid=aVVS(k);
-    aState=aVertexSolid.State();
-    if (aState==TopAbs_IN)  {
-      aVertexSolid.Indices(nV, nZ);
-      //
-      BOPDS_InterfVZ& aVZ=aVZs.Append1();
-      aVZ.SetIndices(nV, nZ);
-      //
-      myDS->AddInterf(nV, nZ);
-    }
-  }
-}
-//=======================================================================
-//function : PerformEZ
-//purpose  : 
-//=======================================================================
-void BOPAlgo_PaveFiller::PerformEZ()
-{ 
-  PerformSZ(TopAbs_EDGE);
+  myDS->InitPaveBlocksForVertex(nV);
+  //
+  return nVNew;
 }
 //=======================================================================
-//function : PerformFZ
+//function : UpdatePaveBlocksWithSDVertices
 //purpose  : 
 //=======================================================================
-void BOPAlgo_PaveFiller::PerformFZ()
-{ 
-  PerformSZ(TopAbs_FACE);
+void BOPAlgo_PaveFiller::UpdatePaveBlocksWithSDVertices()
+{
+  myDS->UpdatePaveBlocksWithSDVertices();
 }
 //=======================================================================
-//function : PerformZZ
+//function : UpdateCommonBlocksWithSDVertices
 //purpose  : 
 //=======================================================================
-void BOPAlgo_PaveFiller::PerformZZ()
+void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
 {
-  Standard_Boolean bJustAdd, bHasInterf;
-  Standard_Integer iSize, nZ1, nZ, k, aNbSolidSolid;
-  //
-  myErrorStatus=0;
-  //
-  myIterator->Initialize(TopAbs_SOLID, TopAbs_SOLID);
-  iSize=myIterator->ExpectedLength();
-  if (!iSize) {
-    return; 
+  if (!myNonDestructive) {
+    UpdatePaveBlocksWithSDVertices();
+    return;
   }
+  Standard_Integer aNbPBP;
   //
-  BOPAlgo_VectorOfSolidSolid aVSolidSolid;
-  //
-  for (; myIterator->More(); myIterator->Next()) {
-    myIterator->Value(nZ1, nZ, bJustAdd);
-    if(bJustAdd) {
-      continue;
-    }
-    //
-    BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid.Append1();
-    aSolidSolid.SetIndices(nZ1, nZ);
-    aSolidSolid.SetDS(myDS);
+  BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
+  aNbPBP=aPBP.Extent();
+  if(!aNbPBP) {
+    return;
   }
   //
-  aNbSolidSolid=aVSolidSolid.Extent();
-  //======================================================
-  BOPAlgo_SolidSolidCnt::Perform(myRunParallel, aVSolidSolid);
-  //======================================================
-  //
-  BOPDS_VectorOfInterfZZ& aZZs=myDS->InterfZZ();
-  //
-  aZZs.SetIncrement(iSize);
-  //
-  for (k=0; k < aNbSolidSolid; ++k) {
-    const BOPAlgo_SolidSolid& aSolidSolid=aVSolidSolid(k);
-    bHasInterf=aSolidSolid.HasInterf();
-    if (bHasInterf) {
-      aSolidSolid.Indices(nZ1, nZ);
-      //
-      BOPDS_InterfZZ& aZZ=aZZs.Append1();
-      aZZ.SetIndices(nZ1, nZ);
+  Standard_Integer i, nV1, nV2;
+  Standard_Real aTolV;
+  BOPDS_MapOfCommonBlock aMCB;
+  BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+  Handle(BOPDS_PaveBlock) aPB;
+  // 
+  aTolV = Precision::Confusion();
+  //
+  for (i=0; i<aNbPBP; ++i) {
+    BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
+    aItPB.Initialize(aLPB);
+    for (; aItPB.More(); aItPB.Next()) {
+      aPB=aItPB.Value();
+      const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
+      if (aCB.IsNull()) {
+        continue;
+      }
       //
-      myDS->AddInterf(nZ1, nZ);
+      if (aMCB.Add(aCB)) {
+        myDS->SortPaveBlocks(aCB);
+        aPB->Indices(nV1, nV2);
+        UpdateVertex(nV1, aTolV);
+        UpdateVertex(nV2, aTolV);
+        myDS->UpdateCommonBlockWithSDVertices(aCB);
+      }
     }
   }
+  UpdatePaveBlocksWithSDVertices();
 }
-//=======================================================================
-//function : PerformSZ
-//purpose  : 
-//=======================================================================
-void BOPAlgo_PaveFiller::PerformSZ(const TopAbs_ShapeEnum aTS)
+
+namespace
 {
-  Standard_Boolean bJustAdd, bHasInterf;
-  Standard_Integer iSize, nS, nZ, k, aNbShapeSolid;
-  //
-  myErrorStatus=0;
-  //
-  myIterator->Initialize(aTS, TopAbs_SOLID);
-  iSize=myIterator->ExpectedLength();
-  if (!iSize) {
-    return; 
-  }
-  //
-  BOPAlgo_VectorOfShapeSolid aVShapeSolid;
-  //
-  for (; myIterator->More(); myIterator->Next()) {
-    myIterator->Value(nS, nZ, bJustAdd);
-    if(bJustAdd) {
-      continue;
-    }
-    //
-    BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid.Append1();
-    aShapeSolid.SetIndices(nS, nZ);
-    aShapeSolid.SetDS(myDS);
-  }
-  //
-  aNbShapeSolid=aVShapeSolid.Extent();
-  //======================================================
-  BOPAlgo_ShapeSolidCnt::Perform(myRunParallel, aVShapeSolid);
-  //======================================================
-  //
-  BOPDS_VectorOfInterfEZ& aEZs=myDS->InterfEZ();
-  BOPDS_VectorOfInterfFZ& aFZs=myDS->InterfFZ();
-  //
-  if (aTS==TopAbs_EDGE) {
-    aEZs.SetIncrement(iSize);
-  }
-  else {//if (aTS==TopAbs_FACE)
-    aFZs.SetIncrement(iSize);
-  }
-  //
-  for (k=0; k < aNbShapeSolid; ++k) {
-    const BOPAlgo_ShapeSolid& aShapeSolid=aVShapeSolid(k);
-    bHasInterf=aShapeSolid.HasInterf();
-    if (bHasInterf) {
-      aShapeSolid.Indices(nS, nZ);
-      //
-      if (aTS==TopAbs_EDGE) {
-        BOPDS_InterfEZ& aEZ=aEZs.Append1();
-        aEZ.SetIndices(nS, nZ);
+  //=======================================================================
+  //function : UpdateInterfsWithSDVertices
+  //purpose  : 
+  //=======================================================================
+  template <class InterfType>
+  void UpdateIntfsWithSDVertices(BOPDS_PDS theDS, BOPCol_NCVector<InterfType>& theInterfs)
+  {
+    for (Standard_Integer i = 0; i < theInterfs.Length(); i++)
+    {
+      InterfType& anIntf = theInterfs(i);
+      Standard_Integer anInd;
+      if (anIntf.HasIndexNew(anInd))
+      {
+        Standard_Integer anIndSD;
+        if (theDS->HasShapeSD(anInd, anIndSD))
+        {
+          anIntf.SetIndexNew(anIndSD);
+        }
       }
-      else  {//if (aTS==TopAbs_FACE)
-        BOPDS_InterfFZ& aFZ=aFZs.Append1();
-        aFZ.SetIndices(nS, nZ);
-      }
-      //
-      myDS->AddInterf(nS, nZ);
     }
   }
 }
+
+//=======================================================================
+//function : UpdateInterfsWithSDVertices
+//purpose  : 
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdateInterfsWithSDVertices()
+{
+  UpdateIntfsWithSDVertices(myDS, myDS->InterfVV());
+  UpdateIntfsWithSDVertices(myDS, myDS->InterfVE());
+  UpdateIntfsWithSDVertices(myDS, myDS->InterfVF());
+  UpdateIntfsWithSDVertices(myDS, myDS->InterfEE());
+  UpdateIntfsWithSDVertices(myDS, myDS->InterfEF());
+}
diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx
deleted file mode 100644 (file)
index 742155a..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-// Created by: Peter KURNEV
-// Copyright (c) 2010-2014 OPEN CASCADE SAS
-// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
-// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
-//                         EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// 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.
-
-#include <BOPAlgo_PaveFiller.hxx>
-
-#include <Precision.hxx>
-
-#include <gp_Pnt.hxx>
-#include <Bnd_Box.hxx>
-
-#include <TopoDS_Iterator.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Edge.hxx>
-
-#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepBndLib.hxx>
-
-#include <BOPDS_ShapeInfo.hxx>
-#include <BOPDS_VectorOfListOfPaveBlock.hxx>
-#include <BOPDS_MapOfCommonBlock.hxx>
-#include <BOPDS_ListOfPaveBlock.hxx>
-#include <BOPDS_CommonBlock.hxx>
-#include <BOPDS_DS.hxx>
-
-//=======================================================================
-//function : SetNonDestructive
-//purpose  : 
-//=======================================================================
-void BOPAlgo_PaveFiller::SetNonDestructive() 
-{
-  if (!myIsPrimary || myNonDestructive) {
-    return;
-  }
-  //
-  Standard_Boolean bFlag;
-  BOPCol_ListIteratorOfListOfShape aItLS;
-  //
-  bFlag=Standard_False;
-  aItLS.Initialize(myArguments);
-  for(; aItLS.More() && (!bFlag); aItLS.Next()) {
-    const TopoDS_Shape& aS=aItLS.Value();
-    bFlag=aS.Locked();
-  }
-  myNonDestructive=bFlag;
-}
-//=======================================================================
-//function : UpdateEdgeTolerance
-//purpose  : 
-//=======================================================================
-void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
-                                              const Standard_Real aTol)
-{
-  Standard_Boolean bIsNewShape, bHasShapeSD;
-  Standard_Integer nV, nVx;
-  Standard_Real aTolV;
-  BRep_Builder aBB;
-  BOPCol_ListIteratorOfListOfInteger aIt;
-  //
-  BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE);
-  const BOPCol_ListOfInteger& aLI=aSIE.SubShapes();
-  //
-  if (myNonDestructive) {
-    bIsNewShape=myDS->IsNewShape(nE);
-    if (!bIsNewShape) {
-      return;
-    }
-    //
-    aIt.Initialize(aLI);
-    for (; aIt.More(); aIt.Next()) {
-      nV = aIt.Value();
-      bHasShapeSD=myDS->HasShapeSD(nV, nVx);
-      if (bHasShapeSD) {
-        continue;
-      }
-      bIsNewShape=myDS->IsNewShape(nV);
-      if (!bIsNewShape) {
-        return;
-      }
-    }
-  }
-  //
-  const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
-  aBB.UpdateEdge(aE, aTol);
-  Bnd_Box& aBoxE=aSIE.ChangeBox();
-  BRepBndLib::Add(aE, aBoxE);
-  aBoxE.SetGap(aBoxE.GetGap() + Precision::Confusion());
-  //
-  aIt.Initialize(aLI);
-  for (; aIt.More(); aIt.Next()) {
-    nV = aIt.Value();
-    bHasShapeSD=myDS->HasShapeSD(nV, nVx);
-    if (bHasShapeSD) {
-      nV=nVx;
-    }
-    const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
-    aTolV = BRep_Tool::Tolerance(aV);
-    if (aTolV < aTol) {
-      aBB.UpdateVertex(aV, aTol);
-      BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV);
-      Bnd_Box& aBoxV = aSIV.ChangeBox();
-      BRepBndLib::Add(aV, aBoxV);
-      aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
-    }
-  }
-}
-//=======================================================================
-//function : UpdateVertex
-//purpose  : 
-//=======================================================================
-Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
-  (const Standard_Integer nV,
-   const Standard_Real aTolNew)
-{
-  Standard_Integer nVNew;
-  Standard_Real aTolV;
-  BRep_Builder aBB;
-  
-  nVNew = nV;
-  if (myDS->IsNewShape(nVNew) || 
-      myDS->HasShapeSD(nV, nVNew) ||
-      !myNonDestructive) {
-    // nV is a new vertex, it has SD or non-destructive mode is not in force
-    const TopoDS_Vertex& aVSD = *(TopoDS_Vertex*)&myDS->Shape(nVNew);
-    aTolV = BRep_Tool::Tolerance(aVSD);
-    if (aTolV < aTolNew) {
-      aBB.UpdateVertex(aVSD, aTolNew);
-      BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVNew);
-      Bnd_Box& aBoxV = aSIV.ChangeBox();
-      BRepBndLib::Add(aVSD, aBoxV);
-      aBoxV.SetGap(aBoxV.GetGap() + Precision::Confusion());
-    }
-    return nVNew;
-  }
-  //
-  // nV is old vertex
-  const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
-  aTolV = BRep_Tool::Tolerance(aV);
-  //
-  // create new vertex
-  TopoDS_Vertex aVNew;
-  gp_Pnt aPV = BRep_Tool::Pnt(aV);
-  aBB.MakeVertex(aVNew, aPV, Max(aTolV, aTolNew));
-  //
-  // append new vertex to DS
-  BOPDS_ShapeInfo aSIV;
-  aSIV.SetShapeType(TopAbs_VERTEX);
-  aSIV.SetShape(aVNew);
-  nVNew = myDS->Append(aSIV);
-  //
-  // bounding box for the new vertex
-  BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nVNew);
-  Bnd_Box& aBoxDS = aSIDS.ChangeBox();
-  BRepBndLib::Add(aVNew, aBoxDS);
-  aBoxDS.SetGap(aBoxDS.GetGap() + Precision::Confusion());
-  //
-  // add vertex to SD map
-  myDS->AddShapeSD(nV, nVNew);
-  //
-  myDS->InitPaveBlocksForVertex(nV);
-  //
-  return nVNew;
-}
-//=======================================================================
-//function : UpdatePaveBlocksWithSDVertices
-//purpose  : 
-//=======================================================================
-void BOPAlgo_PaveFiller::UpdatePaveBlocksWithSDVertices()
-{
-  myDS->UpdatePaveBlocksWithSDVertices();
-}
-//=======================================================================
-//function : UpdateCommonBlocksWithSDVertices
-//purpose  : 
-//=======================================================================
-void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
-{
-  if (!myNonDestructive) {
-    UpdatePaveBlocksWithSDVertices();
-    return;
-  }
-  Standard_Integer aNbPBP;
-  //
-  BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
-  aNbPBP=aPBP.Extent();
-  if(!aNbPBP) {
-    return;
-  }
-  //
-  Standard_Integer i, nV1, nV2;
-  Standard_Real aTolV;
-  BOPDS_MapOfCommonBlock aMCB;
-  BOPDS_ListIteratorOfListOfPaveBlock aItPB;
-  Handle(BOPDS_PaveBlock) aPB;
-  // 
-  aTolV = Precision::Confusion();
-  //
-  for (i=0; i<aNbPBP; ++i) {
-    BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
-    aItPB.Initialize(aLPB);
-    for (; aItPB.More(); aItPB.Next()) {
-      aPB=aItPB.Value();
-      const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
-      if (aCB.IsNull()) {
-        continue;
-      }
-      //
-      if (aMCB.Add(aCB)) {
-        myDS->SortPaveBlocks(aCB);
-        aPB->Indices(nV1, nV2);
-        UpdateVertex(nV1, aTolV);
-        UpdateVertex(nV2, aTolV);
-        myDS->UpdateCommonBlockWithSDVertices(aCB);
-      }
-    }
-  }
-  UpdatePaveBlocksWithSDVertices();
-}
-
-namespace
-{
-  //=======================================================================
-  //function : UpdateInterfsWithSDVertices
-  //purpose  : 
-  //=======================================================================
-  template <class InterfType>
-  void UpdateIntfsWithSDVertices(BOPDS_PDS theDS, BOPCol_NCVector<InterfType>& theInterfs)
-  {
-    for (Standard_Integer i = 0; i < theInterfs.Length(); i++)
-    {
-      InterfType& anIntf = theInterfs(i);
-      Standard_Integer anInd;
-      if (anIntf.HasIndexNew(anInd))
-      {
-        Standard_Integer anIndSD;
-        if (theDS->HasShapeSD(anInd, anIndSD))
-        {
-          anIntf.SetIndexNew(anIndSD);
-        }
-      }
-    }
-  }
-}
-
-//=======================================================================
-//function : UpdateInterfsWithSDVertices
-//purpose  : 
-//=======================================================================
-void BOPAlgo_PaveFiller::UpdateInterfsWithSDVertices()
-{
-  UpdateIntfsWithSDVertices(myDS, myDS->InterfVV());
-  UpdateIntfsWithSDVertices(myDS, myDS->InterfVE());
-  UpdateIntfsWithSDVertices(myDS, myDS->InterfVF());
-  UpdateIntfsWithSDVertices(myDS, myDS->InterfEE());
-  UpdateIntfsWithSDVertices(myDS, myDS->InterfEF());
-}
index 754fc4735176d100371040b4903b4b7bd9720c97..732667be0519ebe4c18ea9cb13d1f7c9b11675bd 100644 (file)
@@ -24,8 +24,8 @@
 #include <BOPDS_DS.hxx>
 #include <BOPDS_Interf.hxx>
 #include <BOPDS_Iterator.hxx>
-#include <BOPDS_MapOfPassKey.hxx>
-#include <BOPDS_PassKey.hxx>
+#include <BOPDS_MapOfPair.hxx>
+#include <BOPDS_Pair.hxx>
 #include <BOPDS_PaveBlock.hxx>
 #include <BOPDS_VectorOfInterfVE.hxx>
 #include <BOPTools_AlgoTools.hxx>
@@ -141,12 +141,11 @@ typedef BOPCol_ContextCnt
 //=======================================================================
 void BOPAlgo_PaveFiller::PerformVE()
 {
-  Standard_Boolean bJustAdd;
   Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx,  k, aNbVE;
   Standard_Real aT, aT1, aT2, aTS1, aTS2;
   BOPDS_Pave aPave;
-  BOPDS_PassKey aPK;
-  BOPDS_MapOfPassKey aMPK;
+  BOPDS_Pair aPK;
+  BOPDS_MapOfPair aMPK;
   BOPAlgo_VectorOfVertexEdge aVVE;
   //
   myErrorStatus=0;
@@ -163,10 +162,7 @@ void BOPAlgo_PaveFiller::PerformVE()
   aVEs.SetIncrement(iSize);
   //
   for (; myIterator->More(); myIterator->Next()) {
-    myIterator->Value(nV, nE, bJustAdd);
-    if(bJustAdd) {
-      continue;
-    }
+    myIterator->Value(nV, nE);
     //
     const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
     if (aSIE.HasSubShape(nV)) {
@@ -187,7 +183,7 @@ void BOPAlgo_PaveFiller::PerformVE()
       nVx=nVSD;
     }
     //
-    aPK.SetIds(nVx, nE);
+    aPK.SetIndices(nVx, nE);
     if (!aMPK.Add(aPK)) {
       continue;
     }
index 030f6a9119e6939b3b41ca05b2f8e62cfa3fc98a..4aeb55ab3ee6ccded080831f4ae78739c1cd34b6 100644 (file)
@@ -327,7 +327,7 @@ void BOPAlgo_PaveFiller::PerformEE()
     return; 
   }
   //
-  Standard_Boolean bJustAdd, bExpressCompute, bIsPBSplittable1, bIsPBSplittable2;
+  Standard_Boolean bExpressCompute, bIsPBSplittable1, bIsPBSplittable2;
   Standard_Integer i, iX, nE1, nE2, aNbCPrts, k, aNbEdgeEdge;
   Standard_Integer nV11, nV12, nV21, nV22;
   Standard_Real aTS11, aTS12, aTS21, aTS22, aT11, aT12, aT21, aT22;
@@ -348,10 +348,7 @@ void BOPAlgo_PaveFiller::PerformEE()
   aEEs.SetIncrement(iSize);
   //
   for (; myIterator->More(); myIterator->Next()) {
-    myIterator->Value(nE1, nE2, bJustAdd);
-    if(bJustAdd) {
-      continue;
-    }
+    myIterator->Value(nE1, nE2);
     //
     const BOPDS_ShapeInfo& aSIE1=myDS->ShapeInfo(nE1);
     if (aSIE1.HasFlag()){
index f9dce5eb9c9b1ca68a230a88d28d4ddd549bb10e..ce679ce3a4422be63c8fd12bc36fe241c9e74ad9 100644 (file)
@@ -147,15 +147,14 @@ void BOPAlgo_PaveFiller::PerformVF()
   myIterator->Initialize(TopAbs_VERTEX, TopAbs_FACE);
   Standard_Integer iSize = myIterator->ExpectedLength();
   //
-  Standard_Boolean bJustAdd;
   Standard_Integer nV, nF;
   //
   if (myGlue == BOPAlgo_GlueFull) {
     // there is no need to intersect vertices with faces in this mode
     // just initialize FaceInfo for all faces
     for (; myIterator->More(); myIterator->Next()) {
-      myIterator->Value(nV, nF, bJustAdd);
-      if (!bJustAdd && !myDS->IsSubShape(nV, nF)) {
+      myIterator->Value(nV, nF);
+      if (!myDS->IsSubShape(nV, nF)) {
         myDS->ChangeFaceInfo(nF);
       }
     }
@@ -178,10 +177,7 @@ void BOPAlgo_PaveFiller::PerformVF()
   aVFs.SetIncrement(iSize);
   //
   for (; myIterator->More(); myIterator->Next()) {
-    myIterator->Value(nV, nF, bJustAdd);
-    if(bJustAdd) {
-      continue;
-    }
+    myIterator->Value(nV, nF);
     //
     if (myDS->IsSubShape(nV, nF)) {
       continue;
index da31950f812d9e97bcffad51a08b045a856c55c0..fc49d54c813b9789acfc1c4ae25802fe5fe45ee6 100644 (file)
@@ -149,15 +149,14 @@ void BOPAlgo_PaveFiller::PerformEF()
     return; 
   }
   //
-  Standard_Boolean bJustAdd;
   Standard_Integer nE, nF;
   //
   if (myGlue == BOPAlgo_GlueFull) {
     // there is no need to intersect edges with faces in this mode
     // just initialize FaceInfo for faces
     for (; myIterator->More(); myIterator->Next()) {
-      myIterator->Value(nE, nF, bJustAdd);
-      if (!bJustAdd && !myDS->ShapeInfo(nE).HasFlag()) {
+      myIterator->Value(nE, nF);
+      if (!myDS->ShapeInfo(nE).HasFlag()) {
         myDS->ChangeFaceInfo(nF);
       }
     }
@@ -190,10 +189,7 @@ void BOPAlgo_PaveFiller::PerformEF()
   aEFs.SetIncrement(iSize);
   //
   for (; myIterator->More(); myIterator->Next()) {
-    myIterator->Value(nE, nF, bJustAdd);
-    if(bJustAdd) {
-      continue;
-    }
+    myIterator->Value(nE, nF);
     //
     const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
     if (aSIE.HasFlag()){//degenerated 
index 1a36c188f3ef0dc581f732fa3edfb66dde7a551a..d114cefa51580cef210cc781495c1baeaee2b6be 100644 (file)
@@ -184,7 +184,7 @@ void BOPAlgo_PaveFiller::PerformFF()
     return; 
   }
   //
-  Standard_Boolean bJustAdd, bApp, bCompC2D1, bCompC2D2, bIsDone;
+  Standard_Boolean bApp, bCompC2D1, bCompC2D2, bIsDone;
   Standard_Boolean bToSplit, bTangentFaces;
   Standard_Integer nF1, nF2, aNbCurves, aNbPoints, i, aNbLP;
   Standard_Integer aNbFaceFace, k;
@@ -202,10 +202,7 @@ void BOPAlgo_PaveFiller::PerformFF()
   bToSplit = Standard_False;
   //
   for (; myIterator->More(); myIterator->Next()) {
-    myIterator->Value(nF1, nF2, bJustAdd);
-    if(bJustAdd) {
-      continue;
-    }
+    myIterator->Value(nF1, nF2);
     //
     const TopoDS_Face& aF1=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
     const TopoDS_Face& aF2=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
index 99a88d6a8234ec766560e7d9bfc3126c0b38289b..5b39cd31485d4b4b969d92944e5811c536325378 100644 (file)
@@ -780,7 +780,7 @@ void BOPAlgo_PaveFiller::Prepare()
     TopAbs_EDGE,
     TopAbs_FACE
   };
-  Standard_Boolean bJustAdd, bIsBasedOnPlane;
+  Standard_Boolean bIsBasedOnPlane;
   Standard_Integer i, aNb, n1, nF, aNbF;
   TopExp_Explorer aExp;
   BOPCol_IndexedMapOfShape aMF;
@@ -791,7 +791,7 @@ void BOPAlgo_PaveFiller::Prepare()
   for(i=0; i<aNb; ++i) {
     myIterator->Initialize(aType[i], aType[2]);
     for (; myIterator->More(); myIterator->Next()) {
-      myIterator->Value(n1, nF, bJustAdd);
+      myIterator->Value(n1, nF);
       const TopoDS_Face& aF=(*(TopoDS_Face *)(&myDS->Shape(nF))); 
       //
       bIsBasedOnPlane=IsBasedOnPlane(aF);
index a6fc3a9b542aaf8dd9ece34686e3a444c56c33a2..b37fc82580be487b6042e64c47e682e28c8c1acc 100644 (file)
@@ -95,7 +95,6 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
     return; 
   }
   //
-  Standard_Boolean bJustAdd;
   Standard_Integer i, nS[2], nE, nV1, nV2, aNbVSD, k;
   Standard_Real aT1, aT2, aTS1, aTS2;
   BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
@@ -104,10 +103,7 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
   TopAbs_ShapeEnum aType[2] = { aType1, aType2 };
   //
   for (; myIterator->More(); myIterator->Next()) {
-    myIterator->Value(nS[0], nS[1], bJustAdd);
-    if(bJustAdd) {
-      continue;
-    }
+    myIterator->Value(nS[0], nS[1]);
     //
     for (i=0; i < 2; ++i) {
       nE=nS[i];
index b5e68dee23b3c0792d2ed99c0c11267793f6dec8..6f1e522bea6a44c1b900a665c26145a640b7be3a 100644 (file)
@@ -21,6 +21,7 @@ BOPAlgo_BuilderSolid.cxx
 BOPAlgo_BuilderSolid.hxx
 BOPAlgo_CheckerSI.cxx
 BOPAlgo_CheckerSI.hxx
+BOPAlgo_CheckerSI_1.cxx
 BOPAlgo_CheckResult.cxx
 BOPAlgo_CheckResult.hxx
 BOPAlgo_CheckStatus.hxx
@@ -42,7 +43,6 @@ BOPAlgo_PaveFiller_7.cxx
 BOPAlgo_PaveFiller_8.cxx
 BOPAlgo_PaveFiller_9.cxx
 BOPAlgo_PaveFiller_10.cxx
-BOPAlgo_PaveFiller_11.cxx
 BOPAlgo_PBOP.hxx
 BOPAlgo_PBuilder.hxx
 BOPAlgo_PPaveFiller.hxx
index 89ebb38b9f9ac19258b6404a0148292947c0b13a..3b9e2c821a43bf672cdd04b3da8d47337f400311 100644 (file)
 #include <BOPCol_ListOfInteger.hxx>
 #include <BOPCol_MapOfInteger.hxx>
 #include <BOPDS_CommonBlock.hxx>
-#include <BOPDS_DataMapOfPassKeyListOfPaveBlock.hxx>
 #include <BOPDS_DS.hxx>
 #include <BOPDS_FaceInfo.hxx>
 #include <BOPDS_IndexRange.hxx>
 #include <BOPDS_MapOfPave.hxx>
 #include <BOPDS_MapOfPaveBlock.hxx>
-#include <BOPDS_PassKey.hxx>
+#include <BOPDS_Pair.hxx>
 #include <BOPDS_PaveBlock.hxx>
 #include <BOPDS_ShapeInfo.hxx>
 #include <BOPDS_VectorOfPave.hxx>
@@ -697,14 +696,14 @@ Standard_Boolean BOPDS_DS::HasInterf(const Standard_Integer theI) const
 {
   Standard_Integer n1, n2;
   Standard_Boolean bRet;
-  BOPDS_MapIteratorMapOfPassKey aIt;
+  BOPDS_MapIteratorOfMapOfPair aIt;
   //
   bRet = Standard_False;
   //
   aIt.Initialize(myInterfTB);
   for (; aIt.More(); aIt.Next()) {
-    const BOPDS_PassKey& aPK = aIt.Value();
-    aPK.Ids(n1, n2);
+    const BOPDS_Pair& aPK = aIt.Value();
+    aPK.Indices(n1, n2);
     if (n1 == theI || n2 == theI) {
       bRet = Standard_True;
       break;
@@ -1005,12 +1004,12 @@ void BOPDS_DS::UpdateCommonBlock(const Handle(BOPDS_CommonBlock)& theCB,
 {
   Standard_Integer nE, iRef, n1, n2;
   BOPDS_ListIteratorOfListOfPaveBlock aItPB, aItPBCB, aItPBN;
-  BOPDS_DataMapIteratorOfDataMapOfPassKeyListOfPaveBlock aItMPKLPB;
   BOPDS_ListOfPaveBlock aLPBN;
-  BOPDS_DataMapOfPassKeyListOfPaveBlock aMPKLPB; 
+  NCollection_DataMap<BOPDS_Pair, BOPDS_ListOfPaveBlock, BOPDS_PairMapHasher> aMPKLPB;
+  NCollection_DataMap<BOPDS_Pair, BOPDS_ListOfPaveBlock, BOPDS_PairMapHasher>::Iterator aItMPKLPB;
   Handle(BOPDS_PaveBlock) aPB;
   Handle(BOPDS_CommonBlock) aCBx;
-  BOPDS_PassKey aPK;
+  BOPDS_Pair aPK;
   //
   const BOPDS_ListOfPaveBlock& aLPBCB=theCB->PaveBlocks();
   if (!aLPBCB.First()->IsToUpdate()){
@@ -1043,7 +1042,7 @@ void BOPDS_DS::UpdateCommonBlock(const Handle(BOPDS_CommonBlock)& theCB,
           aLPB.Append(aPBN);
           //
           aPBN->Indices(n1, n2);
-          aPK.SetIds(n1, n2);
+          aPK.SetIndices(n1, n2);
           if (aMPKLPB.IsBound(aPK)) {
             BOPDS_ListOfPaveBlock& aLPBx=aMPKLPB.ChangeFind(aPK);
             aLPBx.Append(aPBN);
@@ -1054,7 +1053,7 @@ void BOPDS_DS::UpdateCommonBlock(const Handle(BOPDS_CommonBlock)& theCB,
             aMPKLPB.Bind(aPK, aLPBx);
           }
         }
-        aLPB.Remove(aItPB);    
+        aLPB.Remove(aItPB);
         break;
       }
     }
index 2797f1c2c84c662aa8efcc7cc48acf824be2f484..de0984f948d82d9e7407483b4ae211fe74426bcc 100644 (file)
@@ -30,7 +30,7 @@
 #include <BOPDS_VectorOfFaceInfo.hxx>
 #include <BOPCol_DataMapOfIntegerInteger.hxx>
 #include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
-#include <BOPDS_MapOfPassKey.hxx>
+#include <BOPDS_MapOfPair.hxx>
 #include <BOPDS_VectorOfInterfVV.hxx>
 #include <BOPDS_VectorOfInterfVE.hxx>
 #include <BOPDS_VectorOfInterfVF.hxx>
@@ -431,7 +431,7 @@ Standard_EXPORT virtual ~BOPDS_DS();
   //! Returns the table of interferences
   //!
   //! debug
-    const BOPDS_MapOfPassKey& Interferences() const;
+    const BOPDS_MapOfPair& Interferences() const;
   
   Standard_EXPORT void Dump() const;
   
@@ -495,7 +495,7 @@ protected:
   BOPDS_VectorOfFaceInfo myFaceInfoPool;
   BOPCol_DataMapOfIntegerInteger myShapesSD;
   BOPCol_DataMapOfIntegerListOfInteger myMapVE;
-  BOPDS_MapOfPassKey myInterfTB;
+  BOPDS_MapOfPair myInterfTB;
   BOPDS_VectorOfInterfVV myInterfVV;
   BOPDS_VectorOfInterfVE myInterfVE;
   BOPDS_VectorOfInterfVF myInterfVF;
index 7f6f71fbefa66466300f20c583dd9419f08a271b..160a4db2d2a0eba43abf757f84412afba502aa28 100644 (file)
@@ -12,7 +12,7 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <BOPDS_PassKey.hxx>
+#include <BOPDS_Pair.hxx>
 //=======================================================================
 //function : InterfVV
 //purpose  : 
@@ -107,9 +107,7 @@ inline Standard_Integer BOPDS_DS::NbInterfTypes()
 inline void BOPDS_DS::AddInterf(const Standard_Integer theI1,
                                 const Standard_Integer theI2)
 {
-  BOPDS_PassKey aPK;
-  //
-  aPK.SetIds(theI1, theI2);
+  BOPDS_Pair aPK(theI1, theI2);
   myInterfTB.Add(aPK);
 }
 //=======================================================================
@@ -120,16 +118,14 @@ inline Standard_Boolean BOPDS_DS::HasInterf
   (const Standard_Integer theI1,
    const Standard_Integer theI2)const
 {
-  BOPDS_PassKey aPK;
-  //
-  aPK.SetIds(theI1, theI2);
+  BOPDS_Pair aPK(theI1, theI2);
   return myInterfTB.Contains(aPK);
 }
 //=======================================================================
 //function : Interferences
 //purpose  : 
 //=======================================================================
-inline const BOPDS_MapOfPassKey& BOPDS_DS::Interferences()const
+inline const BOPDS_MapOfPair& BOPDS_DS::Interferences()const
 {
   return myInterfTB;
 }
index 4ad8589818f8e7b19c52ff1c2e1f952f03acf270..d3e80582ad6c2ba92aff1f12cee85af4a2812b54 100644 (file)
 #include <BOPDS_DS.hxx>
 #include <BOPDS_IndexRange.hxx>
 #include <BOPDS_Iterator.hxx>
-#include <BOPDS_MapOfPassKeyBoolean.hxx>
-#include <BOPDS_PassKeyBoolean.hxx>
+#include <BOPDS_Pair.hxx>
+#include <BOPDS_MapOfPair.hxx>
 #include <BOPDS_Tools.hxx>
 #include <NCollection_UBTreeFiller.hxx>
 #include <TopoDS_Shape.hxx>
+#include <algorithm>
 
-//
-//
-//
-//
-//
 /////////////////////////////////////////////////////////////////////////
 //=======================================================================
 //class    : BOPDS_TreeSelector
@@ -195,8 +191,11 @@ void BOPDS_Iterator::Initialize(const TopAbs_ShapeEnum aType1,
   myLength=0;
   iX=BOPDS_Tools::TypeToInteger(aType1, aType2);
   if (iX>=0) {
-    myIterator.Initialize(myLists(iX));
-    myLength=myLists(iX).Extent();
+    // sort interfering pairs for constant order of intersection
+    std::stable_sort(myLists(iX).begin(), myLists(iX).end());
+    // initialize iterator to access the pairs
+    myIterator.Init(myLists(iX));
+    myLength = myLists(iX).Extent();
   }
 }
 //=======================================================================
@@ -219,15 +218,13 @@ void BOPDS_Iterator::Next()
 // function: Value
 // purpose: 
 //=======================================================================
-void BOPDS_Iterator::Value
-  (Standard_Integer& theI1,
-   Standard_Integer& theI2,
-   Standard_Boolean& theWithSubShape) const
+void BOPDS_Iterator::Value(Standard_Integer& theI1,
+                           Standard_Integer& theI2) const
 {
   Standard_Integer iT1, iT2, n1, n2;
   //
-  const BOPDS_PassKeyBoolean& aPKB=myIterator.Value();
-  aPKB.Ids(n1, n2);
+  const BOPDS_Pair& aPair = myIterator.Value();
+  aPair.Indices(n1, n2);
   //
   iT1=(Standard_Integer)(myDS->ShapeInfo(n1).ShapeType());
   iT2=(Standard_Integer)(myDS->ShapeInfo(n2).ShapeType());
@@ -238,8 +235,6 @@ void BOPDS_Iterator::Value
     theI1=n2;
     theI2=n1;
   }
-  //
-  theWithSubShape=aPKB.Flag();
 }
 //=======================================================================
 // function: Prepare
@@ -267,33 +262,24 @@ void BOPDS_Iterator::Prepare()
 //=======================================================================
 void BOPDS_Iterator::Intersect()
 {
-  Standard_Boolean bFlag;
-  Standard_Integer aNb, i, aNbR, iTi, iTj;
-  Standard_Integer i1, i2, aNbSD, iX, j, iR;
+  Standard_Integer i, j, iX, i1, i2, iR, aNb, aNbR;
+  Standard_Integer iTi, iTj;
   TopAbs_ShapeEnum aTi, aTj;
-  Handle(NCollection_BaseAllocator) aAllocator;
-  BOPCol_ListIteratorOfListOfInteger aIt;
-  //
-  //-----------------------------------------------------scope_1 f
-  aAllocator=NCollection_BaseAllocator::CommonBaseAllocator();
-  //
-  BOPDS_MapOfPassKeyBoolean aMPKXB(100, aAllocator);
-  BOPDS_PassKeyBoolean aPKXB; 
   //
   BOPCol_BoxBndTree aBBTree;
   NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
   //
-  aNb=myDS->NbSourceShapes();
-  BOPDS_VectorOfTSR aVTSR(aNb, aAllocator);
+  aNb = myDS->NbSourceShapes();
+  BOPDS_VectorOfTSR aVTSR(aNb);
   //
   for (i=0; i<aNb; ++i) {
     const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
-    bFlag=aSI.IsInterfering();
+    Standard_Boolean bHasBrep = aSI.IsInterfering() && !(aSI.ShapeType() == TopAbs_SOLID);
     //
     BOPDS_TSR& aTSR=aVTSR.Append1();
     //
-    aTSR.SetHasBRep(bFlag);
-    if (!bFlag) {
+    aTSR.SetHasBRep(bHasBrep);
+    if (!bHasBrep) {
       continue;
     }
     //
@@ -310,68 +296,57 @@ void BOPDS_Iterator::Intersect()
   BOPDS_TSRCnt::Perform(myRunParallel, aVTSR);
   //===========================================
   //
-  aNbR=myDS->NbRanges()-1;
-  for (iR=0; iR<aNbR; ++iR) {
-    const BOPDS_IndexRange& aR=myDS->Range(iR);
-    i1=aR.First();
-    i2=aR.Last();
-    for (i=i1; i<=i2; ++i) {
-      const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
+  BOPDS_MapOfPair aMPFence;
+  //
+  aNbR = myDS->NbRanges() - 1;
+  for (iR = 0; iR < aNbR; ++iR) {
+    const BOPDS_IndexRange& aR = myDS->Range(iR);
+    i1 = aR.First();
+    i2 = aR.Last();
+    for (i = i1; i <= i2; ++i) {
+      const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
       //
-      if (!aSI.IsInterfering()){
+      if (!aSI.IsInterfering() || (aSI.ShapeType() == TopAbs_SOLID)) {
         continue;
       }
       //
-      aTi=aSI.ShapeType();
-      const Bnd_Box& aBoxi=aSI.Box();
-      //
-      BOPDS_TSR& aTSRi=aVTSR(i);
-      const BOPCol_ListOfInteger& aLI=aTSRi.Indices();
-      aNbSD=aLI.Extent();
-      if (!aNbSD){
+      BOPDS_TSR& aTSRi = aVTSR(i);
+      const BOPCol_ListOfInteger& aLI = aTSRi.Indices();
+      Standard_Integer aNbSD = aLI.Extent();
+      if (!aNbSD) {
         continue;
       }
       //
-      aIt.Initialize(aLI);
+      aTi = aSI.ShapeType();
+      iTi = BOPDS_Tools::TypeToInteger(aTi);
+      //
+      BOPCol_ListIteratorOfListOfInteger aIt(aLI);
       for (; aIt.More(); aIt.Next()) {
-        j=aIt.Value(); // DS index
-        if (j>=i1 && j<=i2) {
+        j = aIt.Value(); // DS index
+        if (j >= i1 && j <= i2) {
           continue;// same range
         }
         //
-        const BOPDS_ShapeInfo& aSIj=myDS->ShapeInfo(j);
-        aTj=aSIj.ShapeType();
-        iTi=BOPDS_Tools::TypeToInteger(aTi);
-        iTj=BOPDS_Tools::TypeToInteger(aTj);
+        const BOPDS_ShapeInfo& aSJ = myDS->ShapeInfo(j);
+        aTj = aSJ.ShapeType();
+        iTj = BOPDS_Tools::TypeToInteger(aTj);
         //
-        bFlag=Standard_False;
-        if (iTi<iTj) {
-          bFlag=aSI.HasSubShape(j);
-        } 
-        else if (iTj<iTi) {
-          bFlag=aSIj.HasSubShape(i);
-        }
-        if (bFlag) {
-          continue; 
+        // avoid interfering of the same shapes and shape with its sub-shapes
+        if (((iTi < iTj) && aSI.HasSubShape(j)) ||
+            ((iTi > iTj) && aSJ.HasSubShape(i))) {
+          continue;
         }
         //
-        aPKXB.SetIds(i, j);
-        if (aMPKXB.Add(aPKXB)) {
-          bFlag=Standard_False;// Bounding boxes are intersected
-          const Bnd_Box& aBoxj=aSIj.Box();
-          if (aBoxi.IsOut(aBoxj)) {
-            bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected
-          }
-          //
-          iX=BOPDS_Tools::TypeToInteger(aTi, aTj);
-          aPKXB.SetFlag(bFlag);
-          myLists(iX).Append(aPKXB);
-        }// if (aMPKXB.Add(aPKXB)) {
+        BOPDS_Pair aPair(i, j);
+        if (aMPFence.Add(aPair)) {
+          iX = BOPDS_Tools::TypeToInteger(aTi, aTj);
+          myLists(iX).Append(aPair);
+        }// if (aMPFence.Add(aPair)) {
       }// for (; aIt.More(); aIt.Next()) {
     }//for (i=i1; i<=i2; ++i) {
   }//for (iR=1; iR<aNbR; ++iR) {
   //
-  aMPKXB.Clear();
+  aMPFence.Clear();
   aVTSR.Clear();
   //-----------------------------------------------------scope_1 t
 }
index 5b1a714bc718bfc4c3596b067360efa85045c06a..9e3313092b2d002454720bae8a7c7fb4411dcb99 100644 (file)
@@ -25,8 +25,8 @@
 #include <BOPCol_BaseAllocator.hxx>
 #include <Standard_Integer.hxx>
 #include <BOPDS_PDS.hxx>
-#include <BOPDS_VectorOfListOfPassKeyBoolean.hxx>
-#include <BOPDS_ListIteratorOfListOfPassKeyBoolean.hxx>
+#include <BOPDS_VectorOfPair.hxx>
+#include <BOPDS_VectorOfVectorOfPair.hxx>
 #include <Standard_Boolean.hxx>
 #include <TopAbs_ShapeEnum.hxx>
 class BOPDS_DS;
@@ -45,100 +45,71 @@ public:
 
   DEFINE_STANDARD_ALLOC
 
-  
-
   //! Empty contructor
   Standard_EXPORT BOPDS_Iterator();
-Standard_EXPORT virtual ~BOPDS_Iterator();
-  
+  Standard_EXPORT virtual ~BOPDS_Iterator();
 
   //! Contructor
   //! theAllocator - the allocator to manage the memory
   Standard_EXPORT BOPDS_Iterator(const BOPCol_BaseAllocator& theAllocator);
-  
 
   //! Modifier
   //! Sets the data structure <pDS> to process
   Standard_EXPORT void SetDS (const BOPDS_PDS& pDS);
-  
 
   //! Selector
   //! Returns the data structure
   Standard_EXPORT const BOPDS_DS& DS() const;
-  
 
   //! Initializes the  iterator
   //! theType1 - the first type of shape
   //! theType2 - the second type of shape
   Standard_EXPORT void Initialize (const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType2);
-  
 
   //! Returns  true if still there are pairs
   //! of intersected shapes
   Standard_EXPORT Standard_Boolean More() const;
-  
 
   //! Moves iterations ahead
   Standard_EXPORT void Next();
-  
 
   //! Returns indices (DS) of intersected shapes
   //! theIndex1 - the index of the first shape
   //! theIndex2 - the index of the second shape
-  //! theWithSubShape - flag. True if the sub-shapes of
-  //! shapes are intersected
-  Standard_EXPORT void Value (Standard_Integer& theIndex1, Standard_Integer& theIndex2, Standard_Boolean& theWithSubShape) const;
-  
+  Standard_EXPORT void Value (Standard_Integer& theIndex1,
+                              Standard_Integer& theIndex2) const;
 
   //! Perform the intersection algorithm and prepare
   //! the results to be used
   Standard_EXPORT virtual void Prepare();
-  
 
   //! Returns the number of intersections founded
   Standard_EXPORT Standard_Integer ExpectedLength() const;
-  
 
   //! Returns the block length
   Standard_EXPORT Standard_Integer BlockLength() const;
-  
+
   //! Set the flag of parallel processing
   //! if <theFlag> is true  the parallel processing is switched on
   //! if <theFlag> is false the parallel processing is switched off
   Standard_EXPORT void SetRunParallel (const Standard_Boolean theFlag);
-  
+
   //! Returns the flag of parallel processing
   Standard_EXPORT Standard_Boolean RunParallel() const;
 
-
-
-
 protected:
 
-  
   Standard_EXPORT virtual void Intersect();
 
-
   BOPCol_BaseAllocator myAllocator;
   Standard_Integer myLength;
   BOPDS_PDS myDS;
-  BOPDS_VectorOfListOfPassKeyBoolean myLists;
-  BOPDS_ListIteratorOfListOfPassKeyBoolean myIterator;
+  BOPDS_VectorOfVectorOfPair myLists;
+  BOPDS_VectorOfPair::Iterator myIterator;
   Standard_Boolean myRunParallel;
 
-
 private:
 
-
-
-
-
 };
 
-
-
-
-
-
-
 #endif // _BOPDS_Iterator_HeaderFile
index c59c06a35bce585be209c313bc92a66bc17724d4..2feaa9b761d0642a76c286d9abdfda6502c69c33 100644 (file)
@@ -22,8 +22,8 @@
 #include <BOPDS_DS.hxx>
 #include <BOPDS_IndexRange.hxx>
 #include <BOPDS_IteratorSI.hxx>
-#include <BOPDS_MapOfPassKeyBoolean.hxx>
-#include <BOPDS_PassKeyBoolean.hxx>
+#include <BOPDS_MapOfPair.hxx>
+#include <BOPDS_Pair.hxx>
 #include <BOPDS_ShapeInfo.hxx>
 #include <BOPDS_Tools.hxx>
 #include <BRep_Tool.hxx>
@@ -80,124 +80,69 @@ void BOPDS_IteratorSI::UpdateByLevelOfCheck(const Standard_Integer theLevel)
 //=======================================================================
 void BOPDS_IteratorSI::Intersect()
 {
-  Standard_Boolean bFlag;
-  Standard_Integer aNbS, i, aNbB;
-  Standard_Integer aNbSD, iX, j, iDS, jB;
+  Standard_Integer i, j, iX, aNbS;
+  Standard_Integer iTi, iTj;
   TopAbs_ShapeEnum aTi, aTj;
-  Handle(NCollection_BaseAllocator) aAllocator;
-  BOPCol_ListIteratorOfListOfInteger aIt;
-  //
-  //-----------------------------------------------------scope_1 f
-  aAllocator=
-    NCollection_BaseAllocator::CommonBaseAllocator();
-  //
-  BOPCol_DataMapOfShapeInteger aMSI(100, aAllocator);
-  BOPCol_DataMapOfIntegerInteger aMII(100, aAllocator);
-  BOPDS_MapOfPassKeyBoolean aMPA(100, aAllocator);
-  BOPDS_MapOfPassKeyBoolean aMPKXB(100, aAllocator);
-  BOPCol_IndexedDataMapOfShapeBox aMSB(100, aAllocator);
-  BOPDS_PassKeyBoolean aPKXB; 
   //
   BOPCol_BoxBndTreeSelector aSelector;
   BOPCol_BoxBndTree aBBTree;
   NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
   //
-  // myPairsAvoid, aMSI, aMSB
-  aNbS=myDS->NbSourceShapes();
+  aNbS = myDS->NbSourceShapes();
   for (i=0; i<aNbS; ++i) {
     const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
-    //
-    if (!aSI.IsInterfering()) { 
+    if (!aSI.IsInterfering()) {
       continue;
     }
     //
-    const TopoDS_Shape& aSi=aSI.Shape();
-    aTi=aSI.ShapeType();
-    if (aTi!=TopAbs_VERTEX) {
-      const BOPCol_ListOfInteger& aLA=aSI.SubShapes();
-      aIt.Initialize(aLA);
-      for (; aIt.More(); aIt.Next()) {
-        iX=aIt.Value();
-        aPKXB.Clear();
-        aPKXB.SetIds(i, iX);
-        aMPA.Add(aPKXB);
-      }
-    }
-    //
-    aPKXB.Clear();
-    aPKXB.SetIds(i, i);
-    aMPA.Add(aPKXB);
-    //
-    const Bnd_Box& aBoxEx=aSI.Box();
-    //
-    aMSI.Bind(aSi, i);
-    aMSB.Add(aSi, aBoxEx);
-  } // for (i=0; i<aNbS; ++i) {
-  // 
-  // aMII
-  aNbB=aMSB.Extent();
-  for (i=1; i<=aNbB; ++i) {
-    const TopoDS_Shape& aS=aMSB.FindKey(i);
-    const Bnd_Box& aBoxEx=aMSB(i);
-    //
+    const Bnd_Box& aBoxEx = aSI.Box();
     aTreeFiller.Add(i, aBoxEx);
-    //
-    iDS=aMSI.Find(aS);
-    aMII.Bind(i, iDS);
   }
   //
   aTreeFiller.Fill();
   //
-  for (i=0; i<aNbS; ++i) {
-    const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
-    aTi=aSI.ShapeType();
+  BOPDS_MapOfPair aMPFence;
+  //
+  for (i = 0; i < aNbS; ++i) {
+    const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
     if (!aSI.IsInterfering()){
       continue;
     }
     //
-    const TopoDS_Shape& aSi=myDS->Shape(i);
-    aTi=aSi.ShapeType();
-    const Bnd_Box& aBoxEx=aMSB.FindFromKey(aSi);
+    const Bnd_Box& aBoxEx = aSI.Box();
+    //
     aSelector.Clear();
     aSelector.SetBox(aBoxEx);
     //
-    aNbSD=aBBTree.Select(aSelector);
-    if (!aNbSD){
+    Standard_Integer aNbSD = aBBTree.Select(aSelector);
+    if (!aNbSD) {
       continue;
     }
     //
-    const BOPCol_ListOfInteger& aLI=aSelector.Indices();
+    aTi = aSI.ShapeType();
+    iTi = BOPDS_Tools::TypeToInteger(aTi);
     //
-    aIt.Initialize(aLI);
+    const BOPCol_ListOfInteger& aLI = aSelector.Indices();
+    BOPCol_ListIteratorOfListOfInteger aIt(aLI);
     for (; aIt.More(); aIt.Next()) {
-      jB=aIt.Value();  // box index in MII
-      j=aMII.Find(jB); // DS index
+      j = aIt.Value();
+      const BOPDS_ShapeInfo& aSJ = myDS->ShapeInfo(j);
+      aTj = aSJ.ShapeType();
+      iTj = BOPDS_Tools::TypeToInteger(aTj);
       //
-      aPKXB.SetIds(i, j);
-      if (aMPA.Contains(aPKXB)) {
+      // avoid interfering of the same shapes and shape with its sub-shapes
+      if ((i == j) || ((iTi < iTj) && aSI.HasSubShape(j)) ||
+                      ((iTi > iTj) && aSJ.HasSubShape(i))) {
         continue;
       }
       //
-      if (aMPKXB.Add(aPKXB)) {
-        bFlag=Standard_False;// Bounding boxes are intersected
-        const Bnd_Box& aBoxi=myDS->ShapeInfo(i).Box();
-        const Bnd_Box& aBoxj=myDS->ShapeInfo(j).Box();
-        if (aBoxi.IsOut(aBoxj)) {
-          bFlag=!bFlag; //Bounding boxes of Sub-shapes are intersected
-        }
-        aTj=myDS->ShapeInfo(j).ShapeType();//
-        iX=BOPDS_Tools::TypeToInteger(aTi, aTj);
-        aPKXB.SetFlag(bFlag);
-        myLists(iX).Append(aPKXB);
+      BOPDS_Pair aPair(i, j);
+      if (aMPFence.Add(aPair)) {
+        iX = BOPDS_Tools::TypeToInteger(aTi, aTj);
+        myLists(iX).Append(aPair);
       }// if (aMPKXB.Add(aPKXB)) {
     }// for (; aIt.More(); aIt.Next()) {
   }//for (i=1; i<=aNbS; ++i) {
   //
-  aMSI.Clear();
-  aMII.Clear();
-  aMPA.Clear();
-  aMPKXB.Clear();
-  aMSB.Clear();
-  //
-  //-----------------------------------------------------scope_1 t
+  aMPFence.Clear();
 }
diff --git a/src/BOPDS/BOPDS_MapOfPair.hxx b/src/BOPDS/BOPDS_MapOfPair.hxx
new file mode 100644 (file)
index 0000000..e9a9e73
--- /dev/null
@@ -0,0 +1,25 @@
+// Created by: Eugeny MALTCHIKOV
+// Copyright (c) 2017 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 BOPDS_MapOfPair_HeaderFile
+#define BOPDS_MapOfPair_HeaderFile
+
+#include <NCollection_Map.hxx>
+#include <BOPDS_PairMapHasher.hxx>
+#include <BOPDS_Pair.hxx>
+
+typedef NCollection_Map<BOPDS_Pair, BOPDS_PairMapHasher> BOPDS_MapOfPair;
+typedef BOPDS_MapOfPair::Iterator BOPDS_MapIteratorOfMapOfPair;
+
+#endif
diff --git a/src/BOPDS/BOPDS_Pair.hxx b/src/BOPDS/BOPDS_Pair.hxx
new file mode 100644 (file)
index 0000000..ca08941
--- /dev/null
@@ -0,0 +1,77 @@
+// Created by: Eugeny MALTCHIKOV
+// Copyright (c) 2017 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 _BOPDS_Pair_HeaderFile
+#define _BOPDS_Pair_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+//! The class is to provide the pair of indices of interfering shapes.
+
+class BOPDS_Pair {
+ public:
+
+  DEFINE_STANDARD_ALLOC
+
+  BOPDS_Pair() : myIndex1(-1), myIndex2(-1) {}
+  //
+  BOPDS_Pair(const Standard_Integer theIndex1,
+             const Standard_Integer theIndex2) : myIndex1(theIndex1), myIndex2(theIndex2) {}
+  
+  ~BOPDS_Pair(){}
+  //
+  //! Sets the indices
+  void SetIndices(const Standard_Integer theIndex1,
+                  const Standard_Integer theIndex2)
+  {
+    myIndex1 = theIndex1;
+    myIndex2 = theIndex2;
+  }
+  //
+  //! Gets the indices
+  void Indices(Standard_Integer& theIndex1,
+               Standard_Integer& theIndex2) const
+  {
+    theIndex1 = myIndex1;
+    theIndex2 = myIndex2;
+  }
+  //
+  //! Operator less
+  Standard_Boolean operator < (const  BOPDS_Pair& theOther) const
+  {
+    return ((myIndex1 != theOther.myIndex1) ?
+            (myIndex1 < theOther.myIndex1) : (myIndex2 < theOther.myIndex2));
+  }
+  //
+  //! Returns true if the Pair is equal to <the theOther>
+  Standard_Boolean IsEqual (const BOPDS_Pair& theOther) const
+  {
+    return (myIndex1 == theOther.myIndex1 && myIndex2 == theOther.myIndex2) ||
+           (myIndex1 == theOther.myIndex2 && myIndex2 == theOther.myIndex1);
+  }
+  //
+  //! Returns hash code
+  Standard_Integer HashCode (const Standard_Integer theUpper) const
+  {
+    return ::HashCode(myIndex1 + myIndex2, theUpper);
+  }
+
+ protected:
+  Standard_Integer myIndex1;
+  Standard_Integer myIndex2;
+};
+
+#endif // _BOPDS_Pair
\ No newline at end of file
diff --git a/src/BOPDS/BOPDS_PairMapHasher.hxx b/src/BOPDS/BOPDS_PairMapHasher.hxx
new file mode 100644 (file)
index 0000000..d0360f7
--- /dev/null
@@ -0,0 +1,52 @@
+// Created by: Eugeny MALTCHIKOV
+// Copyright (c) 2017 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 _BOPDS_PairMapHasher_HeaderFile
+#define _BOPDS_PairMapHasher_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <Standard_Integer.hxx>
+#include <Standard_Boolean.hxx>
+#include <BOPDS_Pair.hxx>
+
+class BOPDS_Pair;
+
+class BOPDS_PairMapHasher 
+{
+public:
+
+  DEFINE_STANDARD_ALLOC
+  static Standard_Integer HashCode(const BOPDS_Pair& thePair,
+                                   const Standard_Integer Upper)
+  {
+    return thePair.HashCode(Upper);
+  }
+  static Standard_Boolean IsEqual(const BOPDS_Pair& thePair1,
+                                  const BOPDS_Pair& thePair2)
+  {
+    return thePair1.IsEqual(thePair2);
+  }
+
+protected:
+
+private:
+
+};
+
+#endif // _BOPDS_PairMapHasher_HeaderFile
index ad85e782274966413383d2b66cfbf32ef9701cca..d5039a5c1dcb196896933fc3b0e8fe9f7983b229 100644 (file)
 // commercial license or contractual agreement.
 
 
+#include <BOPDS_SubIterator.hxx>
+
 #include <Bnd_Box.hxx>
+
 #include <BOPCol_BoxBndTree.hxx>
-#include <BOPCol_DataMapOfIntegerInteger.hxx>
-#include <BOPCol_DataMapOfIntegerMapOfInteger.hxx>
-#include <BOPCol_IndexedDataMapOfShapeBox.hxx>
-#include <BOPCol_MapOfInteger.hxx>
+
 #include <BOPDS_DS.hxx>
-#include <BOPDS_IndexRange.hxx>
-#include <BOPDS_MapOfPassKeyBoolean.hxx>
-#include <BOPDS_PassKeyBoolean.hxx>
-#include <BOPDS_SubIterator.hxx>
-#include <BOPDS_Tools.hxx>
+#include <BOPDS_Pair.hxx>
+#include <BOPDS_MapOfPair.hxx>
+
 #include <NCollection_UBTreeFiller.hxx>
-#include <TopoDS.hxx>
+
 #include <TopoDS_Shape.hxx>
-#include <TopoDS_Vertex.hxx>
 
-//
-//
-//
-//
-//
+#include <algorithm>
+
 //=======================================================================
-//function : 
+//function : BOPDS_SubIterator
 //purpose  : 
 //=======================================================================
   BOPDS_SubIterator::BOPDS_SubIterator()
 :
   myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
-  myList(myAllocator)
+  myList(1, myAllocator)
 {
-  myDS=NULL; 
+  myDS=NULL;
 }
 //=======================================================================
-//function : 
+//function : BOPDS_SubIterator
 //purpose  : 
 //=======================================================================
   BOPDS_SubIterator::BOPDS_SubIterator(const Handle(NCollection_BaseAllocator)& theAllocator)
 :
   myAllocator(theAllocator),
-  myList(myAllocator)
+  myList(1, myAllocator)
 {
-  myDS=NULL; 
+  myDS=NULL;
 }
 //=======================================================================
 //function : ~
 {
 }
 //=======================================================================
-// function: SetDS
-// purpose: 
-//=======================================================================
-  void BOPDS_SubIterator::SetDS(const BOPDS_PDS& aDS)
-{
-  myDS=aDS;
-}
-//=======================================================================
-// function: DS
-// purpose: 
-//=======================================================================
-  const BOPDS_DS&  BOPDS_SubIterator::DS()const
-{
-  return *myDS;
-}
-//=======================================================================
-//function : SetSubSet1
-//purpose  : 
-//=======================================================================
-  void BOPDS_SubIterator::SetSubSet1(const BOPCol_ListOfInteger& theLI)
-{
-  mySubSet1=(BOPCol_PListOfInteger)&theLI;
-}
-//=======================================================================
-//function : SubSet1
-//purpose  : 
-//=======================================================================
-  const BOPCol_ListOfInteger& BOPDS_SubIterator::SubSet1()const 
-{
-  return *mySubSet1;
-}
-//=======================================================================
-//function : SetSubSet2
-//purpose  : 
-//=======================================================================
-  void BOPDS_SubIterator::SetSubSet2(const BOPCol_ListOfInteger& theLI)
-{
-  mySubSet2=(BOPCol_PListOfInteger)&theLI;
-}
-//=======================================================================
-//function : SubSet2
-//purpose  : 
-//=======================================================================
-  const BOPCol_ListOfInteger& BOPDS_SubIterator::SubSet2()const 
-{
-  return *mySubSet2;
-}
-//=======================================================================
 // function: Initialize
 // purpose: 
 //=======================================================================
-  void BOPDS_SubIterator::Initialize()
-{
-  myIterator.Initialize(myList);
-}
-//=======================================================================
-// function: More
-// purpose: 
-//=======================================================================
-  Standard_Boolean BOPDS_SubIterator::More()const
-{
-  return myIterator.More();
-}
-//=======================================================================
-// function: Next
-// purpose: 
-//=======================================================================
-  void BOPDS_SubIterator::Next()
+void BOPDS_SubIterator::Initialize()
 {
-  myIterator.Next();
+  // sort interfering pairs for constant order of intersection
+  std::stable_sort(myList.begin(), myList.end());
+  // initialize iterator to access the pairs
+  myIterator.Init(myList);
 }
 //=======================================================================
 // function: Value
 {
   Standard_Integer iT1, iT2, n1, n2;
   //
-  const BOPDS_PassKeyBoolean& aPKB=myIterator.Value();
-  aPKB.Ids(n1, n2);
+  const BOPDS_Pair& aPKB = myIterator.Value();
+  aPKB.Indices(n1, n2);
   //
   iT1=(Standard_Integer)(myDS->ShapeInfo(n1).ShapeType());
   iT2=(Standard_Integer)(myDS->ShapeInfo(n2).ShapeType());
   if (!myDS){
     return;
   }
+  //
   if (!mySubSet1->Extent() || !mySubSet2->Extent()) {
     return;
   }
+  //
+  myList.SetIncrement(2 * (mySubSet1->Extent() + mySubSet2->Extent()));
+  //
   Intersect();
 }
 //=======================================================================
 //=======================================================================
   void BOPDS_SubIterator::Intersect()
 {
-  Standard_Integer i, aNbB, aNbSD, j, iDS, jB;
-  Handle(NCollection_BaseAllocator) aAllocator;
-  BOPCol_ListIteratorOfListOfInteger aIt, aIt1, aIt2;
-  BOPDS_PassKeyBoolean aPKXB; 
-  //
-  //-----------------------------------------------------scope_1 f
-  aAllocator=
-    NCollection_BaseAllocator::CommonBaseAllocator();
-  //
-  BOPCol_DataMapOfShapeInteger aMSI(100, aAllocator);
-  BOPCol_DataMapOfIntegerInteger aMII(100, aAllocator);
-  BOPDS_MapOfPassKeyBoolean aMPKXB(100, aAllocator);
-  BOPCol_IndexedDataMapOfShapeBox aMSB(100, aAllocator);
-  //
-  BOPCol_BoxBndTreeSelector aSelector;
+  Standard_Integer i, j, iTi, iTj;
   BOPCol_BoxBndTree aBBTree;
   NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
   //
-  aIt1.Initialize(*mySubSet1);
-  for (; aIt1.More(); aIt1.Next()) {
-    i=aIt1.Value();
-    const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
-    const TopoDS_Shape& aS=aSI.Shape();
-    const Bnd_Box& aBoxEx=aSI.Box();
-    aMSI.Bind(aS, i);
-    aMSB.Add(aS, aBoxEx);
-  }
-  //
-  aNbB=aMSB.Extent();
-  for (i=1; i<=aNbB; ++i) {
-    const TopoDS_Shape& aS=aMSB.FindKey(i);
-    const Bnd_Box& aBoxEx=aMSB(i);
+  BOPCol_ListIteratorOfListOfInteger aIt(*mySubSet1);
+  for (; aIt.More(); aIt.Next()) {
+    i = aIt.Value();
     //
-    aTreeFiller.Add(i, aBoxEx);
+    const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
+    const Bnd_Box& aBoxEx = aSI.Box();
     //
-    iDS=aMSI.Find(aS);
-    aMII.Bind(i, iDS);
+    aTreeFiller.Add(i, aBoxEx);
   }
   //
   aTreeFiller.Fill();
   //
-  aIt2.Initialize(*mySubSet2);
-  for (; aIt2.More(); aIt2.Next()) {
-    i=aIt2.Value();
+  BOPDS_MapOfPair aMPKFence;
+  //
+  aIt.Initialize(*mySubSet2);
+  for (; aIt.More(); aIt.Next()) {
+    i = aIt.Value();
     //
-    const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
-    const Bnd_Box& aBoxEx=aSI.Box();
+    const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
+    const Bnd_Box& aBoxEx = aSI.Box();
     //
-    aSelector.Clear();
+    BOPCol_BoxBndTreeSelector aSelector;
     aSelector.SetBox(aBoxEx);
-    aNbSD=aBBTree.Select(aSelector);
-    if (!aNbSD){
+    Standard_Integer aNbSD = aBBTree.Select(aSelector);
+    if (!aNbSD) {
       continue;
     }
-    //const Bnd_Box& aBoxi=myDS->ShapeInfo(i).Box();
     //
-    const BOPCol_ListOfInteger& aLI=aSelector.Indices();
-    aIt.Initialize(aLI);
-    for (; aIt.More(); aIt.Next()) {
-      jB=aIt.Value();  // box index in MII
-      j=aMII.Find(jB); // DS index
+    iTi = BOPDS_Tools::TypeToInteger(aSI.ShapeType());
+    //
+    const BOPCol_ListOfInteger& aLI = aSelector.Indices();
+    BOPCol_ListIteratorOfListOfInteger aItLI(aLI);
+    for (; aItLI.More(); aItLI.Next()) {
+      j = aItLI.Value();
+      //
+      const BOPDS_ShapeInfo& aSJ = myDS->ShapeInfo(j);
+      iTj = BOPDS_Tools::TypeToInteger(aSJ.ShapeType());
       //
-      aPKXB.SetIds(i, j);
-      if (aMPKXB.Add(aPKXB)) {
-        myList.Append(aPKXB);
-      }// if (aMPKXB.Add(aPKXB)) {
-    }// for (; aIt.More(); aIt.Next()) {
+      // avoid interfering of the same shapes and shape with its sub-shapes
+      if ((i == j) || ((iTi < iTj) && aSI.HasSubShape(j)) ||
+                      ((iTi > iTj) && aSJ.HasSubShape(i))) {
+        continue;
+      }
+      //
+      BOPDS_Pair aPair(j, i);
+      if (aMPKFence.Add(aPair)) {
+        myList.Append(aPair);
+      }
+    }
   }
-  //
-  aMSI.Clear();
-  aMII.Clear();
-  aMPKXB.Clear();
-  aMSB.Clear();
-  //
-  //-----------------------------------------------------scope_1 t
 }
index 6b2c76053b069b436371c52136f7864027b6c3a9..1fb242d77ad2c8616b73f832988aeb0a6ee2b860 100644 (file)
@@ -21,8 +21,8 @@
 
 #include <BOPCol_BaseAllocator.hxx>
 #include <BOPDS_PDS.hxx>
-#include <BOPDS_ListOfPassKeyBoolean.hxx>
-#include <BOPDS_ListIteratorOfListOfPassKeyBoolean.hxx>
+#include <BOPDS_Pair.hxx>
+#include <BOPDS_VectorOfPair.hxx>
 #include <BOPCol_PListOfInteger.hxx>
 #include <BOPCol_ListOfInteger.hxx>
 #include <Standard_Boolean.hxx>
 class BOPDS_DS;
 
 
+//! The class BOPDS_SubIterator is used to compute intersections between
+//! bounding boxes of two sub-sets of BRep sub-shapes of arguments
+//! of an operation (see the class BOPDS_DS).
+//! The class provides interface to iterate the pairs of intersected sub-shapes.
 
-//! The class BOPDS_SubIterator is
-//! 1.to compute intersections between two sub-sets of
-//! BRep sub-shapes
-//! of arguments of an operation (see the class BOPDS_DS)
-//! in terms of theirs bounding boxes
-//! 2.provides interface to iterare the pairs of
-//! intersected sub-shapes of given type
 class BOPDS_SubIterator 
 {
 public:
 
   DEFINE_STANDARD_ALLOC
 
-  
-
-  //! Empty contructor
+  //! Empty constructor
   Standard_EXPORT BOPDS_SubIterator();
-Standard_EXPORT virtual ~BOPDS_SubIterator();
-  
+  Standard_EXPORT virtual ~BOPDS_SubIterator();
 
-  //! Contructor
+  //! Constructor
   //! theAllocator - the allocator to manage the memory
   Standard_EXPORT BOPDS_SubIterator(const BOPCol_BaseAllocator& theAllocator);
-  
 
-  //! Modifier
-  //! Sets the data structure <pDS> to process
-  Standard_EXPORT void SetDS (const BOPDS_PDS& pDS);
-  
+  //! Sets the data structure <pDS> to process.
+  //! It is used to access the shapes and their bounding boxes.
+  void SetDS (const BOPDS_PDS& pDS)
+  {
+    myDS = pDS;
+  }
 
-  //! Selector
   //! Returns the data structure
-  Standard_EXPORT const BOPDS_DS& DS() const;
-  
+  const BOPDS_DS& DS() const
+  {
+    return *myDS;
+  }
 
-  //! Modifier
-  //! Sets the first set of indices  <theLI> to process
-  Standard_EXPORT void SetSubSet1 (const BOPCol_ListOfInteger& theLI);
-  
+  //! Sets the first set of indices <theLI> to process
+  void SetSubSet1 (const BOPCol_ListOfInteger& theLI)
+  {
+    mySubSet1 = (BOPCol_PListOfInteger)&theLI;
+  }
 
-  //! Selector
   //! Returns the first set of indices to process
-  Standard_EXPORT const BOPCol_ListOfInteger& SubSet1() const;
-  
+  const BOPCol_ListOfInteger& SubSet1() const
+  {
+    return *mySubSet1;
+  }
 
-  //! Modifier
-  //! Sets the second set of indices  <theLI> to process
-  Standard_EXPORT void SetSubSet2 (const BOPCol_ListOfInteger& theLI);
-  
+  //! Sets the second set of indices <theLI> to process
+  void SetSubSet2 (const BOPCol_ListOfInteger& theLI)
+  {
+    mySubSet2 = (BOPCol_PListOfInteger)&theLI;
+  }
 
-  //! Selector
   //! Returns the second set of indices to process
-  Standard_EXPORT const BOPCol_ListOfInteger& SubSet2() const;
-  
+  const BOPCol_ListOfInteger& SubSet2() const
+  {
+    return *mySubSet2;
+  }
 
-  //! Initializes the  iterator
+  //! Initializes the iterator
   Standard_EXPORT void Initialize();
-  
 
-  //! Returns  true if still there are pairs
-  //! of intersected shapes
-  Standard_EXPORT Standard_Boolean More() const;
-  
+  //! Returns true if there are more pairs of intersected shapes
+  Standard_Boolean More() const
+  {
+    return myIterator.More();
+  }
 
   //! Moves iterations ahead
-  Standard_EXPORT void Next();
-  
+  void Next()
+  {
+    myIterator.Next();
+  }
 
   //! Returns indices (DS) of intersected shapes
   //! theIndex1 - the index of the first shape
   //! theIndex2 - the index of the second shape
   Standard_EXPORT void Value (Standard_Integer& theIndex1, Standard_Integer& theIndex2) const;
-  
 
   //! Perform the intersection algorithm and prepare
   //! the results to be used
   Standard_EXPORT virtual void Prepare();
 
-
-
+  //! Returns the number of interfering pairs
+  Standard_Integer ExpectedLength() const
+  {
+    return myList.Extent();
+  }
 
 protected:
 
-  
+  //! Performs intersection of bounding boxes
   Standard_EXPORT virtual void Intersect();
 
-
   BOPCol_BaseAllocator myAllocator;
   BOPDS_PDS myDS;
-  BOPDS_ListOfPassKeyBoolean myList;
-  BOPDS_ListIteratorOfListOfPassKeyBoolean myIterator;
+  BOPDS_VectorOfPair myList;
+  BOPDS_VectorOfPair::Iterator myIterator;
   BOPCol_PListOfInteger mySubSet1;
   BOPCol_PListOfInteger mySubSet2;
 
-
 private:
 
-
-
-
-
 };
 
-
-
-
-
-
-
 #endif // _BOPDS_SubIterator_HeaderFile
diff --git a/src/BOPDS/BOPDS_VectorOfPair.hxx b/src/BOPDS/BOPDS_VectorOfPair.hxx
new file mode 100644 (file)
index 0000000..5609f49
--- /dev/null
@@ -0,0 +1,23 @@
+// Created by: Eugeny MALTCHIKOV
+// Copyright (c) 2017 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 BOPDS_VectorOfPair_HeaderFile
+#define BOPDS_VectorOfPair_HeaderFile
+
+#include <BOPCol_NCVector.hxx>
+#include <BOPDS_Pair.hxx>
+
+typedef BOPCol_NCVector<BOPDS_Pair> BOPDS_VectorOfPair;
+
+#endif
diff --git a/src/BOPDS/BOPDS_VectorOfVectorOfPair.hxx b/src/BOPDS/BOPDS_VectorOfVectorOfPair.hxx
new file mode 100644 (file)
index 0000000..f50fa0a
--- /dev/null
@@ -0,0 +1,23 @@
+// Created by: Eugeny MALTCHIKOV
+// Copyright (c) 2017 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 BOPDS_VectorOfVectorOfPair_HeaderFile
+#define BOPDS_VectorOfVectorOfPair_HeaderFile
+
+#include <BOPCol_NCVector.hxx>
+#include <BOPDS_VectorOfPair.hxx>
+
+typedef BOPCol_NCVector<BOPDS_VectorOfPair> BOPDS_VectorOfVectorOfPair;
+
+#endif
index 2ed0f45834b512a9282f012728f6f207d07b654c..01380eb0c3dff689d31b38d1e0665dd3345501aa 100644 (file)
@@ -79,3 +79,8 @@ BOPDS_VectorOfListOfPaveBlock.hxx
 BOPDS_VectorOfPave.hxx
 BOPDS_VectorOfPoint.hxx
 BOPDS_VectorOfShapeInfo.hxx
+BOPDS_Pair.hxx
+BOPDS_PairMapHasher.hxx
+BOPDS_MapOfPair.hxx
+BOPDS_VectorOfPair.hxx
+BOPDS_VectorOfVectorOfPair.hxx
index f9780a06a04f3c5d3982f3494954ce95373de871..69655acaa9ade31ecc71e4666b4e0634b5187697 100644 (file)
@@ -18,7 +18,7 @@
 #include <BOPAlgo_CheckResult.hxx>
 #include <BOPCol_ListOfShape.hxx>
 #include <BOPDS_DS.hxx>
-#include <BOPDS_MapOfPassKey.hxx>
+#include <BOPDS_MapOfPair.hxx>
 #include <BOPTest.hxx>
 #include <BOPTest_Objects.hxx>
 #include <BOPTools_AlgoTools.hxx>
@@ -207,7 +207,7 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
   TopAbs_ShapeEnum aType1, aType2;
   BOPAlgo_CheckerSI aChecker;
   BOPCol_ListOfShape aLS;
-  BOPDS_MapIteratorMapOfPassKey aItMPK;
+  BOPDS_MapIteratorOfMapOfPair aItMPK;
   //
   if (aLevel < (aNbInterfTypes-1)) {
     di << "Info:\nThe level of check is set to " 
@@ -239,7 +239,7 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
   //
   const BOPDS_DS& aDS=*(aChecker.PDS());
   //
-  const BOPDS_MapOfPassKey& aMPK=aDS.Interferences();
+  const BOPDS_MapOfPair& aMPK=aDS.Interferences();
   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   using namespace std;
   vector <BOPTest_Interf> aVec;
@@ -248,8 +248,8 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
   //
   aItMPK.Initialize(aMPK);
   for (; aItMPK.More(); aItMPK.Next()) {
-    const BOPDS_PassKey& aPK=aItMPK.Value();
-    aPK.Ids(n1, n2);
+    const BOPDS_Pair& aPK=aItMPK.Value();
+    aPK.Indices(n1, n2);
     if(aDS.IsNewShape(n1) || aDS.IsNewShape(n2)) {
       continue;
     }
index 943470142e7838ed864cf12b021bef93f46e6c6e..9e94ea4b459109ffd6bd3817b8009ec8137903cc 100644 (file)
@@ -235,7 +235,6 @@ Standard_Integer bopiterator (Draw_Interpretor& di,
     return 1;
   }
   //
-  Standard_Boolean bFlag;
   Standard_Integer n1, n2;
   char buf[64], aST1[10], aST2[10];
   BOPDS_Iterator aIt;
@@ -252,12 +251,12 @@ Standard_Integer bopiterator (Draw_Interpretor& di,
     for (i = 0; i < 4; ++i) {
       GetNameByType(aT[i], aST1);
       //
-      for (j = 0; j < 4; ++j) {
+      for (j = i; j < 4; ++j) {
         GetNameByType(aT[j], aST2);
         //
         aIt.Initialize(aT[i], aT[j]);
         for (; aIt.More(); aIt.Next()) {
-          aIt.Value(n1, n2, bFlag);
+          aIt.Value(n1, n2);
           //
           Sprintf(buf, "%s/%s: (z%d z%d)\n", aST1, aST2, n1, n2);
           di << buf;
@@ -276,7 +275,7 @@ Standard_Integer bopiterator (Draw_Interpretor& di,
     //
     aIt.Initialize(aT1, aT2);
     for (; aIt.More(); aIt.Next()) {
-      aIt.Value(n1, n2, bFlag);
+      aIt.Value(n1, n2);
       //
       Sprintf(buf, "%s/%s: (z%d z%d)\n", aST1, aST2, n1, n2);
       di << buf;
index 5e211c510b4b327a274c78c3d1e18f958c2cfa12..57037f721bca70c1cc697a19642e5862ed60b89a 100644 (file)
@@ -1,8 +1,6 @@
 # test script on make volume operation
 # cylinder plane unstable
 
-puts "TODO OCC26020 ALL: Error: bopcheck failed"
-
 # planar face 
 plane pln_f1 0 -232.5 3.8857805861880479e-015 0 -1 -1.1102230246251565e-016
 erase pln_f1
index 5e4145989cb318fb91ae82274c1c09b6470cc88f..79669dfda5de55e59551c14677c0980ea801c771 100755 (executable)
@@ -22,7 +22,7 @@ puts "Start boolean operation ..."
 bopsection result
 puts "Finish boolean operation ..."
 
-checkprops result -l 3384.97
+checkprops result -l 3356.31
 checkshape result
 checksection result
 checknbshapes result -vertex 1197 -edge 1182 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 2380
diff --git a/tests/bugs/modalg_6/bug28284_1 b/tests/bugs/modalg_6/bug28284_1
new file mode 100644 (file)
index 0000000..c2c0142
--- /dev/null
@@ -0,0 +1,26 @@
+puts "========"
+puts "OCC28284"
+puts "========"
+puts ""
+#################################################
+# Avoid classification of sub-shapes of arguments of BOPs relatively solids during Intersection phase
+#################################################
+
+restore [locate_data_file bug28284.brep] b1
+plane p 0 9000 0 0 1 0
+mkface f p -1.e+6 1.e+6 -1.e+6 1.e+6
+halfspace b2 f 0 0 0
+
+bop b1 b2
+
+bopcommon result1
+checkshape result1
+checknbshapes result1 -solid 1
+checkprops result1 -s 5.828e+007 -v 5.50235e+008
+
+bopcut result
+checkshape result
+checknbshapes result -solid 1
+checkprops result -s 247149 -v 1.81425e+006
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
diff --git a/tests/bugs/modalg_6/bug28284_2 b/tests/bugs/modalg_6/bug28284_2
new file mode 100644 (file)
index 0000000..b981200
--- /dev/null
@@ -0,0 +1,26 @@
+puts "========"
+puts "OCC28284"
+puts "========"
+puts ""
+#################################################
+# Avoid classification of sub-shapes of arguments of BOPs relatively solids during Intersection phase
+#################################################
+
+restore [locate_data_file bug28284_1.brep] b1
+plane p 0 9000 0 0 1 0
+mkface f p -1.e+6 1.e+6 -1.e+6 1.e+6
+halfspace b2 f 0 0 0
+
+bop b1 b2
+
+bopcommon result1
+checkshape result1
+checknbshapes result1 -solid 1
+checkprops result1 -s 2.58352e+007 -v 2.43418e+008
+
+bopcut result
+checkshape result
+checknbshapes result -solid 1
+checkprops result -s 247149 -v 1.81425e+006
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
\ No newline at end of file
diff --git a/tests/bugs/modalg_6/bug28284_3 b/tests/bugs/modalg_6/bug28284_3
new file mode 100644 (file)
index 0000000..443eea9
--- /dev/null
@@ -0,0 +1,27 @@
+puts "========"
+puts "OCC28284"
+puts "========"
+puts ""
+#################################################
+# Avoid classification of sub-shapes of arguments of BOPs relatively solids during Intersection phase
+#################################################
+
+box b1 10 10 10
+
+explode b1 sh
+shape b2 So
+add b1_1 b2
+
+bop b1 b2
+
+bopcommon rcom
+checknbshapes rcom -solid 1
+
+bopfuse rfuse
+checknbshapes rfuse -solid 1
+
+bopcut rcut
+checknbshapes rcut -solid 0
+
+boptuc rtuc
+checknbshapes rcut -solid 0
\ No newline at end of file