48 namespace SpatialDomains
56 TriGeom::TriGeom(
const int id,
59 :
Geometry2D(edges[0]->GetVertex(0)->GetCoordim(), curve)
81 m_coordim = edges[0]->GetVertex(0)->GetCoordim();
97 for (
int i = 0; i <
kNedges; i++)
115 return m_xmap->PhysEvaluate(Lcoord, tmp);
119 const TriGeom &face2,
bool doRot,
int dir,
123 doRot, dir, angle, tol);
130 int i, j, vmap[3] = {-1, -1, -1};
136 for (i = 0; i < 3; ++i)
138 rotPt.
Rotate((*face1[i]), dir, angle);
139 for (j = 0; j < 3; ++j)
141 if (rotPt.
dist(*face2[j]) < tol)
152 NekDouble x, y, z, x1, y1, z1, cx = 0.0, cy = 0.0, cz = 0.0;
158 for (i = 0; i < 3; ++i)
160 cx += (*face2[i])(0) - (*face1[i])(0);
161 cy += (*face2[i])(1) - (*face1[i])(1);
162 cz += (*face2[i])(2) - (*face1[i])(2);
171 for (i = 0; i < 3; ++i)
176 for (j = 0; j < 3; ++j)
178 x1 = (*face2[j])(0) - cx;
179 y1 = (*face2[j])(1) - cy;
180 z1 = (*face2[j])(2) - cz;
181 if (sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y) +
182 (z1 - z) * (z1 - z)) < 1e-8)
191 if (vmap[1] == (vmap[0] + 1) % 3)
222 ASSERTL0(
false,
"Unable to determine triangle orientation");
242 if (
m_xmap->GetBasisNumModes(0) != 2 ||
243 m_xmap->GetBasisNumModes(1) != 2)
270 int nEdgeCoeffs =
m_xmap->GetEdgeNcoeffs(0);
283 int N =
m_curve->m_points.size();
285 (-1 + (int)sqrt(static_cast<NekDouble>(8 * N + 1))) / 2;
287 ASSERTL0(nEdgePts * (nEdgePts + 1) / 2 == N,
288 "NUMPOINTS should be a triangle number for" 289 " triangle curved face " +
294 for (i = 0; i < 3; ++i)
299 std::stringstream ss;
300 ss <<
"Curved vertex " << i <<
" of triangle " <<
m_globalID 301 <<
" is separated from expansion vertex by" 303 <<
" (dist = " << dist <<
")";
314 ASSERTL0(edgeCurve->m_points.size() == nEdgePts,
315 "Number of edge points does not correspond " 316 "to number of face points in triangle " +
319 const int offset = 3 + i * (nEdgePts - 2);
334 for (j = 0; j < nEdgePts - 2; ++j)
337 *(edgeCurve->m_points[j + 1]));
338 maxDist = dist > maxDist ? dist : maxDist;
343 for (j = 0; j < nEdgePts - 2; ++j)
346 *(edgeCurve->m_points[nEdgePts - 2 - j]));
347 maxDist = dist > maxDist ? dist : maxDist;
353 std::stringstream ss;
354 ss <<
"Curved edge " << i <<
" of triangle " <<
m_globalID 355 <<
" has a point separated from edge interior" 356 <<
" points by more than " 358 <<
" (maxdist = " << maxDist <<
")";
372 max(nEdgePts * nEdgePts,
m_xmap->GetTotPoints()));
382 for (j = 0; j < N; ++j)
384 phys[j] = (
m_curve->m_points[j]->GetPtr())[i];
387 t->BwdTrans(phys, tmp);
393 m_xmap->GetBasis(0)->GetPointsKey(),
394 m_xmap->GetBasis(1)->GetPointsKey(),
403 int npts =
m_curve->m_points.size();
404 int nEdgePts = (int)sqrt(static_cast<NekDouble>(npts));
412 ASSERTL0(nEdgePts * nEdgePts == npts,
413 "NUMPOINTS should be a square number for" 420 "Number of edge points does not correspond to " 421 "number of face points in triangle " +
427 for (j = 0; j < npts; ++j)
429 tmp[j] = (
m_curve->m_points[j]->GetPtr())[i];
437 m_xmap->GetBasis(0)->GetPointsKey(),
438 m_xmap->GetBasis(1)->GetPointsKey(),
448 "Only 1D/2D points distributions " 461 nEdgeCoeffs =
m_edges[i]->GetXmap()->GetNcoeffs();
465 for (k = 0; k < nEdgeCoeffs; k++)
468 signArray[k] *
m_edges[i]->GetCoeffs(j)[k];
500 orth1.
Mult(norm, dv1);
501 orth2.
Mult(norm, dv2);
508 Lcoords[0] = xin.
dot(orth2) / dv1.
dot(orth2);
509 Lcoords[0] = 2 * Lcoords[0] - 1;
510 Lcoords[1] = xin.
dot(orth1) / dv2.
dot(orth1);
511 Lcoords[1] = 2 * Lcoords[1] - 1;
516 int npts =
m_xmap->GetTotPoints();
534 Lcoords[0] = za[min_i % za.num_elements()];
535 Lcoords[1] = zb[min_i / za.num_elements()];
538 Lcoords[0] = (1.0 + Lcoords[0]) * (1.0 - Lcoords[1]) / 2 - 1.0;
563 if (stdCoord[0] >= -(1 + tol) && stdCoord[1] >= -(1 + tol) &&
564 stdCoord[0] + stdCoord[1] <= tol)
578 CurveMap::iterator it = curvedFaces.find(
m_globalID);
580 if (it != curvedFaces.end())
585 for (
int i = 0; i < 3; ++i)
587 m_edges[i]->Reset(curvedEdges, curvedFaces);
598 for (
int i = 0; i < 3; ++i)
610 int order0 =
m_edges[0]->GetXmap()->GetBasis(0)->GetNumModes();
611 int order1 = max(order0,
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
#define ASSERTL0(condition, msg)
std::shared_ptr< StdNodalTriExp > StdNodalTriExpSharedPtr
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
virtual bool v_ContainsPoint(const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, NekDouble &resid)
std::vector< PointGeomSharedPtr > PointGeomVector
GeomFactorsSharedPtr m_geomFactors
Geometric factors.
StdRegions::StdExpansionSharedPtr GetXmap() const
Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standar...
std::unordered_map< int, CurveSharedPtr > CurveMap
bool MinMaxCheck(const Array< OneD, const NekDouble > &gloCoord)
Check if given global coord is within twice the min/max distance of the element.
NekDouble dot(PointGeom &a)
retun the dot product between this and input a
int Imin(int n, const T *x, const int incx)
Return the index of the minimum element in x.
virtual void v_GenGeomFactors()
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Principle Modified Functions .
void Sub(PointGeom &a, PointGeom &b)
virtual void v_Reset(CurveMap &curvedEdges, CurveMap &curvedFaces)
Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated Geo...
void ClampLocCoords(Array< OneD, NekDouble > &locCoord, NekDouble tol)
Clamp local coords to be within standard regions [-1, 1]^dim.
static const NekDouble kVertexTheSameDouble
GeomState m_geomFactorsState
State of the geometric factors.
static StdRegions::Orientation GetEdgeOrientation(const SegGeom &edge1, const SegGeom &edge2)
Get the orientation of edge1.
virtual void v_FillGeom()
void Rotate(PointGeom &a, int dir, NekDouble angle)
_this = rotation of a by angle 'angle' around axis dir
Gauss Radau pinned at x=-1, .
std::vector< StdRegions::Orientation > m_eorient
Principle Orthogonal Functions .
void Interp2D(const BasisKey &fbasis0, const BasisKey &fbasis1, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, Array< OneD, NekDouble > &to)
this function interpolates a 2D function evaluated at the quadrature points of the 2D basis...
Principle Modified Functions .
void NewtonIterationForLocCoord(const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &ptsx, const Array< OneD, const NekDouble > &ptsy, Array< OneD, NekDouble > &Lcoords, NekDouble &resid)
virtual NekDouble v_GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
Determine the local collapsed coordinates that correspond to a given Cartesian coordinate for this ge...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
PointsManagerT & PointsManager(void)
Principle Orthogonal Functions .
Defines a specification for a set of points.
bool m_setupState
Wether or not the setup routines have been run.
static StdRegions::Orientation GetFaceOrientation(const TriGeom &face1, const TriGeom &face2, bool doRot, int dir, NekDouble angle, NekDouble tol)
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x.
virtual NekDouble v_GetCoord(const int i, const Array< OneD, const NekDouble > &Lcoord)
Given local collapsed coordinate Lcoord, return the value of physical coordinate in direction i...
static const int kNedges
Get the orientation of face1.
void Mult(PointGeom &a, PointGeom &b)
_this = a x b
Array< OneD, Array< OneD, NekDouble > > m_coeffs
Array containing expansion coefficients of m_xmap.
Geometry is straight-sided with constant geometric factors.
std::shared_ptr< Curve > CurveSharedPtr
NekDouble GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
Determine the local collapsed coordinates that correspond to a given Cartesian coordinate for this ge...
LibUtilities::ShapeType m_shapeType
Type of shape.
NekDouble dist(PointGeom &a)
return distance between this and input a
Geometric information has been generated.
void SetUpCoeffs(const int nCoeffs)
Initialise the Geometry::m_coeffs array.
GeomFactorsSharedPtr GetMetricInfo()
Get the geometric factors for this object.
GeomType
Indicates the type of element geometry.
GeomState m_state
Enumeration to dictate whether coefficients are filled.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
std::shared_ptr< SegGeom > SegGeomSharedPtr
Geometry is curved or has non-constant factors.
PointGeomSharedPtr GetVertex(int i) const
Returns vertex i of this object.
int m_coordim
Coordinate dimension of this geometry object.
Describes the specification for a Basis.
1D Gauss-Lobatto-Legendre quadrature points
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
virtual void v_Reset(CurveMap &curvedEdges, CurveMap &curvedFaces)
Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated Geo...