Merge branch 'meshing_fixes' into 'master'

Meshing fixes

See merge request jschoeberl/netgen!481
This commit is contained in:
Joachim Schöberl 2022-02-24 07:58:40 +00:00
commit 58af9adb03
3 changed files with 1350 additions and 1342 deletions

View File

@ -35,6 +35,7 @@ namespace netgen
if (t2 == -1) return false;
if (swapped[t1] || swapped[t2]) return false;
if (mesh[t2].IsDeleted()) return false;
const int faceindex = mesh[t1].GetIndex();
const int surfnr = mesh.GetFaceDescriptor (faceindex).SurfNr();
@ -278,6 +279,7 @@ namespace netgen
}
const auto sel = mesh[sei];
auto index = sel.GetIndex();
for (int j = 0; j < 3; j++)
{
PointIndex pi1 = sel.PNumMod(j+2);
@ -286,6 +288,7 @@ namespace netgen
for (auto sei_other : elements_on_node[pi1])
{
if(sei_other==sei) continue;
if(mesh[sei_other].GetIndex()!=index) continue;
const auto & other = mesh[sei_other];
int pi1_other = -1;
int pi2_other = -1;
@ -333,7 +336,7 @@ namespace netgen
if (mesh[t1].IsDeleted())
return;
if (mesh[t1].GetIndex() != faceindex)
if (swapped[t1])
return;
if (multithread.terminate)
@ -363,6 +366,7 @@ namespace netgen
Array<Vec<3>, PointIndex> & normals,
Array<bool, PointIndex> & fixed,
PointIndex pi1, PointIndex pi2,
double metricweight,
bool check_only = true)
{
Vec<3> nv;
@ -438,7 +442,7 @@ namespace netgen
for (const Element2d & el : mesh.SurfaceElements()[hasonepi])
{
bad1 += CalcTriangleBadness (mesh[el[0]], mesh[el[1]], mesh[el[2]],
nv, -1, loch);
nv, metricweight, loch);
illegal1 += 1-mesh.LegalTrig(el);
}
@ -446,7 +450,7 @@ namespace netgen
{
const Element2d & el = mesh[hasbothpi[k]];
bad1 += CalcTriangleBadness (mesh[el[0]], mesh[el[1]], mesh[el[2]],
nv, -1, loch);
nv, metricweight, loch);
illegal1 += 1-mesh.LegalTrig(el);
}
@ -460,7 +464,7 @@ namespace netgen
double err =
CalcTriangleBadness (mesh[el[0]], mesh[el[1]], mesh[el[2]],
nv, -1, loch);
nv, metricweight, loch);
bad2 += err;
Vec<3> hnv = Cross (Vec3d (mesh[el[0]],
@ -669,7 +673,7 @@ namespace netgen
ParallelFor( Range(edges), [&] (auto i) NETGEN_LAMBDA_INLINE
{
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)
candidate_edges[improvement_counter++] = make_tuple(d_badness, i);
}, TasksPerThread(4));
@ -680,7 +684,7 @@ namespace netgen
for(auto [d_badness, ei] : edges_with_improvement)
{
auto [pi1, pi2] = edges[ei];
CombineImproveEdge(mesh, elementsonnode, normals, fixed, pi1, pi2, false);
CombineImproveEdge(mesh, elementsonnode, normals, fixed, pi1, pi2, metricweight, false);
}
// mesh.Compress();

View File

@ -6063,7 +6063,11 @@ namespace netgen
{
GetSurfaceElementsOfFace (fdi, els_of_face);
if (els_of_face.Size() == 0) continue;
if (els_of_face.Size() == 0)
{
fdi++;
continue;
}
SurfaceElementIndex firstel = els_of_face[0];

File diff suppressed because it is too large Load Diff