36#ifndef NEKTAR_SPATIALDOMAINS_GEOMETRYLOCATOR_H
37#define NEKTAR_SPATIALDOMAINS_GEOMETRYLOCATOR_H
152 NekDouble tol = std::numeric_limits<NekDouble>::epsilon());
#define SPATIAL_DOMAINS_EXPORT
Inverse mapping for a segment.
NekDouble v_FindDistance(const Array< OneD, const NekDouble > &xs, Array< OneD, NekDouble > &xi) override
NekDouble v_GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords) override
Inverse mapping for a triangle or quadrilateral, including the closed-form solve available when every...
void v_CalculateInverseIsoParam() override
int v_AllLeftCheck(const Array< OneD, const NekDouble > &gloCoord, NekDouble &edgeDist) override
void v_PreSolveStraightEdge() override
NekDouble v_FindDistance(const Array< OneD, const NekDouble > &xs, Array< OneD, NekDouble > &xi) override
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 &dist)
NekDouble v_GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords) override
void SolveStraightEdgeQuad(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
Inverse mapping for a tetrahedron, pyramid, prism or hexahedron.
void NewtonIterationForLocCoord(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords, NekDouble &dist)
void v_CalculateInverseIsoParam() override
NekDouble v_GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords) override
Inverts the mapping for one geometry.
int PreliminaryCheck(const Array< OneD, const NekDouble > &gloCoord, NekDouble &edgeDist)
A fast and robust check if a given global coord is outside of a deformed element. For regular element...
virtual ~GeometryLocator()=default
bool m_edgeNormalBuilt
2D only: inward edge normals used to reject points outside straight-sided elements....
virtual NekDouble v_GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
IsoParam m_iso
The shape's isoparametric coefficients. The straight-edged 2D solve rewrites them into a factored for...
NekDouble FindDistance(const Array< OneD, const NekDouble > &xs, Array< OneD, NekDouble > &xi)
Geometry * m_geom
The geometry being searched. Not owned.
virtual void v_CalculateInverseIsoParam()
std::array< std::array< NekDouble, 2 >, kMaxGeomVerts > m_edgeNormal
static std::unique_ptr< GeometryLocator > Create(Geometry *geom)
Build the locator appropriate to geom's dimension, with its cache already populated.
virtual void v_PreSolveStraightEdge()
std::array< NekDouble, 6 > GetBoundingBox()
Generates the bounding box for the element.
bool ContainsPoint(const Array< OneD, const NekDouble > &gloCoord, NekDouble tol=0.0)
Determine whether the element contains a Cartesian coordinate.
NekDouble GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
Determine the local collapsed coordinates corresponding to a given Cartesian coordinate.
bool MinMaxCheck(const Array< OneD, const NekDouble > &gloCoord)
Check if given global coord is within the BoundingBox of the element.
void Build()
Populate the cache. Called by Create() once the concrete type exists, since it dispatches virtually.
std::array< NekDouble, 6 > m_boundingBox
int m_straightEdge
Non-zero if every basis is linear. Bits 1 and 2 are used by the 2D straight-edged solve to record wh...
std::array< std::array< NekDouble, kMaxGeomDim >, kMaxGeomDim > m_invIsoParam
Inverse of the linear part of m_iso, for regular elements.
Geometry * GetGeometry() const
GeometryLocator(Geometry *geom)
virtual NekDouble v_FindDistance(const Array< OneD, const NekDouble > &xs, Array< OneD, NekDouble > &xi)
static bool ClampLocCoords(Array< OneD, NekDouble > &locCoord, int dim, NekDouble tol=std::numeric_limits< NekDouble >::epsilon())
Clamp local coordinates into the reference element , returning whether anything was clamped....
bool m_hasBoundingBox
Element bounding box as (xmin, ymin, zmin, xmax, ymax, zmax).
std::array< bool, kMaxGeomVerts > m_hasEdgeNormal
virtual int v_AllLeftCheck(const Array< OneD, const NekDouble > &gloCoord, NekDouble &edgeDist)
bool m_newtonConverged
Whether the Newton iteration of the last GetLocCoords call converged, i.e. whether its local coordina...
constexpr int kMaxGeomIsoCoeff
constexpr int kMaxGeomVerts
constexpr int kMaxGeomDim
Extents bounded across every supported shape: three coordinate directions, eight isoparametric coeffi...
std::unique_ptr< GeometryLocator > GeometryLocatorUniquePtr
The isoparametric description of a shape's mapping.
std::array< int, kMaxGeomDim > m_manifold
2D only: coordinate directions spanning the manifold.
int m_nCoeff
Coefficients per coordinate direction. Only the leading m_nCoeff entries of each row are meaningful,...
std::array< std::array< NekDouble, kMaxGeomIsoCoeff >, kMaxGeomDim > m_coeff