Nektar++
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Nektar::SpatialDomains::Geometry Class Referenceabstract

Base class for shape geometry information. More...

#include <Geometry.h>

Inheritance diagram for Nektar::SpatialDomains::Geometry:
[legend]

Public Member Functions

 Geometry ()
 Default constructor. More...
 
 Geometry (int coordim)
 Constructor when supplied a coordinate dimension. More...
 
virtual ~Geometry ()
 Default destructor. More...
 
int GetCoordim () const
 Return the coordinate dimension of this object (i.e. the dimension of the space in which this object is embedded). More...
 
void SetCoordim (int coordim)
 Sets the coordinate dimension of this object (i.e. the dimension of the space in which this object is embedded). More...
 
GeomFactorsSharedPtr GetGeomFactors ()
 Get the geometric factors for this object, generating them if required. More...
 
GeomFactorsSharedPtr GetRefGeomFactors (const Array< OneD, const LibUtilities::BasisSharedPtr > &tbasis)
 
GeomFactorsSharedPtr GetMetricInfo ()
 Get the geometric factors for this object. More...
 
LibUtilities::ShapeType GetShapeType (void)
 Get the geometric shape type of this object. More...
 
int GetGlobalID (void) const
 Get the ID of this object. More...
 
void SetGlobalID (int globalid)
 Set the ID of this object. More...
 
int GetVid (int i) const
 Get the ID of vertex i of this object. More...
 
int GetEid (int i) const
 Get the ID of edge i of this object. More...
 
int GetFid (int i) const
 Get the ID of face i of this object. More...
 
int GetTid (int i) const
 Get the ID of trace i of this object. More...
 
PointGeomSharedPtr GetVertex (int i) const
 Returns vertex i of this object. More...
 
Geometry1DSharedPtr GetEdge (int i) const
 Returns edge i of this object. More...
 
Geometry2DSharedPtr GetFace (int i) const
 Returns face i of this object. More...
 
StdRegions::Orientation GetEorient (const int i) const
 Returns the orientation of edge i with respect to the ordering of edges in the standard element. More...
 
StdRegions::Orientation GetForient (const int i) const
 Returns the orientation of face i with respect to the ordering of faces in the standard element. More...
 
int GetNumVerts () const
 Get the number of vertices of this object. More...
 
int GetNumEdges () const
 Get the number of edges of this object. More...
 
int GetNumFaces () const
 Get the number of faces of this object. More...
 
int GetShapeDim () const
 Get the object's shape dimension. More...
 
StdRegions::StdExpansionSharedPtr GetXmap () const
 Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standard element to physical element. More...
 
const Array< OneD, const NekDouble > & GetCoeffs (const int i) const
 Return the coefficients of the transformation Geometry::m_xmap in coordinate direction i. More...
 
void FillGeom ()
 Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements. More...
 
std::array< NekDouble, 6 > GetBoundingBox ()
 Generates the bounding box for the element. More...
 
bool ContainsPoint (const Array< OneD, const NekDouble > &gloCoord, NekDouble tol=0.0)
 Determine whether an element contains a particular Cartesian coordinate \((x,y,z)\). More...
 
bool ContainsPoint (const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol)
 Determine whether an element contains a particular Cartesian coordinate \((x,y,z)\). More...
 
bool ContainsPoint (const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, NekDouble &resid)
 Determine whether an element contains a particular Cartesian coordinate \(\vec{x} = (x,y,z)\). More...
 
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 geometry object. More...
 
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. More...
 
bool MinMaxCheck (const Array< OneD, const NekDouble > &gloCoord)
 Check if given global coord is within twice the min/max distance of the element. More...
 
void ClampLocCoords (Array< OneD, NekDouble > &locCoord, NekDouble tol)
 Clamp local coords to be within standard regions [-1, 1]^dim. More...
 
int GetVertexEdgeMap (int i, int j) const
 Returns the standard element edge IDs that are connected to a given vertex. More...
 
int GetVertexFaceMap (int i, int j) const
 Returns the standard element face IDs that are connected to a given vertex. More...
 
int GetEdgeFaceMap (int i, int j) const
 Returns the standard element edge IDs that are connected to a given face. More...
 
void Reset (CurveMap &curvedEdges, CurveMap &curvedFaces)
 Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated GeomFactors. More...
 
void Setup ()
 

Protected Member Functions

void GenGeomFactors ()
 Handles generation of geometry factors. More...
 
virtual PointGeomSharedPtr v_GetVertex (int i) const =0
 
virtual Geometry1DSharedPtr v_GetEdge (int i) const
 Returns edge i of this object. More...
 
virtual Geometry2DSharedPtr v_GetFace (int i) const
 Returns face i of this object. More...
 
virtual StdRegions::Orientation v_GetEorient (const int i) const
 Returns the orientation of edge i with respect to the ordering of edges in the standard element. More...
 
virtual StdRegions::Orientation v_GetForient (const int i) const
 Returns the orientation of face i with respect to the ordering of faces in the standard element. More...
 
virtual int v_GetNumVerts () const
 Get the number of vertices of this object. More...
 
virtual int v_GetNumEdges () const
 Get the number of edges of this object. More...
 
virtual int v_GetNumFaces () const
 Get the number of faces of this object. More...
 
virtual int v_GetShapeDim () const
 Get the object's shape dimension. More...
 
virtual StdRegions::StdExpansionSharedPtr v_GetXmap () const
 Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standard element to physical element. More...
 
virtual void v_FillGeom ()
 Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements. More...
 
virtual bool v_ContainsPoint (const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, NekDouble &resid)
 
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. More...
 
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 geometry object. More...
 
virtual int v_GetVertexEdgeMap (int i, int j) const
 Returns the standard element edge IDs that are connected to a given vertex. More...
 
virtual int v_GetVertexFaceMap (int i, int j) const
 Returns the standard element face IDs that are connected to a given vertex. More...
 
virtual int v_GetEdgeFaceMap (int i, int j) const
 Returns the standard element edge IDs that are connected to a given face. More...
 
virtual void v_Reset (CurveMap &curvedEdges, CurveMap &curvedFaces)
 Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated GeomFactors. More...
 
virtual void v_Setup ()
 
virtual void v_GenGeomFactors ()=0
 
void SetUpCoeffs (const int nCoeffs)
 Initialise the Geometry::m_coeffs array. More...
 

Static Protected Member Functions

static GeomFactorsSharedPtr ValidateRegGeomFactor (GeomFactorsSharedPtr geomFactor)
 Check to see if a geometric factor has already been created that contains the same regular information. More...
 

Protected Attributes

int m_coordim
 Coordinate dimension of this geometry object. More...
 
GeomFactorsSharedPtr m_geomFactors
 Geometric factors. More...
 
GeomState m_geomFactorsState
 State of the geometric factors. More...
 
StdRegions::StdExpansionSharedPtr m_xmap
 \(\chi\) mapping containing isoparametric transformation. More...
 
GeomState m_state
 Enumeration to dictate whether coefficients are filled. More...
 
bool m_setupState
 Wether or not the setup routines have been run. More...
 
GeomType m_geomType
 Type of geometry. More...
 
LibUtilities::ShapeType m_shapeType
 Type of shape. More...
 
int m_globalID
 Global ID. More...
 
Array< OneD, Array< OneD, NekDouble > > m_coeffs
 Array containing expansion coefficients of m_xmap. More...
 

Static Protected Attributes

static GeomFactorsVector m_regGeomFactorsManager
 

Detailed Description

Base class for shape geometry information.

Definition at line 83 of file Geometry.h.

Constructor & Destructor Documentation

◆ Geometry() [1/2]

Nektar::SpatialDomains::Geometry::Geometry ( )

Default constructor.

Definition at line 54 of file Geometry.cpp.

