Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Nektar::SpatialDomains::SegGeom Class Reference

#include <SegGeom.h>

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

Public Member Functions

 SegGeom ()
 
 SegGeom (int id, const int coordim, const PointGeomSharedPtr vertex[], const CurveSharedPtr curve=CurveSharedPtr())
 
 SegGeom (const SegGeom &in)
 
SegGeomSharedPtr GenerateOneSpaceDimGeom (void)
 Generate a one dimensional space segment geometry where the vert[0] has the same x value and vert[1] is set to vert[0] plus the length of the original segment. More...
 
 ~SegGeom ()
 
CurveSharedPtr GetCurve ()
 
- Public Member Functions inherited from Nektar::SpatialDomains::Geometry1D
 Geometry1D ()
 
 Geometry1D (const int coordim)
 
virtual ~Geometry1D ()
 
- Public Member Functions inherited from Nektar::SpatialDomains::Geometry
 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 ()
 

Static Public Member Functions

static StdRegions::Orientation GetEdgeOrientation (const SegGeom &edge1, const SegGeom &edge2)
 Get the orientation of edge1. More...
 

Static Public Attributes

static const int kNverts = 2
 
static const int kNedges = 1
 
- Static Public Attributes inherited from Nektar::SpatialDomains::Geometry1D
static const int kDim = 1
 

Protected Member Functions

virtual PointGeomSharedPtr v_GetVertex (const int i) const
 
virtual LibUtilities::ShapeType v_GetShapeType () const
 
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 void v_GenGeomFactors ()
 
virtual void v_FillGeom ()
 Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements. 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 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 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 bool v_ContainsPoint (const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, NekDouble &resid)
 
- Protected Member Functions inherited from Nektar::SpatialDomains::Geometry1D
virtual int v_GetShapeDim () const
 Get the object's shape dimension. More...
 
- Protected Member Functions inherited from Nektar::SpatialDomains::Geometry
void GenGeomFactors ()
 Handles generation of geometry factors. More...
 
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_GetNumFaces () const
 Get the number of faces of this object. 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 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...
 
void SetUpCoeffs (const int nCoeffs)
 Initialise the Geometry::m_coeffs array. More...
 

Protected Attributes

SpatialDomains::PointGeomSharedPtr m_verts [kNverts]
 
StdRegions::Orientation m_porient [kNverts]
 
- Protected Attributes inherited from Nektar::SpatialDomains::Geometry
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...
 

Private Member Functions

void SetUpXmap ()
 

Private Attributes

CurveSharedPtr m_curve
 Boolean indicating whether object owns the data. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from Nektar::SpatialDomains::Geometry
static GeomFactorsSharedPtr ValidateRegGeomFactor (GeomFactorsSharedPtr geomFactor)
 Check to see if a geometric factor has already been created that contains the same regular information. More...
 
- Static Protected Attributes inherited from Nektar::SpatialDomains::Geometry
static GeomFactorsVector m_regGeomFactorsManager
 

Detailed Description

Definition at line 54 of file SegGeom.h.

Constructor & Destructor Documentation

◆ SegGeom() [1/3]

Nektar::SpatialDomains::SegGeom::SegGeom ( )

◆ SegGeom() [2/3]

Nektar::SpatialDomains::SegGeom::SegGeom ( int  id,
const int  coordim,
const PointGeomSharedPtr  vertex[],
const CurveSharedPtr  curve = CurveSharedPtr() 
)

Definition at line 52 of file SegGeom.cpp.

References Nektar::SpatialDomains::eNotFilled, Nektar::LibUtilities::eSegment, m_curve, Nektar::SpatialDomains::Geometry::m_globalID, Nektar::SpatialDomains::Geometry::m_shapeType, Nektar::SpatialDomains::Geometry::m_state, and m_verts.

56  : Geometry1D(coordim)
57 {
59  m_globalID = id;
61  m_curve = curve;
62 
63  m_verts[0] = vertex[0];
64  m_verts[1] = vertex[1];
65 }
Geometric information has not been generated.
SpatialDomains::PointGeomSharedPtr m_verts[kNverts]
Definition: SegGeom.h:82
CurveSharedPtr m_curve
Boolean indicating whether object owns the data.
Definition: SegGeom.h:107
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

◆ SegGeom() [3/3]

Nektar::SpatialDomains::SegGeom::SegGeom ( const SegGeom in)

Definition at line 67 of file SegGeom.cpp.

