0024933: Inconsistent results of self-interferences checker in SALOME and DRAW Applic...
authorpkv <pkv@opencascade.com>
Thu, 22 May 2014 13:24:17 +0000 (17:24 +0400)
committerapn <apn@opencascade.com>
Thu, 22 May 2014 13:25:13 +0000 (17:25 +0400)
class BOPAlgo_CheckerSI
   - methods:
void BOPAlgo_CheckerSI::Perform()

class BOPAlgo_ArgumentAnalyzer
   - methods:
void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()

The changes have been done to provide the consistence
between results in SALOME Application and DRAW Application

The sytax of the command "bopcheck" has been changed:
bopcheck Shape [level of check: 0 - 9] [-t -s]
The options:
 -t - display elapsed CPU time
 -s - run in serial (non-parallel) mode. The default mode is parallel.

Modified test cases bugs/modalg_5/bug24029 and bugs/modalg_5/bug24764 according to changed output format of the "bopcheck" command.

src/BOPAlgo/BOPAlgo_ArgumentAnalyzer.cxx
src/BOPAlgo/BOPAlgo_CheckerSI.cxx
src/BOPTest/BOPTest_CheckCommands.cxx
src/BOPTest/BOPTest_Chronometer.hxx [new file with mode: 0644]
src/BOPTest/BOPTest_PartitionCommands.cxx
src/BOPTest/FILES
tests/bugs/modalg_5/bug24029
tests/bugs/modalg_5/bug24764

index 3326863..113d41c 100644 (file)
 
 #include <Standard_ErrorHandler.hxx>
 #include <Standard_Failure.hxx>
 
 #include <Standard_ErrorHandler.hxx>
 #include <Standard_Failure.hxx>
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
-#include <BRepExtrema_DistShapeShape.hxx>
+
+#include <TColStd_Array2OfBoolean.hxx>
+
 #include <gp_Pnt.hxx>
 #include <gp_Pnt.hxx>
+
+#include <Geom_Surface.hxx>
+
 #include <TopoDS_Iterator.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Iterator.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Wire.hxx>
 #include <TopoDS_Shell.hxx>
 #include <TopoDS_Solid.hxx>
 #include <TopoDS_Wire.hxx>
 #include <TopoDS_Shell.hxx>
 #include <TopoDS_Solid.hxx>
+
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+
+#include <BRepExtrema_DistShapeShape.hxx>
+//
 #include <BOPCol_ListOfShape.hxx>
 #include <BOPCol_SequenceOfShape.hxx>
 #include <BOPCol_MapOfShape.hxx>
 
 #include <BOPCol_ListOfShape.hxx>
 #include <BOPCol_SequenceOfShape.hxx>
 #include <BOPCol_MapOfShape.hxx>
 
-#include <TColStd_Array2OfBoolean.hxx>
-
 #include <IntTools_Range.hxx>
 #include <IntTools_EdgeEdge.hxx>
 #include <IntTools_CommonPrt.hxx>
 
 #include <IntTools_Range.hxx>
 #include <IntTools_EdgeEdge.hxx>
 #include <IntTools_CommonPrt.hxx>
 
-#include <BOPAlgo_Operation.hxx>
-#include <BOPAlgo_CheckerSI.hxx>
-#include <BOPAlgo_BuilderFace.hxx>
-
-#include <BOPDS_DS.hxx>
-#include <BOPDS_VectorOfInterfVV.hxx>
-#include <BOPDS_VectorOfInterfVE.hxx>
-#include <BOPDS_VectorOfInterfEE.hxx>
-#include <BOPDS_VectorOfInterfVF.hxx>
-#include <BOPDS_VectorOfInterfEF.hxx>
-#include <BOPDS_VectorOfInterfFF.hxx>
-
 #include <BOPInt_Context.hxx>
 
 #include <BOPTools_AlgoTools3D.hxx>
 #include <BOPTools_AlgoTools.hxx>
 #include <BOPInt_Context.hxx>
 
 #include <BOPTools_AlgoTools3D.hxx>
 #include <BOPTools_AlgoTools.hxx>
-#include <BOPCol_ListOfShape.hxx>
-#include <Geom_Surface.hxx>
+
+#include <BOPDS_DS.hxx>
+#include <BOPDS_MapOfPassKey.hxx>
+
+#include <BOPAlgo_Operation.hxx>
+#include <BOPAlgo_CheckerSI.hxx>
+#include <BOPAlgo_BuilderFace.hxx>
 
 // ================================================================================
 // function: Constructor
 
 // ================================================================================
 // function: Constructor
