Skip to content

Commit 1c0bb24

Browse files
authored
Shape Healing - Regression after #584 (#753)
Fixed issue with unstable shape order after fixing. Fixed reference data which was changed
1 parent de1fcc2 commit 1c0bb24

7 files changed

Lines changed: 27 additions & 47 deletions

File tree

.github/actions/clang-format-check/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ runs:
5353
run: |
5454
$files = Get-Content "changed_files.txt" | Where-Object { Test-Path $_ }
5555
if ($files.Count -gt 0) {
56-
python3 .github/actions/scripts/validate-license.py --files @files --fix
56+
# Pass files as individual arguments
57+
$files = @($files)
58+
& python3 .github/actions/scripts/validate-license.py --files @files --fix
5759
}
5860
5961
- name: Check formatting

src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Shell.cxx

Lines changed: 17 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,7 @@ IMPLEMENT_STANDARD_RTTIEXT(ShapeFix_Shell, ShapeFix_Root)
6262
namespace
6363
{
6464
// Type aliases for unordered maps with custom allocators
65-
using FaceEdgesAllocator =
66-
NCollection_Allocator<std::pair<const TopoDS_Face, NCollection_Array1<TopoDS_Edge>>>;
67-
using FaceEdgesMap = std::unordered_map<TopoDS_Face,
68-
NCollection_Array1<TopoDS_Edge>,
69-
TopTools_ShapeMapHasher,
70-
TopTools_ShapeMapHasher,
71-
FaceEdgesAllocator>;
65+
using FaceEdgesMap = NCollection_IndexedDataMap<TopoDS_Face, NCollection_Array1<TopoDS_Edge>>;
7266
using EdgeFacesAllocator =
7367
NCollection_Allocator<std::pair<const TopoDS_Edge, NCollection_DynamicArray<TopoDS_Face>>>;
7468
using EdgeFacesMap = std::unordered_map<TopoDS_Edge,
@@ -212,16 +206,16 @@ static NCollection_List<TopTools_SequenceOfShape> GetConnectedFaceGroups(
212206
{
213207
NCollection_List<TopTools_SequenceOfShape> aConnectedGroups;
214208

215-
if (theFaceEdges.empty())
209+
if (theFaceEdges.IsEmpty())
216210
{
217211
return aConnectedGroups;
218212
}
219213

220-
TopTools_MapOfShape aVisitedFaces(static_cast<int>(theFaceEdges.size()));
214+
TopTools_MapOfShape aVisitedFaces(static_cast<int>(theFaceEdges.Size()));
221215

222216
for (auto aFaceIter = theFaceEdges.begin(); aFaceIter != theFaceEdges.end(); ++aFaceIter)
223217
{
224-
const TopoDS_Face& aStartFace = aFaceIter->first;
218+
const TopoDS_Face& aStartFace = aFaceIter.ChangeIterator().Key();
225219

226220
if (aVisitedFaces.Contains(aStartFace))
227221
{
@@ -244,10 +238,10 @@ static NCollection_List<TopTools_SequenceOfShape> GetConnectedFaceGroups(
244238
aConnectedGroup.Append(aCurrentFace);
245239

246240
// Find connected faces through shared edges
247-
auto aFaceEdgesIter = theFaceEdges.find(aCurrentFace);
248-
if (aFaceEdgesIter != theFaceEdges.end())
241+
auto aFaceEdgesIter = theFaceEdges.Seek(aCurrentFace);
242+
if (aFaceEdgesIter)
249243
{
250-
const NCollection_Array1<TopoDS_Edge>& aFaceEdgesArray = aFaceEdgesIter->second;
244+
const NCollection_Array1<TopoDS_Edge>& aFaceEdgesArray = *aFaceEdgesIter;
251245

252246
for (Standard_Integer anEdgeIdx = aFaceEdgesArray.Lower();
253247
anEdgeIdx <= aFaceEdgesArray.Upper();
@@ -275,25 +269,7 @@ static NCollection_List<TopTools_SequenceOfShape> GetConnectedFaceGroups(
275269
}
276270
}
277271

278-
// Insert in sorted order (largest groups first)
279-
Standard_Boolean anIsInserted = Standard_False;
280-
281-
for (NCollection_List<TopTools_SequenceOfShape>::Iterator anIter(aConnectedGroups);
282-
anIter.More();
283-
anIter.Next())
284-
{
285-
if (aConnectedGroup.Length() > anIter.Value().Length())
286-
{
287-
aConnectedGroups.InsertBefore(aConnectedGroup, anIter);
288-
anIsInserted = Standard_True;
289-
break;
290-
}
291-
}
292-
293-
if (!anIsInserted)
294-
{
295-
aConnectedGroups.Append(aConnectedGroup);
296-
}
272+
aConnectedGroups.Append(aConnectedGroup);
297273
}
298274

299275
return aConnectedGroups;
@@ -339,7 +315,7 @@ static Standard_Boolean GetShells(TopTools_SequenceOfShape& theLfaces,
339315
NCollection_DataMap<TopoDS_Edge, std::pair<bool, bool>, TopTools_ShapeMapHasher>;
340316

341317
FaceEdgesMap aFaceEdges;
342-
aFaceEdges.reserve(theLfaces.Length());
318+
aFaceEdges.ReSize(theLfaces.Length());
343319
size_t aNumberOfEdges = 0;
344320
NCollection_DynamicArray<TopoDS_Edge> aTempEdges;
345321
for (TopTools_SequenceOfShape::Iterator anFaceIter(theLfaces); anFaceIter.More();
@@ -357,16 +333,16 @@ static Standard_Boolean GetShells(TopTools_SequenceOfShape& theLfaces,
357333
{
358334
aFaceEdgesArray.SetValue(idx + 1, aTempEdges.Value(idx));
359335
}
360-
aFaceEdges[aFace] = std::move(aFaceEdgesArray);
336+
aFaceEdges.Add(aFace, std::move(aFaceEdgesArray));
361337
}
362338

363339
EdgeFacesMap aEdgeFaces;
364340
aEdgeFaces.reserve(aNumberOfEdges);
365341

366-
for (const auto& aFaceEdgesPair : aFaceEdges)
342+
for (Standard_Integer aFaceInd = 1; aFaceInd <= aFaceEdges.Size(); ++aFaceInd)
367343
{
368-
const TopoDS_Face& aFace = aFaceEdgesPair.first;
369-
const NCollection_Array1<TopoDS_Edge>& aFaceEdgesArray = aFaceEdgesPair.second;
344+
const TopoDS_Face& aFace = aFaceEdges.FindKey(aFaceInd);
345+
const NCollection_Array1<TopoDS_Edge>& aFaceEdgesArray = aFaceEdges.FindFromIndex(aFaceInd);
370346

371347
for (Standard_Integer anEdgeInd = aFaceEdgesArray.Lower(); anEdgeInd <= aFaceEdgesArray.Upper();
372348
++anEdgeInd)
@@ -425,7 +401,7 @@ static Standard_Boolean GetShells(TopTools_SequenceOfShape& theLfaces,
425401
Standard_Integer aBadOrientationCount = 0, aGoodOrientationCount = 0;
426402
TopoDS_Face F1 = TopoDS::Face(aProcessingFaces.Value(aFaceIdx));
427403
// Get edges of the face
428-
const NCollection_Array1<TopoDS_Edge>& aFaceEdgesArray = aFaceEdges[F1];
404+
const NCollection_Array1<TopoDS_Edge>& aFaceEdgesArray = aFaceEdges.FindFromKey(F1);
429405

430406
for (Standard_Integer anEdgeInd = aFaceEdgesArray.Lower(); anEdgeInd <= aFaceEdgesArray.Upper();
431407
++anEdgeInd)
@@ -631,9 +607,10 @@ static Standard_Boolean GetShells(TopTools_SequenceOfShape& theLfaces,
631607
continue; // Skip first group (already processed)
632608

633609
const TopTools_SequenceOfShape& aUnprocessedGroup = aGroupIter.Value();
634-
for (Standard_Integer aFaceIdx = 1; aFaceIdx <= aUnprocessedGroup.Length(); ++aFaceIdx)
610+
for (Standard_Integer anUnprocFaceIdx = 1; anUnprocFaceIdx <= aUnprocessedGroup.Length();
611+
++anUnprocFaceIdx)
635612
{
636-
aSeqUnconnectFaces.Append(aUnprocessedGroup.Value(aFaceIdx));
613+
aSeqUnconnectFaces.Append(aUnprocessedGroup.Value(anUnprocFaceIdx));
637614
}
638615
}
639616

tests/bugs/mesh/bug25044_59

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
puts "TODO 25044 ALL: Not connected mesh inside face 147"
1+
puts "TODO 25044 ALL: Not connected mesh inside face 137"
22

33
puts "======="
44
puts "0025588: BRepMesh_ShapeTool::FindUV check for 2d points to be the same is inconsistent with ShapeAnalysis_Wire::CheckLacking"

tests/bugs/mesh/bug25044_60

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ puts "======="
44
puts ""
55

66
puts "TODO OCC25588 All: Not connected mesh inside face 893"
7-
puts "TODO OCC25588 All: Not connected mesh inside face 1094"
7+
puts "TODO OCC25588 All: Not connected mesh inside face 1097"
88

99
pload XDE
1010

tests/bugs/mesh/bug25628

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if { [llength $log] != 0 } {
2020
puts "Mesh is OK"
2121
}
2222

23-
checktrinfo a_36 -tri 37 -nod 39
23+
checktrinfo a_36 -tri 4551 -nod 2302
2424

2525
vinit
2626
vdisplay a_36

tests/de/step_2/S1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# !!!! This file is generated automatically, do not edit manually! See end script
22
puts "TODO CR23096 ALL: TPSTAT : Faulty"
33
puts "TODO CR23096 ALL: TOLERANCE : Faulty"
4+
puts "TODO CR23096 ALL: CHECKSHAPE : Faulty"
45

56

67
set filename trj12_ttmouse-pe-214.stp
78

89
set ref_data {
910
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
1011
TPSTAT : Faulties = 0 ( 0 ) Warnings = 40 ( 18 ) Summary = 40 ( 18 )
11-
CHECKSHAPE : Wires = 48 ( 48 ) Faces = 48 ( 48 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
12+
CHECKSHAPE : Wires = 48 ( 48 ) Faces = 40 ( 48 ) Shells = 8 ( 0 ) Solids = 8 ( 0 )
1213
NBSHAPES : Solid = 15 ( 16 ) Shell = 17 ( 17 ) Face = 366 ( 366 )
1314
STATSHAPE : Solid = 71 ( 79 ) Shell = 87 ( 87 ) Face = 2732 ( 2732 ) FreeWire = 0 ( 0 )
14-
TOLERANCE : MaxTol = 116.4921053 ( 5.033069571 ) AvgTol = 0.562451842 ( 0.06578172668 )
15+
TOLERANCE : MaxTol = 116.4921053 ( 5.033069571 ) AvgTol = 1.066335101 ( 0.06578172668 )
1516
LABELS : N0Labels = 10 ( 10 ) N1Labels = 32 ( 32 ) N2Labels = 0 ( 0 ) TotalLabels = 42 ( 42 ) NameLabels = 22 ( 22 ) ColorLabels = 22 ( 22 ) LayerLabels = 0 ( 0 )
1617
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
1718
NCOLORS : NColors = 6 ( 6 )

tests/heal/wire_tails_real/A5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ stepread [locate_data_file bug26261_ca07771-040x.stp] s *
44
renamevar s_1 s
55
fixshape r s -maxtaila 1 -maxtailw 1e-3
66

7-
checknbshapes r -vertex 25952 -edge 42001 -wire 16519 -face 16205 -shell 51 -solid 1 -compsolid 0 -compound 2
7+
checknbshapes r -vertex 25951 -edge 42000 -wire 16519 -face 16205 -shell 51 -solid 1 -compsolid 0 -compound 2
88
checkprops r -l 127197.46264592493

0 commit comments

Comments
 (0)