Do bad element Optimization only when requested

This commit is contained in:
Matthias Hochsteger 2024-04-02 21:59:27 +02:00
parent ff505f1e41
commit 78a3d24fde

View File

@ -659,13 +659,16 @@ namespace netgen
// optimize only bad elements first // optimize only bad elements first
optmesh.SetMinBadness(1000.); optmesh.SetMinBadness(1000.);
bool do_split = mp.optimize3d.find('d') != string::npos;
bool do_swap = mp.optimize3d.find('s') != string::npos;
bool do_swap2 = mp.optimize3d.find('t') != string::npos;
for(auto i : Range(mp.optsteps3d)) for(auto i : Range(mp.optsteps3d))
{ {
auto [total_badness, max_badness, bad_els] = optmesh.UpdateBadness(); auto [total_badness, max_badness, bad_els] = optmesh.UpdateBadness();
if(bad_els==0) break; if(bad_els==0) break;
optmesh.SplitImprove(); if(do_split) optmesh.SplitImprove();
optmesh.SwapImprove(); if(do_swap) optmesh.SwapImprove();
optmesh.SwapImprove2(); if(do_swap2) optmesh.SwapImprove2();
} }
// Now optimize all elements // Now optimize all elements