@@ -302,145 +303,57 @@ void BOPAlgo_ArgumentAnalyzer::TestTypes()
 //=======================================================================
 void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
 {
 //=======================================================================
 void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
 {
-  Standard_Integer ii=0, j;
-  Standard_Boolean bSelfInt;
-
+  Standard_Integer ii;
+  //
   for(ii = 0; ii < 2; ii++) {
     const TopoDS_Shape& aS = (ii == 0) ? myShape1 : myShape2;
   for(ii = 0; ii < 2; ii++) {
     const TopoDS_Shape& aS = (ii == 0) ? myShape1 : myShape2;
-
     if(aS.IsNull()) {
       continue;
     }
     if(aS.IsNull()) {
       continue;
     }
-
+    //
     Standard_Boolean bIsEmpty = (ii == 0) ? myEmpty1 : myEmpty2;
     if (bIsEmpty) {
       continue;
     }
     Standard_Boolean bIsEmpty = (ii == 0) ? myEmpty1 : myEmpty2;
     if (bIsEmpty) {
       continue;
     }
-
-    BOPAlgo_CheckerSI aChecker;
+    //
+    Standard_Integer iErr, n1, n2;
+    BOPDS_MapIteratorMapOfPassKey aItMPK;
     BOPCol_ListOfShape anArgs;
     BOPCol_ListOfShape anArgs;
+    BOPAlgo_CheckerSI aChecker;
     //
     anArgs.Append(aS);
     aChecker.SetArguments(anArgs);
     //
     aChecker.Perform();
     //
     anArgs.Append(aS);
     aChecker.SetArguments(anArgs);
     //
     aChecker.Perform();
-    Standard_Integer iErr = aChecker.ErrorStatus();
+    iErr=aChecker.ErrorStatus();
     //
     //
-    const BOPDS_PDS& theDS = aChecker.PDS();
-    BOPDS_VectorOfInterfVV& aVVs=theDS->InterfVV();
-    BOPDS_VectorOfInterfVE& aVEs=theDS->InterfVE();
-    BOPDS_VectorOfInterfEE& aEEs=theDS->InterfEE();
-    BOPDS_VectorOfInterfVF& aVFs=theDS->InterfVF();
-    BOPDS_VectorOfInterfEF& aEFs=theDS->InterfEF();
-    BOPDS_VectorOfInterfFF& aFFs=theDS->InterfFF();
-    BOPDS_VectorOfInterfVZ& aVZs=theDS->InterfVZ();
-    BOPDS_VectorOfInterfEZ& aEZs=theDS->InterfEZ();
-    BOPDS_VectorOfInterfFZ& aFZs=theDS->InterfFZ();
-    BOPDS_VectorOfInterfZZ& aZZs=theDS->InterfZZ();
+    const BOPDS_DS& aDS=*(aChecker.PDS());
+    const BOPDS_MapOfPassKey& aMPK=aDS.Interferences();
     //
     //
-    Standard_Integer aNbTypeInt, aTypeInt, i, nI1, nI2;
-    Standard_Integer aNb[] = {
-      aVVs.Extent(), aVEs.Extent(), aEEs.Extent(), 
-      aVFs.Extent(), aEFs.Extent(), aFFs.Extent(),
-      aVZs.Extent(), aEZs.Extent(), aFZs.Extent(), 
-      aZZs.Extent()
-    };
-    //
-    BOPDS_Interf* aInt=NULL;
-    //
-    aNbTypeInt=BOPDS_DS::NbInterfTypes();
-    for (aTypeInt = 0; aTypeInt < aNbTypeInt; ++aTypeInt) {
-      for (i = 0; i < aNb[aTypeInt]; ++i) {
-        switch(aTypeInt) {
-        case 0:
-          aInt=(BOPDS_Interf*)(&aVVs(i));
-          break;
-        case 1:
-          aInt=(BOPDS_Interf*)(&aVEs(i));
-          break;
-        case 2:
-          aInt=(BOPDS_Interf*)(&aEEs(i));
-          break;
-        case 3:
-          aInt=(BOPDS_Interf*)(&aVFs(i));
-          break;
-        case 4:
-          aInt=(BOPDS_Interf*)(&aEFs(i));
-          break;
-        case 5:
-          aInt=(BOPDS_Interf*)(&aFFs(i));
-          break;
-        case 6:
-          aInt=(BOPDS_Interf*)(&aVZs(i));
-          break;
-        case 7:
-          aInt=(BOPDS_Interf*)(&aEZs(i));
-          break;
-        case 8:
-          aInt=(BOPDS_Interf*)(&aFZs(i));
-          break;
-        case 9:
-          aInt=(BOPDS_Interf*)(&aZZs(i));
-          break;
-        default:
-          aInt=NULL;
-        }
-        //
-        aInt->Indices(nI1, nI2);
-        if (nI1 == nI2) {
-          continue;
-        } 
-        if (theDS->IsNewShape(nI1) || theDS->IsNewShape(nI2)) {
-          continue;
-        }
-        //
-        if (aTypeInt == 4) {
-          BOPDS_InterfEF& aEF=aEFs(i);
-          if (aEF.CommonPart().Type()==TopAbs_SHAPE) {
-            continue;
-          }
-        }
-        //
-        const TopoDS_Shape& aS1 = theDS->Shape(nI1);
-        const TopoDS_Shape& aS2 = theDS->Shape(nI2);
-        //
-        if (aTypeInt == 5) {
-          bSelfInt = Standard_False;
-          BOPDS_InterfFF& aFF = aFFs(i);
-          BOPDS_VectorOfPoint& aVP=aFF.ChangePoints();
-          Standard_Integer aNbP=aVP.Extent();
-          BOPDS_VectorOfCurve& aVC=aFF.ChangeCurves();
-          Standard_Integer aNbC=aVC.Extent();
-          if (!aNbP && !aNbC) {
-            continue;
-          }
-          for (j=0; j<aNbC; ++j) {
-            BOPDS_Curve& aNC=aVC(j);
-            BOPDS_ListOfPaveBlock& aLPBC=aNC.ChangePaveBlocks();
-            if (aLPBC.Extent()) {
-              bSelfInt = Standard_True;
-              break;
-            }
-          }
-          if (!bSelfInt) {
-            continue;
-          }
-        }
-        //
-        BOPAlgo_CheckResult aResult;
-        if(ii == 0) {
-          aResult.SetShape1(myShape1);
-          aResult.AddFaultyShape1(aS1);
-          aResult.AddFaultyShape1(aS2);
-        }
-        else {
-          aResult.SetShape2(myShape2);
-          aResult.AddFaultyShape2(aS1);
-          aResult.AddFaultyShape2(aS2);
-        }
-        aResult.SetCheckStatus(BOPAlgo_SelfIntersect);
-        myResult.Append(aResult);
+    aItMPK.Initialize(aMPK);
+    for (; aItMPK.More(); aItMPK.Next()) {
+      const BOPDS_PassKey& aPK=aItMPK.Value();
+      aPK.Ids(n1, n2);
+      if(aDS.IsNewShape(n1) || aDS.IsNewShape(n2)) {
+        continue;
+      }
+      //
+      const TopoDS_Shape& aS1=aDS.Shape(n1);
+      const TopoDS_Shape& aS2=aDS.Shape(n2);
+      //
+      BOPAlgo_CheckResult aResult;
+      if(ii == 0) {
+        aResult.SetShape1(myShape1);
+        aResult.AddFaultyShape1(aS1);
+        aResult.AddFaultyShape1(aS2);
       }
       }
+      else {
+        aResult.SetShape2(myShape2);
+        aResult.AddFaultyShape2(aS1);
+        aResult.AddFaultyShape2(aS2);
+      }
+      aResult.SetCheckStatus(BOPAlgo_SelfIntersect);
+      myResult.Append(aResult);
     }
     //
     if (iErr) {
     }
     //
     if (iErr) {
@@ -456,7 +369,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
       aResult.SetCheckStatus(BOPAlgo_OperationAborted);
       myResult.Append(aResult);
     }
       aResult.SetCheckStatus(BOPAlgo_OperationAborted);
       myResult.Append(aResult);
     }
-  }
+  }// for(ii = 0; ii < 2; ii++) {
 }
 // ================================================================================
 // function: TestSmallEdge
 }
 // ================================================================================
 // function: TestSmallEdge
