netgen/libsrc/meshing/meshfunc2d.cpp

58 lines
1.3 KiB
C++
Raw Normal View History

2009-01-13 04:40:13 +05:00
#include <mystdlib.h>
#include "meshing.hpp"
namespace netgen
{
DLL_HEADER void Optimize2d (Mesh & mesh, MeshingParameters & mp)
2009-01-13 04:40:13 +05:00
{
2013-02-03 20:40:27 +06:00
static int timer = NgProfiler::CreateTimer ("optimize2d");
NgProfiler::RegionTimer reg(timer);
2009-01-13 04:40:13 +05:00
mesh.CalcSurfacesOfNode();
2014-08-31 18:12:31 +06:00
const char * optstr = mp.optimize2d.c_str();
2009-01-13 04:40:13 +05:00
int optsteps = mp.optsteps2d;
2013-02-03 20:40:27 +06:00
for (int i = 1; i <= optsteps; i++)
2009-01-13 04:40:13 +05:00
for (size_t j = 1; j <= strlen(optstr); j++)
{
if (multithread.terminate) break;
switch (optstr[j-1])
{
case 's':
{ // topological swap
MeshOptimize2d meshopt;
2014-12-02 18:23:36 +05:00
meshopt.SetMetricWeight (mp.elsizeweight);
2009-01-13 04:40:13 +05:00
meshopt.EdgeSwapping (mesh, 0);
break;
}
case 'S':
{ // metric swap
MeshOptimize2d meshopt;
2014-12-02 18:23:36 +05:00
meshopt.SetMetricWeight (mp.elsizeweight);
2009-01-13 04:40:13 +05:00
meshopt.EdgeSwapping (mesh, 1);
break;
}
case 'm':
{
MeshOptimize2d meshopt;
2014-12-02 18:23:36 +05:00
meshopt.SetMetricWeight (mp.elsizeweight);
2011-07-25 14:40:23 +06:00
meshopt.ImproveMesh(mesh, mp);
2009-01-13 04:40:13 +05:00
break;
}
case 'c':
{
MeshOptimize2d meshopt;
2014-12-02 18:23:36 +05:00
meshopt.SetMetricWeight (mp.elsizeweight);
2009-01-13 04:40:13 +05:00
meshopt.CombineImprove(mesh);
break;
}
default:
cerr << "Optimization code " << optstr[j-1] << " not defined" << endl;
}
}
}
}