0023535: Exception in BSplCLib::BuildCache()
authornbv <nbv@opencascade.com>
Fri, 7 Dec 2012 10:12:54 +0000 (14:12 +0400)
committernbv <nbv@opencascade.com>
Fri, 7 Dec 2012 10:12:54 +0000 (14:12 +0400)
Preliminary result. It was tested with spl_2.brep file only.
Add "const"
Adding test cases for this fix

src/IntCurve/IntCurve_IntCurveCurveGen.cdl
src/IntCurve/IntCurve_IntCurveCurveGen.gxx
tests/bugs/fclasses/bug23535_1 [new file with mode: 0755]
tests/bugs/fclasses/bug23535_2 [new file with mode: 0755]
tests/bugs/fclasses/bug23535_3 [new file with mode: 0755]
tests/bugs/fclasses/bug23535_4 [new file with mode: 0755]
tests/bugs/fclasses/bug23535_5 [new file with mode: 0755]
tests/bugs/fclasses/bug23535_6 [new file with mode: 0755]
tests/bugs/fclasses/bug23535_7 [new file with mode: 0755]

index 5094016..0494d94 100755 (executable)
@@ -212,7 +212,28 @@ is
 
        raises ConstructionError from Standard
        is static private;
+       
+       
+       
+    InternalCompositePerform_noRecurs(me: in out;
+           NbInterC1: Integer from Standard;
+           C1:  TheCurve;
+           NumInterC1: Integer from Standard;
+           Tab1: Array1OfReal from TColStd;
+            D1: Domain from IntRes2d;          
+           NbInterC2: Integer from Standard;
+           C2:  TheCurve;
+           NumInterC2: Integer from Standard;
+           Tab2: Array1OfReal from TColStd;
+           D2: Domain from IntRes2d;
+           TolConf,Tol: Real from Standard)
+       
+       ---Purpose: Part of InternalCompositePerform function
+     
+       raises ConstructionError from Standard
+       is static private;
+       
+  
 
     InternalCompositePerform(me: in out;
              C1:  TheCurve; D1: Domain from IntRes2d;
index 976b693..08003db 100755 (executable)
@@ -805,6 +805,102 @@ void IntCurve_IntCurveCurveGen::InternalPerform (const TheCurve& C1,
   }
 }
 
+void IntCurve_IntCurveCurveGen::InternalCompositePerform_noRecurs(
+                                      const Standard_Integer NbInterC1,
+                                      const TheCurve& C1,
+                                      const Standard_Integer NumInterC1,
+                                      const TColStd_Array1OfReal& Tab1,
+                                      const IntRes2d_Domain& D1,
+                                      const Standard_Integer NbInterC2,
+                                      const TheCurve& C2,
+                                      const Standard_Integer NumInterC2,
+                                      const TColStd_Array1OfReal& Tab2,
+                                      const IntRes2d_Domain& D2,
+                                      const Standard_Real TolConf,
+                                      const Standard_Real Tol)
+{
+    
+    
+       if(NumInterC2>NbInterC2)
+    return;
+
+  
+  IntRes2d_Domain DomainC1NumInter;
+  IntRes2d_Domain DomainC2NumInter;
+
+  //----------------------------------------------------------------------
+  //-- Creation du domaine associe a la portion de C1
+  //----------------------------------------------------------------------
+  Standard_Boolean DomainIsOK = Standard_True;
+  Standard_Real ParamInf,ParamSup;
+  
+  if(NbInterC1>1) {
+    TheCurveTool::GetInterval(C1,NumInterC1,Tab1,ParamInf,ParamSup);
+    //--------------------------------------------------------------
+    //-- Verification : Domaine Inclu dans Intervalle de Definition
+    //--------------------------------------------------------------
+
+    Standard_Real u;
+
+    u = D1.FirstParameter();
+    if(ParamInf < u) { ParamInf = u; }
+
+    u = D1.LastParameter();
+    if(ParamSup > u) { ParamSup = u; }
+
+    if((ParamSup - ParamInf) > 1e-10) {
+      DomainC1NumInter.SetValues(TheCurveTool::Value(C1,ParamInf),
+                                 ParamInf,
+                                 D1.FirstTolerance(),
+                                 TheCurveTool::Value(C1,ParamSup),
+                                 ParamSup,
+                                 D1.LastTolerance());
+    } else {
+      DomainIsOK = Standard_False;
+    }
+  } else {
+    DomainC1NumInter = D1;
+  }
+  
+  //----------------------------------------------------------------------
+  //-- Creation du domaine associe a la portion de C2
+  //----------------------------------------------------------------------
+  if(NbInterC2 > 1) {
+    TheCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
+    //--------------------------------------------------------------
+    //-- Verification : Domaine Inclu dans Intervalle de Definition
+    //--------------------------------------------------------------
+
+    Standard_Real u;
+
+    u = D2.FirstParameter();
+    if(ParamInf < u) { ParamInf = u; }
+    u = D2.LastParameter();
+
+    if(ParamSup > u) { ParamSup = u; }
+
+    if((ParamSup - ParamInf) > 1e-10) { 
+      DomainC2NumInter.SetValues(TheCurveTool::Value(C2,ParamInf),
+                                 ParamInf,
+                                 D2.FirstTolerance(),
+                                 TheCurveTool::Value(C2,ParamSup),
+                                 ParamSup,
+                                 D2.LastTolerance());
+    } else {
+      DomainIsOK = Standard_False;
+    }
+  } else {
+    DomainC2NumInter = D2;
+  }
+
+  if(DomainIsOK) { 
+    InternalPerform(C2,DomainC2NumInter,
+                    C1,DomainC1NumInter,
+                    TolConf,Tol,
+                    Standard_True);
+  }
+}
+
 
 
 
