Merge branch 'allow_internal_edges_boundarylayer' into 'master'

allow internal edges on boundarylayer (for sphere, ellipsoid)

See merge request ngsolve/netgen!631
This commit is contained in:
Schöberl, Joachim 2024-02-13 10:04:27 +01:00
commit 259ea216cb
3 changed files with 16 additions and 7 deletions

View File

@ -679,7 +679,8 @@ namespace netgen
// result in pushed through elements, since we do not (yet)
// curvature through layers.
// Therefore we disable curving for these surfaces.
mesh.GetFaceDescriptor(i).SetSurfNr(-1);
if(!params.keep_surfaceindex)
mesh.GetFaceDescriptor(i).SetSurfNr(-1);
}
}
@ -984,7 +985,7 @@ namespace netgen
Array<PointIndex> points;
// find first vertex on edge
double edge_len = 0.;
auto is_end_point = [&] (PointIndex pi)
auto is_end_point = [&] (PointIndex pi, const Segment& testseg)
{
// if(mesh[pi].Type() == FIXEDPOINT)
// return true;
@ -992,13 +993,14 @@ namespace netgen
auto segs = topo.GetVertexSegments(pi);
auto first_edgenr = mesh[segs[0]].edgenr;
for(auto segi : segs)
if(mesh[segi].edgenr != first_edgenr)
return true;
if(auto& seg = mesh[segi]; seg.edgenr != first_edgenr || (testseg[0] == seg[1] && testseg[1] == seg[0]))
return true;
return false;
};
bool any_grows = false;
const Segment* last_seg = nullptr;
for(const auto& seg : segments)
{
if(seg.edgenr-1 == edgenr)
@ -1006,8 +1008,9 @@ 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]))
if(points.Size() == 0 && is_end_point(seg[0], seg))
{
last_seg = &seg;
points.Append(seg[0]);
points.Append(seg[1]);
edge_len += (mesh[seg[1]] - mesh[seg[0]]).Length();
@ -1034,6 +1037,7 @@ 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() &&
@ -1042,10 +1046,11 @@ namespace netgen
edge_len += (mesh[points.Last()] - mesh[seg[0]]).Length();
points.Append(seg[0]);
point_found = true;
last_seg = &seg;
break;
}
}
if(is_end_point(points.Last()))
if(last_seg && is_end_point(points.Last(), *last_seg))
break;
if(!point_found)
{

View File

@ -23,6 +23,7 @@ public:
bool limit_growth_vectors = true;
double limit_safety = 0.3; // alloow only 30% of the growth vector length
bool sides_keep_surfaceindex = false;
bool keep_surfaceindex = false;
Array<size_t> project_boundaries;
};

View File

@ -1463,7 +1463,8 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
variant<string, int> domain, bool outside,
optional<string> project_boundaries,
bool grow_edges, bool limit_growth_vectors,
bool sides_keep_surfaceindex)
bool sides_keep_surfaceindex,
bool keep_surfaceindex)
{
BoundaryLayerParameters blp;
BitArray boundaries(self.GetNFD()+1);
@ -1549,12 +1550,14 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
blp.grow_edges = grow_edges;
blp.limit_growth_vectors = limit_growth_vectors;
blp.sides_keep_surfaceindex = sides_keep_surfaceindex;
blp.keep_surfaceindex = keep_surfaceindex;
GenerateBoundaryLayer (self, blp);
self.UpdateTopology();
}, py::arg("boundary"), py::arg("thickness"), py::arg("material"),
py::arg("domains") = ".*", py::arg("outside") = false,
py::arg("project_boundaries")=nullopt, py::arg("grow_edges")=true, py::arg("limit_growth_vectors") = true, py::arg("sides_keep_surfaceindex")=false,
py::arg("keep_surfaceindex")=false,
R"delimiter(
Add boundary layer to mesh.