fix isendpoint check in boundarylayer code

This commit is contained in:
Christopher Lackner 2024-02-13 13:01:42 +01:00
parent 07fb5d698e
commit 8e94de7a73

View File

@ -985,22 +985,23 @@ namespace netgen
Array<PointIndex> points;
// find first vertex on edge
double edge_len = 0.;
auto is_end_point = [&] (PointIndex pi, const Segment& testseg)
auto is_end_point = [&] (PointIndex pi)
{
// if(mesh[pi].Type() == FIXEDPOINT)
// return true;
// return false;
auto segs = topo.GetVertexSegments(pi);
if(segs.Size() == 1)
return true;
auto first_edgenr = mesh[segs[0]].edgenr;
for(auto segi : segs)
if(auto& seg = mesh[segi]; seg.edgenr != first_edgenr || (testseg[0] == seg[1] && testseg[1] == seg[0]))
if(mesh[segi].edgenr != first_edgenr)
return true;
return false;
};
bool any_grows = false;
const Segment* last_seg = nullptr;
for(const auto& seg : segments)
{
if(seg.edgenr-1 == edgenr)
@ -1008,9 +1009,8 @@ namespace netgen
if(growthvectors[seg[0]].Length2() != 0 ||
growthvectors[seg[1]].Length2() != 0)
any_grows = true;
if(points.Size() == 0 && is_end_point(seg[0], seg))
if(points.Size() == 0 && is_end_point(seg[0]))
{
last_seg = &seg;
points.Append(seg[0]);
points.Append(seg[1]);
edge_len += (mesh[seg[1]] - mesh[seg[0]]).Length();
@ -1037,7 +1037,6 @@ namespace netgen
edge_len += (mesh[points.Last()] - mesh[seg[1]]).Length();
points.Append(seg[1]);
point_found = true;
last_seg = &seg;
break;
}
else if(seg[1] == points.Last() &&
@ -1046,11 +1045,10 @@ namespace netgen
edge_len += (mesh[points.Last()] - mesh[seg[0]]).Length();
points.Append(seg[0]);
point_found = true;
last_seg = &seg;
break;
}
}
if(last_seg && is_end_point(points.Last(), *last_seg))
if(is_end_point(points.Last()))
break;
if(!point_found)
{