From 48eb4fed07c9bf72d14dae93963d249785da413f Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Wed, 10 Jan 2024 16:31:05 +0100 Subject: [PATCH 1/3] add tolerance to occ-edge projection --- libsrc/occ/occ_edge.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libsrc/occ/occ_edge.cpp b/libsrc/occ/occ_edge.cpp index 0c907d78..4805bb17 100644 --- a/libsrc/occ/occ_edge.cpp +++ b/libsrc/occ/occ_edge.cpp @@ -61,7 +61,12 @@ namespace netgen void OCCEdge::ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const { auto pnt = ng2occ(p); - GeomAPI_ProjectPointOnCurve proj(pnt, curve, s0, s1); + // extend the projection parameter range, else projection might fail + // for an endpoint + // see discussion here: https://forum.ngsolve.org/t/how-to-apply-occidentification-correctly/2555 + // I do not see a better way using occ tolerances? + double eps = 1e-7 * (s1-s0); + GeomAPI_ProjectPointOnCurve proj(pnt, curve, s0-eps, s1+eps); pnt = proj.NearestPoint(); if(gi) gi->dist = (proj.LowerDistanceParameter() - s0)/(s1-s0); From c0d394ebf55de436fd589e5868e490e9369fd4d1 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Mon, 15 Jan 2024 08:16:14 +0100 Subject: [PATCH 2/3] introduce 'shallow_archive' member --- libsrc/core/archive.hpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libsrc/core/archive.hpp b/libsrc/core/archive.hpp index 6db37a07..d7546060 100644 --- a/libsrc/core/archive.hpp +++ b/libsrc/core/archive.hpp @@ -57,6 +57,17 @@ namespace ngcore }; + + + template + class has_shallow_archive : public std::false_type {}; + + template + class has_shallow_archive> + : public std::is_same {}; + + + #ifdef NETGEN_PYTHON pybind11::object CastAnyToPy(const std::any& a); #endif // NETGEN_PYTHON @@ -501,7 +512,7 @@ namespace ngcore template Archive& operator & (std::shared_ptr& ptr) { - if constexpr(has_shared_from_this2::value) + if constexpr(has_shallow_archive::value) if (shallow_to_python) { Shallow (ptr); From 696620828fd4b36fba0edb946ed7d12e700c0941 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Mon, 15 Jan 2024 21:42:18 +0100 Subject: [PATCH 3/3] don't restrict refinement parameter in HPRefinement (more user responsibility) --- libsrc/meshing/hprefinement.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/meshing/hprefinement.cpp b/libsrc/meshing/hprefinement.cpp index 1fae823f..066d1942 100644 --- a/libsrc/meshing/hprefinement.cpp +++ b/libsrc/meshing/hprefinement.cpp @@ -676,7 +676,7 @@ namespace netgen // prepare new points - fac1 = max(0.001,min(0.33,fac1)); + // fac1 = max(0.001,min(0.33,fac1)); PrintMessage(3, " in HP-REFINEMENT with fac1 ", fac1); *testout << " in HP-REFINEMENT with fac1 " << fac1 << endl;