index c6aa133..859b5c9 100644 (file)
@@ -126,6 +126,8 @@ void BOPAlgo_CheckerSI::Init()
 void BOPAlgo_CheckerSI::Perform()
 {
   try {
 void BOPAlgo_CheckerSI::Perform()
 {
   try {
+    Standard_Integer iErr;
+    //
     OCC_CATCH_SIGNALS
     //
     myErrorStatus=0;
     OCC_CATCH_SIGNALS
     //
     myErrorStatus=0;
@@ -142,37 +144,43 @@ void BOPAlgo_CheckerSI::Perform()
     }
     //
     BOPAlgo_PaveFiller::Perform();
     }
     //
     BOPAlgo_PaveFiller::Perform();
+    iErr=myErrorStatus; 
     //
     //
-    if (!myErrorStatus) {
-      PerformVZ();
+    PerformVZ();
+    if (myErrorStatus) {
+      iErr=myErrorStatus; 
     }
     //
     }
     //
-    if (!myErrorStatus) {
-      PerformEZ();
-    } 
+    PerformEZ();
+    if (myErrorStatus) {
+      iErr=myErrorStatus; 
+    }
     //
     //
-    if (!myErrorStatus) {
-      PerformFZ();
+    PerformFZ();
+    if (myErrorStatus) {
+      iErr=myErrorStatus; 
     }
     //
     }
     //
-    if (!myErrorStatus) {
-      PerformZZ();
+    PerformZZ();
+    if (myErrorStatus) {
+      iErr=myErrorStatus; 
     }
     // 
     }
     // 
-    if (!myErrorStatus) {
-      PostTreat();
+    PostTreat();
+    if (myErrorStatus) {
+      iErr=myErrorStatus; 
     }
     //
     if (myNonDestructive) {
     }
     //
     if (myNonDestructive) {
-      Standard_Integer iErr;
-      //
-      iErr=myErrorStatus; 
-      //
       PostTreatCopy();
       PostTreatCopy();
-      if (!myErrorStatus) {
-        myErrorStatus=iErr;
+      if (myErrorStatus) {
+        iErr=myErrorStatus; 
       }
     }
       }
     }
+    //
+    if (iErr) {
+      myErrorStatus=iErr;
+    }
   }
   //
   catch (Standard_Failure) {
   }
   //
   catch (Standard_Failure) {
@@ -183,7 +191,6 @@ void BOPAlgo_CheckerSI::Perform()
     myErrorStatus=11;
   }
 }
     myErrorStatus=11;
   }
 }
-
 //=======================================================================
 //function : PostTreat
 //purpose  : 
 //=======================================================================
 //function : PostTreat
 //purpose  : 
index c93f5f8..c724cd5 100644 (file)
 // commercial license or contractual agreement.
 
 #include <BOPTest.ixx>
 // commercial license or contractual agreement.
 
 #include <BOPTest.ixx>
-#include <TCollection_AsciiString.hxx>
 
 
-#include <gp_Pnt.hxx>
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+#include <TCollection_AsciiString.hxx>
 
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Compound.hxx>
 #include <BRep_Builder.hxx>
 
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Compound.hxx>
 #include <BRep_Builder.hxx>
+#include <BRepBuilderAPI_Copy.hxx>
 
 #include <DBRep.hxx>
 
 #include <DBRep.hxx>
-
-#include <Geom_Geometry.hxx>
-#include <Geom_CartesianPoint.hxx>
-
 #include <Draw.hxx>
 #include <Draw.hxx>
-#include <DrawTrSurf.hxx>
-
-#include <BRepBuilderAPI_Copy.hxx>
 
 #include <BOPCol_ListOfShape.hxx>
 
 #include <BOPDS_DS.hxx>
 
 #include <BOPCol_ListOfShape.hxx>
 
 #include <BOPDS_DS.hxx>
