From: Pasukhin Dmitry Date: Tue, 21 Oct 2025 10:14:33 +0000 (+0100) Subject: Shape Healing - Regression after #584 (#753) X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=occt.git Shape Healing - Regression after #584 (#753) Fixed issue with unstable shape order after fixing. Fixed reference data which was changed --- diff --git a/.github/actions/clang-format-check/action.yml b/.github/actions/clang-format-check/action.yml index 99384c1cee..942aab4fb5 100644 --- a/.github/actions/clang-format-check/action.yml +++ b/.github/actions/clang-format-check/action.yml @@ -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 diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Shell.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Shell.cxx index ef05ee8131..5e8357678c 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Shell.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Shell.cxx @@ -62,13 +62,7 @@ IMPLEMENT_STANDARD_RTTIEXT(ShapeFix_Shell, ShapeFix_Root) namespace { // Type aliases for unordered maps with custom allocators -using FaceEdgesAllocator = - NCollection_Allocator>>; -using FaceEdgesMap = std::unordered_map, - TopTools_ShapeMapHasher, - TopTools_ShapeMapHasher, - FaceEdgesAllocator>; +using FaceEdgesMap = NCollection_IndexedDataMap>; using EdgeFacesAllocator = NCollection_Allocator>>; using EdgeFacesMap = std::unordered_map GetConnectedFaceGroups( { NCollection_List aConnectedGroups; - if (theFaceEdges.empty()) + if (theFaceEdges.IsEmpty()) { return aConnectedGroups; } - TopTools_MapOfShape aVisitedFaces(static_cast(theFaceEdges.size())); + TopTools_MapOfShape aVisitedFaces(static_cast(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 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& aFaceEdgesArray = aFaceEdgesIter->second; + const NCollection_Array1& aFaceEdgesArray = *aFaceEdgesIter; for (Standard_Integer anEdgeIdx = aFaceEdgesArray.Lower(); anEdgeIdx <= aFaceEdgesArray.Upper(); @@ -275,25 +269,7 @@ static NCollection_List GetConnectedFaceGroups( } } - // Insert in sorted order (largest groups first) - Standard_Boolean anIsInserted = Standard_False; - - for (NCollection_List::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, TopTools_ShapeMapHasher>; FaceEdgesMap aFaceEdges; - aFaceEdges.reserve(theLfaces.Length()); + aFaceEdges.ReSize(theLfaces.Length()); size_t aNumberOfEdges = 0; NCollection_DynamicArray 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& aFaceEdgesArray = aFaceEdgesPair.second; + const TopoDS_Face& aFace = aFaceEdges.FindKey(aFaceInd); + const NCollection_Array1& 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& aFaceEdgesArray = aFaceEdges[F1]; + const NCollection_Array1& 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)); } } diff --git a/tests/bugs/mesh/bug25044_59 b/tests/bugs/mesh/bug25044_59 index c7a258093a..a682378001 100644 --- a/tests/bugs/mesh/bug25044_59 +++ b/tests/bugs/mesh/bug25044_59 @@ -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" diff --git a/tests/bugs/mesh/bug25044_60 b/tests/bugs/mesh/bug25044_60 index 6c89250587..9fabc51021 100644 --- a/tests/bugs/mesh/bug25044_60 +++ b/tests/bugs/mesh/bug25044_60 @@ -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 diff --git a/tests/bugs/mesh/bug25628 b/tests/bugs/mesh/bug25628 index 2dac4f54b1..90e3d56111 100644 --- a/tests/bugs/mesh/bug25628 +++ b/tests/bugs/mesh/bug25628 @@ -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 diff --git a/tests/de/step_2/S1 b/tests/de/step_2/S1 index 0e45c77abe..dd4aa60f85 100755 --- a/tests/de/step_2/S1 +++ b/tests/de/step_2/S1 @@ -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 ) diff --git a/tests/heal/wire_tails_real/A5 b/tests/heal/wire_tails_real/A5 index 8cbda82dc6..54ac8da2c6 100644 --- a/tests/heal/wire_tails_real/A5 +++ b/tests/heal/wire_tails_real/A5 @@ -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