References Nektar::SpatialDomains::Geometry::m_coordim, Nektar::SpatialDomains::Geometry::m_globalID, Nektar::SpatialDomains::Geometry::m_shapeType, Nektar::SpatialDomains::Geometry::m_state, m_verts, Nektar::SpatialDomains::Geometry::m_xmap, and Nektar::SpatialDomains::Geometry::SetUpCoeffs().

68  : Geometry1D(in)
69 {
70  // From Geometry class
71  m_shapeType = in.m_shapeType;
72 
73  // info from EdgeComponent class
74  m_globalID = in.m_globalID;
75  m_xmap = in.m_xmap;
76  SetUpCoeffs(m_xmap->GetNcoeffs());
77 
78  // info from SegGeom class
79  m_coordim = in.m_coordim;
80  m_verts[0] = in.m_verts[0];
81  m_verts[1] = in.m_verts[1];
82 
83  m_state = in.m_state;
84 }
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition: Geometry.h:189
SpatialDomains::PointGeomSharedPtr m_verts[kNverts]
Definition: SegGeom.h:82
LibUtilities::ShapeType m_shapeType
Type of shape.
Definition: Geometry.h:197
void SetUpCoeffs(const int nCoeffs)
Initialise the Geometry::m_coeffs array.
Definition: Geometry.h:643
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

◆ ~SegGeom()

Nektar::SpatialDomains::SegGeom::~SegGeom ( )

Definition at line 165 of file SegGeom.cpp.

166 {
167 }

Member Function Documentation

◆ GenerateOneSpaceDimGeom()

SegGeomSharedPtr Nektar::SpatialDomains::SegGeom::GenerateOneSpaceDimGeom ( void  )

Generate a one dimensional space segment geometry where the vert[0] has the same x value and vert[1] is set to vert[0] plus the length of the original segment.

Definition at line 111 of file SegGeom.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::SpatialDomains::eNotFilled, Nektar::SpatialDomains::Geometry::GetGlobalID(), Nektar::SpatialDomains::Geometry::m_geomFactors, Nektar::SpatialDomains::Geometry::m_globalID, m_verts, Nektar::SpatialDomains::Geometry::m_xmap, and v_GenGeomFactors().

112 {
114 
115  // info about numbering
116  returnval->m_globalID = m_globalID;
117 
118  // geometric information.
119  returnval->m_coordim = 1;
120  NekDouble x0 = (*m_verts[0])[0];
122  1, m_verts[0]->GetGlobalID(), x0, 0.0, 0.0);
123  vert0->SetGlobalID(vert0->GetGlobalID());
124  returnval->m_verts[0] = vert0;
125 
126  // Get information to calculate length.
127  const Array<OneD, const LibUtilities::BasisSharedPtr> base =
128  m_xmap->GetBase();
130  v.push_back(base[0]->GetPointsKey());
132 
133  const Array<OneD, const NekDouble> jac = m_geomFactors->GetJac(v);
134 
135  NekDouble len = 0.0;
136  if (jac.num_elements() == 1)
137  {
138  len = jac[0] * 2.0;
139  }
140  else
141  {
142  Array<OneD, const NekDouble> w0 = base[0]->GetW();
143  len = 0.0;
144 
145  for (int i = 0; i < jac.num_elements(); ++i)
146  {
147  len += jac[i] * w0[i];
148  }
149  }
150  // Set up second vertex.
152  1, m_verts[1]->GetGlobalID(), x0 + len, 0.0, 0.0);
153  vert1->SetGlobalID(vert1->GetGlobalID());
154 
155  returnval->m_verts[1] = vert1;
156 
157  // at present just use previous m_xmap[0];
158  returnval->m_xmap = m_xmap;
159  returnval->SetUpCoeffs(m_xmap->GetNcoeffs());
160  returnval->m_state = eNotFilled;
161 
162  return returnval;
163 }
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition: Geometry.h:189
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:246
GeomFactorsSharedPtr m_geomFactors
Geometric factors.
Definition: Geometry.h:185
int GetGlobalID(void) const
Get the ID of this object.
Definition: Geometry.h:314
virtual void v_GenGeomFactors()
Definition: SegGeom.cpp:224
Geometric information has not been generated.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
double NekDouble
std::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:59
SpatialDomains::PointGeomSharedPtr m_verts[kNverts]
Definition: SegGeom.h:82
std::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:62

◆ GetCurve()

CurveSharedPtr Nektar::SpatialDomains::SegGeom::GetCurve ( )
inline

