From 60c80fe9fc7b60570d680c8322912a42d753cf1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Sch=C3=B6berl?= Date: Tue, 3 Oct 2017 06:33:39 +0200 Subject: [PATCH] use (double) factor for 2D hprefinement for strength of geometric refinement --- libsrc/csg/python_csg.cpp | 5 +++-- libsrc/geom2d/genmesh2d.cpp | 2 +- libsrc/geom2d/geometry2d.hpp | 4 ++-- libsrc/geom2d/python_geom2d.cpp | 9 ++++----- libsrc/gprim/spline.hpp | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libsrc/csg/python_csg.cpp b/libsrc/csg/python_csg.cpp index aae72160..35f3872e 100644 --- a/libsrc/csg/python_csg.cpp +++ b/libsrc/csg/python_csg.cpp @@ -375,7 +375,7 @@ DLL_HEADER void ExportCSG(py::module &m) })) .def("Add", [] (CSGeometry & self, shared_ptr solid, py::list bcmod, double maxh, - py::tuple col, bool transparent) + py::tuple col, bool transparent, int layer) { solid->AddSurfaces (self); solid->GiveUpOwner(); @@ -385,6 +385,7 @@ DLL_HEADER void ExportCSG(py::module &m) // self.GetTopLevelObject(tlonr)->SetTransparent(solid->IsTransparent()); self.GetTopLevelObject(tlonr)->SetTransparent(transparent); self.GetTopLevelObject(tlonr)->SetMaxH(maxh); + self.GetTopLevelObject(tlonr)->SetLayer(layer); // cout << "rgb = " << py::len(rgb) << endl; if (py::len(col)==3) @@ -421,7 +422,7 @@ DLL_HEADER void ExportCSG(py::module &m) return tlonr; }, py::arg("solid"), py::arg("bcmod")=py::list(), py::arg("maxh")=1e99, - py::arg("col")=py::tuple(), py::arg("transparent")=false + py::arg("col")=py::tuple(), py::arg("transparent")=false, py::arg("layer")=1 ) .def("AddSurface", FunctionPointer diff --git a/libsrc/geom2d/genmesh2d.cpp b/libsrc/geom2d/genmesh2d.cpp index dead31e9..0ddfb8b4 100644 --- a/libsrc/geom2d/genmesh2d.cpp +++ b/libsrc/geom2d/genmesh2d.cpp @@ -416,7 +416,7 @@ namespace netgen mpi = pi; mindist = Dist2(gp3, (*mesh)[pi]); } - (*mesh)[mpi].Singularity(1.); + (*mesh)[mpi].Singularity(geometry.GetPoint(i).hpref); } diff --git a/libsrc/geom2d/geometry2d.hpp b/libsrc/geom2d/geometry2d.hpp index 0c21859c..3c4dab90 100644 --- a/libsrc/geom2d/geometry2d.hpp +++ b/libsrc/geom2d/geometry2d.hpp @@ -36,9 +36,9 @@ namespace netgen /// copy spline mesh from other spline (-1.. do not copy) int copyfrom; /// perfrom anisotropic refinement (hp-refinement) to edge - bool hpref_left; + double hpref_left; /// perfrom anisotropic refinement (hp-refinement) to edge - bool hpref_right; + double hpref_right; /// int layer; diff --git a/libsrc/geom2d/python_geom2d.cpp b/libsrc/geom2d/python_geom2d.cpp index f67de52e..5b71b980 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, bool hpref) + ([](SplineGeometry2d &self, double px, double py, double maxh, double hpref) { Point<2> p; p(0) = px; @@ -42,9 +42,9 @@ DLL_HEADER void ExportGeom2d(py::module &m) self.geompoints.Append(gp); return self.geompoints.Size()-1; }), - py::arg("x"), py::arg("y"), py::arg("maxh") = 1e99, py::arg("hpref")=false) + py::arg("x"), py::arg("y"), py::arg("maxh") = 1e99, py::arg("hpref")=0) .def("Append", FunctionPointer([](SplineGeometry2d &self, py::list segment, int leftdomain, int rightdomain, - py::object bc, py::object copy, double maxh, bool hpref) + py::object bc, py::object copy, double maxh, double hpref) { py::extract segtype(segment[0]); @@ -96,8 +96,7 @@ DLL_HEADER void ExportGeom2d(py::module &m) self.AppendSegment(seg); return self.GetNSplines()-1; }), py::arg("point_indices"), py::arg("leftdomain") = 1, py::arg("rightdomain") = py::int_(0), - py::arg("bc")=NGDummyArgument(), py::arg("copy")=NGDummyArgument(), py::arg("maxh")=1e99, py::arg("hpref")=false - ) + py::arg("bc")=NGDummyArgument(), py::arg("copy")=NGDummyArgument(), py::arg("maxh")=1e99, py::arg("hpref")=0) .def("AppendSegment", FunctionPointer([](SplineGeometry2d &self, py::list point_indices, int leftdomain, int rightdomain) diff --git a/libsrc/gprim/spline.hpp b/libsrc/gprim/spline.hpp index 4121fd61..a628d07d 100644 --- a/libsrc/gprim/spline.hpp +++ b/libsrc/gprim/spline.hpp @@ -27,13 +27,13 @@ namespace netgen /// max mesh-size at point double hmax; /// hp-refinement - bool hpref; + double hpref; /// GeomPoint () { ; } /// - GeomPoint (const Point & ap, double aref = 1, bool ahpref=false) + GeomPoint (const Point & ap, double aref = 1, double ahpref=0) : Point(ap), refatpoint(aref), hmax(1e99), hpref(ahpref) { ; } };