Fix SwapImprove

This commit is contained in:
Matthias Hochsteger 2020-07-15 17:26:39 +00:00 committed by Joachim Schöberl
parent e17aa88cad
commit ce8ba71f33
2 changed files with 286 additions and 281 deletions

View File

@ -2015,6 +2015,8 @@ double MeshOptimize3d :: SwapImproveEdge (Mesh & mesh, OPTIMIZEGOAL goal,
} }
} }
bool have_bad_element = false;
for (ElementIndex ei : hasbothpoints) for (ElementIndex ei : hasbothpoints)
{ {
if (mesh[ei].GetType () != TET) if (mesh[ei].GetType () != TET)
@ -2037,10 +2039,13 @@ double MeshOptimize3d :: SwapImproveEdge (Mesh & mesh, OPTIMIZEGOAL goal,
if ((goal == OPT_LEGAL) && if ((goal == OPT_LEGAL) &&
mesh.LegalTet (mesh[ei]) && mesh.LegalTet (mesh[ei]) &&
CalcBad (mesh.Points(), mesh[ei], 0) < 1e3) CalcBad (mesh.Points(), mesh[ei], 0) >= 1e3)
return 0.0; have_bad_element = true;
} }
if ((goal == OPT_LEGAL) && !have_bad_element)
return 0.0;
int nsuround = hasbothpoints.Size(); int nsuround = hasbothpoints.Size();
int mattyp = mesh[hasbothpoints[0]].GetIndex(); int mattyp = mesh[hasbothpoints[0]].GetIndex();

File diff suppressed because it is too large Load Diff