]> OCCT Git - occt.git/commitdiff
0031190: Modeling Algorithms - progress indication in GeomPlate is inconsistent
authorakaftasev <akaftasev@opencascade.com>
Mon, 29 Mar 2021 16:15:54 +0000 (19:15 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 2 Apr 2021 17:01:34 +0000 (20:01 +0300)
Added ability to display progress indicator in plate commands
Added tests

src/BRepTest/BRepTest_FillingCommands.cxx
src/GeomPlate/GeomPlate_BuildPlateSurface.cxx
src/Plate/Plate_Plate.cxx
src/math/math_Recipes.cxx
tests/lowalgos/grids.list
tests/lowalgos/progress/A1 [new file with mode: 0644]
tests/lowalgos/progress/A2 [new file with mode: 0644]
tests/lowalgos/progress/A3 [new file with mode: 0644]
tests/lowalgos/progress/A4 [new file with mode: 0644]

index 99f424d24ed5fa716708311c947f1d24b446e8de..0bd777772d38891824fba5fdb5181c852a9f7f0d 100644 (file)
@@ -29,6 +29,7 @@
 #include <GeometryTest.hxx>
 #include <Draw_Interpretor.hxx>
 #include <Draw_Appli.hxx>
+#include <Draw_ProgressIndicator.hxx>
 #include <DrawTrSurf.hxx>
 #include <TopAbs_ShapeEnum.hxx>
 #include <TopoDS.hxx>
@@ -167,8 +168,13 @@ static Standard_Integer plate (Draw_Interpretor & di,Standard_Integer n,const ch
                                     NbPtsCur->Value(i));
     Henri.Add(Cont);
   }
-  
-  Henri.Perform();
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
+  Henri.Perform(aProgress->Start());
+  if (aProgress->UserBreak())
+  {
+    di << "Error: UserBreak\n";
+    return 0;
+  }
 
   Standard_Real ErrG0 = 1.1*Henri.G0Error();
   //std::cout<<" dist. max = "<<Henri.G0Error()<<" ; angle max = "<<Henri.G1Error()<<std::endl;