Definition at line 73 of file SegGeom.h.

References m_curve.

Referenced by export_GeomElements().

74  {
75  return m_curve;
76  }
CurveSharedPtr m_curve
Boolean indicating whether object owns the data.
Definition: SegGeom.h:107

◆ GetEdgeOrientation()

StdRegions::Orientation Nektar::SpatialDomains::SegGeom::GetEdgeOrientation ( const SegGeom edge1,
const SegGeom edge2 
)
static

Get the orientation of edge1.

If edge1 is connected to edge2 in the same direction as the points comprising edge1 then it is forward, otherwise it is backward.

For example, assume edge1 is comprised of points 1 and 2, and edge2 is comprised of points 2 and 3, then edge1 is forward.

If edge1 is comprised of points 2 and 1 and edge2 is comprised of points 3 and 2, then edge1 is backward.

Since both edges are passed, it does not need any information from the EdgeComponent instance.

Definition at line 200 of file SegGeom.cpp.

References ASSERTL0, Nektar::StdRegions::eBackwards, Nektar::StdRegions::eForwards, Nektar::SpatialDomains::Geometry::GetGlobalID(), and Nektar::SpatialDomains::Geometry::GetVertex().

Referenced by Nektar::SpatialDomains::QuadGeom::QuadGeom(), and Nektar::SpatialDomains::TriGeom::TriGeom().

