Rename blp.keep_surfaceindex to disable_curving

When disabling curving at faces, also disable it for adjacent edges
This commit is contained in:
Matthias Hochsteger 2024-10-08 17:35:53 +02:00
parent 4373def54b
commit 4a1fe78ff6
6 changed files with 38 additions and 11 deletions

View File

@ -339,7 +339,7 @@ void BoundaryLayerTool ::CreateNewFaceDescriptors()
// result in pushed through elements, since we do not (yet)
// curvature through layers.
// Therefore we disable curving for these surfaces.
if (!params.keep_surfaceindex)
if (params.disable_curving)
mesh.GetFaceDescriptor(i).SetSurfNr(-1);
}
}
@ -1079,7 +1079,23 @@ void BoundaryLayerTool ::AddSegments()
{
auto& new_segs =
insert_only_volume_elements ? new_segments_on_moved_bnd : new_segments;
// cout << "add new segs " << endl << new_segs << endl;
if (params.disable_curving)
{
for (auto& seg : segments)
if (is_edge_moved[seg.si])
{
seg.epgeominfo[0].edgenr = -1;
seg.epgeominfo[0].edgenr = -1;
}
for (auto& seg : new_segs)
{
seg.epgeominfo[0].edgenr = -1;
seg.epgeominfo[0].edgenr = -1;
}
}
if (have_single_segments)
MergeAndAddSegments(mesh, segments, new_segs);
else
@ -1264,6 +1280,8 @@ void BoundaryLayerTool ::ProcessParameters()
void BoundaryLayerTool ::Perform()
{
if (domains.NumSet() == 0)
return;
CreateNewFaceDescriptors();
CalculateGrowthVectors();
CreateFaceDescriptorsSides();
@ -1288,6 +1306,7 @@ void BoundaryLayerTool ::Perform()
if (params.limit_growth_vectors)
LimitGrowthVectorLengths();
FixEdges();
FixSurfaceElements();
for (auto [pi, data] : growth_vector_map)

View File

@ -90,6 +90,7 @@ public:
void InterpolateSurfaceGrowthVectors ();
void InterpolateGrowthVectors ();
void LimitGrowthVectorLengths ();
void FixEdges ();
void FixSurfaceElements ();
void InsertNewElements (FlatArray<Array<pair<SegmentIndex, int>>, SegmentIndex> segmap, const BitArray& in_surface_direction);

View File

@ -365,6 +365,13 @@ void BoundaryLayerTool ::InterpolateSurfaceGrowthVectors()
addGW(pi, corrections[pi]);
}
void BoundaryLayerTool ::FixEdges()
{
for (auto& seg : mesh.LineSegments())
if (seg.epgeominfo[0].edgenr == -1 && seg.epgeominfo[1].edgenr == -1)
seg.edgenr = -1;
}
void BoundaryLayerTool ::FixSurfaceElements()
{
static Timer tall("FixSurfaceElements");

View File

@ -2961,7 +2961,7 @@ namespace netgen
ost << "\n grow_edges: " << mp.grow_edges;
ost << "\n limit_growth_vectors: " << mp.limit_growth_vectors;
ost << "\n sides_keep_surfaceindex: " << (mp.sides_keep_surfaceindex ? ToString(*mp.sides_keep_surfaceindex) : "nullopt");
ost << "\n keep_surfaceindex: " << mp.keep_surfaceindex;
ost << "\n disable_curving: " << mp.disable_curving;
ost << endl;
return ost;
}

View File

@ -1285,7 +1285,7 @@ namespace netgen
bool grow_edges = true;
bool limit_growth_vectors = true;
std::optional<bool> sides_keep_surfaceindex = nullopt; // !outside by default
bool keep_surfaceindex = false;
bool disable_curving = true; // disable curving affected boundaries/edges (could lead to self-intersecting volume elements)
};

View File

@ -1477,7 +1477,7 @@ py::arg("point_tolerance") = -1.)
optional<variant<string, std::vector<int>>> project_boundaries,
bool grow_edges, bool limit_growth_vectors,
bool sides_keep_surfaceindex,
bool keep_surfaceindex)
bool disable_curving)
{
BoundaryLayerParameters blp;
blp.boundary = boundary;
@ -1489,13 +1489,13 @@ py::arg("point_tolerance") = -1.)
blp.grow_edges = grow_edges;
blp.limit_growth_vectors = limit_growth_vectors;
blp.sides_keep_surfaceindex = sides_keep_surfaceindex;
blp.keep_surfaceindex = keep_surfaceindex;
blp.disable_curving = disable_curving;
GenerateBoundaryLayer (self, blp);
self.UpdateTopology();
}, py::arg("boundary"), py::arg("thickness"), py::arg("material")=nullopt,
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, "Add boundary layer to mesh. see help(BoundaryLayerParameters) for details.")
py::arg("disable_curving")=true, "Add boundary layer to mesh. see help(BoundaryLayerParameters) for details.")
.def_static ("EnableTableClass", [] (string name, bool set)
{
@ -1732,7 +1732,7 @@ py::arg("point_tolerance") = -1.)
bool grow_edges,
bool limit_growth_vectors,
std::optional<bool> sides_keep_surfaceindex,
bool keep_surfaceindex)
bool disable_curving)
{
BoundaryLayerParameters blp;
blp.boundary = boundary;
@ -1744,14 +1744,14 @@ py::arg("point_tolerance") = -1.)
blp.grow_edges = grow_edges;
blp.limit_growth_vectors = limit_growth_vectors;
blp.sides_keep_surfaceindex = sides_keep_surfaceindex;
blp.keep_surfaceindex = keep_surfaceindex;
blp.disable_curving = disable_curving;
return blp;
}),
py::arg("boundary"), py::arg("thickness"), py::arg("new_material")=nullopt,
py::arg("domain") = ".*", 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")=nullopt,
py::arg("keep_surfaceindex")=false,
py::arg("disable_curving")=true,
R"delimiter(
Add boundary layer to mesh.
@ -1803,7 +1803,7 @@ project_boundaries : Optional[str] = None
.def_readwrite("grow_edges", &BoundaryLayerParameters::grow_edges)
.def_readwrite("limit_growth_vectors", &BoundaryLayerParameters::limit_growth_vectors)
.def_readwrite("sides_keep_surfaceindex", &BoundaryLayerParameters::sides_keep_surfaceindex)
.def_readwrite("keep_surfaceindex", &BoundaryLayerParameters::keep_surfaceindex)
.def_readwrite("disable_curving", &BoundaryLayerParameters::disable_curving)
;
py::implicitly_convertible<py::dict, BoundaryLayerParameters>();