]> OCCT Git - occt.git/commitdiff
0032692: Mesh - In BRepMesh_ModelPreProcessor avoid crashes with problematic topology
authoroan <oan@opencascade.com>
Tue, 28 Jun 2022 08:43:49 +0000 (11:43 +0300)
committersmoskvin <smoskvin@opencascade.com>
Wed, 29 Jun 2022 18:32:45 +0000 (21:32 +0300)
Improved the processing for the case where Failure flag for the meshing face is set. Specific tests added.
Check triangulation consistency even for shapes with problematic topology given that they are suitable for keeping it.

src/BRepMesh/BRepMesh_ModelPreProcessor.cxx
tests/bugs/mesh/bug32692_1 [new file with mode: 0644]
tests/bugs/mesh/bug32692_2 [new file with mode: 0644]
tests/bugs/mesh/bug32692_3 [new file with mode: 0644]

index 4eefa2428705d028dc0de8cbbe880a3f80ab8a99..e987376b2cc8fff60fa174da3da4eb842369d9d8 100644 (file)
@@ -46,7 +46,8 @@ namespace
     void operator()(const Standard_Integer theFaceIndex) const
     {
       const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
-      if (aDFace->IsSet(IMeshData_Outdated))
+      if (aDFace->IsSet(IMeshData_Outdated) ||
+          aDFace->GetFace().IsNull())
       {
         return;
       }
@@ -119,7 +120,7 @@ namespace
     void operator()(const Standard_Integer theFaceIndex) const
     {
       const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
-      if (aDFace->GetSurface()->GetType() != GeomAbs_Cone)
+      if (aDFace->GetSurface()->GetType() != GeomAbs_Cone || aDFace->IsSet(IMeshData_Failure))
       {
         return;
       }
@@ -128,7 +129,7 @@ namespace
       for (Standard_Integer aEdgeIdx = 0; aEdgeIdx < aDWire->EdgesNb() - 1; ++aEdgeIdx)
       {
         const IMeshData::IEdgePtr& aDEdge = aDWire->GetEdge (aEdgeIdx);
-        
+
         if (aDEdge->GetPCurve(aDFace.get(), TopAbs_FORWARD) != aDEdge->GetPCurve(aDFace.get(), TopAbs_REVERSED))
         {
           if (aDEdge->GetCurve()->ParametersNb() == 2)
@@ -146,7 +147,7 @@ namespace
             }
           }
           return;
-        } 
+        }
       }
     }
 
diff --git a/tests/bugs/mesh/bug32692_1 b/tests/bugs/mesh/bug32692_1
new file mode 100644 (file)
index 0000000..db139cb
--- /dev/null
@@ -0,0 +1,11 @@
+puts "========="
+puts "OCC32692: Crash when the input shape has some invalid topology"
+puts "========="
+puts ""
+
+puts "REQUIRED ALL: Meshing statuses: SelfIntersectingWire Failure"
+
+restore [locate_data_file bug32692.brep] s
+incmesh s 0.01 -parallel
+
+checktrinfo s -nod 7511 -tri 7625 -empty 9 -face 309
diff --git a/tests/bugs/mesh/bug32692_2 b/tests/bugs/mesh/bug32692_2
new file mode 100644 (file)
index 0000000..3431ec9
--- /dev/null
@@ -0,0 +1,11 @@
+puts "========="
+puts "OCC32692: Crash when the input shape has some invalid topology"
+puts "========="
+puts ""
+
+puts "REQUIRED ALL: Meshing statuses: Reused"
+
+restore [locate_data_file bug32692_broken_mesh.brep] s
+incmesh s 0.01 -parallel
+
+checktrinfo s -nod 3 -tri 1 -face 1
diff --git a/tests/bugs/mesh/bug32692_3 b/tests/bugs/mesh/bug32692_3
new file mode 100644 (file)
index 0000000..50d9334
--- /dev/null
@@ -0,0 +1,14 @@
+puts "========="
+puts "OCC32692: Crash when the input shape has some invalid topology"
+puts "========="
+puts ""
+
+puts "REQUIRED ALL: Meshing statuses: OpenWire Failure Outdated"
+
+pload MODELING
+cylinder c 0 0 0 10
+mkface f c
+
+incmesh f 0.01 -parallel
+
+checktrinfo f -nod 0 -tri 0 -face 1