Path: blob/devel/ElmerGUI/netgen/libsrc/meshing/meshfunc2d.cpp
3206 views
#include <mystdlib.h>1#include "meshing.hpp"23namespace netgen4{56void Optimize2d (Mesh & mesh, MeshingParameters & mp)7{8int i;910//double h = mp.maxh;1112mesh.CalcSurfacesOfNode();1314const char * optstr = mp.optimize2d;15int optsteps = mp.optsteps2d;1617// cout << "optstr = " << optstr << endl;1819for (i = 1; i <= optsteps; i++)20for (size_t j = 1; j <= strlen(optstr); j++)21{22if (multithread.terminate) break;23switch (optstr[j-1])24{25case 's':26{ // topological swap27MeshOptimize2d meshopt;28meshopt.SetMetricWeight (0);29meshopt.EdgeSwapping (mesh, 0);30break;31}32case 'S':33{ // metric swap34MeshOptimize2d meshopt;35meshopt.SetMetricWeight (0);36meshopt.EdgeSwapping (mesh, 1);37break;38}39case 'm':40{41MeshOptimize2d meshopt;42meshopt.SetMetricWeight (1);43meshopt.ImproveMesh(mesh);44break;45}4647case 'c':48{49MeshOptimize2d meshopt;50meshopt.SetMetricWeight (0.2);51meshopt.CombineImprove(mesh);52break;53}54default:55cerr << "Optimization code " << optstr[j-1] << " not defined" << endl;56}57}58}5960}616263