]> 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, 20 Jul 2022 12:53:26 +0000 (15:53 +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 2a6d20badb42345a7a6646a96f8a8e6911edd245..cd2465c358395aa691b0c63e6309ffc6b4008282 100644 (file)
@@ -45,7 +45,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;
       }
@@ -118,7 +119,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;
       }
@@ -127,7 +128,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)
@@ -145,7 +146,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