Merge branch 'fix_blayer_meshopt' into 'master'

Fix blayer meshoptimization

See merge request ngsolve/netgen!647
This commit is contained in:
Hochsteger, Matthias 2024-04-02 23:25:10 +02:00
commit 6e2eae70ad
2 changed files with 7 additions and 3 deletions

View File

@ -169,6 +169,7 @@ public:
/// Inserts element acont into row i. BASE-based. Does not test if already used, assumes to have enough memory /// Inserts element acont into row i. BASE-based. Does not test if already used, assumes to have enough memory
inline void AddSave (int i, const T & acont) inline void AddSave (int i, const T & acont)
{ {
NETGEN_CHECK_RANGE(i, BASE, data.Size()+BASE);
((T*)data[i-BASE].col)[data[i-BASE].size] = acont; ((T*)data[i-BASE].col)[data[i-BASE].size] = acont;
data[i-BASE].size++; data[i-BASE].size++;
} }

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