]> OCCT Git - occt.git/commitdiff
Shape Healing - Regression after #584 (#753) IR master
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Tue, 21 Oct 2025 10:14:33 +0000 (11:14 +0100)
committerGitHub <noreply@github.com>
Tue, 21 Oct 2025 10:14:33 +0000 (11:14 +0100)
Fixed issue with unstable shape order after fixing.
Fixed reference data which was changed

.github/actions/clang-format-check/action.yml
src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Shell.cxx
tests/bugs/mesh/bug25044_59
tests/bugs/mesh/bug25044_60
tests/bugs/mesh/bug25628
tests/de/step_2/S1
tests/heal/wire_tails_real/A5

index 99384c1cee67f369e68dc46ac848b598a2d3e23f..942aab4fb50d36ba5fe3396281b26817a9d6a5c6 100644 (file)
@@ -53,7 +53,9 @@ runs:
       run: |
         $files = Get-Content "changed_files.txt" | Where-Object { Test-Path $_ }
         if ($files.Count -gt 0) {
-          python3 .github/actions/scripts/validate-license.py --files @files --fix
+          # Pass files as individual arguments
+          $files = @($files)
+          & python3 .github/actions/scripts/validate-license.py --files @files --fix
         }
 
     - name: Check formatting
index ef05ee8131aac2dfdf5500630d58608ac14c9d44..5e8357678c8fb57c26e8af1edc348cb66c6654f1 100644 (file)
@@ -62,13 +62,7 @@ IMPLEMENT_STANDARD_RTTIEXT(ShapeFix_Shell, ShapeFix_Root)
 namespace
 {
 // Type aliases for unordered maps with custom allocators
-using FaceEdgesAllocator =
-  NCollection_Allocator<std::pair<const TopoDS_Face, NCollection_Array1<TopoDS_Edge>>>;
-using FaceEdgesMap = std::unordered_map<TopoDS_Face,
-                                        NCollection_Array1<TopoDS_Edge>,
-                                        TopTools_ShapeMapHasher,
-                                        TopTools_ShapeMapHasher,
-                                        FaceEdgesAllocator>;
+using FaceEdgesMap = NCollection_IndexedDataMap<TopoDS_Face, NCollection_Array1<TopoDS_Edge>>;
 using EdgeFacesAllocator =
   NCollection_Allocator<std::pair<const TopoDS_Edge, NCollection_DynamicArray<TopoDS_Face>>>;
 using EdgeFacesMap = std::unordered_map<TopoDS_Edge,
@@ -212,16 +206,16 @@ static NCollection_List<TopTools_SequenceOfShape> GetConnectedFaceGroups(
 {
   NCollection_List<TopTools_SequenceOfShape> aConnectedGroups;
 
-  if (theFaceEdges.empty())
+  if (theFaceEdges.IsEmpty())
   {
     return aConnectedGroups;
   }
 
-  TopTools_MapOfShape aVisitedFaces(static_cast<int>(theFaceEdges.size()));
+  TopTools_MapOfShape aVisitedFaces(static_cast<int>(theFaceEdges.Size()));
 
   for (auto aFaceIter = theFaceEdges.begin(); aFaceIter != theFaceEdges.end(); ++aFaceIter)
   {
-    const TopoDS_Face& aStartFace = aFaceIter->first;
+    const TopoDS_Face& aStartFace = aFaceIter.ChangeIterator().Key();
 
     if (aVisitedFaces.Contains(aStartFace))
     {
@@ -244,10 +238,10 @@ static NCollection_List<TopTools_SequenceOfShape> GetConnectedFaceGroups(
       aConnectedGroup.Append(aCurrentFace);
 
       // Find connected faces through shared edges
-      auto aFaceEdgesIter = theFaceEdges.find(aCurrentFace);
-      if (aFaceEdgesIter != theFaceEdges.end())
+      auto aFaceEdgesIter = theFaceEdges.Seek(aCurrentFace);
+      if (aFaceEdgesIter)
       {
-        const NCollection_Array1<TopoDS_Edge>& aFaceEdgesArray = aFaceEdgesIter->second;
+        const NCollection_Array1<TopoDS_Edge>& aFaceEdgesArray = *aFaceEdgesIter;
 
         for (Standard_Integer anEdgeIdx = aFaceEdgesArray.Lower();
              anEdgeIdx <= aFaceEdgesArray.Upper();
@@ -275,25 +269,7 @@ static NCollection_List<TopTools_SequenceOfShape> GetConnectedFaceGroups(
       }
     }
 
-    // Insert in sorted order (largest groups first)
-    Standard_Boolean anIsInserted = Standard_False;
-
-    for (NCollection_List<TopTools_SequenceOfShape>::Iterator anIter(aConnectedGroups);
-         anIter.More();
-         anIter.Next())
-    {
-      if (aConnectedGroup.Length() > anIter.Value().Length())
-      {
-        aConnectedGroups.InsertBefore(aConnectedGroup, anIter);
-        anIsInserted = Standard_True;
-        break;
-      }
-    }
-
-    if (!anIsInserted)
-    {
-      aConnectedGroups.Append(aConnectedGroup);
-    }
+    aConnectedGroups.Append(aConnectedGroup);
   }
 
   return aConnectedGroups;
@@ -339,7 +315,7 @@ static Standard_Boolean GetShells(TopTools_SequenceOfShape&     theLfaces,
     NCollection_DataMap<TopoDS_Edge, std::pair<bool, bool>, TopTools_ShapeMapHasher>;
 
   FaceEdgesMap aFaceEdges;
-  aFaceEdges.reserve(theLfaces.Length());
+  aFaceEdges.ReSize(theLfaces.Length());
   size_t                                aNumberOfEdges = 0;
   NCollection_DynamicArray<TopoDS_Edge> aTempEdges;
   for (TopTools_SequenceOfShape::Iterator anFaceIter(theLfaces); anFaceIter.More();
@@ -357,16 +333,16 @@ static Standard_Boolean GetShells(TopTools_SequenceOfShape&     theLfaces,
     {
       aFaceEdgesArray.SetValue(idx + 1, aTempEdges.Value(idx));
     }
-    aFaceEdges[aFace] = std::move(aFaceEdgesArray);
+    aFaceEdges.Add(aFace, std::move(aFaceEdgesArray));
   }
 
   EdgeFacesMap aEdgeFaces;
   aEdgeFaces.reserve(aNumberOfEdges);
 
-  for (const auto& aFaceEdgesPair : aFaceEdges)
+  for (Standard_Integer aFaceInd = 1; aFaceInd <= aFaceEdges.Size(); ++aFaceInd)
   {
-    const TopoDS_Face&                     aFace           = aFaceEdgesPair.first;
-    const NCollection_Array1<TopoDS_Edge>& aFaceEdgesArray = aFaceEdgesPair.second;
+    const TopoDS_Face&                     aFace           = aFaceEdges.FindKey(aFaceInd);
+    const NCollection_Array1<TopoDS_Edge>& aFaceEdgesArray = aFaceEdges.FindFromIndex(aFaceInd);
 
     for (Standard_Integer anEdgeInd = aFaceEdgesArray.Lower(); anEdgeInd <= aFaceEdgesArray.Upper();
          ++anEdgeInd)
@@ -425,7 +401,7 @@ static Standard_Boolean GetShells(TopTools_SequenceOfShape&     theLfaces,
     Standard_Integer aBadOrientationCount = 0, aGoodOrientationCount = 0;
     TopoDS_Face      F1 = TopoDS::Face(aProcessingFaces.Value(aFaceIdx));
     // Get edges of the face
-    const NCollection_Array1<TopoDS_Edge>& aFaceEdgesArray = aFaceEdges[F1];
+    const NCollection_Array1<TopoDS_Edge>& aFaceEdgesArray = aFaceEdges.FindFromKey(F1);
 
     for (Standard_Integer anEdgeInd = aFaceEdgesArray.Lower(); anEdgeInd <= aFaceEdgesArray.Upper();
          ++anEdgeInd)
@@ -631,9 +607,10 @@ static Standard_Boolean GetShells(TopTools_SequenceOfShape&     theLfaces,
       continue; // Skip first group (already processed)
 
     const TopTools_SequenceOfShape& aUnprocessedGroup = aGroupIter.Value();
-    for (Standard_Integer aFaceIdx = 1; aFaceIdx <= aUnprocessedGroup.Length(); ++aFaceIdx)
+    for (Standard_Integer anUnprocFaceIdx = 1; anUnprocFaceIdx <= aUnprocessedGroup.Length();
+         ++anUnprocFaceIdx)
     {
-      aSeqUnconnectFaces.Append(aUnprocessedGroup.Value(aFaceIdx));
+      aSeqUnconnectFaces.Append(aUnprocessedGroup.Value(anUnprocFaceIdx));
     }
   }
 
index c7a258093a8f45bce6139cd23234cdd5ec1c7cfe..a682378001b9237e80e3289bb97efc9f73ac66bb 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO 25044 ALL: Not connected mesh inside face 147"
+puts "TODO 25044 ALL: Not connected mesh inside face 137"
 
 puts "======="
 puts "0025588: BRepMesh_ShapeTool::FindUV check for 2d points to be the same is inconsistent with ShapeAnalysis_Wire::CheckLacking"
index 6c892505875b0b384c4e477d77fcf387d0a15f20..9fabc51021d03f9b00c265a0f463d98cdfdd09ed 100644 (file)
@@ -4,7 +4,7 @@ puts "======="
 puts ""
 
 puts "TODO OCC25588 All: Not connected mesh inside face 893"
-puts "TODO OCC25588 All: Not connected mesh inside face 1094"
+puts "TODO OCC25588 All: Not connected mesh inside face 1097"
 
 pload XDE
 
index 2dac4f54b19339ad77dcc0732b1df4f20fa8b16e..90e3d561111f171c879372c506c195fa1e4b03db 100644 (file)
@@ -20,7 +20,7 @@ if { [llength $log] != 0 } {
   puts "Mesh is OK"
 }
 
-checktrinfo a_36 -tri 37 -nod 39
+checktrinfo a_36 -tri 4551 -nod 2302
 
 vinit
 vdisplay a_36
index 0e45c77abe162f68fd94f70c73241e7b5c952b0a..dd4aa60f85d6a637b1ded745e6b38dd426791a75 100755 (executable)
@@ -1,6 +1,7 @@
 # !!!! This file is generated automatically, do not edit manually! See end script
 puts "TODO CR23096 ALL: TPSTAT : Faulty" 
 puts "TODO CR23096 ALL: TOLERANCE : Faulty" 
+puts "TODO CR23096 ALL: CHECKSHAPE : Faulty" 
 
 
 set filename trj12_ttmouse-pe-214.stp
@@ -8,10 +9,10 @@ set filename trj12_ttmouse-pe-214.stp
 set ref_data {
 DATA        : Faulties = 0  ( 0 )  Warnings = 0  ( 0 )  Summary  = 0  ( 0 )
 TPSTAT      : Faulties = 0  ( 0 )  Warnings = 40  ( 18 )  Summary  = 40  ( 18 )
-CHECKSHAPE  : Wires    = 48  ( 48 )  Faces    = 48  ( 48 )  Shells   = 0  ( 0 )   Solids   = 0 ( 0 )
+CHECKSHAPE  : Wires    = 48  ( 48 )  Faces    = 40  ( 48 )  Shells   = 8  ( 0 )   Solids   = 8 ( 0 )
 NBSHAPES    : Solid    = 15  ( 16 )  Shell    = 17  ( 17 )  Face     = 366  ( 366 ) 
 STATSHAPE   : Solid    = 71  ( 79 )  Shell    = 87  ( 87 )  Face     = 2732  ( 2732 )   FreeWire = 0  ( 0 ) 
-TOLERANCE   : MaxTol   =    116.4921053  (    5.033069571 )  AvgTol   =     0.562451842  (   0.06578172668 )
+TOLERANCE   : MaxTol   =    116.4921053  (    5.033069571 )  AvgTol   =     1.066335101  (   0.06578172668 )
 LABELS      : N0Labels = 10  ( 10 )  N1Labels = 32  ( 32 )  N2Labels = 0  ( 0 )   TotalLabels = 42  ( 42 )   NameLabels = 22  ( 22 )   ColorLabels = 22  ( 22 )   LayerLabels = 0  ( 0 )
 PROPS       : Centroid = 0  ( 0 )  Volume   = 0  ( 0 )  Area     = 0  ( 0 )
 NCOLORS     : NColors  = 6  ( 6 )
index 8cbda82dc60586feb831dffab0fc7243257e2ae7..54ac8da2c628b9403625ed96e4a1bfdcb139a125 100644 (file)
@@ -4,5 +4,5 @@ stepread [locate_data_file bug26261_ca07771-040x.stp] s *
 renamevar s_1 s
 fixshape  r  s  -maxtaila 1  -maxtailw 1e-3
 
-checknbshapes  r  -vertex 25952  -edge 42001  -wire 16519  -face 16205  -shell 51  -solid 1  -compsolid 0  -compound 2
+checknbshapes  r  -vertex 25951  -edge 42000  -wire 16519  -face 16205  -shell 51  -solid 1  -compsolid 0  -compound 2
 checkprops r -l 127197.46264592493