DiscussionsIssue archiveOCCT:Modeling Algorithms

Archived issue #0030176

Modeling Algorithms - Infinite loop in IntWalk_PWalking::Perform()

CommunityOCCT:Modeling Algorithmsclosed10 public notes

Search issues

Description

The do loop on line 1003 of IntWalk_PWalking.cxx gets stuck in an infinite loop. The loop follows the pattern explained on line 1171, i.e.:
              // In order to avoid cyclic changes
              // (PasTropGrand --> Decrease step --> 
              // StepTooSmall --> Increase step --> PasTropGrand...)
              // nullify LevelOfIterWithoutAppend only if the condition
              // is satisfied:
              if (aPrevStatus != IntWalk_PasTropGrand)
                LevelOfIterWithoutAppend = 0;


However, the same logic appears to be missing on line 1098. The following patch seems to resolve the issue:

Index: src/IntWalk/IntWalk_PWalking.cxx
===================================================================
--- src/IntWalk/IntWalk_PWalking.cxx	(revision 1)
+++ src/IntWalk/IntWalk_PWalking.cxx	(working copy)
@@ -1098,7 +1098,14 @@
                 if(aDelta > Epsilon(pasInit[i]))
                 {
                   pasInit[i] -= aDelta;
-                  LevelOfIterWithoutAppend=0;
+
+                  // In order to avoid cyclic changes
+                  // (PasTropGrand --> Decrease step -->
+                  // StepTooSmall --> Increase step --> PasTropGrand...)
+                  // nullify LevelOfIterWithoutAppend only if the condition
+                  // is satisfied:
+                  if (aPrevStatus != IntWalk_StepTooSmall)
+                    LevelOfIterWithoutAppend=0;
                 }
               }
             }

Steps to reproduce

restore [locate_data_file Attachment 1 (BREP)] sshh
explode sshh e

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

Additional information

We are using OpenCASCADE as the CAD kernel for our software (acdl.mit.edu/ESP). I am happy to help explain how to compile and run an ESP test case that gets stuck in an infinite loop. I unfortunately am not familiar enough with the OpenCASCADE testing to generate an OCCT test that will reproduce the issue.

Public activity

10 archived notes

Participants are labeled by their role within this record.

01Commenter 1
All we need to reproduce the problem is knowledge of which upper level OCCT algorithm do you call and all input data to it. Each shape should be available in BRep format written by the method BRepTools::Write().
02Commenter 2
Please provide input shapes and may be a piece of code reproducing the problem, and then reassign again to me.
03Author
I was able to crate a little program what gets stuck in the infinite loop. Please let know if you have questions about it.
04Commenter 4
Dear Nikolay, please take care of further processing.
05Commenter 2
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: nbv
Date: Wed Oct 3 17:02:44 2018 +0300

    0030176: Modeling Algorithms - Infinite loop in IntWalk_PWalking::Perform()
    
    Currently resetting of counter LevelOfIterWithoutAppend is enabled only if additional iterations have taken some positive effect.
06Commenter 2
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: nbv
Date: Thu Oct 4 09:45:45 2018 +0300

    # Small correction in the new test case.

07Commenter 7
Dear Mikhail,

Please review the current state of CR30176 branch.

Test results are here: http://jenkins-test-12.nnov.opencascade.com/view/CR30176-master_NBV/
08Commenter 8
Reviewed.
09Commenter 1
Combination -
OCCT branch : [archived branch] SHA - [revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 17451.459999999814 / 17401.889999999843 [+0.28%]
Products
Total CPU difference: 7442.740000000059 / 7431.600000000062 [+0.15%]
Windows-64-VC14:
OCCT
Total CPU difference: 17439.148988698547 / 17485.309684598556 [-0.26%]
Products
Total CPU difference: 8325.211766400007 / 8352.574341799986 [-0.33%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
10Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]