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