respect localh in CombineImprove()

This commit is contained in:
mhochsteger@cerbsim.com 2022-02-23 21:11:39 +01:00
parent 922a0c5c86
commit 231c6870d9

View File

@ -366,6 +366,7 @@ namespace netgen
Array<Vec<3>, PointIndex> & normals, Array<Vec<3>, PointIndex> & normals,
Array<bool, PointIndex> & fixed, Array<bool, PointIndex> & fixed,
PointIndex pi1, PointIndex pi2, PointIndex pi1, PointIndex pi2,
double metricweight,
bool check_only = true) bool check_only = true)
{ {
Vec<3> nv; Vec<3> nv;
@ -441,7 +442,7 @@ namespace netgen
for (const Element2d & el : mesh.SurfaceElements()[hasonepi]) for (const Element2d & el : mesh.SurfaceElements()[hasonepi])
{ {
bad1 += CalcTriangleBadness (mesh[el[0]], mesh[el[1]], mesh[el[2]], bad1 += CalcTriangleBadness (mesh[el[0]], mesh[el[1]], mesh[el[2]],
nv, -1, loch); nv, metricweight, loch);
illegal1 += 1-mesh.LegalTrig(el); illegal1 += 1-mesh.LegalTrig(el);
} }
@ -449,7 +450,7 @@ namespace netgen
{ {
const Element2d & el = mesh[hasbothpi[k]]; const Element2d & el = mesh[hasbothpi[k]];
bad1 += CalcTriangleBadness (mesh[el[0]], mesh[el[1]], mesh[el[2]], bad1 += CalcTriangleBadness (mesh[el[0]], mesh[el[1]], mesh[el[2]],
nv, -1, loch); nv, metricweight, loch);
illegal1 += 1-mesh.LegalTrig(el); illegal1 += 1-mesh.LegalTrig(el);
} }
@ -463,7 +464,7 @@ namespace netgen
double err = double err =
CalcTriangleBadness (mesh[el[0]], mesh[el[1]], mesh[el[2]], CalcTriangleBadness (mesh[el[0]], mesh[el[1]], mesh[el[2]],
nv, -1, loch); nv, metricweight, loch);
bad2 += err; bad2 += err;
Vec<3> hnv = Cross (Vec3d (mesh[el[0]], Vec<3> hnv = Cross (Vec3d (mesh[el[0]],
@ -672,7 +673,7 @@ namespace netgen
ParallelFor( Range(edges), [&] (auto i) NETGEN_LAMBDA_INLINE ParallelFor( Range(edges), [&] (auto i) NETGEN_LAMBDA_INLINE
{ {
auto [pi1, pi2] = edges[i]; auto [pi1, pi2] = edges[i];
double d_badness = CombineImproveEdge(mesh, elementsonnode, normals, fixed, pi1, pi2, true); double d_badness = CombineImproveEdge(mesh, elementsonnode, normals, fixed, pi1, pi2, metricweight, true);
if(d_badness < 0.0) if(d_badness < 0.0)
candidate_edges[improvement_counter++] = make_tuple(d_badness, i); candidate_edges[improvement_counter++] = make_tuple(d_badness, i);
}, TasksPerThread(4)); }, TasksPerThread(4));
@ -683,7 +684,7 @@ namespace netgen
for(auto [d_badness, ei] : edges_with_improvement) for(auto [d_badness, ei] : edges_with_improvement)
{ {
auto [pi1, pi2] = edges[ei]; auto [pi1, pi2] = edges[ei];
CombineImproveEdge(mesh, elementsonnode, normals, fixed, pi1, pi2, false); CombineImproveEdge(mesh, elementsonnode, normals, fixed, pi1, pi2, metricweight, false);
} }
// mesh.Compress(); // mesh.Compress();