+#include <BOPDS_MapOfPassKey.hxx>
 
 #include <BOPAlgo_CheckerSI.hxx>
 
 #include <BOPAlgo_CheckerSI.hxx>
-#include <BOPDS_VectorOfInterfVV.hxx>
-#include <BOPDS_VectorOfInterfVE.hxx>
-#include <BOPDS_VectorOfInterfEE.hxx>
-#include <BOPDS_VectorOfInterfVF.hxx>
-#include <BOPDS_VectorOfInterfEF.hxx>
-#include <BOPDS_VectorOfInterfFF.hxx>
-#include <BOPDS_VectorOfInterfVZ.hxx>
-#include <BOPDS_VectorOfInterfEZ.hxx>
-#include <BOPDS_VectorOfInterfFZ.hxx>
-#include <BOPDS_VectorOfInterfZZ.hxx>
-
 #include <BOPAlgo_ArgumentAnalyzer.hxx>
 #include <BOPAlgo_CheckResult.hxx>
 
 #include <BOPAlgo_ArgumentAnalyzer.hxx>
 #include <BOPAlgo_CheckResult.hxx>
 
+#include <BOPTest_Chronometer.hxx>
+//
 static 
 static 
-  Standard_Integer bopcheck (Draw_Interpretor&, Standard_Integer, const char** );
-
-static 
-  Standard_Integer bopargcheck (Draw_Interpretor&, Standard_Integer, const char** );
+  void MakeShapeForFullOutput (const TCollection_AsciiString&,
+                               const Standard_Integer,
+                               const BOPCol_ListOfShape&,
+                               Standard_Integer& ,
+                               Draw_Interpretor&);
 //
 //
+static Standard_Integer bopcheck   (Draw_Interpretor&, Standard_Integer, const char** );
+static Standard_Integer bopargcheck(Draw_Interpretor&, Standard_Integer, const char** );
 
 //=======================================================================
 //function : CheckCommands
 //purpose  : 
 //=======================================================================
 
 //=======================================================================
 //function : CheckCommands
 //purpose  : 
 //=======================================================================
-  void  BOPTest::CheckCommands(Draw_Interpretor& theCommands)
+void  BOPTest::CheckCommands(Draw_Interpretor& theCommands)
 {
   static Standard_Boolean done = Standard_False;
   if (done) 
 {
   static Standard_Boolean done = Standard_False;
   if (done) 
@@ -78,16 +70,71 @@ static
                   "Use bopargcheck without parameters to get ",  
                   __FILE__, bopargcheck, g);
 }
                   "Use bopargcheck without parameters to get ",  
                   __FILE__, bopargcheck, g);
 }
-
+//=======================================================================
+//class    : BOPTest_Interf
+//purpose  : Auxiliary class
+//=======================================================================
+class BOPTest_Interf {
+ public:
+  BOPTest_Interf() : myIndex1(-1), myIndex2(-1), myType(-1) {
+  }
+  //
+  ~BOPTest_Interf() {
+  }
+  //
+  void SetIndices(const Standard_Integer theIndex1,
+                  const Standard_Integer theIndex2) {
+    myIndex1=theIndex1; 
+    myIndex2=theIndex2; 
+  }
+  //
+  void Indices(Standard_Integer& theIndex1,
+               Standard_Integer& theIndex2) const {
+    theIndex1=myIndex1; 
+    theIndex2=myIndex2; 
+  }
+  //
+  void SetType(const Standard_Integer theType) {
+    myType=theType;
+  }
+  //
+  Standard_Integer Type() const {
+    return myType;
+  }
+  //
+  bool operator < (const  BOPTest_Interf& aOther) const {
+    bool bFlag;
+    //
+    if (myType==aOther.myType) {
+      if (myIndex1 == aOther.myIndex1) {
+        bFlag=(myIndex2 < aOther.myIndex2);
+      }
+      else {
+        bFlag=(myIndex1 < aOther.myIndex1);
+      }
+    }
+    else {
+      bFlag=(myType < aOther.myType);
+    }
+    //
+    return bFlag;
+  }
+  //
+ protected:
+  Standard_Integer myIndex1;
+  Standard_Integer myIndex2;
+  Standard_Integer myType;
+};
 //=======================================================================
 //function : bopcheck
 //purpose  : 
 //=======================================================================
 //=======================================================================
 //function : bopcheck
 //purpose  : 
 //=======================================================================