57 {
58 }
GeomState m_geomFactorsState
State of the geometric factors.
Definition: Geometry.h:187
Geometric information has not been generated.
bool m_setupState
Wether or not the setup routines have been run.
Definition: Geometry.h:193
LibUtilities::ShapeType m_shapeType
Type of shape.
Definition: Geometry.h:197
GeomState m_state
Enumeration to dictate whether coefficients are filled.
Definition: Geometry.h:191
int m_coordim
Coordinate dimension of this geometry object.
Definition: Geometry.h:183

◆ Geometry() [2/2]

Nektar::SpatialDomains::Geometry::Geometry ( int  coordim)

Constructor when supplied a coordinate dimension.

Definition at line 63 of file Geometry.cpp.

66 {
67 }
GeomState m_geomFactorsState
State of the geometric factors.
Definition: Geometry.h:187
Geometric information has not been generated.
bool m_setupState
Wether or not the setup routines have been run.
Definition: Geometry.h:193
LibUtilities::ShapeType m_shapeType
Type of shape.
Definition: Geometry.h:197
GeomState m_state
Enumeration to dictate whether coefficients are filled.
Definition: Geometry.h:191
int m_coordim
Coordinate dimension of this geometry object.
Definition: Geometry.h:183

◆ ~Geometry()

Nektar::SpatialDomains::Geometry::~Geometry ( )
virtual

Default destructor.

Definition at line 72 of file Geometry.cpp.

73 {
74 }

Member Function Documentation

◆ ClampLocCoords()

void Nektar::SpatialDomains::Geometry::ClampLocCoords ( Array< OneD, NekDouble > &  locCoord,
NekDouble  tol 
)

Clamp local coords to be within standard regions [-1, 1]^dim.

Parameters
LcoordsCorresponding local coordinates

Definition at line 478 of file Geometry.cpp.

References ASSERTL1, and GetShapeDim().

Referenced by Nektar::SpatialDomains::PyrGeom::v_ContainsPoint(), Nektar::SpatialDomains::TetGeom::v_ContainsPoint(), Nektar::SpatialDomains::PrismGeom::v_ContainsPoint(), Nektar::SpatialDomains::HexGeom::v_ContainsPoint(), Nektar::SpatialDomains::QuadGeom::v_ContainsPoint(), Nektar::SpatialDomains::TriGeom::v_ContainsPoint(), and Nektar::SpatialDomains::SegGeom::v_ContainsPoint().

480 {
481  // Validation checks
482  ASSERTL1(locCoord.num_elements() == GetShapeDim(),
483  "Expects same number of local coordinates as shape dimension.");
484 
485  // If out of range clamp locCoord to be within [-1,1]^dim
486  // since any larger value will be very oscillatory if
487  // called by 'returnNearestElmt' option in
488  // ExpList::GetExpIndex
489  for (int i = 0; i < GetShapeDim(); ++i)
490  {
491  if (locCoord[i] < -(1 + tol))
492  {
493  locCoord[i] = -(1 + tol);
494  }
495 
496  if (locCoord[i] > (1 + tol))
497  {
498  locCoord[i] = 1 + tol;
499  }
500  }
501 }
int GetShapeDim() const
Get the object&#39;s shape dimension.
Definition: Geometry.h:412
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ ContainsPoint() [1/3]

bool Nektar::SpatialDomains::Geometry::ContainsPoint ( const Array< OneD, const NekDouble > &  gloCoord,
NekDouble  tol = 0.0 
)
inline

Determine whether an element contains a particular Cartesian coordinate \((x,y,z)\).

See also
Geometry::ContainsPoint

Definition at line 453 of file Geometry.h.

References GetCoordim(), and v_ContainsPoint().