@@ -826,115 +922,39 @@ IntCurve_IntCurveCurveGen::InternalCompositePerform(const TheCurve& C1,
                                                    const Standard_Real Tol,
                                                    const Standard_Boolean RecursOnC2) {
   
-  Standard_Integer NumInterC2=XXXNumInterC2;
+  Standard_Integer NumInterC2=XXXNumInterC2;    
   Standard_Integer NumInterC1=XXXNumInterC1;
 
 
 //  Standard_Boolean Arret=Standard_False;
 
-  if(NumInterC2<=NbInterC2) {
-    if(RecursOnC2) {
-      for(Standard_Integer i=NumInterC1 ; i<=NbInterC1; i++) {
-       NumInterC1=i;
-       InternalCompositePerform(C2,D2,NumInterC2,NbInterC2,Tab2,
-                                C1,D1,NumInterC1,NbInterC1,Tab1,
-                                TolConf,Tol,
-                                Standard_False);
-      }
-      if(NumInterC2<NbInterC2) {
-       NumInterC2++;
-       NumInterC1=1;
-       InternalCompositePerform(C1,D1,NumInterC1,NbInterC1,Tab1,
-                                C2,D2,NumInterC2,NbInterC2,Tab2,
-                                TolConf,Tol,
-                                Standard_True);
-      }
-    }
-    else {
-      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-      //~~~~~~~~~~~~~~~~ I n t e r s e c t i o  n   ~~~~~~~~~~~~~~~~
-      //~~~~~~~~~~~~~~~~      de C2[NumInterC2]     ~~~~~~~~~~~~~~~~
-      //~~~~~~~~~~~~~~~~      et C1[NumInterC1]     ~~~~~~~~~~~~~~~~
-      //~~~~~~~~~~~~~~~~  (pour respecter l ordre)  ~~~~~~~~~~~~~~~~
-      //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-      
-      IntRes2d_Domain DomainC1NumInter;
-      IntRes2d_Domain DomainC2NumInter;
-
-      //----------------------------------------------------------------------
-      //-- Creation du domaine associe a la portion de C1
-      //----------------------------------------------------------------------
-      Standard_Boolean DomainIsOK = Standard_True;
-      Standard_Real ParamInf,ParamSup;
-      
-      if(NbInterC1>1) {
-       TheCurveTool::GetInterval(C1,NumInterC1,Tab1,ParamInf,ParamSup);
-       //--------------------------------------------------------------
-       //-- Verification : Domaine Inclu dans Intervalle de Definition
-       //--------------------------------------------------------------
-       Standard_Real u;
-       
-       u = D1.FirstParameter();
-       if(ParamInf < u) { ParamInf = u; }
-         
-       u = D1.LastParameter();
-       if(ParamSup > u) { ParamSup = u; }
-       
-       if((ParamSup - ParamInf) > 1e-10) { 
-         DomainC1NumInter.SetValues(TheCurveTool::Value(C1,ParamInf),
-                                    ParamInf,
-                                    D1.FirstTolerance(),
-                                    TheCurveTool::Value(C1,ParamSup),
-                                    ParamSup,
-                                    D1.LastTolerance());
-       }
-       else {
-         DomainIsOK = Standard_False;
-       }
-      }
-      else {
-       DomainC1NumInter = D1;
-      }
-      
-      //----------------------------------------------------------------------
-      //-- Creation du domaine associe a la portion de C2
-      //----------------------------------------------------------------------
-      if(NbInterC2 > 1) {
-       TheCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
-       //--------------------------------------------------------------
-       //-- Verification : Domaine Inclu dans Intervalle de Definition
-       //--------------------------------------------------------------
-       Standard_Real u;
-       
-       u = D2.FirstParameter();
-       if(ParamInf < u) { ParamInf = u; }
-       
-       u = D2.LastParameter();
-       if(ParamSup > u) { ParamSup = u; }
-       
-       if((ParamSup - ParamInf) > 1e-10) { 
-         DomainC2NumInter.SetValues(TheCurveTool::Value(C2,ParamInf),
-                                    ParamInf,
-                                    D2.FirstTolerance(),
-                                    TheCurveTool::Value(C2,ParamSup),
-                                    ParamSup,
-                                    D2.LastTolerance());
-       }
-       else {
-         DomainIsOK = Standard_False;
-       }
-      }
-      else {
-       DomainC2NumInter = D2;
-      }
-      
-      if(DomainIsOK) { 
-       InternalPerform(C2,DomainC2NumInter,
-                       C1,DomainC1NumInter,
-                       TolConf,Tol,
-                       Standard_True);
-      }
-    }
+  if(NumInterC2>NbInterC2)
+    return;
+
+  if(!RecursOnC2){
+    InternalCompositePerform_noRecurs(NbInterC1, C1, NumInterC1, Tab1, D1, NbInterC2, C2, NumInterC2, Tab2, D2, TolConf, Tol);
+    return;
+  }
+
+  for(Standard_Integer i=NumInterC1 ; i<=NbInterC1; i++) {
+    NumInterC1=i;
+    /*
+      InternalCompositePerform(C2,D2,NumInterC2,NbInterC2,Tab2,
+                       C1,D1,NumInterC1,NbInterC1,Tab1,
+                       TolConf,Tol,Standard_False);
+    */
+
+    InternalCompositePerform_noRecurs(NbInterC2,C2,NumInterC2,Tab2,D2,NbInterC1,C1,NumInterC1,Tab1,D1,TolConf,Tol);
+  }
+
+  if(NumInterC2<NbInterC2) {
+    NumInterC2++;
+    NumInterC1=1;
+
+    InternalCompositePerform(C1,D1,NumInterC1,NbInterC1,Tab1,
+                             C2,D2,NumInterC2,NbInterC2,Tab2,
+                             TolConf,Tol,
+                             Standard_True);
   }
 }
 
diff --git a/tests/bugs/fclasses/bug23535_1 b/tests/bugs/fclasses/bug23535_1
new file mode 100755 (executable)
index 0000000..1ab0aa5
--- /dev/null
@@ -0,0 +1,9 @@
+puts "============"
+puts "OCC23535"
+puts "============"
+puts ""
+#######################################################################
+# Exception in BSplCLib::BuildCache()
+#######################################################################
+
+restore [locate_data_file bug23535_spl_13.brep] result
diff --git a/tests/bugs/fclasses/bug23535_2 b/tests/bugs/fclasses/bug23535_2
new file mode 100755 (executable)
index 0000000..8a1632d
--- /dev/null
@@ -0,0 +1,9 @@
+puts "============"
+puts "OCC23535"
+puts "============"
+puts ""
+#######################################################################
+# Exception in BSplCLib::BuildCache()
+#######################################################################
+
+restore [locate_data_file bug23535_spl_14.brep] result
diff --git a/tests/bugs/fclasses/bug23535_3 b/tests/bugs/fclasses/bug23535_3
new file mode 100755 (executable)
index 0000000..d1900d4
--- /dev/null
@@ -0,0 +1,9 @@
+puts "============"
+puts "OCC23535"
+puts "============"
+puts ""
+#######################################################################
+# Exception in BSplCLib::BuildCache()
+#######################################################################
+
+restore [locate_data_file bug23535_spl_2.brep] result
diff --git a/tests/bugs/fclasses/bug23535_4 b/tests/bugs/fclasses/bug23535_4
new file mode 100755 (executable)
index 0000000..2c283ea
--- /dev/null
@@ -0,0 +1,9 @@
+puts "============"
+puts "OCC23535"
+puts "============"
+puts ""
+#######################################################################
+# Exception in BSplCLib::BuildCache()
+#######################################################################
+
+restore [locate_data_file bug23535_spl_3.brep] result
diff --git a/tests/bugs/fclasses/bug23535_5 b/tests/bugs/fclasses/bug23535_5
new file mode 100755 (executable)
index 0000000..c1b4083
--- /dev/null
@@ -0,0 +1,9 @@
+puts "============"
+puts "OCC23535"
+puts "============"
+puts ""
+#######################################################################
+# Exception in BSplCLib::BuildCache()
+#######################################################################
+
+restore [locate_data_file bug23535_spl_5.brep] result
diff --git a/tests/bugs/fclasses/bug23535_6 b/tests/bugs/fclasses/bug23535_6
new file mode 100755 (executable)
index 0000000..4e36c3e
--- /dev/null
@@ -0,0 +1,9 @@
+puts "============"
+puts "OCC23535"
+puts "============"
+puts ""
+#######################################################################
+# Exception in BSplCLib::BuildCache()
+#######################################################################
+
+restore [locate_data_file bug23535_spl_7.brep] result
diff --git a/tests/bugs/fclasses/bug23535_7 b/tests/bugs/fclasses/bug23535_7
new file mode 100755 (executable)
index 0000000..ebfb61c
--- /dev/null
@@ -0,0 +1,9 @@
+puts "============"
+puts "OCC23535"
+puts "============"
+puts ""
+#######################################################################
+# Exception in BSplCLib::BuildCache()
+#######################################################################
+
+restore [locate_data_file bug23535_spl_8.brep] result