From 3b79dbc8ffacabd4d9001ba59fbc21ae96e084f4 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Mon, 10 Mar 2025 10:05:11 +0100 Subject: [PATCH] Layer parameter for RestrictH --- libsrc/csg/genmesh.cpp | 2 +- libsrc/meshing/basegeom.cpp | 2 +- libsrc/meshing/meshtype.hpp | 2 +- libsrc/meshing/python_mesh.cpp | 18 +++++++++--------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libsrc/csg/genmesh.cpp b/libsrc/csg/genmesh.cpp index c9bba2f0..f613db25 100644 --- a/libsrc/csg/genmesh.cpp +++ b/libsrc/csg/genmesh.cpp @@ -718,7 +718,7 @@ namespace netgen mesh -> LoadLocalMeshSize (mparam.meshsizefilename); for (auto mspnt : mparam.meshsize_points) - mesh -> RestrictLocalH (mspnt.pnt, mspnt.h); + mesh -> RestrictLocalH (mspnt.pnt, mspnt.h, mspnt.layer); } spoints.SetSize(0); diff --git a/libsrc/meshing/basegeom.cpp b/libsrc/meshing/basegeom.cpp index 05d683ff..8c611a0b 100644 --- a/libsrc/meshing/basegeom.cpp +++ b/libsrc/meshing/basegeom.cpp @@ -474,7 +474,7 @@ namespace netgen } for(const auto& mspnt : mparam.meshsize_points) - mesh.RestrictLocalH(mspnt.pnt, mspnt.h); + mesh.RestrictLocalH(mspnt.pnt, mspnt.h, mspnt.layer); mesh.LoadLocalMeshSize(mparam.meshsizefilename); } diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index 27597581..e0572155 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -1635,7 +1635,7 @@ namespace netgen Point<3> pnt; double h; int layer = 1; - MeshSizePoint (Point<3> _pnt, double _h) : pnt(_pnt), h(_h) { ; } + MeshSizePoint (Point<3> pnt_, double h_, int layer_ = 1) : pnt(pnt_), h(h_), layer(layer_) { ; } MeshSizePoint () = default; MeshSizePoint (const MeshSizePoint &) = default; MeshSizePoint (MeshSizePoint &&) = default; diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index c3aea835..dc0d2a60 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -1683,25 +1683,25 @@ py::arg("point_tolerance") = -1.) return mp; }), py::arg("mp")=nullptr, meshingparameter_description.c_str()) .def("__str__", &ToString) - .def("RestrictH", [](MP & mp, double x, double y, double z, double h) + .def("RestrictH", [](MP & mp, double x, double y, double z, double h, int layer) { - mp.meshsize_points.Append ( MeshingParameters::MeshSizePoint(Point<3> (x,y,z), h)); - }, py::arg("x"), py::arg("y"), py::arg("z"), py::arg("h") + mp.meshsize_points.Append ( MeshingParameters::MeshSizePoint(Point<3> (x,y,z), h, layer)); + }, py::arg("x"), py::arg("y"), py::arg("z"), py::arg("h"), py::arg("layer")=1 ) - .def("RestrictH", [](MP & mp, const Point<3>& p, double h) + .def("RestrictH", [](MP & mp, const Point<3>& p, double h, int layer) { - mp.meshsize_points.Append ({p, h}); - }, py::arg("p"), py::arg("h")) + mp.meshsize_points.Append ({p, h, layer}); + }, py::arg("p"), py::arg("h"), py::arg("layer")=1) .def("RestrictHLine", [](MP& mp, const Point<3>& p1, const Point<3>& p2, - double maxh) + double maxh, int layer) { int steps = int(Dist(p1, p2) / maxh) + 2; auto v = p2 - p1; for (int i = 0; i <= steps; i++) { - mp.meshsize_points.Append({p1 + double(i)/steps * v, maxh}); + mp.meshsize_points.Append({p1 + double(i)/steps * v, maxh, layer}); } - }, py::arg("p1"), py::arg("p2"), py::arg("maxh")) + }, py::arg("p1"), py::arg("p2"), py::arg("maxh"), py::arg("layer")=1) ; m.def("SetTestoutFile", FunctionPointer ([] (const string & filename)