diff --git a/libsrc/general/table.hpp b/libsrc/general/table.hpp index a62277fa..54f5be31 100644 --- a/libsrc/general/table.hpp +++ b/libsrc/general/table.hpp @@ -169,6 +169,7 @@ public: /// 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) { + NETGEN_CHECK_RANGE(i, BASE, data.Size()+BASE); ((T*)data[i-BASE].col)[data[i-BASE].size] = acont; data[i-BASE].size++; } diff --git a/libsrc/meshing/meshfunc.cpp b/libsrc/meshing/meshfunc.cpp index 0b17572c..c1a23880 100644 --- a/libsrc/meshing/meshfunc.cpp +++ b/libsrc/meshing/meshfunc.cpp @@ -659,13 +659,16 @@ namespace netgen // optimize only bad elements first 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)) { auto [total_badness, max_badness, bad_els] = optmesh.UpdateBadness(); if(bad_els==0) break; - optmesh.SplitImprove(); - optmesh.SwapImprove(); - optmesh.SwapImprove2(); + if(do_split) optmesh.SplitImprove(); + if(do_swap) optmesh.SwapImprove(); + if(do_swap2) optmesh.SwapImprove2(); } // Now optimize all elements