[occ] fix boundarylayer + curve

This commit is contained in:
Christopher Lackner 2022-02-25 18:17:49 +01:00 committed by mhochsteger@cerbsim.com
parent 8dd4c0c9e3
commit 21b263a0ba
3 changed files with 17 additions and 7 deletions

View File

@ -232,12 +232,15 @@ namespace netgen
virtual PointGeomInfo ProjectPoint (int surfind, Point<3> & p) const 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 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 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 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 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, virtual void PointBetween (const Point<3> & p1,
const Point<3> & p2, double secpoint, const Point<3> & p2, double secpoint,
@ -260,7 +269,7 @@ namespace netgen
Point<3> & newp, Point<3> & newp,
PointGeomInfo & newgi) const PointGeomInfo & newgi) const
{ {
if(faces.Size()) if(faces.Size() >= surfi && surfi > 0)
{ {
faces[surfi-1]->PointBetween(p1, p2, secpoint, gi1, gi2, newp, newgi); faces[surfi-1]->PointBetween(p1, p2, secpoint, gi1, gi2, newp, newgi);
return; return;
@ -276,7 +285,7 @@ namespace netgen
Point<3> & newp, Point<3> & newp,
EdgePointGeomInfo & newgi) const EdgePointGeomInfo & newgi) const
{ {
if(edges.Size()) if(ap1.edgenr < edges.Size() && ap1.edgenr >= 0)
{ {
edges[ap1.edgenr]->PointBetween(p1, p2, secpoint, edges[ap1.edgenr]->PointBetween(p1, p2, secpoint,
ap1, ap2, newp, newgi); ap1, ap2, newp, newgi);

View File

@ -900,6 +900,7 @@ namespace netgen
} }
mesh.GetTopology().ClearEdges(); mesh.GetTopology().ClearEdges();
mesh.SetNextMajorTimeStamp();
mesh.UpdateTopology(); mesh.UpdateTopology();
} }

View File

@ -126,7 +126,7 @@ namespace netgen
public: public:
EdgePointGeomInfo () 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) EdgePointGeomInfo & operator= (const EdgePointGeomInfo & gi2)