@@ -217,7 +223,7 @@ static Standard_Integer plate (Draw_Interpretor & di,Standard_Integer n,const ch
 //  commande gplate : resultat face egale a la surface approchee
 //////////////////////////////////////////////////////////////////////////////// 
  
-static Standard_Integer gplate (Draw_Interpretor & ,Standard_Integer n,const char** a)
+static Standard_Integer gplate (Draw_Interpretor & di,Standard_Integer n,const char** a)
 {
   if (n < 6 ) return 1; 
   Standard_Integer NbCurFront=Draw::Atoi(a[2]),
@@ -298,7 +304,13 @@ static Standard_Integer gplate (Draw_Interpretor & ,Standard_Integer n,const cha
          Henri.Add(PCont);
        }
     }    
-  Henri.Perform();
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
+  Henri.Perform(aProgress->Start());
+  if (aProgress->UserBreak())
+  {
+    di << "Error: UserBreak\n";
+    return 0;
+  }
   Standard_Integer nbcarreau=9;
   Standard_Integer degmax=8;
   Standard_Real seuil;
@@ -368,7 +380,13 @@ static Standard_Integer approxplate (Draw_Interpretor & di,Standard_Integer n,co
     Henri.Add(Cont);
   }
   
-  Henri.Perform();
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
+  Henri.Perform(aProgress->Start());
+  if (aProgress->UserBreak())
+  {
+    di << "Error: UserBreak\n";
+    return 0;
+  }
 
   Standard_Real dmax = Henri.G0Error(),
                 anmax = Henri.G1Error();
index a135f7b2b940fea55aa292e95cb2c8ff6239b29a..7e5a5d87862243e40f60440be24a7818dc0c4ab2 100644 (file)
@@ -470,7 +470,7 @@ void GeomPlate_BuildPlateSurface::Perform(const Message_ProgressRange& theProgre
   //======================================================================   
   // Initial Surface 
   //======================================================================
-  Message_ProgressScope aPS(theProgress, NULL, 100, Standard_True);
+  Message_ProgressScope aPS(theProgress, "Calculating the surface filled", 100, Standard_True);
   if (!mySurfInitIsGive)
   {
     ComputeSurfInit (aPS.Next(10));
@@ -1716,7 +1716,8 @@ void GeomPlate_BuildPlateSurface::ComputeSurfInit(const Message_ProgressRange& t
       //====================================================================
       // Construction of the surface
       //====================================================================
-      myPlate.SolveTI(2, ComputeAnisotropie(), theProgress);
+      Message_ProgressScope aPS(theProgress, "ComputeSurfInit", 1);
+      myPlate.SolveTI(2, ComputeAnisotropie(), aPS.Next());
       if (theProgress.UserBreak())
       {
           return;
index 46f8ef0d270ba1b7fe8614510e87e5c42a73977a..23f6c1191b7a3fbbe995bcf58331e30d097ac2e9 100644 (file)
@@ -345,7 +345,7 @@ void Plate_Plate::SolveTI1(const Standard_Integer IterationNumber,
   Standard_Real pivot_max = 1.e-12;
   OK = Standard_True;     
 
-  Message_ProgressScope aScope (theProgress, NULL, 10);
+  Message_ProgressScope aScope (theProgress, "Plate_Plate::SolveTI1()", 10);
   math_Gauss algo_gauss(mat,pivot_max, aScope.Next (7));
 
   if (aScope.UserBreak())
@@ -459,7 +459,7 @@ void Plate_Plate::SolveTI2(const Standard_Integer IterationNumber,
   Standard_Real pivot_max = 1.e-12;
   OK = Standard_True;      // ************ JHH
 
-  Message_ProgressScope aScope (theProgress, NULL, 10);
+  Message_ProgressScope aScope (theProgress, "Plate_Plate::SolveTI2()", 10);
   math_Gauss algo_gauss(mat,pivot_max, aScope.Next (7));
   
   if (aScope.UserBreak())
@@ -733,7 +733,7 @@ void Plate_Plate::SolveTI3(const Standard_Integer IterationNumber,
   Standard_Real pivot_max = 1.e-12;
   OK = Standard_True;      // ************ JHH
 
-  Message_ProgressScope aScope (theProgress, NULL, 10);
+  Message_ProgressScope aScope (theProgress, "Plate_Plate::SolveTI3()", 10);
   math_Gauss algo_gauss(mat,pivot_max, aScope.Next (7));
   
   if (aScope.UserBreak())
index 31168f47e6f66eb9275175dfde957a5d42fb5d90..165d20fe9fd53d6400c936b53efe0e1bcd9116c2 100644 (file)
@@ -185,7 +185,7 @@ Standard_Integer LU_Decompose(math_Matrix& a,
      Standard_Integer n = a.RowNumber();
      d = 1.0;
 
-     Message_ProgressScope aPS(theProgress, "", n);
+     Message_ProgressScope aPS(theProgress, "math_Gauss LU_Decompose", n);
 
      for(i = 1; i <= n; i++) {
        big = 0.0;
index 7aa5c18d2158fd964b1021c0d4d786c1cc58d8ea..0ebc6f8e35c26d383d2ac0f3bc33a82d9d8c918b 100644 (file)
@@ -7,3 +7,5 @@
 007 intss
 008 classifier
 009 bvh
+010 progress
+
diff --git a/tests/lowalgos/progress/A1 b/tests/lowalgos/progress/A1
new file mode 100644 (file)
index 0000000..aaa2165
--- /dev/null
@@ -0,0 +1,33 @@
+puts "========"
+puts "0031190: Modeling Algorithms - progress indication in GeomPlate is inconsistent"
+puts "========"
+
+plane p 
+trim p p -1 3 -1 3 
+mkface p p 
+beziercurve c1 3 0 0 0 1 0 1 2 0 0 
+mkedge e1 c1 
+tcopy e1 e2 
+tcopy e1 e3 
+ttranslate e2 0 2 0 
+trotate e3 0 0 0 0 0 1 90 
+tcopy e3 e4 
+ttranslate e4 2 0 0 
+
+# Configurate XProgress 
+XProgress +t 
+
+# create the surface 
+set output [gplate r1 4 0 p e1 0 e2 0 e3 0 e4 0] 
+
+# Test data
+set ctr {"0%" "Calculating the surface filled" "Plate_Plate::SolveTI1()" "math_Gauss LU_Decompose" "100%" }
+
+foreach data ${ctr} {
+  if ![regexp $data $output] {
+    puts "Error: gplate command: Mismatch data on '$data'"
+    break
+  }
+}
diff --git a/tests/lowalgos/progress/A2 b/tests/lowalgos/progress/A2
new file mode 100644 (file)
index 0000000..2030079
--- /dev/null
@@ -0,0 +1,30 @@
+puts "========"
+puts "0031190: Modeling Algorithms - progress indication in GeomPlate is inconsistent"
+puts "========"
+
+beziercurve c1 3 0 0 0 1 0 1 2 0 0 
+mkedge e1 c1 
+tcopy e1 e2 
+ttranslate e2 0 2 0 
+
+beziercurve c2 3 0 0 0 0 1 2 0 2 0
+mkedge e3 c2
+tcopy e3 e4 
+ttranslate e4 2 0 0 
+
+# Configurate XProgress 
+XProgress +t 
+
+# create the surface 
+set output [gplate r1 4 0 e1 0 e2 0 e3 0 e4 0] 
+
+# Test data
+set ctr {"0%" "Calculating the surface filled" "ComputeSurfInit"
+         "Plate_Plate::SolveTI1()" "math_Gauss LU_Decompose" "100%" }
+
+foreach data ${ctr} {
+  if ![regexp $data $output] {
+     puts "Error: gplate command: Mismatch data on '$data'"
+     break
+  }
+}
diff --git a/tests/lowalgos/progress/A3 b/tests/lowalgos/progress/A3
new file mode 100644 (file)
index 0000000..e38ea89
--- /dev/null
@@ -0,0 +1,40 @@
+puts "========"
+puts "0031190: Modeling Algorithms - progress indication in GeomPlate is inconsistent"
+puts "========"
+# Generate control points       
+set points {}
+set i 0
+for {set j 0} {$j < 300} {incr j; incr i} {
+  point p$i $j 0 0
+  lappend points p$i
+}
+for {set j 1} {$j < 300} {incr j; incr i} {
+  point p$i 0 $j 0
+  lappend points p$i
+}
+for {set j 0} {$j < 300} {incr j; incr i} {
+  point p$i 300 $j 0
+  lappend points p$i
+}
+
+for {set j 0} {$j < 301} {incr j; incr i} {
+  point p$i $j 300 0
+  lappend points p$i
+}
+
+# Configurate XProgress 
+XProgress +t 
+
+# create the surface 
+set output [eval gplate res 0 [llength $points] $points] 
+
+# Test data
+set ctr {"0%" "Calculating the surface filled" "Plate_Plate::SolveTI1()" "math_Gauss LU_Decompose" "100%" }
+
+foreach data ${ctr} {
+  if ![regexp $data $output] {
+    puts "Error: gplate command: Mismatch data on '$data'"
+    break
+  }
+}
diff --git a/tests/lowalgos/progress/A4 b/tests/lowalgos/progress/A4
new file mode 100644 (file)
index 0000000..b30a964
--- /dev/null
@@ -0,0 +1,27 @@
+puts "========"
+puts "0031190: Modeling Algorithms - progress indication in GeomPlate is inconsistent"
+puts "========"
+# Generate control points       
+set n 100
+set l {}
+for {set i 0} {$i < $n} {incr i} {
+  point p$i [dval sin(2.*pi*$i/$n)] [dval cos(2.*pi*$i/$n)] [expr abs(1-2.*$i/$n)]
+  lappend l p$i
+}
+
+# Configurate XProgress 
+XProgress +t 
+
+# create the surface 
+set output [eval gplate r 0 [llength $l] $l] 
+
+# Test data
+set ctr {"0%" "Calculating the surface filled" "Plate_Plate::SolveTI1()" "math_Gauss LU_Decompose" "100%" }
+
+foreach data ${ctr} {
+  if ![regexp $data $output] {
+    puts "Error: gplate command: Mismatch data on '$data'"
+    break
+  }
+}