45namespace SpatialDomains
87 int npts =
m_curve->m_points.size();
115 returnval->m_coordim = 1;
119 vert0->SetGlobalID(vert0->GetGlobalID());
120 returnval->m_verts[0] = vert0;
126 v.push_back(base[0]->GetPointsKey());
141 for (
int i = 0; i < jac.size(); ++i)
143 len += jac[i] * w0[i];
149 vert1->SetGlobalID(vert1->GetGlobalID());
151 returnval->m_verts[1] = vert1;
154 returnval->m_xmap =
m_xmap;
155 returnval->SetUpCoeffs(
m_xmap->GetNcoeffs());
178 return m_xmap->PhysEvaluate(Lcoord, tmp);
211 std::ostringstream errstrm;
212 errstrm <<
"Connected edges do not share a vertex. Edges ";
232 if (
m_xmap->GetBasisNumModes(0) != 2)
251 int npts =
m_curve->m_points.size();
260 "Vertex 0 is separated from first point by more than ";
261 std::stringstream strstrm;
264 err += strstrm.str();
272 "Vertex 1 is separated from last point by more than ";
273 std::stringstream strstrm;
276 err += strstrm.str();
288 for (
int j = 0; j < npts; ++j)
290 tmp[j] = (
m_curve->m_points[j]->GetPtr())[i];
314 CurveMap::iterator it = curvedEdges.find(
m_globalID);
316 if (it != curvedEdges.end())
367 tmp += (xs[i] - gloCoord[i]) * (xs[i] - gloCoord[i]);
383 int nq =
m_xmap->GetTotPoints();
387 for (
int i = 0; i < dim; ++i)
396 NekDouble fx_prev = std::numeric_limits<NekDouble>::max();
405 NekDouble fx = 0, fxp = 0, fxp2 = 0, xcDiff = 0;
406 for (
int j = 0; j < dim; ++j)
408 xc[j] =
m_xmap->PhysEvaluate(xi, x[j], xc_der[j], xc_der2[j]);
410 xcDiff = xc[j] - xs[j];
412 fx += xcDiff * xcDiff;
413 fxp += xc_der[j][0] * xcDiff;
414 fxp2 += xc_der2[j][0] * xcDiff + xc_der[j][0] * xc_der[j][0];
438 while (gamma > 1e-10)
441 xi_pk[0] = xi[0] + pk * gamma;
443 if (xi_pk[0] < -1.0 || xi_pk[0] > 1.0)
451 NekDouble fx_pk = 0, fxp_pk = 0, xc_pkDiff = 0;
452 for (
int j = 0; j < dim; ++j)
454 xc_pk[j] =
m_xmap->PhysEvaluate(xi_pk, x[j], xc_der_pk[j]);
456 xc_pkDiff = xc_pk[j] - xs[j];
457 fx_pk += xc_pkDiff * xc_pkDiff;
458 fxp_pk += xc_der_pk[j][0] * xc_pkDiff;
465 if ((fx_pk - (fx + c1 * gamma * pk * fxp)) <
466 std::numeric_limits<NekDouble>::epsilon() &&
467 (-pk * fxp_pk + c2 * pk * fxp) <
468 std::numeric_limits<NekDouble>::epsilon())
486 return sqrt(fx_prev);
490 ASSERTL0(
false,
"Geometry type unknown")
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Describes the specification for a Basis.
Defines a specification for a set of points.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
Array< OneD, DataType > & GetPtr()
NekDouble GetCoord(const int i, const Array< OneD, const NekDouble > &Lcoord)
Given local collapsed coordinate Lcoord, return the value of physical coordinate in direction i.
bool m_setupState
Wether or not the setup routines have been run.
PointGeomSharedPtr GetVertex(int i) const
Returns vertex i of this object.
GeomState m_state
Enumeration to dictate whether coefficients are filled.
void SetUpCoeffs(const int nCoeffs)
Initialise the Geometry::m_coeffs array.
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...
virtual void v_Reset(CurveMap &curvedEdges, CurveMap &curvedFaces)
Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated Geo...
bool ClampLocCoords(Array< OneD, NekDouble > &locCoord, NekDouble tol=std::numeric_limits< NekDouble >::epsilon())
Clamp local coords to be within standard regions [-1, 1]^dim.
int GetGlobalID(void) const
Get the ID of this object.
int GetCoordim() const
Return the coordinate dimension of this object (i.e. the dimension of the space in which this object ...
LibUtilities::ShapeType m_shapeType
Type of shape.
Array< OneD, Array< OneD, NekDouble > > m_coeffs
Array containing expansion coefficients of m_xmap.
GeomState m_geomFactorsState
State of the geometric factors.
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
GeomFactorsSharedPtr m_geomFactors
Geometric factors.
int m_coordim
Coordinate dimension of this geometry object.
virtual void v_Setup() override
virtual PointGeomSharedPtr v_GetVertex(const int i) const override
virtual int v_GetNumVerts() const override
Get the number of vertices of this object.
virtual LibUtilities::ShapeType v_GetShapeType() const
virtual void v_FillGeom() override
Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements.
SegGeomSharedPtr GenerateOneSpaceDimGeom(void)
Generate a one dimensional space segment geometry where the vert[0] has the same x value and vert[1] ...
CurveSharedPtr m_curve
Boolean indicating whether object owns the data.
virtual void v_GenGeomFactors() override
SpatialDomains::PointGeomSharedPtr m_verts[kNverts]
static StdRegions::Orientation GetEdgeOrientation(const SegGeom &edge1, const SegGeom &edge2)
Get the orientation of edge1.
virtual NekDouble v_FindDistance(const Array< OneD, const NekDouble > &xs, Array< OneD, NekDouble > &xi) override
virtual NekDouble v_GetCoord(const int i, const Array< OneD, const NekDouble > &Lcoord) override
Given local collapsed coordinate Lcoord, return the value of physical coordinate in direction i.
virtual void v_Reset(CurveMap &curvedEdges, CurveMap &curvedFaces) override
Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated Geo...
PointsManagerT & PointsManager(void)
std::vector< PointsKey > PointsKeyVector
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
@ eModified_A
Principle Modified Functions .
static const NekDouble kVertexTheSameDouble
static const unsigned int kNewtonIterations
std::shared_ptr< Curve > CurveSharedPtr
std::unordered_map< int, CurveSharedPtr > CurveMap
GeomType
Indicates the type of element geometry.
@ eRegular
Geometry is straight-sided with constant geometric factors.
@ eDeformed
Geometry is curved or has non-constant factors.
std::shared_ptr< SegGeom > SegGeomSharedPtr
std::shared_ptr< PointGeom > PointGeomSharedPtr
@ eNotFilled
Geometric information has not been generated.
@ ePtsFilled
Geometric information has been generated.
The above copyright notice and this permission notice shall be included.
std::shared_ptr< DNekMat > DNekMatSharedPtr
scalarT< T > abs(scalarT< T > in)
scalarT< T > sqrt(scalarT< T > in)