48 namespace SpatialDomains
56 QuadGeom::QuadGeom(
const int id,
59 :
Geometry2D(edges[0]->GetVertex(0)->GetCoordim(), curve)
84 m_coordim = edges[0]->GetVertex(0)->GetCoordim();
98 for (
int i = 0; i <
kNedges; i++)
110 int order0 = max(
m_edges[0]->
GetXmap()->GetBasis(0)->GetNumModes(),
112 int order1 = max(
m_edges[1]->
GetXmap()->GetBasis(0)->GetNumModes(),
135 return m_xmap->PhysEvaluate(Lcoord, tmp);
143 doRot, dir, angle, tol);
154 int i, j, vmap[4] = {-1, -1, -1, -1};
160 for (i = 0; i < 4; ++i)
162 rotPt.
Rotate((*face1[i]), dir, angle);
163 for (j = 0; j < 4; ++j)
165 if (rotPt.
dist(*face2[j]) < tol)
176 NekDouble x, y, z, x1, y1, z1, cx = 0.0, cy = 0.0, cz = 0.0;
182 for (i = 0; i < 4; ++i)
184 cx += (*face2[i])(0) - (*face1[i])(0);
185 cy += (*face2[i])(1) - (*face1[i])(1);
186 cz += (*face2[i])(2) - (*face1[i])(2);
195 for (i = 0; i < 4; ++i)
200 for (j = 0; j < 4; ++j)
202 x1 = (*face2[j])(0) - cx;
203 y1 = (*face2[j])(1) - cy;
204 z1 = (*face2[j])(2) - cz;
205 if (sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y) +
206 (z1 - z) * (z1 - z)) < 1e-8)
217 if (vmap[1] == (vmap[0] + 1) % 4)
254 ASSERTL0(
false,
"unable to determine face orientation");
284 if ((
m_xmap->GetBasisNumModes(0) != 2) ||
285 (
m_xmap->GetBasisNumModes(1) != 2))
348 int npts =
m_curve->m_points.size();
349 int nEdgePts = (int)sqrt(static_cast<NekDouble>(npts));
357 ASSERTL0(nEdgePts * nEdgePts == npts,
358 "NUMPOINTS should be a square number in" 365 "Number of edge points does not correspond to " 366 "number of face points in quadrilateral " +
372 for (j = 0; j < npts; ++j)
374 tmp[j] = (
m_curve->m_points[j]->GetPtr())[i];
381 m_xmap->GetBasis(0)->GetPointsKey(),
382 m_xmap->GetBasis(1)->GetPointsKey(),
399 nEdgeCoeffs =
m_edges[i]->GetXmap()->GetNcoeffs();
403 for (k = 0; k < nEdgeCoeffs; k++)
406 signArray[k] * (
m_edges[i]->GetCoeffs(j))[k];
436 orth1.
Mult(norm, dv1);
437 orth2.
Mult(norm, dv2);
444 Lcoords[0] = xin.
dot(orth2) / dv1.
dot(orth2);
445 Lcoords[0] = 2 * Lcoords[0] - 1;
446 Lcoords[1] = xin.
dot(orth1) / dv2.
dot(orth1);
447 Lcoords[1] = 2 * Lcoords[1] - 1;
454 int npts =
m_xmap->GetTotPoints();
472 Lcoords[0] = za[min_i % za.num_elements()];
473 Lcoords[1] = zb[min_i / za.num_elements()];
499 if (stdCoord[0] >= -(1 + tol) && stdCoord[1] >= -(1 + tol) &&
500 stdCoord[0] <= (1 + tol) && stdCoord[1] <= (1 + tol))
514 CurveMap::iterator it = curvedFaces.find(
m_globalID);
516 if (it != curvedFaces.end())
521 for (
int i = 0; i < 4; ++i)
523 m_edges[i]->Reset(curvedEdges, curvedFaces);
534 for (
int i = 0; i < 4; ++i)
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
#define ASSERTL0(condition, msg)
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.
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.
GeomState m_geomFactorsState
State of the geometric factors.
static StdRegions::Orientation GetEdgeOrientation(const SegGeom &edge1, const SegGeom &edge2)
Get the orientation of edge1.
void Rotate(PointGeom &a, int dir, NekDouble angle)
_this = rotation of a by angle 'angle' around axis dir
std::vector< StdRegions::Orientation > m_eorient
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...
static const NekDouble kNekZeroTol
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...
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 void v_Reset(CurveMap &curvedEdges, CurveMap &curvedFaces)
Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated Geo...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
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 QuadGeom &face1, const QuadGeom &face2, bool doRot=false, int dir=0, NekDouble angle=0.0, NekDouble tol=1e-8)
Get the orientation of face1.
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x.
void Mult(PointGeom &a, PointGeom &b)
_this = a x b
virtual void v_FillGeom()
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.
virtual bool v_ContainsPoint(const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, 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...
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.