0030176: Modeling Algorithms - Infinite loop in IntWalk_PWalking::Perform()
authornbv <nbv@opencascade.com>
Wed, 3 Oct 2018 14:02:44 +0000 (17:02 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 4 Oct 2018 15:09:44 +0000 (18:09 +0300)
Currently resetting of counter LevelOfIterWithoutAppend is enabled only if additional iterations have taken some positive effect.

src/IntWalk/IntWalk_PWalking.cxx
tests/perf/modalg/bug30176 [new file with mode: 0644]

index 1a5fa68..2419511 100644 (file)
@@ -762,6 +762,9 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
                                   Epsilon(VM1 - Vm1),
                                   Epsilon(UM2 - Um2),
                                   Epsilon(VM2 - Vm2)};
+
+  Standard_Integer aPrevNbPoints = line->NbPoints();
+
   Arrive = Standard_False;
   while(!Arrive) //010
   {
@@ -1099,7 +1102,13 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
                 if(aDelta > Epsilon(pasInit[i]))
                 {
                   pasInit[i] -= aDelta;
-                  LevelOfIterWithoutAppend=0;
+                  if ((aPrevStatus != IntWalk_StepTooSmall) &&
+                      (line->NbPoints() != aPrevNbPoints))
+                  {
+                    LevelOfIterWithoutAppend = 0;
+                  }
+
+                  aPrevNbPoints = line->NbPoints();
                 }
               }
             }
@@ -1174,8 +1183,13 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
               // StepTooSmall --> Increase step --> PasTropGrand...)
               // nullify LevelOfIterWithoutAppend only if the condition
               // is satisfied:
-              if (aPrevStatus != IntWalk_PasTropGrand)
+              if ((aPrevStatus != IntWalk_PasTropGrand) &&
+                  (line->NbPoints() != aPrevNbPoints))
+              {
                 LevelOfIterWithoutAppend = 0;
+              }
+
+              aPrevNbPoints = line->NbPoints();
 
               break;
             }
diff --git a/tests/perf/modalg/bug30176 b/tests/perf/modalg/bug30176
new file mode 100644 (file)
index 0000000..ebc07ff
--- /dev/null
@@ -0,0 +1,24 @@
+puts "========"
+puts "0030176: Modeling Algorithms - Infinite loop in IntWalk_PWalking::Perform()"
+puts "========"
+puts ""
+
+restore [locate_data_file bug30176_shape.brep] sshh
+explode sshh e
+
+dchrono h1 restart
+blend result sshh 0.1 sshh_36 0.1 sshh_36 0.1 sshh_38 0.1 sshh_71 0.1 sshh_72 0.1 sshh_73
+dchrono h1 stop counter BlOp
+
+checkshape result
+
+if {[regexp "Faulties" [bopargcheck result]]} {
+  puts "Error: bopargcheck has found some faulties in result"
+}
+
+checkmaxtol result -ref 0.0001
+checknbshapes result -wire 43 -face 43 -shell 1 -solid 1
+
+checkprops result -s 26.9203 -v 9.40217
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png