Draw surface vectors on quads

This commit is contained in:
Matthias Hochsteger 2023-03-07 20:30:30 +01:00
parent ca173ea989
commit 99ea85a175
2 changed files with 16 additions and 11 deletions

View File

@ -2202,7 +2202,7 @@ namespace netgen
void VisualSceneSolution :: DrawTrigSurfaceVectors(const NgArray< Point<3> > & lp, void VisualSceneSolution :: DrawTrigSurfaceVectors(const NgArray< Point<3> > & lp,
const Point<3> & pmin, const Point<3> & pmax, const Point<3> & pmin, const Point<3> & pmax,
const int sei, const SolData * vsol) const int sei, const SolData * vsol, bool swap_lam)
{ {
shared_ptr<Mesh> mesh = GetMesh(); shared_ptr<Mesh> mesh = GetMesh();
@ -2267,12 +2267,17 @@ namespace netgen
if (lam1 >= 0 && lam2 >= 0 && lam1+lam2 <= 1) if (lam1 >= 0 && lam2 >= 0 && lam1+lam2 <= 1)
{ {
if(swap_lam)
{
Swap(lam1, lam2);
lam1 = 1.0-lam1;
lam2 = 1.0-lam2;
}
Point<3> cp; Point<3> cp;
for (k = 0; k < 3; k++) for (k = 0; k < 3; k++)
cp(k) = lp[0](k) + cp(k) = lp[0](k) +
lam1 * (lp[1](k)-lp[0](k)) + lam1 * (lp[1](k)-lp[0](k)) +
lam2 * (lp[2](k)-lp[0](k)); lam2 * (lp[2](k)-lp[0](k));
Point<2> xref(lam1, lam2); Point<2> xref(lam1, lam2);
if (mesh->GetCurvedElements().IsHighOrder()) if (mesh->GetCurvedElements().IsHighOrder())
mesh->GetCurvedElements(). mesh->GetCurvedElements().
@ -2460,22 +2465,21 @@ namespace netgen
} }
else if (el.GetType() == QUAD) else if (el.GetType() == QUAD)
{ {
/*
NgArray < Point<3> > lp(3); NgArray < Point<3> > lp(3);
lp[0] = mesh->Point(el[0]); lp[0] = mesh->Point(el[0]);
lp[1] = mesh->Point(el[1]); lp[1] = mesh->Point(el[1]);
lp[2] = mesh->Point(el[2]);
DrawTrigSurfaceVectors(lp,pmin,pmax,sei,vsol);
lp[0] = mesh->Point(el[0]);
lp[1] = mesh->Point(el[2]);
lp[2] = mesh->Point(el[3]); lp[2] = mesh->Point(el[3]);
DrawTrigSurfaceVectors(lp,pmin,pmax,sei,vsol); DrawTrigSurfaceVectors(lp,pmin,pmax,sei,vsol);
*/
lp[0] = mesh->Point(el[2]);
lp[1] = mesh->Point(el[1]);
lp[2] = mesh->Point(el[3]);
DrawTrigSurfaceVectors(lp,pmin,pmax,sei,vsol, true);
/*
Point<3> lp[4]; Point<3> lp[4];
Point<2> p2d[4]; Point<2> p2d[4];
@ -2574,6 +2578,7 @@ namespace netgen
} }
} }
*/
} }
} }
} }

View File

@ -328,7 +328,7 @@ public:
void DrawSurfaceVectors (); void DrawSurfaceVectors ();
void DrawTrigSurfaceVectors(const NgArray< Point<3> > & lp, const Point<3> & pmin, const Point<3> & pmax, void DrawTrigSurfaceVectors(const NgArray< Point<3> > & lp, const Point<3> & pmin, const Point<3> & pmax,
const int sei, const SolData * vsol); const int sei, const SolData * vsol, bool swap_lam=false);
void DrawIsoSurface(const SolData * sol, const SolData * grad, int comp); void DrawIsoSurface(const SolData * sol, const SolData * grad, int comp);
void DrawIsoLines (const Point<3> & p1, void DrawIsoLines (const Point<3> & p1,