diff --git a/libsrc/csg/genmesh.cpp b/libsrc/csg/genmesh.cpp index de45e713..4b8f1713 100644 --- a/libsrc/csg/genmesh.cpp +++ b/libsrc/csg/genmesh.cpp @@ -687,6 +687,8 @@ namespace netgen mparam.grading); mesh -> LoadLocalMeshSize (mparam.meshsizefilename); + for (auto mspnt : mparam.meshsize_points) + mesh -> RestrictLocalH (mspnt.pnt, mspnt.h); } spoints.SetSize(0); diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index 3687e240..77a0c1c0 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -1130,12 +1130,26 @@ namespace netgen MeshingParameters (); /// MeshingParameters (const MeshingParameters & mp2) = default; + MeshingParameters (MeshingParameters && mp2) = default; /// void Print (ostream & ost) const; /// // void CopyFrom(const MeshingParameters & other); - + class MeshSizePoint + { + public: + Point<3> pnt; + double h; + MeshSizePoint (Point<3> _pnt, double _h) : pnt(_pnt), h(_h) { ; } + MeshSizePoint () = default; + MeshSizePoint (const MeshSizePoint &) = default; + MeshSizePoint (MeshSizePoint &&) = default; + MeshSizePoint & operator= (const MeshSizePoint &) = default; + MeshSizePoint & operator= (MeshSizePoint &&) = default; + }; + Array meshsize_points; + void (*render_function)(bool) = NULL; void Render(bool blocking = false) { diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index eb14c78d..59099743 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -593,7 +593,13 @@ DLL_HEADER void ExportNetgenMeshing() .add_property("maxh", FunctionPointer ([](const MP & mp ) { return mp.maxh; }), FunctionPointer ([](MP & mp, double maxh) { return mp.maxh = maxh; })) - + .def("RestrictH", FunctionPointer + ([](MP & mp, double x, double y, double z, double h) + { + mp.meshsize_points.Append ( MeshingParameters::MeshSizePoint (Point<3> (x,y,z), h)); + }), + (bp::arg("x"), bp::arg("y"), bp::arg("z"), bp::arg("h")) + ) ; bp::def("SetTestoutFile", FunctionPointer ([] (const string & filename) diff --git a/python/csg.py b/python/csg.py index 725a09a9..cde89fc9 100644 --- a/python/csg.py +++ b/python/csg.py @@ -14,7 +14,11 @@ def VS (obj): def csg_meshing_func (geom, **args): - return GenerateMesh (geom, MeshingParameters (**args)) + if "mp" in args: + return GenerateMesh (geom, args["mp"]) + else: + return GenerateMesh (geom, MeshingParameters (**args)) +# return GenerateMesh (geom, MeshingParameters (**args)) CSGeometry.GenerateMesh = csg_meshing_func