202 {
204 
205  if ((*edge1.GetVertex(0) == *edge2.GetVertex(0)) ||
206  (*edge1.GetVertex(0) == *edge2.GetVertex(1)))
207  {
208  // Backward direction. Vertex 0 is connected to edge 2.
209  returnval = StdRegions::eBackwards;
210  }
211  else if ((*edge1.GetVertex(1) != *edge2.GetVertex(0)) &&
212  (*edge1.GetVertex(1) != *edge2.GetVertex(1)))
213  {
214  // Not forward either, then we have a problem.
215  std::ostringstream errstrm;
216  errstrm << "Connected edges do not share a vertex. Edges ";
217  errstrm << edge1.GetGlobalID() << ", " << edge2.GetGlobalID();
218  ASSERTL0(false, errstrm.str());
219  }
220 
221  return returnval;
222 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216

◆ SetUpXmap()

void Nektar::SpatialDomains::SegGeom::SetUpXmap ( )
private

Definition at line 86 of file SegGeom.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eModified_A, m_curve, and Nektar::SpatialDomains::Geometry::m_xmap.

Referenced by v_Reset(), and v_Setup().

87 {
88  if (m_curve)
89  {
90  int npts = m_curve->m_points.size();
91  LibUtilities::PointsKey pkey(npts + 1,
93  const LibUtilities::BasisKey B(LibUtilities::eModified_A, npts, pkey);
95  }
96  else
97  {
98  const LibUtilities::BasisKey B(
100  2,
101  LibUtilities::PointsKey(2, LibUtilities::eGaussLobattoLegendre));
103  }
104 }
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition: Geometry.h:189
Principle Modified Functions .
Definition: BasisType.h:48
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
CurveSharedPtr m_curve
Boolean indicating whether object owns the data.
Definition: SegGeom.h:107
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:51

◆ v_ContainsPoint()

bool Nektar::SpatialDomains::SegGeom::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 from Nektar::SpatialDomains::Geometry.

Definition at line 372 of file SegGeom.cpp.

References Nektar::SpatialDomains::Geometry::ClampLocCoords(), Nektar::SpatialDomains::eRegular, Nektar::SpatialDomains::Geometry::GetLocCoords(), Nektar::SpatialDomains::Geometry::GetMetricInfo(), and Nektar::SpatialDomains::Geometry::MinMaxCheck().

376 {
377  //Rough check if within twice min/max point
378  if (GetMetricInfo()->GetGtype() != eRegular)
379  {
380  if (!MinMaxCheck(gloCoord))
381  {
382  return false;
383  }
384  }
385 
386  // Convert to the local (eta) coordinates.
387  resid = GetLocCoords(gloCoord, stdCoord);
388 
389  if (stdCoord[0] >= -(1 + tol) && stdCoord[0] <= 1 + tol)
390  {
391  return true;
392  }
393 
394  //Clamp local coords
395  ClampLocCoords(stdCoord, tol);
396 
397  return false;
398 }
bool MinMaxCheck(const Array< OneD, const NekDouble > &gloCoord)
Check if given global coord is within twice the min/max distance of the element.
Definition: Geometry.cpp:435
void ClampLocCoords(Array< OneD, NekDouble > &locCoord, NekDouble tol)
Clamp local coords to be within standard regions [-1, 1]^dim.
Definition: Geometry.cpp:478
Geometry is straight-sided with constant geometric factors.
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...
Definition: Geometry.h:534
GeomFactorsSharedPtr GetMetricInfo()
Get the geometric factors for this object.
Definition: Geometry.h:298

◆ v_FillGeom()

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

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

See also
v_FillGeom()

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 247 of file SegGeom.cpp.

References Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::SpatialDomains::ePtsFilled, Nektar::ErrorUtil::ewarning, Nektar::eWrapper, Nektar::NekVector< DataType >::GetPtr(), Nektar::NekConstants::kVertexTheSameDouble, Nektar::SpatialDomains::Geometry::m_coeffs, Nektar::SpatialDomains::Geometry::m_coordim, m_curve, Nektar::SpatialDomains::Geometry::m_globalID, Nektar::SpatialDomains::Geometry::m_state, m_verts, Nektar::SpatialDomains::Geometry::m_xmap, NEKERROR, and Nektar::LibUtilities::PointsManager().

Referenced by v_GenGeomFactors(), and v_GetLocCoords().

248 {
249  if (m_state != ePtsFilled)
250  {
251  int i;
252 
253  if (m_coordim > 0 && m_curve)
254  {
255  int npts = m_curve->m_points.size();
256  LibUtilities::PointsKey pkey(npts + 1,
258  Array<OneD, NekDouble> tmp(npts);
259 
260  if (m_verts[0]->dist(*(m_curve->m_points[0])) >
262  {
263  std::string err =
264  "Vertex 0 is separated from first point by more than ";
265  std::stringstream strstrm;
266  strstrm << NekConstants::kVertexTheSameDouble << " in edge "
267  << m_globalID;
268  err += strstrm.str();
269  NEKERROR(ErrorUtil::ewarning, err.c_str());
270  }
271 
272  if (m_verts[1]->dist(*(m_curve->m_points[npts - 1])) >
274  {
275  std::string err =
276  "Vertex 1 is separated from last point by more than ";
277  std::stringstream strstrm;
278  strstrm << NekConstants::kVertexTheSameDouble << " in edge "
279  << m_globalID;
280  err += strstrm.str();
281  NEKERROR(ErrorUtil::ewarning, err.c_str());
282  }
283 
284  LibUtilities::PointsKey fkey(npts, m_curve->m_ptype);
285  DNekMatSharedPtr I0 =
286  LibUtilities::PointsManager()[fkey]->GetI(pkey);
287  NekVector<NekDouble> out(npts + 1);
288 
289  for (int i = 0; i < m_coordim; ++i)
290  {
291  // Load up coordinate values into tmp
292  for (int j = 0; j < npts; ++j)
293  {
294  tmp[j] = (m_curve->m_points[j]->GetPtr())[i];
295  }
296 
297  // Interpolate to GLL points
298  NekVector<NekDouble> in(npts, tmp, eWrapper);
299  out = (*I0) * in;
300 
301  m_xmap->FwdTrans(out.GetPtr(), m_coeffs[i]);
302  }
303  }
304 
305  for (i = 0; i < m_coordim; ++i)
306  {
307  m_coeffs[i][0] = (*m_verts[0])[i];
308  m_coeffs[i][1] = (*m_verts[1])[i];
309  }
310 
312  }
313 }
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition: Geometry.h:189
#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< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
static const NekDouble kVertexTheSameDouble
PointsManagerT & PointsManager(void)
SpatialDomains::PointGeomSharedPtr m_verts[kNverts]
Definition: SegGeom.h:82
Array< OneD, Array< OneD, NekDouble > > m_coeffs
Array containing expansion coefficients of m_xmap.
Definition: Geometry.h:201
CurveSharedPtr m_curve
Boolean indicating whether object owns the data.
Definition: SegGeom.h:107
Geometric information has been generated.
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
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:51

◆ v_GenGeomFactors()

void Nektar::SpatialDomains::SegGeom::v_GenGeomFactors ( )
protectedvirtual

Implements Nektar::SpatialDomains::Geometry.

Definition at line 224 of file SegGeom.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::SpatialDomains::eDeformed, Nektar::SpatialDomains::ePtsFilled, Nektar::SpatialDomains::eRegular, Nektar::SpatialDomains::Geometry::m_coeffs, Nektar::SpatialDomains::Geometry::m_coordim, Nektar::SpatialDomains::Geometry::m_geomFactors, Nektar::SpatialDomains::Geometry::m_geomFactorsState, Nektar::SpatialDomains::Geometry::m_setupState, Nektar::SpatialDomains::Geometry::m_xmap, v_FillGeom(), and v_Setup().

Referenced by GenerateOneSpaceDimGeom().

225 {
226  if(!m_setupState)
227  {
229  }
230 
232  {
235 
236  if (m_xmap->GetBasisNumModes(0) != 2)
237  {
238  gType = eDeformed;
239  }
240 
242  gType, m_coordim, m_xmap, m_coeffs);
244  }
245 }
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition: Geometry.h:189
GeomFactorsSharedPtr m_geomFactors
Geometric factors.
Definition: Geometry.h:185
GeomState m_geomFactorsState
State of the geometric factors.
Definition: Geometry.h:187
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
bool m_setupState
Wether or not the setup routines have been run.
Definition: Geometry.h:193
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.
virtual void v_FillGeom()
Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements...
Definition: SegGeom.cpp:247
Geometric information has been generated.
GeomType
Indicates the type of element geometry.
Geometry is curved or has non-constant factors.
int m_coordim
Coordinate dimension of this geometry object.
Definition: Geometry.h:183

◆ v_GetCoord()

NekDouble Nektar::SpatialDomains::SegGeom::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 from Nektar::SpatialDomains::Geometry.

Definition at line 174 of file SegGeom.cpp.

References ASSERTL1, Nektar::SpatialDomains::ePtsFilled, Nektar::SpatialDomains::Geometry::m_coeffs, Nektar::SpatialDomains::Geometry::m_state, and Nektar::SpatialDomains::Geometry::m_xmap.

176 {
177  ASSERTL1(m_state == ePtsFilled, "Geometry is not in physical space");
178 
179  Array<OneD, NekDouble> tmp(m_xmap->GetTotPoints());
180  m_xmap->BwdTrans(m_coeffs[i], tmp);
181 
182  return m_xmap->PhysEvaluate(Lcoord, tmp);
183 }
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition: Geometry.h:189
Array< OneD, Array< OneD, NekDouble > > m_coeffs
Array containing expansion coefficients of m_xmap.
Definition: Geometry.h:201
Geometric information has been generated.
GeomState m_state
Enumeration to dictate whether coefficients are filled.
Definition: Geometry.h:191
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ v_GetLocCoords()

NekDouble Nektar::SpatialDomains::SegGeom::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 from Nektar::SpatialDomains::Geometry.

Definition at line 339 of file SegGeom.cpp.

References Nektar::ErrorUtil::efatal, Nektar::SpatialDomains::eRegular, Nektar::SpatialDomains::Geometry::GetMetricInfo(), Nektar::SpatialDomains::Geometry::m_coeffs, Nektar::SpatialDomains::Geometry::m_coordim, Nektar::SpatialDomains::Geometry::m_xmap, NEKERROR, and v_FillGeom().

341 {
342  int i;
343  NekDouble resid = 0.0;
345 
346  // calculate local coordinate for coord
347  if (GetMetricInfo()->GetGtype() == eRegular)
348  {
349  NekDouble len = 0.0;
350  NekDouble xi = 0.0;
351 
352  const int npts = m_xmap->GetTotPoints();
353  Array<OneD, NekDouble> pts(npts);
354 
355  for (i = 0; i < m_coordim; ++i)
356  {
357  m_xmap->BwdTrans(m_coeffs[i], pts);
358  len += (pts[npts - 1] - pts[0]) * (pts[npts - 1] - pts[0]);
359  xi += (coords[i] - pts[0]) * (pts[npts-1] - pts[0]);
360  }
361 
362  Lcoords[0] = 2 * xi / len - 1.0;
363  }
364  else
365  {
367  "inverse mapping must be set up to use this call");
368  }
369  return resid;
370 }
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition: Geometry.h:189
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209
double NekDouble
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.
virtual void v_FillGeom()
Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements...
Definition: SegGeom.cpp:247
GeomFactorsSharedPtr GetMetricInfo()
Get the geometric factors for this object.
Definition: Geometry.h:298
int m_coordim
Coordinate dimension of this geometry object.
Definition: Geometry.h:183

◆ v_GetNumEdges()

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

Get the number of edges of this object.

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 417 of file SegGeom.cpp.

References kNedges.

418 {
419  return kNedges;
420 }
static const int kNedges
Definition: SegGeom.h:79

◆ v_GetNumVerts()

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

Get the number of vertices of this object.

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 412 of file SegGeom.cpp.

References kNverts.

413 {
414  return kNverts;
415 }
static const int kNverts
Definition: SegGeom.h:78

◆ v_GetShapeType()

LibUtilities::ShapeType Nektar::SpatialDomains::SegGeom::v_GetShapeType ( ) const
protectedvirtual

Definition at line 169 of file SegGeom.cpp.

References Nektar::LibUtilities::eSegment.

◆ v_GetVertex()

PointGeomSharedPtr Nektar::SpatialDomains::SegGeom::v_GetVertex ( const int  i) const
protectedvirtual

Implements Nektar::SpatialDomains::Geometry.

Definition at line 400 of file SegGeom.cpp.

References kNverts, and m_verts.

401 {
402  PointGeomSharedPtr returnval;
403 
404  if (i >= 0 && i < kNverts)
405  {
406  returnval = m_verts[i];
407  }
408 
409  return returnval;
410 }
std::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:59
SpatialDomains::PointGeomSharedPtr m_verts[kNverts]
Definition: SegGeom.h:82
static const int kNverts
Definition: SegGeom.h:78

◆ v_Reset()

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

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

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 315 of file SegGeom.cpp.

References m_curve, Nektar::SpatialDomains::Geometry::m_globalID, Nektar::SpatialDomains::Geometry::m_xmap, Nektar::SpatialDomains::Geometry::SetUpCoeffs(), SetUpXmap(), and Nektar::SpatialDomains::Geometry::v_Reset().

316 {
317  Geometry::v_Reset(curvedEdges, curvedFaces);
318  CurveMap::iterator it = curvedEdges.find(m_globalID);
319 
320  if (it != curvedEdges.end())
321  {
322  m_curve = it->second;
323  }
324 
325  SetUpXmap();
326  SetUpCoeffs(m_xmap->GetNcoeffs());
327 }
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition: Geometry.h:189
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
CurveSharedPtr m_curve
Boolean indicating whether object owns the data.
Definition: SegGeom.h:107
void SetUpCoeffs(const int nCoeffs)
Initialise the Geometry::m_coeffs array.
Definition: Geometry.h:643

◆ v_Setup()

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

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 329 of file SegGeom.cpp.

References Nektar::SpatialDomains::Geometry::m_setupState, Nektar::SpatialDomains::Geometry::m_xmap, Nektar::SpatialDomains::Geometry::SetUpCoeffs(), and SetUpXmap().

Referenced by v_GenGeomFactors().

330 {
331  if(!m_setupState)
332  {
333  SetUpXmap();
334  SetUpCoeffs(m_xmap->GetNcoeffs());
335  m_setupState = true;
336  }
337 }
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition: Geometry.h:189
bool m_setupState
Wether or not the setup routines have been run.
Definition: Geometry.h:193
void SetUpCoeffs(const int nCoeffs)
Initialise the Geometry::m_coeffs array.
Definition: Geometry.h:643

Member Data Documentation

◆ kNedges

const int Nektar::SpatialDomains::SegGeom::kNedges = 1
static

Definition at line 79 of file SegGeom.h.

Referenced by v_GetNumEdges().

◆ kNverts

const int Nektar::SpatialDomains::SegGeom::kNverts = 2
static

Definition at line 78 of file SegGeom.h.

Referenced by v_GetNumVerts(), and v_GetVertex().

◆ m_curve

CurveSharedPtr Nektar::SpatialDomains::SegGeom::m_curve
private

Boolean indicating whether object owns the data.

Definition at line 107 of file SegGeom.h.

Referenced by GetCurve(), SegGeom(), SetUpXmap(), v_FillGeom(), and v_Reset().

◆ m_porient

StdRegions::Orientation Nektar::SpatialDomains::SegGeom::m_porient[kNverts]
protected

Definition at line 83 of file SegGeom.h.

◆ m_verts

SpatialDomains::PointGeomSharedPtr Nektar::SpatialDomains::SegGeom::m_verts[kNverts]
protected

Definition at line 82 of file SegGeom.h.

Referenced by GenerateOneSpaceDimGeom(), SegGeom(), v_FillGeom(), and v_GetVertex().