diff --git a/libsrc/geom2d/genmesh2d.cpp b/libsrc/geom2d/genmesh2d.cpp index 208d0c2b..54dc5691 100644 --- a/libsrc/geom2d/genmesh2d.cpp +++ b/libsrc/geom2d/genmesh2d.cpp @@ -207,6 +207,9 @@ namespace netgen // mesh size restrictions ... + + for (auto & point : geompoints) + mesh2d.RestrictLocalH (Point<3> (point(0), point(1), 0), point.hmax); for (int i = 0; i < splines.Size(); i++) { @@ -240,7 +243,21 @@ namespace netgen for (auto mspnt : mp.meshsize_points) mesh2d.RestrictLocalH (mspnt.pnt, mspnt.h); - + + // add point elements + for (auto & point : geompoints) + if (point.name.length()) + { + Point<3> newp(point(0), point(1), 0); + PointIndex npi = mesh2d.AddPoint (newp, 1, FIXEDPOINT); + mesh2d.AddLockedPoint(npi); + Element0d el(npi, npi); + el.name = point.name; + mesh2d.SetCD2Name(npi, point.name); + mesh2d.pointelements.Append (el); + searchtree.Insert (newp, npi); + } + // first add all vertices (for compatible orientation on periodic bnds) { double diam2 = Dist2(pmin, pmax); diff --git a/libsrc/geom2d/python_geom2d.cpp b/libsrc/geom2d/python_geom2d.cpp index f44b525e..d6abe3b8 100644 --- a/libsrc/geom2d/python_geom2d.cpp +++ b/libsrc/geom2d/python_geom2d.cpp @@ -31,7 +31,7 @@ DLL_HEADER void ExportGeom2d(py::module &m) .def("Load",&SplineGeometry2d::Load) .def("AppendPoint", FunctionPointer - ([](SplineGeometry2d &self, double px, double py, double maxh, double hpref) + ([](SplineGeometry2d &self, double px, double py, double maxh, double hpref, string name) { Point<2> p; p(0) = px; @@ -39,10 +39,11 @@ DLL_HEADER void ExportGeom2d(py::module &m) GeomPoint<2> gp(p); gp.hmax = maxh; gp.hpref = hpref; + gp.name = name; self.geompoints.Append(gp); return self.geompoints.Size()-1; }), - py::arg("x"), py::arg("y"), py::arg("maxh") = 1e99, py::arg("hpref")=0) + py::arg("x"), py::arg("y"), py::arg("maxh") = 1e99, py::arg("hpref")=0, py::arg("name")="") .def("Append", FunctionPointer([](SplineGeometry2d &self, py::list segment, int leftdomain, int rightdomain, py::object bc, py::object copy, double maxh, double hpref) { diff --git a/libsrc/gprim/spline.hpp b/libsrc/gprim/spline.hpp index a628d07d..e227a18a 100644 --- a/libsrc/gprim/spline.hpp +++ b/libsrc/gprim/spline.hpp @@ -28,7 +28,8 @@ namespace netgen double hmax; /// hp-refinement double hpref; - + /// + string name; /// GeomPoint () { ; } diff --git a/libsrc/include/nginterface_v2_impl.hpp b/libsrc/include/nginterface_v2_impl.hpp index aa538761..62e8068d 100644 --- a/libsrc/include/nginterface_v2_impl.hpp +++ b/libsrc/include/nginterface_v2_impl.hpp @@ -47,6 +47,7 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<0> (size_t nr) const Ng_Element ret; ret.type = NG_PNT; ret.index = el.index; + ret.mat = &el.name; ret.points.num = 1; ret.points.ptr = (int*)&el.pnum; diff --git a/libsrc/meshing/adfront2.cpp b/libsrc/meshing/adfront2.cpp index 7eb426ad..11dd7421 100644 --- a/libsrc/meshing/adfront2.cpp +++ b/libsrc/meshing/adfront2.cpp @@ -22,7 +22,7 @@ namespace netgen mgi = new MultiPointGeomInfo (*amgi); for (int i = 1; i <= mgi->GetNPGI(); i++) if (mgi->GetPGI(i).trignum <= 0) - cout << "Add FrontPoint2, illegal geominfo = " << mgi->GetPGI(i).trignum << endl; + cout << "WARNING: Add FrontPoint2, illegal geominfo = " << mgi->GetPGI(i).trignum << endl; } else mgi = NULL; @@ -136,7 +136,7 @@ namespace netgen if (!gi1.trignum || !gi2.trignum) { - cout << "ERROR: in AdFront::AddLine, illegal geominfo" << endl; + cout << "WARNING: in AdFront::AddLine, illegal geominfo" << endl; } lines[li].SetGeomInfo (gi1, gi2); diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index 5fe1d8a6..75a0946d 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -1062,6 +1062,7 @@ namespace netgen { public: PointIndex pnum; + string name; int index; Element0d () = default; Element0d (PointIndex _pnum, int _index)