From 21b263a0ba412d15212f6e4a47b3ba567c57948e Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Fri, 25 Feb 2022 18:17:49 +0100 Subject: [PATCH] [occ] fix boundarylayer + curve --- libsrc/meshing/basegeom.hpp | 21 +++++++++++++++------ libsrc/meshing/boundarylayer.cpp | 1 + libsrc/meshing/meshtype.hpp | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/libsrc/meshing/basegeom.hpp b/libsrc/meshing/basegeom.hpp index 44c66bdd..c8a272c1 100644 --- a/libsrc/meshing/basegeom.hpp +++ b/libsrc/meshing/basegeom.hpp @@ -232,12 +232,15 @@ namespace netgen virtual PointGeomInfo ProjectPoint (int surfind, Point<3> & p) const { - return faces[surfind-1]->Project(p); + if(surfind <= faces.Size() && surfind > 0) + return faces[surfind-1]->Project(p); + return PointGeomInfo(); } virtual void ProjectPointEdge (int surfind, int surfind2, Point<3> & p, EdgePointGeomInfo* gi = nullptr) const { - edges[gi->edgenr]->ProjectPoint(p, gi); + if(gi && gi->edgenr < edges.Size()) + edges[gi->edgenr]->ProjectPoint(p, gi); } virtual bool CalcPointGeomInfo(int surfind, PointGeomInfo& gi, const Point<3> & p3) const @@ -246,11 +249,17 @@ namespace netgen } virtual bool ProjectPointGI (int surfind, Point<3> & p, PointGeomInfo & gi) const { - return faces[surfind-1]->ProjectPointGI(p, gi); + if(surfind > 0 && surfind <= faces.Size()) + return faces[surfind-1]->ProjectPointGI(p, gi); } virtual Vec<3> GetNormal(int surfind, const Point<3> & p, const PointGeomInfo* gi = nullptr) const - { return faces[surfind-1]->GetNormal(p, gi); } + { + if(surfind > 0 && surfind <= faces.Size()) + return faces[surfind-1]->GetNormal(p, gi); + else + return {0., 0., 0.}; + } virtual void PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint, @@ -260,7 +269,7 @@ namespace netgen Point<3> & newp, PointGeomInfo & newgi) const { - if(faces.Size()) + if(faces.Size() >= surfi && surfi > 0) { faces[surfi-1]->PointBetween(p1, p2, secpoint, gi1, gi2, newp, newgi); return; @@ -276,7 +285,7 @@ namespace netgen Point<3> & newp, EdgePointGeomInfo & newgi) const { - if(edges.Size()) + if(ap1.edgenr < edges.Size() && ap1.edgenr >= 0) { edges[ap1.edgenr]->PointBetween(p1, p2, secpoint, ap1, ap2, newp, newgi); diff --git a/libsrc/meshing/boundarylayer.cpp b/libsrc/meshing/boundarylayer.cpp index 662868bb..ac8fe472 100644 --- a/libsrc/meshing/boundarylayer.cpp +++ b/libsrc/meshing/boundarylayer.cpp @@ -900,6 +900,7 @@ namespace netgen } mesh.GetTopology().ClearEdges(); + mesh.SetNextMajorTimeStamp(); mesh.UpdateTopology(); } diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index f3b83c7c..9a1ac204 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -126,7 +126,7 @@ namespace netgen public: EdgePointGeomInfo () - : edgenr(0), body(0), dist(0.0), u(0.0), v(0.0) { ; } + : edgenr(-1), body(0), dist(0.0), u(0.0), v(0.0) { ; } EdgePointGeomInfo & operator= (const EdgePointGeomInfo & gi2)