456 {
457  Array<OneD,NekDouble> locCoord(GetCoordim(), 0.0);
458  NekDouble resid;
459  return v_ContainsPoint(gloCoord, locCoord, tol, resid);
460 }
virtual bool v_ContainsPoint(const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, NekDouble &resid)
Definition: Geometry.cpp:255
int GetCoordim() const
Return the coordinate dimension of this object (i.e. the dimension of the space in which this object ...
Definition: Geometry.h:271
double NekDouble

◆ ContainsPoint() [2/3]

bool Nektar::SpatialDomains::Geometry::ContainsPoint ( const Array< OneD, const NekDouble > &  gloCoord,
Array< OneD, NekDouble > &  locCoord,
NekDouble  tol 
)
inline

Determine whether an element contains a particular Cartesian coordinate \((x,y,z)\).

See also
Geometry::ContainsPoint

Definition at line 468 of file Geometry.h.

References v_ContainsPoint().

472 {
473  NekDouble resid;
474  return v_ContainsPoint(gloCoord, locCoord, tol, resid);
475 }
virtual bool v_ContainsPoint(const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, NekDouble &resid)
Definition: Geometry.cpp:255
double NekDouble

◆ ContainsPoint() [3/3]

bool Nektar::SpatialDomains::Geometry::ContainsPoint ( const Array< OneD, const NekDouble > &  gloCoord,
Array< OneD, NekDouble > &  locCoord,
NekDouble  tol,
NekDouble resid 
)
inline

Determine whether an element contains a particular Cartesian coordinate \(\vec{x} = (x,y,z)\).

For curvilinear and non-affine elements (i.e. where the Jacobian varies as a function of the standard element coordinates), this is a non-linear optimisation problem that requires the use of a Newton iteration. Note therefore that this can be an expensive operation.

The parameter tol which is by default 0, can be used to expand the coordinate range of the standard element from \([-1,1]^d\) to \([-1-\epsilon,1+\epsilon\) to handle challenging edge cases. The function also returns the local coordinates corresponding to gloCoord that can be used to speed up subsequent searches.

Parameters
gloCoordThe coordinate \( (x,y,z) \).
locCoordOn exit, this is the local coordinate \(\vec{\xi}\) such that \(\chi(\vec{\xi}) = \vec{x}\).
tolThe tolerance used to dictate the bounding box of the standard coordinates \(\vec{\xi}\).
residOn exit, returns the minimum distance between gloCoord and the quadrature points inside the element.
Returns
true if the coordinate gloCoord is contained in the element; false otherwise.
See also
Geometry::GetLocCoords.

Definition at line 505 of file Geometry.h.

References v_ContainsPoint().

510 {
511  return v_ContainsPoint(gloCoord, locCoord, tol, resid);
512 }
virtual bool v_ContainsPoint(const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, NekDouble &resid)
Definition: Geometry.cpp:255

◆ FillGeom()

void Nektar::SpatialDomains::Geometry::FillGeom ( )
inline

Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements.

See also
v_FillGeom()

Definition at line 442 of file Geometry.h.

References v_FillGeom().

Referenced by export_Geometry().

443 {
444  v_FillGeom();
445 }
virtual void v_FillGeom()
Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements...
Definition: Geometry.cpp:326

◆ GenGeomFactors()

void Nektar::SpatialDomains::Geometry::GenGeomFactors ( )
inlineprotected

Handles generation of geometry factors.

Generate the geometric factors (i.e. derivatives of \(\chi\)) and related metrics.

See also
SpatialDomains::GeomFactors

Definition at line 635 of file Geometry.h.

References v_GenGeomFactors().

Referenced by GetGeomFactors().

636 {
637  return v_GenGeomFactors();
638 }

◆ GetBoundingBox()

std::array< NekDouble, 6 > Nektar::SpatialDomains::Geometry::GetBoundingBox ( )

Generates the bounding box for the element.

For regular elements, the vertices are sufficient to define the extent of the bounding box. For non-regular elements, the extremes of the quadrature point coordinates are used. A 10% margin is added around this computed region to account for convex hull elements where the true extent of the element may extend slightly beyond the quadrature points.

Definition at line 363 of file Geometry.cpp.

References Nektar::SpatialDomains::eRegular, GetCoordim(), GetGeomFactors(), GetNumVerts(), GetVertex(), GetXmap(), Nektar::NekConstants::kGeomFactorsTol, m_coeffs, and CellMLToNektar.cellml_metadata::p.

364 {
365  //NekDouble minx, miny, minz, maxx, maxy, maxz;
366  Array<OneD, NekDouble> min(3), max(3);
367 
368  // Always get vertexes min/max
370  Array<OneD, NekDouble> x(3, 0.0);
371  p->GetCoords(x[0], x[1], x[2]);
372  for (int j = 0; j < 3; ++j)
373  {
374  min[j] = x[j];
375  max[j] = x[j];
376  }
377  for (int i = 1; i < GetNumVerts(); ++i)
378  {
379  p = GetVertex(i);
380  p->GetCoords(x[0], x[1], x[2]);
381  for (int j = 0; j < 3; ++j)
382  {
383  min[j] = (x[j] < min[j] ? x[j] : min[j]);
384  max[j] = (x[j] > max[j] ? x[j] : max[j]);
385  }
386  }
387  // If element is deformed loop over quadrature points
388  if (GetGeomFactors()->GetGtype() != eRegular)
389  {
390  const int nq = GetXmap()->GetTotPoints();
391  Array<OneD, Array<OneD, NekDouble>> x(3);
392  for (int j = 0; j < 3; ++j)
393  {
394  x[j] = Array<OneD, NekDouble>(nq, 0.0);
395  }
396  for (int j = 0; j < GetCoordim(); ++j)
397  {
398  GetXmap()->BwdTrans(m_coeffs[j], x[j]);
399  }
400  for (int j = 0; j < 3; ++j)
401  {
402  for (int i = 0; i < nq; ++i)
403  {
404  min[j] = (x[j][i] < min[j] ? x[j][i] : min[j]);
405  max[j] = (x[j][i] > max[j] ? x[j][i] : max[j]);
406  }
407 
408  // Add 10% margin to bounding box in case elements have
409  // convex boundaries.
410  const NekDouble len = max[j] - min[j];
411  max[j] += 0.1*len;
412  min[j] -= 0.1*len;
413  }
414  }
415  // Add geometric tolerance
416  for (int j = 0; j < 3; ++j)
417  {
418  const NekDouble len = max[j] - min[j];
419  min[j] -= NekConstants::kGeomFactorsTol*len;
420  max[j] += NekConstants::kGeomFactorsTol*len;
421  }
422 
423  // Return bounding box
424  return {{ min[0], min[1], min[2], max[0], max[1], max[2] }};
425 }
StdRegions::StdExpansionSharedPtr GetXmap() const
Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standar...
Definition: Geometry.h:421
GeomFactorsSharedPtr GetGeomFactors()
Get the geometric factors for this object, generating them if required.
Definition: Geometry.h:289
int GetCoordim() const
Return the coordinate dimension of this object (i.e. the dimension of the space in which this object ...
Definition: Geometry.h:271
double NekDouble
std::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:59
int GetNumVerts() const
Get the number of vertices of this object.
Definition: Geometry.h:385
Array< OneD, Array< OneD, NekDouble > > m_coeffs
Array containing expansion coefficients of m_xmap.
Definition: Geometry.h:201
Geometry is straight-sided with constant geometric factors.
static const NekDouble kGeomFactorsTol
PointGeomSharedPtr GetVertex(int i) const
Returns vertex i of this object.
Definition: Geometry.h:343

◆ GetCoeffs()

const Array< OneD, const NekDouble > & Nektar::SpatialDomains::Geometry::GetCoeffs ( const int  i) const
inline

Return the coefficients of the transformation Geometry::m_xmap in coordinate direction i.

Definition at line 430 of file Geometry.h.

References m_coeffs.

Referenced by export_Geometry().

432 {
433  return m_coeffs[i];
434 }
Array< OneD, Array< OneD, NekDouble > > m_coeffs
Array containing expansion coefficients of m_xmap.
Definition: Geometry.h:201

◆ GetCoord()

NekDouble Nektar::SpatialDomains::Geometry::GetCoord ( const int  i,
const Array< OneD, const NekDouble > &  Lcoord 
)
inline

Given local collapsed coordinate Lcoord, return the value of physical coordinate in direction i.

Definition at line 545 of file Geometry.h.

References v_GetCoord().

547 {
548  return v_GetCoord(i, Lcoord);
549 }
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...
Definition: Geometry.cpp:302

◆ GetCoordim()

int Nektar::SpatialDomains::Geometry::GetCoordim ( ) const
inline

Return the coordinate dimension of this object (i.e. the dimension of the space in which this object is embedded).

Definition at line 271 of file Geometry.h.

References m_coordim.

Referenced by Nektar::SpatialDomains::PointGeom::Add(), Nektar::SpatialDomains::MeshGraph::CheckRange(), ContainsPoint(), export_Geometry(), GetBoundingBox(), and Nektar::SpatialDomains::PointGeom::Sub().

272 {
273  return m_coordim;
274 }
int m_coordim
Coordinate dimension of this geometry object.
Definition: Geometry.h:183

◆ GetEdge()

Geometry1DSharedPtr Nektar::SpatialDomains::Geometry::GetEdge ( int  i) const
inline

◆ GetEdgeFaceMap()

int Nektar::SpatialDomains::Geometry::GetEdgeFaceMap ( int  i,
int  j 
) const
inline

Returns the standard element edge IDs that are connected to a given face.

For example, on a prism, edge 0 is connnected to faces 0 and 1; GetEdgeFaceMap(0,j) would therefore return the values 0 and 1 respectively. We assume that j runs between 0 and 1 inclusive, since every face is connected to precisely two faces for all 3D elements.

This function is used in the construction of the low-energy preconditioner.

Parameters
iThe edge to query connectivity for.
jThe local face index between 0 and 1 connected to this element.
See also
MultiRegions::PreconditionerLowEnergy

Definition at line 611 of file Geometry.h.

References v_GetEdgeFaceMap().

612 {
613  return v_GetEdgeFaceMap(i, j);
614 }
virtual int v_GetEdgeFaceMap(int i, int j) const
Returns the standard element edge IDs that are connected to a given face.
Definition: Geometry.cpp:291

◆ GetEid()

int Nektar::SpatialDomains::Geometry::GetEid ( int  i) const

Get the ID of edge i of this object.

Definition at line 145 of file Geometry.cpp.

References GetEdge().

Referenced by export_Geometry(), GetTid(), Nektar::SpatialDomains::PyrGeom::SetUpLocalEdges(), Nektar::SpatialDomains::PrismGeom::SetUpLocalEdges(), Nektar::SpatialDomains::TetGeom::SetUpLocalEdges(), and Nektar::SpatialDomains::HexGeom::SetUpLocalEdges().

146 {
147  return GetEdge(i)->GetGlobalID();
148 }
Geometry1DSharedPtr GetEdge(int i) const
Returns edge i of this object.
Definition: Geometry.h:351

◆ GetEorient()

StdRegions::Orientation Nektar::SpatialDomains::Geometry::GetEorient ( const int  i) const
inline

Returns the orientation of edge i with respect to the ordering of edges in the standard element.

Definition at line 368 of file Geometry.h.

References v_GetEorient().

Referenced by export_Geometry().

369 {
370  return v_GetEorient(i);
371 }
virtual StdRegions::Orientation v_GetEorient(const int i) const
Returns the orientation of edge i with respect to the ordering of edges in the standard element...
Definition: Geometry.cpp:193

◆ GetFace()

Geometry2DSharedPtr Nektar::SpatialDomains::Geometry::GetFace ( int  i) const
inline

Returns face i of this object.

Definition at line 359 of file Geometry.h.

References v_GetFace().

Referenced by export_Geometry(), GetFid(), and Nektar::GlobalMapping::UpdateGeometry().

360 {
361  return v_GetFace(i);
362 }
virtual Geometry2DSharedPtr v_GetFace(int i) const
Returns face i of this object.
Definition: Geometry.cpp:172

◆ GetFid()

int Nektar::SpatialDomains::Geometry::GetFid ( int  i) const

Get the ID of face i of this object.

Definition at line 153 of file Geometry.cpp.

References GetFace().

Referenced by export_Geometry(), and GetTid().

154 {
155  return GetFace(i)->GetGlobalID();
156 }
Geometry2DSharedPtr GetFace(int i) const
Returns face i of this object.
Definition: Geometry.h:359

◆ GetForient()

StdRegions::Orientation Nektar::SpatialDomains::Geometry::GetForient ( const int  i) const
inline

Returns the orientation of face i with respect to the ordering of faces in the standard element.

Definition at line 377 of file Geometry.h.

References v_GetForient().

Referenced by export_Geometry().

378 {
379  return v_GetForient(i);
380 }
virtual StdRegions::Orientation v_GetForient(const int i) const
Returns the orientation of face i with respect to the ordering of faces in the standard element...
Definition: Geometry.cpp:204

◆ GetGeomFactors()

GeomFactorsSharedPtr Nektar::SpatialDomains::Geometry::GetGeomFactors ( )
inline

Get the geometric factors for this object, generating them if required.

Definition at line 289 of file Geometry.h.

References GenGeomFactors(), m_geomFactors, and ValidateRegGeomFactor().

Referenced by GetBoundingBox().

290 {
291  GenGeomFactors();
293 }
void GenGeomFactors()
Handles generation of geometry factors.
Definition: Geometry.h:635
GeomFactorsSharedPtr m_geomFactors
Geometric factors.
Definition: Geometry.h:185
static GeomFactorsSharedPtr ValidateRegGeomFactor(GeomFactorsSharedPtr geomFactor)
Check to see if a geometric factor has already been created that contains the same regular informatio...
Definition: Geometry.cpp:90

◆ GetGlobalID()

int Nektar::SpatialDomains::Geometry::GetGlobalID ( void  ) const
inline

◆ GetLocCoords()

NekDouble Nektar::SpatialDomains::Geometry::GetLocCoords ( const Array< OneD, const NekDouble > &  coords,
Array< OneD, NekDouble > &  Lcoords 
)
inline

Determine the local collapsed coordinates that correspond to a given Cartesian coordinate for this geometry object.

For curvilinear and non-affine elements (i.e. where the Jacobian varies as a function of the standard element coordinates), this is a non-linear optimisation problem that requires the use of a Newton iteration. Note therefore that this can be an expensive operation.

Note that, clearly, the provided Cartesian coordinate lie outside the element. The function therefore returns the minimum distance from some position in the element to . Lcoords will also be constrained to fit within the range \([-1,1]^d\) where \( d \) is the dimension of the element.

Parameters
coordsInput Cartesian global coordinates
LcoordsCorresponding local coordinates
Returns
Distance between obtained coordinates and provided ones.

Definition at line 534 of file Geometry.h.

References v_GetLocCoords().

Referenced by Nektar::SpatialDomains::PyrGeom::v_ContainsPoint(), Nektar::SpatialDomains::TetGeom::v_ContainsPoint(), Nektar::SpatialDomains::PrismGeom::v_ContainsPoint(), Nektar::SpatialDomains::HexGeom::v_ContainsPoint(), Nektar::SpatialDomains::QuadGeom::v_ContainsPoint(), Nektar::SpatialDomains::TriGeom::v_ContainsPoint(), and Nektar::SpatialDomains::SegGeom::v_ContainsPoint().

537 {
538  return v_GetLocCoords(coords, Lcoords);
539 }
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...
Definition: Geometry.cpp:314

◆ GetMetricInfo()

GeomFactorsSharedPtr Nektar::SpatialDomains::Geometry::GetMetricInfo ( )
inline

◆ GetNumEdges()

int Nektar::SpatialDomains::Geometry::GetNumEdges ( ) const
inline

Get the number of edges of this object.

Definition at line 393 of file Geometry.h.

References v_GetNumEdges().

Referenced by export_Geometry().

394 {
395  return v_GetNumEdges();
396 }
virtual int v_GetNumEdges() const
Get the number of edges of this object.
Definition: Geometry.cpp:215

◆ GetNumFaces()

int Nektar::SpatialDomains::Geometry::GetNumFaces ( ) const
inline

Get the number of faces of this object.

Definition at line 401 of file Geometry.h.

References v_GetNumFaces().

Referenced by export_Geometry().

402 {
403  return v_GetNumFaces();
404 }
virtual int v_GetNumFaces() const
Get the number of faces of this object.
Definition: Geometry.cpp:225

◆ GetNumVerts()

int Nektar::SpatialDomains::Geometry::GetNumVerts ( ) const
inline

Get the number of vertices of this object.

Definition at line 385 of file Geometry.h.

References v_GetNumVerts().

Referenced by Nektar::SpatialDomains::MeshGraph::CheckRange(), export_Geometry(), and GetBoundingBox().

386 {
387  return v_GetNumVerts();
388 }
virtual int v_GetNumVerts() const
Get the number of vertices of this object.
Definition: Geometry.cpp:183

◆ GetRefGeomFactors()

GeomFactorsSharedPtr Nektar::SpatialDomains::Geometry::GetRefGeomFactors ( const Array< OneD, const LibUtilities::BasisSharedPtr > &  tbasis)

◆ GetShapeDim()

int Nektar::SpatialDomains::Geometry::GetShapeDim ( ) const
inline

Get the object's shape dimension.

For example, a segment is one dimensional and quadrilateral is two dimensional.

Definition at line 412 of file Geometry.h.

References v_GetShapeDim().

Referenced by ClampLocCoords(), export_Geometry(), and GetTid().

413 {
414  return v_GetShapeDim();
415 }
virtual int v_GetShapeDim() const
Get the object&#39;s shape dimension.
Definition: Geometry.cpp:235

◆ GetShapeType()

LibUtilities::ShapeType Nektar::SpatialDomains::Geometry::GetShapeType ( void  )
inline

Get the geometric shape type of this object.

Definition at line 306 of file Geometry.h.

References m_shapeType.

Referenced by Nektar::SpatialDomains::MeshGraph::CheckRange(), and export_Geometry().

307 {
308  return m_shapeType;
309 }
LibUtilities::ShapeType m_shapeType
Type of shape.
Definition: Geometry.h:197

◆ GetTid()

int Nektar::SpatialDomains::Geometry::GetTid ( int  i) const
inline

Get the ID of trace i of this object.

The trace element is the facet one dimension lower than the object; for example, a quadrilateral has four trace segments forming its boundary.

Definition at line 333 of file Geometry.h.

References GetEid(), GetFid(), GetShapeDim(), and GetVid().

Referenced by export_Geometry().

334 {
335  const int nDim = GetShapeDim();
336  return nDim == 1 ? GetVid(i) : nDim == 2 ? GetEid(i) :
337  nDim == 3 ? GetFid(i) : 0;
338 }
int GetShapeDim() const
Get the object&#39;s shape dimension.
Definition: Geometry.h:412
int GetEid(int i) const
Get the ID of edge i of this object.
Definition: Geometry.cpp:145
int GetFid(int i) const
Get the ID of face i of this object.
Definition: Geometry.cpp:153
int GetVid(int i) const
Get the ID of vertex i of this object.
Definition: Geometry.cpp:137

◆ GetVertex()

PointGeomSharedPtr Nektar::SpatialDomains::Geometry::GetVertex ( int  i) const
inline

◆ GetVertexEdgeMap()

int Nektar::SpatialDomains::Geometry::GetVertexEdgeMap ( int  i,
int  j 
) const
inline

Returns the standard element edge IDs that are connected to a given vertex.

For example, on a prism, vertex 0 is connnected to edges 0, 3, and 4; GetVertexEdgeMap(0,j) would therefore return the values 0, 1 and 4 respectively. We assume that j runs between 0 and 2 inclusive, which is true for every 3D element asides from the pyramid.

This function is used in the construction of the low-energy preconditioner.

Parameters
iThe vertex to query connectivity for.
jThe local edge index between 0 and 2 connected to this element.
Todo:
Expand to work with pyramid elements.
See also
MultiRegions::PreconditionerLowEnergy

Definition at line 568 of file Geometry.h.

References v_GetVertexEdgeMap().

569 {
570  return v_GetVertexEdgeMap(i, j);
571 }
virtual int v_GetVertexEdgeMap(int i, int j) const
Returns the standard element edge IDs that are connected to a given vertex.
Definition: Geometry.cpp:269

◆ GetVertexFaceMap()

int Nektar::SpatialDomains::Geometry::GetVertexFaceMap ( int  i,
int  j 
) const
inline

Returns the standard element face IDs that are connected to a given vertex.

For example, on a hexahedron, vertex 0 is connnected to faces 0, 1, and 4; GetVertexFaceMap(0,j) would therefore return the values 0, 1 and 4 respectively. We assume that j runs between 0 and 2 inclusive, which is true for every 3D element asides from the pyramid.

This is used in the construction of the low-energy preconditioner.

Parameters
iThe vertex to query connectivity for.
jThe local face index between 0 and 2 connected to this element.
Todo:
Expand to work with pyramid elements.
See also
MultiRegions::PreconditionerLowEnergy

Definition at line 590 of file Geometry.h.

References v_GetVertexFaceMap().

591 {
592  return v_GetVertexFaceMap(i, j);
593 }
virtual int v_GetVertexFaceMap(int i, int j) const
Returns the standard element face IDs that are connected to a given vertex.
Definition: Geometry.cpp:280

◆ GetVid()

int Nektar::SpatialDomains::Geometry::GetVid ( int  i) const

◆ GetXmap()

StdRegions::StdExpansionSharedPtr Nektar::SpatialDomains::Geometry::GetXmap ( ) const
inline

Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standard element to physical element.

Definition at line 421 of file Geometry.h.

References v_GetXmap().

Referenced by export_Geometry(), GetBoundingBox(), Nektar::SpatialDomains::PyrGeom::SetUpXmap(), Nektar::SpatialDomains::TetGeom::SetUpXmap(), Nektar::SpatialDomains::PrismGeom::SetUpXmap(), Nektar::SpatialDomains::HexGeom::SetUpXmap(), Nektar::SpatialDomains::QuadGeom::SetUpXmap(), Nektar::SpatialDomains::TriGeom::SetUpXmap(), Nektar::SpatialDomains::QuadGeom::v_FillGeom(), Nektar::SpatialDomains::TriGeom::v_FillGeom(), and Nektar::SpatialDomains::Geometry3D::v_FillGeom().

422 {
423  return v_GetXmap();
424 }
virtual StdRegions::StdExpansionSharedPtr v_GetXmap() const
Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standar...
Definition: Geometry.cpp:245

◆ MinMaxCheck()

bool Nektar::SpatialDomains::Geometry::MinMaxCheck ( const Array< OneD, const NekDouble > &  gloCoord)

Check if given global coord is within twice the min/max distance of the element.

Parameters
coordsInput Cartesian global coordinates
Returns
True if within distance or False otherwise.

Definition at line 435 of file Geometry.cpp.

References ASSERTL1, m_coeffs, m_coordim, m_xmap, v_FillGeom(), Vmath::Vmax(), and Vmath::Vmin().

Referenced by Nektar::SpatialDomains::PyrGeom::v_ContainsPoint(), Nektar::SpatialDomains::TetGeom::v_ContainsPoint(), Nektar::SpatialDomains::PrismGeom::v_ContainsPoint(), Nektar::SpatialDomains::HexGeom::v_ContainsPoint(), Nektar::SpatialDomains::QuadGeom::v_ContainsPoint(), Nektar::SpatialDomains::TriGeom::v_ContainsPoint(), and Nektar::SpatialDomains::SegGeom::v_ContainsPoint().

436 {
437  // Validation checks
438  ASSERTL1(gloCoord.num_elements() >= m_coordim,
439  "Expects number of global coordinates supplied to be greater than "
440  "or equal to the mesh dimension.");
441 
442  int i;
443  Array<OneD, NekDouble> mincoord(m_coordim), maxcoord(m_coordim);
444  NekDouble diff = 0.0;
445 
446  v_FillGeom();
447 
448  const int npts = m_xmap->GetTotPoints();
449  Array<OneD, NekDouble> pts(npts);
450 
451  for (i = 0; i < m_coordim; ++i)
452  {
453  m_xmap->BwdTrans(m_coeffs[i], pts);
454  mincoord[i] = Vmath::Vmin(pts.num_elements(), pts, 1);
455  maxcoord[i] = Vmath::Vmax(pts.num_elements(), pts, 1);
456 
457  diff = std::max(maxcoord[i] - mincoord[i], diff);
458  }
459 
460  for (i = 0; i < m_coordim; ++i)
461  {
462  if ((gloCoord[i] < mincoord[i] - 0.2 * diff) ||
463  (gloCoord[i] > maxcoord[i] + 0.2 * diff))
464  {
465  return false;
466  }
467  }
468 
469  return true;
470 }
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition: Geometry.h:189
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
Definition: Vmath.cpp:782
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
Definition: Vmath.cpp:874
double NekDouble
Array< OneD, Array< OneD, NekDouble > > m_coeffs
Array containing expansion coefficients of m_xmap.
Definition: Geometry.h:201
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250
virtual void v_FillGeom()
Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements...
Definition: Geometry.cpp:326
int m_coordim
Coordinate dimension of this geometry object.
Definition: Geometry.h:183

◆ Reset()

void Nektar::SpatialDomains::Geometry::Reset ( CurveMap curvedEdges,
CurveMap curvedFaces 
)
inline

Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated GeomFactors.

Definition at line 620 of file Geometry.h.

References v_Reset().

621 {
622  v_Reset(curvedEdges, curvedFaces);
623 }
virtual void v_Reset(CurveMap &curvedEdges, CurveMap &curvedFaces)
Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated Geo...
Definition: Geometry.cpp:335

◆ SetCoordim()

void Nektar::SpatialDomains::Geometry::SetCoordim ( int  coordim)
inline

Sets the coordinate dimension of this object (i.e. the dimension of the space in which this object is embedded).

Definition at line 280 of file Geometry.h.

References m_coordim.

281 {
282  m_coordim = dim;
283 }
int m_coordim
Coordinate dimension of this geometry object.
Definition: Geometry.h:183

◆ SetGlobalID()

void Nektar::SpatialDomains::Geometry::SetGlobalID ( int  globalid)
inline

Set the ID of this object.

Definition at line 322 of file Geometry.h.

References m_globalID.

323 {
324  m_globalID = globalid;
325 }

◆ Setup()

void Nektar::SpatialDomains::Geometry::Setup ( )
inline

Definition at line 624 of file Geometry.h.

References v_Setup().

Referenced by export_Geometry().

625 {
626  v_Setup();
627 }

◆ SetUpCoeffs()

void Nektar::SpatialDomains::Geometry::SetUpCoeffs ( const int  nCoeffs)
inlineprotected

◆ v_ContainsPoint()

bool Nektar::SpatialDomains::Geometry::v_ContainsPoint ( const Array< OneD, const NekDouble > &  gloCoord,
Array< OneD, NekDouble > &  locCoord,
NekDouble  tol,
NekDouble resid 
)
protectedvirtual

For curvilinear and non-affine elements (i.e. where the Jacobian varies as a function of the standard element coordinates), this is a non-linear optimisation problem that requires the use of a Newton iteration. Note therefore that this can be an expensive operation.

The parameter tol which is by default 0, can be used to expand the coordinate range of the standard element from \([-1,1]^d\) to \([-1-\epsilon,1+\epsilon\) to handle challenging edge cases. The function also returns the local coordinates corresponding to gloCoord that can be used to speed up subsequent searches.

Parameters
gloCoordThe coordinate \( (x,y,z) \).
locCoordOn exit, this is the local coordinate \(\vec{\xi}\) such that \(\chi(\vec{\xi}) = \vec{x}\).
tolThe tolerance used to dictate the bounding box of the standard coordinates \(\vec{\xi}\).
residOn exit, returns the minimum distance between gloCoord and the quadrature points inside the element.
Returns
true if the coordinate gloCoord is contained in the element; false otherwise.
See also
Geometry::GetLocCoords.

Reimplemented in Nektar::SpatialDomains::SegGeom, Nektar::SpatialDomains::TriGeom, Nektar::SpatialDomains::QuadGeom, Nektar::SpatialDomains::HexGeom, Nektar::SpatialDomains::PrismGeom, Nektar::SpatialDomains::PyrGeom, and Nektar::SpatialDomains::TetGeom.

Definition at line 255 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by ContainsPoint().

259 {
260  boost::ignore_unused(gloCoord, locCoord, tol, resid);
262  "This function has not been defined for this geometry");
263  return false;
264 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ v_FillGeom()

void Nektar::SpatialDomains::Geometry::v_FillGeom ( )
protectedvirtual

Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements.

See also
v_FillGeom()

Reimplemented in Nektar::SpatialDomains::Geometry3D, Nektar::SpatialDomains::SegGeom, Nektar::SpatialDomains::TriGeom, and Nektar::SpatialDomains::QuadGeom.

Definition at line 326 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by FillGeom(), and MinMaxCheck().

327 {
329  "This function is only valid for expansion type geometries");
330 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ v_GenGeomFactors()

virtual void Nektar::SpatialDomains::Geometry::v_GenGeomFactors ( )
protectedpure virtual

◆ v_GetCoord()

NekDouble Nektar::SpatialDomains::Geometry::v_GetCoord ( const int  i,
const Array< OneD, const NekDouble > &  Lcoord 
)
protectedvirtual

Given local collapsed coordinate Lcoord, return the value of physical coordinate in direction i.

Reimplemented in Nektar::SpatialDomains::Geometry3D, Nektar::SpatialDomains::SegGeom, Nektar::SpatialDomains::TriGeom, and Nektar::SpatialDomains::QuadGeom.

Definition at line 302 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by GetCoord().

304 {
305  boost::ignore_unused(i, Lcoord);
307  "This function is only valid for expansion type geometries");
308  return 0.0;
309 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ v_GetEdge()

Geometry1DSharedPtr Nektar::SpatialDomains::Geometry::v_GetEdge ( int  i) const
protectedvirtual

Returns edge i of this object.

Reimplemented in Nektar::SpatialDomains::Geometry3D, and Nektar::SpatialDomains::Geometry2D.

Definition at line 161 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by GetEdge().

162 {
163  boost::ignore_unused(i);
165  "This function is only valid for shape type geometries");
166  return Geometry1DSharedPtr();
167 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209
std::shared_ptr< Geometry1D > Geometry1DSharedPtr
Definition: Geometry.h:63

◆ v_GetEdgeFaceMap()

int Nektar::SpatialDomains::Geometry::v_GetEdgeFaceMap ( int  i,
int  j 
) const
protectedvirtual

Returns the standard element edge IDs that are connected to a given face.

For example, on a prism, edge 0 is connnected to faces 0 and 1; GetEdgeFaceMap(0,j) would therefore return the values 0 and 1 respectively. We assume that j runs between 0 and 1 inclusive, since every face is connected to precisely two faces for all 3D elements.

This function is used in the construction of the low-energy preconditioner.

Parameters
iThe edge to query connectivity for.
jThe local face index between 0 and 1 connected to this element.
See also
MultiRegions::PreconditionerLowEnergy

Reimplemented in Nektar::SpatialDomains::HexGeom, Nektar::SpatialDomains::PrismGeom, and Nektar::SpatialDomains::TetGeom.

Definition at line 291 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by GetEdgeFaceMap().

292 {
293  boost::ignore_unused(i, j);
295  "This function has not been defined for this geometry");
296  return 0;
297 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ v_GetEorient()

StdRegions::Orientation Nektar::SpatialDomains::Geometry::v_GetEorient ( const int  i) const
protectedvirtual

Returns the orientation of edge i with respect to the ordering of edges in the standard element.

Reimplemented in Nektar::SpatialDomains::Geometry3D, and Nektar::SpatialDomains::Geometry2D.

Definition at line 193 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, Nektar::StdRegions::eForwards, and NEKERROR.

Referenced by GetEorient().

194 {
195  boost::ignore_unused(i);
197  "This function is not valid for this geometry.");
198  return StdRegions::eForwards;
199 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ v_GetFace()

Geometry2DSharedPtr Nektar::SpatialDomains::Geometry::v_GetFace ( int  i) const
protectedvirtual

Returns face i of this object.

Reimplemented in Nektar::SpatialDomains::Geometry3D.

Definition at line 172 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by GetFace().

173 {
174  boost::ignore_unused(i);
176  "This function is only valid for shape type geometries");
177  return Geometry2DSharedPtr();
178 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209
std::shared_ptr< Geometry2D > Geometry2DSharedPtr
Definition: Geometry.h:65

◆ v_GetForient()

StdRegions::Orientation Nektar::SpatialDomains::Geometry::v_GetForient ( const int  i) const
protectedvirtual

Returns the orientation of face i with respect to the ordering of faces in the standard element.

Reimplemented in Nektar::SpatialDomains::Geometry3D.

Definition at line 204 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, Nektar::StdRegions::eFwd, and NEKERROR.

Referenced by GetForient().

205 {
206  boost::ignore_unused(i);
208  "This function is not valid for this geometry.");
209  return StdRegions::eFwd;
210 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ v_GetLocCoords()

NekDouble Nektar::SpatialDomains::Geometry::v_GetLocCoords ( const Array< OneD, const NekDouble > &  coords,
Array< OneD, NekDouble > &  Lcoords 
)
protectedvirtual

Determine the local collapsed coordinates that correspond to a given Cartesian coordinate for this geometry object.

For curvilinear and non-affine elements (i.e. where the Jacobian varies as a function of the standard element coordinates), this is a non-linear optimisation problem that requires the use of a Newton iteration. Note therefore that this can be an expensive operation.

Note that, clearly, the provided Cartesian coordinate lie outside the element. The function therefore returns the minimum distance from some position in the element to . Lcoords will also be constrained to fit within the range \([-1,1]^d\) where \( d \) is the dimension of the element.

Parameters
coordsInput Cartesian global coordinates
LcoordsCorresponding local coordinates
Returns
Distance between obtained coordinates and provided ones.

Reimplemented in Nektar::SpatialDomains::TriGeom, Nektar::SpatialDomains::SegGeom, Nektar::SpatialDomains::QuadGeom, Nektar::SpatialDomains::HexGeom, Nektar::SpatialDomains::PrismGeom, Nektar::SpatialDomains::PyrGeom, and Nektar::SpatialDomains::TetGeom.

Definition at line 314 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by GetLocCoords().

316 {
317  boost::ignore_unused(coords, Lcoords);
319  "This function is only valid for expansion type geometries");
320  return 0.0;
321 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ v_GetNumEdges()

int Nektar::SpatialDomains::Geometry::v_GetNumEdges ( ) const
protectedvirtual

Get the number of edges of this object.

Reimplemented in Nektar::SpatialDomains::Geometry3D, Nektar::SpatialDomains::SegGeom, and Nektar::SpatialDomains::Geometry2D.

Definition at line 215 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by GetNumEdges().

216 {
218  "This function is only valid for shape type geometries");
219  return 0;
220 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ v_GetNumFaces()

int Nektar::SpatialDomains::Geometry::v_GetNumFaces ( ) const
protectedvirtual

Get the number of faces of this object.

Reimplemented in Nektar::SpatialDomains::Geometry3D.

Definition at line 225 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by GetNumFaces().

226 {
228  "This function is only valid for shape type geometries");
229  return 0;
230 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ v_GetNumVerts()

int Nektar::SpatialDomains::Geometry::v_GetNumVerts ( ) const
protectedvirtual

Get the number of vertices of this object.

Reimplemented in Nektar::SpatialDomains::Geometry3D, Nektar::SpatialDomains::SegGeom, and Nektar::SpatialDomains::Geometry2D.

Definition at line 183 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by GetNumVerts().

184 {
186  "This function is only valid for shape type geometries");
187  return 0;
188 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ v_GetShapeDim()

int Nektar::SpatialDomains::Geometry::v_GetShapeDim ( ) const
protectedvirtual

Get the object's shape dimension.

For example, a segment is one dimensional and quadrilateral is two dimensional.

Reimplemented in Nektar::SpatialDomains::Geometry3D, Nektar::SpatialDomains::Geometry2D, Nektar::SpatialDomains::Geometry1D, and Nektar::SpatialDomains::Geometry0D.

Definition at line 235 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by GetShapeDim().

236 {
238  "This function is only valid for shape type geometries");
239  return 0;
240 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ v_GetVertex()

virtual PointGeomSharedPtr Nektar::SpatialDomains::Geometry::v_GetVertex ( int  i) const
protectedpure virtual

◆ v_GetVertexEdgeMap()

int Nektar::SpatialDomains::Geometry::v_GetVertexEdgeMap ( int  i,
int  j 
) const
protectedvirtual

Returns the standard element edge IDs that are connected to a given vertex.

For example, on a prism, vertex 0 is connnected to edges 0, 3, and 4; GetVertexEdgeMap(0,j) would therefore return the values 0, 1 and 4 respectively. We assume that j runs between 0 and 2 inclusive, which is true for every 3D element asides from the pyramid.

This function is used in the construction of the low-energy preconditioner.

Parameters
iThe vertex to query connectivity for.
jThe local edge index between 0 and 2 connected to this element.
Todo:
Expand to work with pyramid elements.
See also
MultiRegions::PreconditionerLowEnergy

Reimplemented in Nektar::SpatialDomains::HexGeom, Nektar::SpatialDomains::PrismGeom, and Nektar::SpatialDomains::TetGeom.

Definition at line 269 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by GetVertexEdgeMap().

270 {
271  boost::ignore_unused(i, j);
273  "This function has not been defined for this geometry");
274  return 0;
275 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ v_GetVertexFaceMap()

int Nektar::SpatialDomains::Geometry::v_GetVertexFaceMap ( int  i,
int  j 
) const
protectedvirtual

Returns the standard element face IDs that are connected to a given vertex.

For example, on a hexahedron, vertex 0 is connnected to faces 0, 1, and 4; GetVertexFaceMap(0,j) would therefore return the values 0, 1 and 4 respectively. We assume that j runs between 0 and 2 inclusive, which is true for every 3D element asides from the pyramid.

This is used in the construction of the low-energy preconditioner.

Parameters
iThe vertex to query connectivity for.
jThe local face index between 0 and 2 connected to this element.
Todo:
Expand to work with pyramid elements.
See also
MultiRegions::PreconditionerLowEnergy

Reimplemented in Nektar::SpatialDomains::HexGeom, Nektar::SpatialDomains::PrismGeom, and Nektar::SpatialDomains::TetGeom.

Definition at line 280 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by GetVertexFaceMap().

281 {
282  boost::ignore_unused(i, j);
284  "This function has not been defined for this geometry");
285  return 0;
286 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ v_GetXmap()

StdRegions::StdExpansionSharedPtr Nektar::SpatialDomains::Geometry::v_GetXmap ( ) const
protectedvirtual

Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standard element to physical element.

Definition at line 245 of file Geometry.cpp.

References m_xmap.

Referenced by GetXmap().

246 {
247  return m_xmap;
248 }
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition: Geometry.h:189

◆ v_Reset()

void Nektar::SpatialDomains::Geometry::v_Reset ( CurveMap curvedEdges,
CurveMap curvedFaces 
)
protectedvirtual

Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated GeomFactors.

Reimplemented in Nektar::SpatialDomains::TriGeom, Nektar::SpatialDomains::QuadGeom, Nektar::SpatialDomains::SegGeom, Nektar::SpatialDomains::HexGeom, Nektar::SpatialDomains::PrismGeom, Nektar::SpatialDomains::TetGeom, and Nektar::SpatialDomains::PyrGeom.

Definition at line 335 of file Geometry.cpp.

References Nektar::SpatialDomains::eNotFilled, m_geomFactors, m_geomFactorsState, and m_state.

Referenced by Reset(), Nektar::SpatialDomains::PyrGeom::v_Reset(), Nektar::SpatialDomains::TetGeom::v_Reset(), Nektar::SpatialDomains::PrismGeom::v_Reset(), Nektar::SpatialDomains::HexGeom::v_Reset(), Nektar::SpatialDomains::SegGeom::v_Reset(), Nektar::SpatialDomains::QuadGeom::v_Reset(), and Nektar::SpatialDomains::TriGeom::v_Reset().

336 {
337  boost::ignore_unused(curvedEdges, curvedFaces);
338 
339  // Reset state
342 
343  // Junk geometric factors
345 }
GeomFactorsSharedPtr m_geomFactors
Geometric factors.
Definition: Geometry.h:185
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition: GeomFactors.h:62
GeomState m_geomFactorsState
State of the geometric factors.
Definition: Geometry.h:187
Geometric information has not been generated.
GeomState m_state
Enumeration to dictate whether coefficients are filled.
Definition: Geometry.h:191

◆ v_Setup()

void Nektar::SpatialDomains::Geometry::v_Setup ( )
protectedvirtual

Reimplemented in Nektar::SpatialDomains::TriGeom, Nektar::SpatialDomains::QuadGeom, Nektar::SpatialDomains::SegGeom, Nektar::SpatialDomains::HexGeom, Nektar::SpatialDomains::PrismGeom, Nektar::SpatialDomains::TetGeom, and Nektar::SpatialDomains::PyrGeom.

Definition at line 347 of file Geometry.cpp.

References Nektar::ErrorUtil::efatal, and NEKERROR.

Referenced by Setup().

348 {
350  "This function is only valid for expansion type geometries");
351 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ ValidateRegGeomFactor()

GeomFactorsSharedPtr Nektar::SpatialDomains::Geometry::ValidateRegGeomFactor ( GeomFactorsSharedPtr  geomFactor)
staticprotected

Check to see if a geometric factor has already been created that contains the same regular information.

The principle behind this is that many regular (i.e. constant Jacobian) elements have identicial geometric factors. Memory may therefore be reduced by storing only the unique factors.

Parameters
geomFactorThe GeomFactor to check.
Returns
Either the cached GeomFactor or geomFactor.
Todo:
Currently this method is disabled since the lookup is very expensive.
Todo:
should this '#if 0' statement be removed?

Definition at line 90 of file Geometry.cpp.

References Nektar::SpatialDomains::eRegular, and m_regGeomFactorsManager.

Referenced by GetGeomFactors().

92 {
93  GeomFactorsSharedPtr returnval = geomFactor;
94 
95 /// \todo should this '#if 0' statement be removed?
96 #if 0
97  bool found = false;
98  if (geomFactor->GetGtype() == eRegular)
99  {
100  for (GeomFactorsVectorIter iter = m_regGeomFactorsManager.begin();
101  iter != m_regGeomFactorsManager.end();
102  ++iter)
103  {
104  if (**iter == *geomFactor)
105  {
106  returnval = *iter;
107  found = true;
108  break;
109  }
110  }
111 
112  if (!found)
113  {
114  m_regGeomFactorsManager.push_back(geomFactor);
115  returnval = geomFactor;
116  }
117  }
118 #endif
119  return returnval;
120 }
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition: GeomFactors.h:62
static GeomFactorsVector m_regGeomFactorsManager
Definition: Geometry.h:180
Geometry is straight-sided with constant geometric factors.

Member Data Documentation

◆ m_coeffs

Array<OneD, Array<OneD, NekDouble> > Nektar::SpatialDomains::Geometry::m_coeffs
protected

◆ m_coordim

int Nektar::SpatialDomains::Geometry::m_coordim
protected

Coordinate dimension of this geometry object.

Definition at line 183 of file Geometry.h.

Referenced by Nektar::SpatialDomains::PointGeom::Add(), Nektar::SpatialDomains::Geometry2D::Geometry2D(), Nektar::SpatialDomains::Geometry3D::Geometry3D(), GetCoordim(), Nektar::SpatialDomains::PointGeom::GetCoords(), MinMaxCheck(), Nektar::SpatialDomains::PointGeom::Mult(), Nektar::SpatialDomains::PointGeom::PointGeom(), Nektar::SpatialDomains::QuadGeom::QuadGeom(), Nektar::SpatialDomains::SegGeom::SegGeom(), SetCoordim(), SetUpCoeffs(), Nektar::SpatialDomains::PyrGeom::SetUpFaceOrientation(), Nektar::SpatialDomains::PrismGeom::SetUpFaceOrientation(), Nektar::SpatialDomains::TetGeom::SetUpFaceOrientation(), Nektar::SpatialDomains::HexGeom::SetUpFaceOrientation(), Nektar::SpatialDomains::PointGeom::Sub(), Nektar::SpatialDomains::TriGeom::TriGeom(), Nektar::SpatialDomains::QuadGeom::v_FillGeom(), Nektar::SpatialDomains::TriGeom::v_FillGeom(), Nektar::SpatialDomains::SegGeom::v_FillGeom(), Nektar::SpatialDomains::Geometry3D::v_FillGeom(), Nektar::SpatialDomains::PyrGeom::v_GenGeomFactors(), Nektar::SpatialDomains::PrismGeom::v_GenGeomFactors(), Nektar::SpatialDomains::HexGeom::v_GenGeomFactors(), Nektar::SpatialDomains::TetGeom::v_GenGeomFactors(), Nektar::SpatialDomains::QuadGeom::v_GenGeomFactors(), Nektar::SpatialDomains::TriGeom::v_GenGeomFactors(), Nektar::SpatialDomains::SegGeom::v_GenGeomFactors(), Nektar::SpatialDomains::TetGeom::v_GetLocCoords(), Nektar::SpatialDomains::PyrGeom::v_GetLocCoords(), Nektar::SpatialDomains::PrismGeom::v_GetLocCoords(), Nektar::SpatialDomains::HexGeom::v_GetLocCoords(), Nektar::SpatialDomains::QuadGeom::v_GetLocCoords(), Nektar::SpatialDomains::SegGeom::v_GetLocCoords(), and Nektar::SpatialDomains::TriGeom::v_GetLocCoords().

◆ m_geomFactors

GeomFactorsSharedPtr Nektar::SpatialDomains::Geometry::m_geomFactors
protected

◆ m_geomFactorsState

GeomState Nektar::SpatialDomains::Geometry::m_geomFactorsState
protected

◆ m_geomType

GeomType Nektar::SpatialDomains::Geometry::m_geomType
protected

Type of geometry.

Definition at line 195 of file Geometry.h.

◆ m_globalID

int Nektar::SpatialDomains::Geometry::m_globalID
protected

◆ m_regGeomFactorsManager

GeomFactorsVector Nektar::SpatialDomains::Geometry::m_regGeomFactorsManager
staticprotected

Definition at line 180 of file Geometry.h.

Referenced by ValidateRegGeomFactor().

◆ m_setupState

bool Nektar::SpatialDomains::Geometry::m_setupState
protected

◆ m_shapeType

LibUtilities::ShapeType Nektar::SpatialDomains::Geometry::m_shapeType
protected

◆ m_state

GeomState Nektar::SpatialDomains::Geometry::m_state
protected

◆ m_xmap

StdRegions::StdExpansionSharedPtr Nektar::SpatialDomains::Geometry::m_xmap
protected

\(\chi\) mapping containing isoparametric transformation.

Definition at line 189 of file Geometry.h.

Referenced by Nektar::SpatialDomains::SegGeom::GenerateOneSpaceDimGeom(), MinMaxCheck(), Nektar::SpatialDomains::Geometry2D::NewtonIterationForLocCoord(), Nektar::SpatialDomains::Geometry3D::NewtonIterationForLocCoord(), Nektar::SpatialDomains::SegGeom::SegGeom(), Nektar::SpatialDomains::PyrGeom::SetUpXmap(), Nektar::SpatialDomains::TetGeom::SetUpXmap(), Nektar::SpatialDomains::PrismGeom::SetUpXmap(), Nektar::SpatialDomains::HexGeom::SetUpXmap(), Nektar::SpatialDomains::QuadGeom::SetUpXmap(), Nektar::SpatialDomains::TriGeom::SetUpXmap(), Nektar::SpatialDomains::SegGeom::SetUpXmap(), Nektar::SpatialDomains::QuadGeom::v_FillGeom(), Nektar::SpatialDomains::TriGeom::v_FillGeom(), Nektar::SpatialDomains::SegGeom::v_FillGeom(), Nektar::SpatialDomains::Geometry3D::v_FillGeom(), Nektar::SpatialDomains::PyrGeom::v_GenGeomFactors(), Nektar::SpatialDomains::PrismGeom::v_GenGeomFactors(), Nektar::SpatialDomains::HexGeom::v_GenGeomFactors(), Nektar::SpatialDomains::TetGeom::v_GenGeomFactors(), Nektar::SpatialDomains::QuadGeom::v_GenGeomFactors(), Nektar::SpatialDomains::TriGeom::v_GenGeomFactors(), Nektar::SpatialDomains::SegGeom::v_GenGeomFactors(), Nektar::SpatialDomains::QuadGeom::v_GetCoord(), Nektar::SpatialDomains::TriGeom::v_GetCoord(), Nektar::SpatialDomains::SegGeom::v_GetCoord(), Nektar::SpatialDomains::Geometry3D::v_GetCoord(), Nektar::SpatialDomains::PyrGeom::v_GetLocCoords(), Nektar::SpatialDomains::TetGeom::v_GetLocCoords(), Nektar::SpatialDomains::PrismGeom::v_GetLocCoords(), Nektar::SpatialDomains::HexGeom::v_GetLocCoords(), Nektar::SpatialDomains::QuadGeom::v_GetLocCoords(), Nektar::SpatialDomains::SegGeom::v_GetLocCoords(), Nektar::SpatialDomains::TriGeom::v_GetLocCoords(), v_GetXmap(), Nektar::SpatialDomains::PyrGeom::v_Reset(), Nektar::SpatialDomains::HexGeom::v_Reset(), Nektar::SpatialDomains::SegGeom::v_Reset(), Nektar::SpatialDomains::QuadGeom::v_Reset(), Nektar::SpatialDomains::TriGeom::v_Reset(), Nektar::SpatialDomains::PyrGeom::v_Setup(), Nektar::SpatialDomains::TetGeom::v_Setup(), Nektar::SpatialDomains::PrismGeom::v_Setup(), Nektar::SpatialDomains::HexGeom::v_Setup(), Nektar::SpatialDomains::SegGeom::v_Setup(), Nektar::SpatialDomains::QuadGeom::v_Setup(), and Nektar::SpatialDomains::TriGeom::v_Setup().