Skip to content

Commit

Permalink
Merge branch 'fix_splitimprove' into 'master'
Browse files Browse the repository at this point in the history
Skip SplitImproveEdge if it would insert tets with negative volume

See merge request ngsolve/netgen!668
  • Loading branch information
mhochsteger committed Sep 13, 2024
2 parents 67a67a4 + 73c7524 commit fe5a3ac
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 97 deletions.
11 changes: 10 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,20 @@ test_win:
script:
- pip install pytest-check
- cd tests\pytest
- REM python test_tutorials.py new_results.json
- cd %NETGEN_BUILD_DIR%\netgen
- ctest -C Release -V --output-on-failure
- cd ..
needs: ["build_win"]

generate_results:
<<: *win
stage: test
script:
- pip install pytest-check
- cd tests\pytest
- python test_tutorials.py new_results.json
needs: ["build_win"]
when: manual
artifacts:
paths:
- tests/pytest/new_results.json
Expand Down
9 changes: 6 additions & 3 deletions libsrc/meshing/improve3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,6 @@ double MeshOptimize3d :: SplitImproveEdge (Table<ElementIndex,PointIndex> & elem
Element newel1 = oldel;
Element newel2 = oldel;

oldel.Touch();
oldel.Delete();

newel1.Touch();
newel2.Touch();

Expand All @@ -576,6 +573,12 @@ double MeshOptimize3d :: SplitImproveEdge (Table<ElementIndex,PointIndex> & elem
if (newel2[l] == pi1) newel2[l] = pinew;
}

if( newel1.Volume(mesh.Points()) < 0.0 || newel2.Volume(mesh.Points()) < 0.0)
return 0.0;

oldel.Touch();
oldel.Delete();

mesh.AddVolumeElement (newel1);
mesh.AddVolumeElement (newel2);
}
Expand Down
94 changes: 1 addition & 93 deletions tests/pytest/results.json
Original file line number Diff line number Diff line change
Expand Up @@ -827,98 +827,6 @@
"total_badness": 100414.60403
}
],
"cylinder.geo": [
{
"angles_tet": [
19.071,
144.66
],
"angles_trig": [
22.881,
111.85
],
"ne1d": 52,
"ne2d": 286,
"ne3d": 394,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 2, 2, 6, 18, 38, 45, 53, 70, 51, 48, 40, 12, 9]",
"total_badness": 562.09628542
},
{
"angles_tet": [
22.85,
151.98
],
"angles_trig": [
25.237,
118.13
],
"ne1d": 24,
"ne2d": 66,
"ne3d": 69,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 1, 1, 3, 3, 3, 5, 0, 4, 2, 2, 9, 26, 3, 7]",
"total_badness": 95.643757297
},
{
"angles_tet": [
14.788,
156.92
],
"angles_trig": [
11.549,
134.56
],
"ne1d": 36,
"ne2d": 152,
"ne3d": 548,
"quality_histogram": "[0, 0, 0, 0, 1, 7, 24, 35, 41, 59, 44, 55, 57, 51, 39, 38, 48, 26, 19, 4]",
"total_badness": 980.19781779
},
{
"angles_tet": [
19.062,
144.68
],
"angles_trig": [
22.836,
111.85
],
"ne1d": 52,
"ne2d": 286,
"ne3d": 394,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 2, 2, 6, 18, 38, 45, 52, 71, 52, 46, 41, 12, 9]",
"total_badness": 562.08196742
},
{
"angles_tet": [
23.602,
139.69
],
"angles_trig": [
23.844,
118.54
],
"ne1d": 76,
"ne2d": 636,
"ne3d": 1056,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 2, 16, 35, 78, 108, 109, 163, 185, 154, 105, 81, 20]",
"total_badness": 1453.0463737
},
{
"angles_tet": [
24.173,
139.41
],
"angles_trig": [
26.472,
120.11
],
"ne1d": 124,
"ne2d": 1666,
"ne3d": 6448,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 17, 44, 136, 282, 586, 944, 1320, 1470, 1240, 401]",
"total_badness": 7815.6380623
}
],
"cylsphere.geo": [
{
"angles_tet": [
Expand Down Expand Up @@ -3422,4 +3330,4 @@
"total_badness": 12938.174838
}
]
}
}

0 comments on commit fe5a3ac

Please sign in to comment.