-Standard_Integer bopcheck 
-  (Draw_Interpretor& di, Standard_Integer n,  const char** a )
+Standard_Integer bopcheck (Draw_Interpretor& di, 
+                           Standard_Integer n,  
+                           const char** a )
 {
   if (n<2) {
 {
   if (n<2) {
-    di << " Use >bopcheck Shape [level of check: 0 - 9" << "\n";
+    di << " Use > bopcheck Shape [level of check: 0 - 9] [-t -s]" << "\n";
     di << " The level of check defines "; 
     di << " which interferences will be checked:\n";
     di << " 0 - V/V only\n"; 
     di << " The level of check defines "; 
     di << " which interferences will be checked:\n";
     di << " 0 - V/V only\n"; 
@@ -110,28 +157,53 @@ Standard_Integer bopcheck
     return 1;
   }
   //
     return 1;
   }
   //
-  Standard_Integer theLevelOfCheck, aNbInterfTypes;
+  Standard_Boolean bRunParallel, bShowTime;
+  Standard_Integer i, aLevel, aNbInterfTypes;
   //
   aNbInterfTypes=BOPDS_DS::NbInterfTypes();
   //
   //
   aNbInterfTypes=BOPDS_DS::NbInterfTypes();
   //
-  theLevelOfCheck = (n==3) ? Draw::Atoi(a[2]) : aNbInterfTypes-1;
-  if (theLevelOfCheck > aNbInterfTypes-1) {
+  aLevel=aNbInterfTypes-1;
+  //
+  if (n>2) {
+    aLevel=Draw::Atoi(a[2]); 
+  }
+  //
+  if (aLevel < 0 || aLevel > aNbInterfTypes-1) {
     di << "Invalid level";
     return 1;
   }
     di << "Invalid level";
     return 1;
   }
+  //
+  bShowTime=Standard_False;
+  bRunParallel=Standard_True;
+  for (i=3; i<n; ++i) {
+    if (!strcmp(a[i], "-s")) {
+      bRunParallel=Standard_False;
+    }
+    else if (!strcmp(a[i], "-t")) {
+      bShowTime=Standard_True;
+    }
+  }
+  //
+  //aLevel = (n==3) ? Draw::Atoi(a[2]) : aNbInterfTypes-1;
   //-------------------------------------------------------------------
   //-------------------------------------------------------------------
-  char buf[256];
-  char type[10][4] = {
+  char buf[256], aName1[32], aName2[32];
+  char aInterfTypes[10][4] = {
     "V/V", "V/E", "E/E","V/F", "E/F", "F/F", "V/Z", "E/Z", "F/Z", "Z/Z"
   };
     "V/V", "V/E", "E/E","V/F", "E/F", "F/F", "V/Z", "E/Z", "F/Z", "Z/Z"
   };
-  Standard_Integer iErr, aTypeInt, i, ind, j, nI1, nI2;
-  Standard_Boolean bSelfInt, bFFInt;
   //
   //
-  if (theLevelOfCheck >= 0 && theLevelOfCheck < (aNbInterfTypes-1)) {
+  Standard_Integer iErr, iCnt, n1, n2, iT;
+  TopAbs_ShapeEnum aType1, aType2;
+  BOPAlgo_CheckerSI aChecker;
+  BOPCol_ListOfShape aLS;
+  BOPDS_MapIteratorMapOfPassKey aItMPK;
+  BOPTime_Chronometer aChrono;
+  //
+  if (aLevel < (aNbInterfTypes-1)) {
     di << "Info:\nThe level of check is set to " 
     di << "Info:\nThe level of check is set to " 
-      << type[theLevelOfCheck] << ", i.e. intersection(s)\n";
-    for (i=theLevelOfCheck+1; i<aNbInterfTypes; ++i) {
-      di << type[i];
+      << aInterfTypes[aLevel] << ", i.e. intersection(s)\n";
+    
+    for (i=aLevel+1; i<aNbInterfTypes; ++i) {
+      di << aInterfTypes[i];
       if (i<aNbInterfTypes-1) {
         di << ", ";
       }
       if (i<aNbInterfTypes-1) {
         di << ", ";
       }
@@ -139,138 +211,78 @@ Standard_Integer bopcheck
     di << " will not be checked.\n\n";
   }
   //
     di << " will not be checked.\n\n";
   }
   //
-  BOPAlgo_CheckerSI aChecker;
-  BOPCol_ListOfShape anArgs;
+  aLS.Append(aS);
+  aChecker.SetArguments(aLS);
+  aChecker.SetLevelOfCheck(aLevel);
+  aChecker.SetRunParallel(bRunParallel);
   //
   //
-  anArgs.Append(aS);
-  aChecker.SetArguments(anArgs);
-  aChecker.SetLevelOfCheck(theLevelOfCheck);
+  aChrono.Start();
   //
   aChecker.Perform();
   //
   aChecker.Perform();
-  iErr = aChecker.ErrorStatus();
   //
   //
-  const BOPDS_PDS& theDS = aChecker.PDS();
-  BOPDS_VectorOfInterfVV& aVVs=theDS->InterfVV();
-  BOPDS_VectorOfInterfVE& aVEs=theDS->InterfVE();
-  BOPDS_VectorOfInterfEE& aEEs=theDS->InterfEE();
-  BOPDS_VectorOfInterfVF& aVFs=theDS->InterfVF();
-  BOPDS_VectorOfInterfEF& aEFs=theDS->InterfEF();
-  BOPDS_VectorOfInterfFF& aFFs=theDS->InterfFF();
-  BOPDS_VectorOfInterfVZ& aVZs=theDS->InterfVZ();
-  BOPDS_VectorOfInterfEZ& aEZs=theDS->InterfEZ();
-  BOPDS_VectorOfInterfFZ& aFZs=theDS->InterfFZ();
-  BOPDS_VectorOfInterfZZ& aZZs=theDS->InterfZZ();
+  aChrono.Stop();
   //
   //
-  Standard_Integer aNb[] ={
-    aVVs.Extent(), aVEs.Extent(), aEEs.Extent(), 
-    aVFs.Extent(), aEFs.Extent(), aFFs.Extent(),
-    aVZs.Extent(), aEZs.Extent(), aFZs.Extent(), 
-    aZZs.Extent(),
-  };
+  iErr=aChecker.ErrorStatus();
   //
   //
-  bSelfInt = Standard_False;
-  ind = 0;
-  for (aTypeInt = 0; aTypeInt < aNbInterfTypes; ++aTypeInt) {
-    
-    for (i = 0; i < aNb[aTypeInt]; ++i) {
-      BOPDS_Interf* aInt=NULL;
-      //
-      switch(aTypeInt) {
-      case 0:
-        aInt=(BOPDS_Interf*)(&aVVs(i));
-        break;
-      case 1:
-        aInt=(BOPDS_Interf*)(&aVEs(i));
-        break;
-      case 2:
-        aInt=(BOPDS_Interf*)(&aEEs(i));
-        break;
-      case 3:
-        aInt=(BOPDS_Interf*)(&aVFs(i));
-        break;
-      case 4:
-        aInt=(BOPDS_Interf*)(&aEFs(i));
-        break;
-      case 5:
-        aInt=(BOPDS_Interf*)(&aFFs(i));
-        break;
-      case 6:
-        aInt=(BOPDS_Interf*)(&aVZs(i));
-        break;
-      case 7:
-        aInt=(BOPDS_Interf*)(&aEZs(i));
-        break;
-      case 8:
-        aInt=(BOPDS_Interf*)(&aFZs(i));
-        break;
-      case 9:
-        aInt=(BOPDS_Interf*)(&aZZs(i));
-        break;
-      default:
-        break;
-      }
-      //
-      nI1 = aInt->Index1();
-      nI2 = aInt->Index2();
-      if (nI1 == nI2) {
-        continue;
-      }
-      //
-      if(theDS->IsNewShape(nI1) || theDS->IsNewShape(nI2)) {
-        continue;
-      }
-      //
-      if (aTypeInt == 4) {
-        BOPDS_InterfEF& aEF=aEFs(i);
-        if (aEF.CommonPart().Type()==TopAbs_SHAPE) {
-          continue;
-        }
-      }
-      //
-      const TopoDS_Shape& aS1 = theDS->Shape(nI1);
-      const TopoDS_Shape& aS2 = theDS->Shape(nI2);
-      //
-      if (aTypeInt == 5) {
-        bFFInt = Standard_False;
-        BOPDS_InterfFF& aFF = aFFs(i);
-        BOPDS_VectorOfPoint& aVP=aFF.ChangePoints();
-        Standard_Integer aNbP=aVP.Extent();
-        BOPDS_VectorOfCurve& aVC=aFF.ChangeCurves();
-        Standard_Integer aNbC=aVC.Extent();
-        if (!aNbP && !aNbC) {
-          continue;
-        }
-        for (j=0; j<aNbC; ++j) {
-          BOPDS_Curve& aNC=aVC(j);
-          BOPDS_ListOfPaveBlock& aLPBC=aNC.ChangePaveBlocks();
-          if (aLPBC.Extent()) {
-            bFFInt = Standard_True;
-            break;
-          }
-        }
-        if (!bFFInt) {
-          continue;
-        }
-      }
-      //
-      di << type[aTypeInt] << ":";
-      //
-      TCollection_AsciiString aBaseName("x");
-      TCollection_AsciiString anumbername(ind);
-      TCollection_AsciiString aXName = aBaseName + anumbername;
-      Standard_CString aname=aXName.ToCString();
-      DBRep::Set (aname, aS1);
-      ++ind;
-      TCollection_AsciiString anumbername1(ind);
-      TCollection_AsciiString aXName1 = aBaseName + anumbername1;
-      Standard_CString aname1=aXName1.ToCString();
-      DBRep::Set (aname1, aS2);
-      ++ind;
-      //
-      Sprintf(buf, "%s, %s \n", aname, aname1);
-      di << buf;
-      bSelfInt = Standard_True;
+  const BOPDS_DS& aDS=*(aChecker.PDS());
+  //
+  const BOPDS_MapOfPassKey& aMPK=aDS.Interferences();
+  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  using namespace std;
+  vector <BOPTest_Interf> aVec;
+  vector <BOPTest_Interf>::iterator aIt;
+  BOPTest_Interf aBInterf;
+  //
+  aItMPK.Initialize(aMPK);
+  for (; aItMPK.More(); aItMPK.Next()) {
+    const BOPDS_PassKey& aPK=aItMPK.Value();
+    aPK.Ids(n1, n2);
+    if(aDS.IsNewShape(n1) || aDS.IsNewShape(n2)) {
+      continue;
+    }
+    //
+    const BOPDS_ShapeInfo& aSI1=aDS.ShapeInfo(n1);
+    const BOPDS_ShapeInfo& aSI2=aDS.ShapeInfo(n2);
+    aType1=aSI1.ShapeType();
+    aType2=aSI2.ShapeType();
+    //
+    iT=BOPDS_Tools::TypeToInteger(aType1, aType2);
+    //
+    aBInterf.SetIndices(n1, n2);
+    aBInterf.SetType(iT);
+    //
+    aVec.push_back(aBInterf);
+  }
+  //
+  sort( aVec.begin(), aVec.end(), less<BOPTest_Interf>());
+  //
+  iCnt=0;
+  for (aIt=aVec.begin(); aIt!=aVec.end(); aIt++) {
+    const BOPTest_Interf& aBI=*aIt;
+    //
+    aBI.Indices(n1, n2);
+    if(aDS.IsNewShape(n1) || aDS.IsNewShape(n2)) {
+      continue;
     }
     }
+    //
+    const TopoDS_Shape& aS1=aDS.Shape(n1);
+    const TopoDS_Shape& aS2=aDS.Shape(n2);
+    //
+    iT=aBI.Type(); 
+    di << aInterfTypes[iT] << ": ";
+    //
+    sprintf(aName1, "x%d", n1);
+    //sprintf(aName1, "x%d", iCnt);
+    DBRep::Set (aName1, aS1);
+    //
+    ++iCnt;
+    sprintf(aName2, "x%d", n2);
+    //sprintf(aName2, "x%d", iCnt);
+    DBRep::Set (aName2, aS2);
+    ++iCnt;
+    //
+    sprintf(buf, "%s %s \n", aName1, aName2);
+    di << buf;
   }
   //
   if (iErr) {
   }
   //
   if (iErr) {
@@ -278,48 +290,25 @@ Standard_Integer bopcheck
     di << "so the list may be incomplete." << "\n";
   }
   //
     di << "so the list may be incomplete." << "\n";
   }
   //
-  if (!bSelfInt) {
+  if (!iCnt) {
     di << " This shape seems to be OK." << "\n";
   }
     di << " This shape seems to be OK." << "\n";
   }
-  return 0;
-}
-
-//=======================================================================
-//function : MakeShapeForFullOutput
-//purpose  : 
-//=======================================================================
-static void MakeShapeForFullOutput
-  (const TCollection_AsciiString & aBaseName,
-   const Standard_Integer          aIndex,
-   const BOPCol_ListOfShape &    aList,
-   Standard_Integer&               aCount,
-   Draw_Interpretor&               di)
-{
-  TCollection_AsciiString aNum(aIndex);
-  TCollection_AsciiString aName = aBaseName + aNum;
-  Standard_CString name = aName.ToCString();
-
-  TopoDS_Compound cmp;
-  BRep_Builder BB;
-  BB.MakeCompound(cmp);
-
-  BOPCol_ListIteratorOfListOfShape anIt(aList);
-  for(; anIt.More(); anIt.Next()) {
-    const TopoDS_Shape & aS = anIt.Value();
-    BB.Add(cmp, aS);
-    aCount++;
+  if (bShowTime) {
+    Standard_Real aTime;
+    //
+    aTime=aChrono.Time();
+    Sprintf(buf, "  Tps: %7.2lf\n", aTime);
+    di << buf;
   }
   }
-  di << "Made faulty shape: " << name << "\n";
-  DBRep::Set(name, cmp);
+  return 0;
 }
 }
-
-
 //=======================================================================
 //function : bopargcheck
 //purpose  : 
 //=======================================================================
 //=======================================================================
 //function : bopargcheck
 //purpose  : 
 //=======================================================================
-Standard_Integer bopargcheck 
-  (Draw_Interpretor& di, Standard_Integer n,  const char** a )
+Standard_Integer bopargcheck (Draw_Interpretor& di, 
+                              Standard_Integer n,  
+                              const char** a )
 {
   if (n<2) {
     di << "\n";
 {
   if (n<2) {
     di << "\n";
@@ -333,7 +322,7 @@ Standard_Integer bopargcheck
     di << " S (section)" << "\n";
     di << " U (unknown)" << "\n";
     di << " For example: \"bopargcheck s1 s2 -F\" enables" ;
     di << " S (section)" << "\n";
     di << " U (unknown)" << "\n";
     di << " For example: \"bopargcheck s1 s2 -F\" enables" ;
-    di << "checking for Fuse operation" << "\n";
+    di << " checking for Fuse operation" << "\n";
     di << " default - section" << "\n" << "\n";
     di << " /<Test Options>" << "\n";
     di << " R (disable small edges (shrank range) test)" << "\n";
     di << " default - section" << "\n" << "\n";
     di << " /<Test Options>" << "\n";
     di << " R (disable small edges (shrank range) test)" << "\n";
@@ -852,3 +841,30 @@ Standard_Integer bopargcheck
 
   return 0;
 }
 
   return 0;
 }
+//=======================================================================
+//function : MakeShapeForFullOutput
+//purpose  : 
+//=======================================================================
+void MakeShapeForFullOutput (const TCollection_AsciiString & aBaseName,
+                             const Standard_Integer          aIndex,
+                             const BOPCol_ListOfShape &    aList,
+                             Standard_Integer&               aCount,
+                             Draw_Interpretor&               di)
+{
+  TCollection_AsciiString aNum(aIndex);
+  TCollection_AsciiString aName = aBaseName + aNum;
+  Standard_CString name = aName.ToCString();
+
+  TopoDS_Compound cmp;
+  BRep_Builder BB;
+  BB.MakeCompound(cmp);
+
+  BOPCol_ListIteratorOfListOfShape anIt(aList);
+  for(; anIt.More(); anIt.Next()) {
+    const TopoDS_Shape & aS = anIt.Value();
+    BB.Add(cmp, aS);
+    aCount++;
+  }
+  di << "Made faulty shape: " << name << "\n";
+  DBRep::Set(name, cmp);
+}
diff --git a/src/BOPTest/BOPTest_Chronometer.hxx b/src/BOPTest/BOPTest_Chronometer.hxx
new file mode 100644 (file)
index 0000000..e51aa2f
--- /dev/null
@@ -0,0 +1,83 @@
+// Created by: Peter KURNEV
+// Copyright (c) 2010-2014 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  BOPTest_Chronometer_HeaderFile
+#define  BOPTest_Chronometer_HeaderFile
+//
+#ifdef HAVE_TBB
+#include <BOPCol_TBB.hxx>
+//=======================================================================
+//class : BOPTime_Chronometer
+//purpose  : 
+//=======================================================================
+class BOPTime_Chronometer {
+ public:
+  BOPTime_Chronometer() {
+  }
+  //
+  ~BOPTime_Chronometer() {
+  }
+  //
+  void Start() {
+    myT0 = tick_count::now();
+  }
+  //
+  void Stop() {
+    myTime=(tick_count::now() - myT0).seconds();
+  }
+  //
+  double Time() const{
+    return myTime;
+  };
+  //
+ protected:
+  tick_count myT0;
+  double myTime;
+};
+////////////////////////////////////////////////////////////////////////
+#else
+#include <OSD_Chronometer.hxx>
+//=======================================================================
+//class    : BOPTime_Chronometer
+//purpose  : 
+//=======================================================================
+class BOPTime_Chronometer {
+ public:
+  BOPTime_Chronometer() {
+  }
+  //
+  ~BOPTime_Chronometer() {
+  }
+  //
+  void Start() {
+    myChronometer.Reset();
+    myChronometer.Start();
+  }
+  //
+  void Stop() {
+    myChronometer.Stop();
+    myChronometer.Show(myTime);
+  }
+  //
+  double Time() const{
+    return myTime;
+  };
+  //
+ protected:
+  OSD_Chronometer myChronometer;
+  double myTime;
+};
+#endif
+//
+#endif
index d735a98..ea3794e 100644 (file)
 #include <BOPTest_DrawableShape.hxx>
 #include <BOPTest_Objects.hxx>
 
 #include <BOPTest_DrawableShape.hxx>
 #include <BOPTest_Objects.hxx>
 
-//
-#ifdef HAVE_TBB
-#include <BOPCol_TBB.hxx>
-//=======================================================================
-//class : BOPTime_Chronometer
-//purpose  : 
-//=======================================================================
-class BOPTime_Chronometer {
- public:
-  BOPTime_Chronometer() {
-  }
-  //
-  ~BOPTime_Chronometer() {
-  }
-  //
-  void Start() {
-    myT0 = tick_count::now();
-  }
-  //
-  void Stop() {
-    myTime=(tick_count::now() - myT0).seconds();
-  }
-  //
-  double Time() const{
-    return myTime;
-  };
-  //
- protected:
-  tick_count myT0;
-  double myTime;
-};
-////////////////////////////////////////////////////////////////////////
-#else
-#include <OSD_Chronometer.hxx>
-//=======================================================================
-//class    : BOPTime_Chronometer
-//purpose  : 
-//=======================================================================
-class BOPTime_Chronometer {
- public:
-  BOPTime_Chronometer() {
-  }
-  //
-  ~BOPTime_Chronometer() {
-  }
-  //
-  void Start() {
-    myChronometer.Reset();
-    myChronometer.Start();
-  }
-  //
-  void Stop() {
-    myChronometer.Stop();
-    myChronometer.Show(myTime);
-  }
-  //
-  double Time() const{
-    return myTime;
-  };
-  //
- protected:
-  OSD_Chronometer myChronometer;
-  double myTime;
-};
-#endif
+#include <BOPTest_Chronometer.hxx>
 
 static Standard_Integer bfillds  (Draw_Interpretor&, Standard_Integer, const char**); 
 static Standard_Integer bbuild   (Draw_Interpretor&, Standard_Integer, const char**);
 
 static Standard_Integer bfillds  (Draw_Interpretor&, Standard_Integer, const char**); 
 static Standard_Integer bbuild   (Draw_Interpretor&, Standard_Integer, const char**);
index f94d8f1..1a1377d 100755 (executable)
@@ -4,3 +4,4 @@ BOPTest_LowCommands.cxx
 BOPTest_CheckCommands.cxx
 BOPTest_TolerCommands.cxx
 BOPTest_ObjCommands.cxx
 BOPTest_CheckCommands.cxx
 BOPTest_TolerCommands.cxx
 BOPTest_ObjCommands.cxx
+BOPTest_Chronometer.hxx
index 0841d10..1a7ac90 100644 (file)
@@ -14,13 +14,13 @@ set info1 [bopcheck c]
 set info2 [bopcheck c 4]
 set info3 [bopcheck c 3]
 
 set info2 [bopcheck c 4]
 set info3 [bopcheck c 3]
 
-if { [regexp "x23" $info1] != 1 } {
+if { [regexp "x35" $info1] != 1 } {
     puts "Error : bopcheck c works wrong"
 } else {
     puts "OK: bopcheck c works properly"
 }
 
     puts "Error : bopcheck c works wrong"
 } else {
     puts "OK: bopcheck c works properly"
 }
 
-if { [regexp "x11" $info2] != 1 || [regexp "F/F:x12," $info2] != 0 } {
+if { [regexp "x13" $info2] != 1 || [regexp "x39" $info2] != 1 } {
     puts "Error : bopcheck c 4 works wrong"
 } else {
     puts "OK: bopcheck c 4 works properly"
     puts "Error : bopcheck c 4 works wrong"
 } else {
     puts "OK: bopcheck c 4 works properly"
@@ -31,4 +31,3 @@ if { [regexp "This shape seems to be OK" $info3] != 1 } {
 } else {
     puts "OK: bopcheck c 3 works properly"
 }
 } else {
     puts "OK: bopcheck c 3 works properly"
 }
-
index 0c622ea..516f354 100755 (executable)
@@ -9,15 +9,7 @@ puts ""
 restore [locate_data_file bug24764_qa.brep] a
 
 bopcheck a 4
 restore [locate_data_file bug24764_qa.brep] a
 
 bopcheck a 4
-
-set N 16
-set qz {}
-
-lappend qz a
-for {set i 0} {$i < $N} {incr i} {
- lappend qz x${i}
-}
-eval compound $qz result
+compound a x2 x51 x8 x10 x28 x30 x36 x46 x1 x50 result
 
 set nb_v_good 24
 set nb_e_good 24
 
 set nb_v_good 24
 set nb_e_good 24