Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
Nektar::SpatialDomains::TriGeom Class Reference

#include <TriGeom.h>

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

Public Member Functions

 TriGeom ()
 
 TriGeom (const TriGeom &in)
 
 TriGeom (const int id, std::array< SegGeom *, kNedges > edges, Curve *curve=nullptr)
 
 ~TriGeom () override=default
 
- Public Member Functions inherited from Nektar::SpatialDomains::Geometry2D
 Geometry2D ()
 
 Geometry2D (const int coordim, Curve *curve)
 
 ~Geometry2D () override=default
 
CurveGetCurve ()
 
void SetCurve (Curve *curvePtr)
 
- Public Member Functions inherited from Nektar::SpatialDomains::Geometry
 Geometry ()
 Default constructor.
 
 Geometry (int coordim)
 Constructor when supplied a coordinate dimension.
 
virtual ~Geometry ()=default
 
int GetCoordim () const
 Return the coordinate dimension of this object (i.e. the dimension of the space in which this object is embedded).
 
void SetCoordim (int coordim)
 Sets the coordinate dimension of this object (i.e. the dimension of the space in which this object is embedded).
 
GeomFactorsUniquePtr GenGeomFactors (LibUtilities::PointsKeyVector &keyTgt)
 Used by Expansion to generate associated GeomFactors.
 
LibUtilities::ShapeType GetShapeType (void)
 Get the geometric shape type of this object.
 
int GetGlobalID (void) const
 Get the ID of this object.
 
void SetGlobalID (int globalid)
 Set the ID of this object.
 
int GetVid (int i) const
 Returns global id of vertex i of this object.
 
int GetEid (int i) const
 Get the ID of edge i of this object.
 
int GetFid (int i) const
 Get the ID of face i of this object.
 
int GetTid (int i) const
 Get the ID of trace i of this object.
 
PointGeomGetVertex (int i) const
 Returns vertex i of this object.
 
Geometry1DGetEdge (int i) const
 Returns edge i of this object.
 
Geometry2DGetFace (int i) const
 Returns face i of this object.
 
StdRegions::Orientation GetEorient (const int i) const
 Returns the orientation of edge i with respect to the ordering of edges in the standard element.
 
StdRegions::Orientation GetForient (const int i) const
 Returns the orientation of face i with respect to the ordering of faces in the standard element.
 
int GetNumVerts () const
 Get the number of vertices of this object.
 
int GetNumEdges () const
 Get the number of edges of this object.
 
int GetNumFaces () const
 Get the number of faces of this object.
 
int GetShapeDim () const
 Get the object's shape dimension.
 
StdRegions::StdExpansionSharedPtr GetXmap () const
 Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standard element to physical element.
 
const Array< OneD, const NekDouble > & GetCoeffs (const int i) const
 Return the coefficients of the transformation Geometry::m_xmap in coordinate direction i.
 
void FillGeom ()
 Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements.
 
std::array< NekDouble, 6 > GetBoundingBox ()
 Generates the bounding box for the element.
 
void ClearBoundingBox ()
 
bool ContainsPoint (const Array< OneD, const NekDouble > &gloCoord, NekDouble tol=0.0)
 Determine whether an element contains a particular Cartesian coordinate \((x,y,z)\).
 
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)\).
 
bool ContainsPoint (const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, NekDouble &dist)
 Determine whether an element contains a particular Cartesian coordinate \(\vec{x} = (x,y,z)\).
 
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.
 
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.
 
int PreliminaryCheck (const Array< OneD, const NekDouble > &gloCoord)
 A fast and robust check if a given global coord is outside of a deformed element. For regular elements, this check is unnecessary.
 
bool MinMaxCheck (const Array< OneD, const NekDouble > &gloCoord)
 Check if given global coord is within the BoundingBox of the element.
 
bool ClampLocCoords (Array< OneD, NekDouble > &locCoord, NekDouble tol=std::numeric_limits< NekDouble >::epsilon())
 Clamp local coords to be within standard regions [-1, 1]^dim.
 
NekDouble FindDistance (const Array< OneD, const NekDouble > &xs, Array< OneD, NekDouble > &xi)
 
int GetVertexEdgeMap (int i, int j) const
 Returns the standard element edge IDs that are connected to a given vertex.
 
int GetVertexFaceMap (int i, int j) const
 Returns the standard element face IDs that are connected to a given vertex.
 
int GetEdgeFaceMap (int i, int j) const
 Returns the standard element edge IDs that are connected to a given face.
 
int GetEdgeNormalToFaceVert (int i, int j) const
 Returns the standard lement edge IDs that are normal to a given face vertex.
 
int GetDir (const int i, const int j=0) const
 Returns the element coordinate direction corresponding to a given face coordinate direction.
 
GeomType CalcGeomType ()
 
void Reset (CurveMap &curvedEdges, CurveMap &curvedFaces)
 Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated GeomFactors.
 
void ResetNonRecursive (CurveMap &curvedEdges, CurveMap &curvedFaces)
 Reset this geometry object non-recursively: unset the current state, zero Geometry::m_coeffs and remove allocated GeomFactors.
 
void Setup ()
 

Static Public Member Functions

static StdRegions::Orientation GetFaceOrientation (const TriGeom &face1, const TriGeom &face2, bool doRot, int dir, NekDouble angle, NekDouble tol)
 Get the orientation of face1.
 
static StdRegions::Orientation GetFaceOrientation (std::array< PointGeom *, kNedges > face1, std::array< PointGeom *, kNedges > face2, bool doRot, int dir, NekDouble angle, NekDouble tol)
 

Static Public Attributes

static const int kNedges = 3
 
static const int kNverts = 3
 
static const int kNfacets = kNedges
 
- Static Public Attributes inherited from Nektar::SpatialDomains::Geometry2D
static const int kDim = 2
 

Protected Member Functions

NekDouble v_GetCoord (const int i, const Array< OneD, const NekDouble > &Lcoord) override
 Given local collapsed coordinate Lcoord, return the value of physical coordinate in direction i.
 
GeomType v_CalcGeomType () override
 
GeomFactorsUniquePtr v_GenGeomFactors (LibUtilities::PointsKeyVector &keyTgt) override
 Used by Expansion to generate associated GeomFactors.
 
void v_FillGeom () override
 
int v_GetDir (const int faceidx, const int facedir) const override
 Returns the element coordinate direction corresponding to a given face coordinate direction.
 
void v_Reset (CurveMap &curvedEdges, CurveMap &curvedFaces) override
 Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated GeomFactors.
 
void v_Setup () override
 
int v_AllLeftCheck (const Array< OneD, const NekDouble > &gloCoord) override
 
int v_GetNumVerts () const final
 Get the number of vertices of this object.
 
int v_GetNumEdges () const final
 Get the number of edges of this object.
 
PointGeomv_GetVertex (const int i) const final
 Returns vertex i of this object.
 
Geometry1Dv_GetEdge (const int i) const final
 Returns edge i of this object.
 
StdRegions::Orientation v_GetEorient (const int i) const final
 Returns the orientation of edge i with respect to the ordering of edges in the standard element.
 
- Protected Member Functions inherited from Nektar::SpatialDomains::Geometry2D
NekDouble v_GetLocCoords (const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords) override
 Determine the local collapsed coordinates that correspond to a given Cartesian coordinate for this geometry object.
 
void NewtonIterationForLocCoord (const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &ptsx, const Array< OneD, const NekDouble > &ptsy, Array< OneD, NekDouble > &Lcoords, NekDouble &dist)
 
void SolveStraightEdgeQuad (const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
 
void v_CalculateInverseIsoParam () override
 
int v_GetShapeDim () const override
 Get the object's shape dimension.
 
NekDouble v_FindDistance (const Array< OneD, const NekDouble > &xs, Array< OneD, NekDouble > &xi) override
 
- Protected Member Functions inherited from Nektar::SpatialDomains::Geometry
virtual int v_GetVid (int i) const
 Get the ID of vertex i of this object.
 
virtual Geometry2Dv_GetFace (const int i) const
 Returns face i of this object.
 
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.
 
virtual int v_GetNumFaces () const
 Get the number of faces of this object.
 
virtual StdRegions::StdExpansionSharedPtr v_GetXmap () const
 Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standard element to physical element.
 
virtual bool v_ContainsPoint (const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, NekDouble &dist)
 Determine whether an element contains a particular Cartesian coordinate \(\vec{x} = (x,y,z)\).
 
virtual int v_GetVertexEdgeMap (int i, int j) const
 Returns the standard element edge IDs that are connected to a given vertex.
 
virtual int v_GetVertexFaceMap (int i, int j) const
 Returns the standard element face IDs that are connected to a given vertex.
 
virtual int v_GetEdgeFaceMap (int i, int j) const
 Returns the standard element edge IDs that are connected to a given face.
 
virtual int v_GetEdgeNormalToFaceVert (const int i, const int j) const
 Returns the standard lement edge IDs that are normal to a given face vertex.
 
void SetUpCoeffs (const int nCoeffs)
 Initialise the Geometry::m_coeffs array.
 

Protected Attributes

std::array< PointGeom *, kNvertsm_verts
 
std::array< SegGeom *, kNedgesm_edges
 
std::array< StdRegions::Orientation, kNedgesm_eorient
 
- Protected Attributes inherited from Nektar::SpatialDomains::Geometry2D
Curvem_curve
 
Array< OneD, int > m_manifold
 
Array< OneD, Array< OneD, NekDouble > > m_edgeNormal
 
- Protected Attributes inherited from Nektar::SpatialDomains::Geometry
int m_coordim
 Coordinate dimension of this geometry object.
 
StdRegions::StdExpansionSharedPtr m_xmap
 \(\chi\) mapping containing isoparametric transformation.
 
GeomState m_state
 Enumeration to dictate whether coefficients are filled.
 
bool m_setupState
 Wether or not the setup routines have been run.
 
LibUtilities::ShapeType m_shapeType
 Type of shape.
 
int m_globalID
 Global ID.
 
std::vector< Array< OneD, NekDouble > > m_coeffs
 Array containing expansion coefficients of m_xmap.
 
Array< OneD, NekDoublem_boundingBox
 Array containing bounding box.
 
Array< OneD, Array< OneD, NekDouble > > m_isoParameter
 
Array< OneD, Array< OneD, NekDouble > > m_invIsoParam
 
int m_straightEdge
 

Private Member Functions

void SetUpXmap ()
 

Detailed Description

Definition at line 54 of file TriGeom.h.

Constructor & Destructor Documentation

◆ TriGeom() [1/3]

Nektar::SpatialDomains::TriGeom::TriGeom ( )

◆ TriGeom() [2/3]

Nektar::SpatialDomains::TriGeom::TriGeom ( const TriGeom in)

Definition at line 90 of file TriGeom.cpp.

90 : Geometry2D(in)
91{
92 // From Geometry
93 m_shapeType = in.m_shapeType;
94
95 // From TriFaceComponent
96 m_globalID = in.m_globalID;
97
98 // From TriGeom
99 m_verts = in.m_verts;
100 m_edges = in.m_edges;
101 for (int i = 0; i < kNedges; i++)
102 {
103 m_eorient[i] = in.m_eorient[i];
104 }
105}
static const int kNedges
Definition TriGeom.h:57
std::array< PointGeom *, kNverts > m_verts
Definition TriGeom.h:119
std::array< SegGeom *, kNedges > m_edges
Definition TriGeom.h:120
std::array< StdRegions::Orientation, kNedges > m_eorient
Definition TriGeom.h:121

References kNedges, m_edges, m_eorient, Nektar::SpatialDomains::Geometry::m_globalID, Nektar::SpatialDomains::Geometry::m_shapeType, and m_verts.

◆ TriGeom() [3/3]

Nektar::SpatialDomains::TriGeom::TriGeom ( const int  id,
std::array< SegGeom *, kNedges edges,
Curve curve = nullptr 
)

Copy the edge pointers

Definition at line 59 of file TriGeom.cpp.

61 : Geometry2D(edges[0]->GetVertex(0)->GetCoordim(), curve)
62{
63 int j;
64
66 m_globalID = id;
67
68 /// Copy the edge pointers
69 m_edges = edges;
70
71 for (j = 0; j < kNedges; ++j)
72 {
73 m_eorient[j] =
74 SegGeom::GetEdgeOrientation(*edges[j], *edges[(j + 1) % kNedges]);
75 m_verts[j] =
76 edges[j]->GetVertex(m_eorient[j] == StdRegions::eForwards ? 0 : 1);
77 }
78
82
83 m_coordim = edges[0]->GetVertex(0)->GetCoordim();
84 if (m_coordim <= 1)
85 {
86 NEKERROR(ErrorUtil::efatal, "Cannot call function with dim == 1");
87 }
88}
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
PointGeom * GetVertex(int i) const
Returns vertex i of this object.
Definition Geometry.h:353
int GetCoordim() const
Return the coordinate dimension of this object (i.e. the dimension of the space in which this object ...
Definition Geometry.h:277
int m_coordim
Coordinate dimension of this geometry object.
Definition Geometry.h:184
static StdRegions::Orientation GetEdgeOrientation(const SegGeom &edge1, const SegGeom &edge2)
Get the orientation of edge1.
Definition SegGeom.cpp:211

References Nektar::StdRegions::eBackwards, Nektar::ErrorUtil::efatal, Nektar::StdRegions::eForwards, Nektar::LibUtilities::eTriangle, Nektar::SpatialDomains::SegGeom::GetEdgeOrientation(), kNedges, Nektar::SpatialDomains::Geometry::m_coordim, m_edges, m_eorient, Nektar::SpatialDomains::Geometry::m_globalID, Nektar::SpatialDomains::Geometry::m_shapeType, m_verts, and NEKERROR.

◆ ~TriGeom()

Nektar::SpatialDomains::TriGeom::~TriGeom ( )
overridedefault

Member Function Documentation

◆ GetFaceOrientation() [1/2]

StdRegions::Orientation Nektar::SpatialDomains::TriGeom::GetFaceOrientation ( const TriGeom face1,
const TriGeom face2,
bool  doRot,
int  dir,
NekDouble  angle,
NekDouble  tol 
)
static

Get the orientation of face1.

Definition at line 207 of file TriGeom.cpp.

212{
213 return GetFaceOrientation(face1.m_verts, face2.m_verts, doRot, dir, angle,
214 tol);
215}
static StdRegions::Orientation GetFaceOrientation(const TriGeom &face1, const TriGeom &face2, bool doRot, int dir, NekDouble angle, NekDouble tol)
Get the orientation of face1.
Definition TriGeom.cpp:207

References GetFaceOrientation(), and m_verts.

Referenced by Nektar::MultiRegions::DisContField::FindPeriodicTraces(), and GetFaceOrientation().

◆ GetFaceOrientation() [2/2]

static StdRegions::Orientation Nektar::SpatialDomains::TriGeom::GetFaceOrientation ( std::array< PointGeom *, kNedges face1,
std::array< PointGeom *, kNedges face2,
bool  doRot,
int  dir,
NekDouble  angle,
NekDouble  tol 
)
static

◆ SetUpXmap()

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

Definition at line 659 of file TriGeom.cpp.

660{
661 int order0 = m_edges[0]->GetXmap()->GetBasis(0)->GetNumModes();
662 int order1 = std::max(
663 order0, std::max(m_edges[1]->GetXmap()->GetBasis(0)->GetNumModes(),
664 m_edges[2]->GetXmap()->GetBasis(0)->GetNumModes()));
665
666 std::array<LibUtilities::BasisKey, 2> basis = {
667 LibUtilities::BasisKey(
669 LibUtilities::PointsKey(order0 + 1,
671 LibUtilities::BasisKey(
673 LibUtilities::PointsKey(order1,
674 LibUtilities::eGaussRadauMAlpha1Beta0))};
675
676 m_xmap = GetStdTriFactory().CreateInstance(basis);
677}
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition Geometry.h:186
StdRegions::StdExpansionSharedPtr GetXmap() const
Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standar...
Definition Geometry.h:440
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition PointsType.h:51
@ eModified_B
Principle Modified Functions .
Definition BasisType.h:49
@ eModified_A
Principle Modified Functions .
Definition BasisType.h:48
XmapFactory< StdRegions::StdTriExp, 2 > & GetStdTriFactory()
Definition TriGeom.cpp:48

References Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eModified_A, Nektar::LibUtilities::eModified_B, Nektar::SpatialDomains::GetStdTriFactory(), Nektar::SpatialDomains::Geometry::GetXmap(), m_edges, and Nektar::SpatialDomains::Geometry::m_xmap.

Referenced by v_Reset(), and v_Setup().

◆ v_AllLeftCheck()

int Nektar::SpatialDomains::TriGeom::v_AllLeftCheck ( const Array< OneD, const NekDouble > &  gloCoord)
overrideprotectedvirtual

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 107 of file TriGeom.cpp.

108{
109 int nc = 1, d0 = m_manifold[0], d1 = m_manifold[1];
110 if (0 == m_edgeNormal.size())
111 {
112 m_edgeNormal = Array<OneD, Array<OneD, NekDouble>>(m_verts.size());
113 Array<OneD, Array<OneD, NekDouble>> x(2);
114 x[0] = Array<OneD, NekDouble>(3);
115 x[1] = Array<OneD, NekDouble>(3);
116 m_verts[0]->GetCoords(x[0]);
117 int i0 = 1, i1 = 0, direction = 1;
118 for (size_t i = 0; i < m_verts.size(); ++i)
119 {
120 i0 ^= 1;
121 i1 ^= 1;
122 m_verts[(i + 1) % m_verts.size()]->GetCoords(x[i1]);
123 if (m_edges[i]->GetXmap()->GetBasis(0)->GetNumModes() > 2)
124 {
125 continue;
126 }
127 m_edgeNormal[i] = Array<OneD, NekDouble>(2);
128 m_edgeNormal[i][0] = x[i0][d1] - x[i1][d1];
129 m_edgeNormal[i][1] = x[i1][d0] - x[i0][d0];
130 }
131 if (m_coordim == 3)
132 {
133 for (size_t i = 0; i < m_verts.size(); ++i)
134 {
135 if (m_edgeNormal[i].size() == 2)
136 {
137 m_verts[i]->GetCoords(x[0]);
138 m_verts[(i + 2) % m_verts.size()]->GetCoords(x[1]);
139 if (m_edgeNormal[i][0] * (x[1][d0] - x[0][d0]) <
140 m_edgeNormal[i][1] * (x[0][d1] - x[1][d1]))
141 {
142 direction = -1;
143 }
144 break;
145 }
146 }
147 }
148 if (direction == -1)
149 {
150 for (size_t i = 0; i < m_verts.size(); ++i)
151 {
152 if (m_edgeNormal[i].size() == 2)
153 {
154 m_edgeNormal[i][0] = -m_edgeNormal[i][0];
155 m_edgeNormal[i][1] = -m_edgeNormal[i][1];
156 }
157 }
158 }
159 }
160
161 Array<OneD, NekDouble> vertex(3);
162 for (size_t i = 0; i < m_verts.size(); ++i)
163 {
164 int i1 = (i + 1) % m_verts.size();
165 if (m_verts[i]->GetGlobalID() < m_verts[i1]->GetGlobalID())
166 {
167 m_verts[i]->GetCoords(vertex);
168 }
169 else
170 {
171 m_verts[i1]->GetCoords(vertex);
172 }
173 if (m_edgeNormal[i].size() == 0)
174 {
175 nc = 0; // not sure
176 continue;
177 }
178 if (m_edgeNormal[i][0] * (gloCoord[d0] - vertex[d0]) <
179 m_edgeNormal[i][1] * (vertex[d1] - gloCoord[d1]))
180 {
181 return -1; // outside
182 }
183 }
184 // 3D manifold needs to check the distance
185 if (m_coordim == 3)
186 {
187 nc = 0;
188 }
189 // nc: 1 (side element), 0 (maybe inside), -1 (outside)
190 return nc;
191}
Array< OneD, Array< OneD, NekDouble > > m_edgeNormal
Definition Geometry2D.h:69
int GetGlobalID(void) const
Get the ID of this object.
Definition Geometry.h:314

References Nektar::SpatialDomains::Geometry::GetGlobalID(), Nektar::SpatialDomains::Geometry::GetXmap(), Nektar::SpatialDomains::Geometry::m_coordim, Nektar::SpatialDomains::Geometry2D::m_edgeNormal, m_edges, Nektar::SpatialDomains::Geometry2D::m_manifold, and m_verts.

◆ v_CalcGeomType()

GeomType Nektar::SpatialDomains::TriGeom::v_CalcGeomType ( )
overrideprotectedvirtual

Calculates the GeomType (deformed, regular etc).

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 316 of file TriGeom.cpp.

317{
318 if (!m_setupState)
319 {
321 }
323
324 GeomType Gtype = eRegular;
325
326 // check to see if expansions are linear
327 if (m_xmap->GetBasisNumModes(0) != 2 || m_xmap->GetBasisNumModes(1) != 2)
328 {
329 Gtype = eDeformed;
330 }
331
332 m_manifold = Array<OneD, int>(m_coordim);
333 m_manifold[0] = 0;
334 m_manifold[1] = 1;
335 if (m_coordim == 3)
336 {
337 PointGeom e01, e21, norm;
338 e01.Sub(*m_verts[0], *m_verts[1]);
339 e21.Sub(*m_verts[2], *m_verts[1]);
340 norm.Mult(e01, e21);
341 int tmpi = 0;
342 double tmp = std::fabs(norm[0]);
343 if (tmp < fabs(norm[1]))
344 {
345 tmp = fabs(norm[1]);
346 tmpi = 1;
347 }
348 if (tmp < fabs(norm[2]))
349 {
350 tmpi = 2;
351 }
352 m_manifold[0] = (tmpi + 1) % 3;
353 m_manifold[1] = (tmpi + 2) % 3;
354 m_manifold[2] = (tmpi + 3) % 3;
355 }
356 if (Gtype == eRegular)
357 {
358 Array<OneD, Array<OneD, NekDouble>> verts(m_verts.size());
359 for (int i = 0; i < m_verts.size(); ++i)
360 {
361 verts[i] = Array<OneD, NekDouble>(3);
362 m_verts[i]->GetCoords(verts[i]);
363 }
364 // a00 + a01 xi1 + a02 xi2
365 // a10 + a11 xi1 + a12 xi2
366 m_isoParameter = Array<OneD, Array<OneD, NekDouble>>(2);
367 for (int i = 0; i < 2; ++i)
368 {
369 unsigned int d = m_manifold[i];
370 m_isoParameter[i] = Array<OneD, NekDouble>(3, 0.);
371 NekDouble A = verts[0][d];
372 NekDouble B = verts[1][d];
373 NekDouble C = verts[2][d];
374 m_isoParameter[i][0] = 0.5 * (B + C); // 1
375 m_isoParameter[i][1] = 0.5 * (-A + B); // xi1
376 m_isoParameter[i][2] = 0.5 * (-A + C); // xi2
377 }
378 }
379
380 if (Gtype == eRegular)
381 {
383 }
384
385 return Gtype;
386}
bool m_setupState
Wether or not the setup routines have been run.
Definition Geometry.h:190
Array< OneD, Array< OneD, NekDouble > > m_isoParameter
Definition Geometry.h:199
GeomType
Indicates the type of element geometry.
@ eRegular
Geometry is straight-sided with constant geometric factors.
@ eDeformed
Geometry is curved or has non-constant factors.
std::vector< double > d(NPUPPER *NPUPPER)

References Nektar::SpatialDomains::eDeformed, Nektar::SpatialDomains::eRegular, Nektar::SpatialDomains::Geometry::m_coordim, Nektar::SpatialDomains::Geometry::m_isoParameter, Nektar::SpatialDomains::Geometry2D::m_manifold, Nektar::SpatialDomains::Geometry::m_setupState, m_verts, Nektar::SpatialDomains::Geometry::m_xmap, Nektar::SpatialDomains::PointGeom::Mult(), Nektar::SpatialDomains::PointGeom::Sub(), Nektar::SpatialDomains::Geometry2D::v_CalculateInverseIsoParam(), v_FillGeom(), and v_Setup().

◆ v_FillGeom()

void Nektar::SpatialDomains::TriGeom::v_FillGeom ( )
overrideprotectedvirtual

Note verts and edges are listed according to anticlockwise convention but points in _coeffs have to be in array format from left to right.

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 402 of file TriGeom.cpp.

403{
404 // check to see if geometry structure is already filled
405 if (m_state == ePtsFilled)
406 {
407 return;
408 }
409
410 int i, j, k;
411 int nEdgeCoeffs = m_xmap->GetTraceNcoeffs(0);
412
413 if (m_curve)
414 {
415 int pdim = LibUtilities::PointsManager()[LibUtilities::PointsKey(
416 2, m_curve->m_ptype)]
417 ->GetPointsDim();
418
419 // Deal with 2D points type separately
420 // (e.g. electrostatic or Fekete points) to 1D tensor
421 // product.
422 if (pdim == 2)
423 {
424 int N = m_curve->m_points.size();
425 int nEdgePts =
426 (-1 + (int)sqrt(static_cast<NekDouble>(8 * N + 1))) / 2;
427
428 ASSERTL0(nEdgePts * (nEdgePts + 1) / 2 == N,
429 "NUMPOINTS should be a triangle number for"
430 " triangle curved face " +
431 std::to_string(m_globalID));
432
433 // Sanity check 1: are curved vertices consistent with
434 // triangle vertices?
435 for (i = 0; i < 3; ++i)
436 {
437 NekDouble dist = m_verts[i]->dist(*(m_curve->m_points[i]));
439 {
440 std::stringstream ss;
441 ss << "Curved vertex " << i << " of triangle " << m_globalID
442 << " is separated from expansion vertex by"
443 << " more than " << NekConstants::kVertexTheSameDouble
444 << " (dist = " << dist << ")";
445 NEKERROR(ErrorUtil::ewarning, ss.str().c_str());
446 }
447 }
448
449 // Sanity check 2: are curved edges from the face curvature
450 // consistent with curved edges?
451 for (i = 0; i < kNedges; ++i)
452 {
453 Curve *edgeCurve = m_edges[i]->GetCurve();
454
455 ASSERTL0(edgeCurve->m_points.size() == nEdgePts,
456 "Number of edge points does not correspond "
457 "to number of face points in triangle " +
458 std::to_string(m_globalID));
459
460 const int offset = 3 + i * (nEdgePts - 2);
461 NekDouble maxDist = 0.0;
462
463 // Account for different ordering of nodal coordinates
464 // vs. Cartesian ordering of element.
466
467 if (i == 2)
468 {
469 orient = orient == StdRegions::eForwards
472 }
473
474 if (orient == StdRegions::eForwards)
475 {
476 for (j = 0; j < nEdgePts - 2; ++j)
477 {
478 NekDouble dist = m_curve->m_points[offset + j]->dist(
479 *(edgeCurve->m_points[j + 1]));
480 maxDist = dist > maxDist ? dist : maxDist;
481 }
482 }
483 else
484 {
485 for (j = 0; j < nEdgePts - 2; ++j)
486 {
487 NekDouble dist = m_curve->m_points[offset + j]->dist(
488 *(edgeCurve->m_points[nEdgePts - 2 - j]));
489 maxDist = dist > maxDist ? dist : maxDist;
490 }
491 }
492
494 {
495 std::stringstream ss;
496 ss << "Curved edge " << i << " of triangle " << m_globalID
497 << " has a point separated from edge interior"
498 << " points by more than "
500 << " (maxdist = " << maxDist << ")";
501 NEKERROR(ErrorUtil::ewarning, ss.str().c_str());
502 }
503 }
504
505 const LibUtilities::PointsKey P0(
507 const LibUtilities::PointsKey P1(
508 nEdgePts, LibUtilities::eGaussRadauMAlpha1Beta0);
509 const LibUtilities::BasisKey T0(LibUtilities::eOrtho_A, nEdgePts,
510 P0);
511 const LibUtilities::BasisKey T1(LibUtilities::eOrtho_B, nEdgePts,
512 P1);
513 Array<OneD, NekDouble> phys(
514 std::max(nEdgePts * nEdgePts, m_xmap->GetTotPoints()));
515 Array<OneD, NekDouble> tmp(nEdgePts * nEdgePts);
516
517 for (i = 0; i < m_coordim; ++i)
518 {
519 // Create a StdNodalTriExp.
523
524 for (j = 0; j < N; ++j)
525 {
526 phys[j] = (m_curve->m_points[j]->GetPtr())[i];
527 }
528
529 t->BwdTrans(phys, tmp);
530
531 // Interpolate points to standard region.
533 P0, P1, tmp, m_xmap->GetBasis(0)->GetPointsKey(),
534 m_xmap->GetBasis(1)->GetPointsKey(), phys);
535
536 // Forwards transform to get coefficient space.
537 m_xmap->FwdTrans(phys, m_coeffs[i]);
538 }
539 }
540 else if (pdim == 1)
541 {
542 int npts = m_curve->m_points.size();
543 int nEdgePts = (int)sqrt(static_cast<NekDouble>(npts));
544 Array<OneD, NekDouble> tmp(npts);
545 Array<OneD, NekDouble> phys(m_xmap->GetTotPoints());
546 LibUtilities::PointsKey curveKey(nEdgePts, m_curve->m_ptype);
547
548 // Sanity checks:
549 // - Curved faces should have square number of points;
550 // - Each edge should have sqrt(npts) points.
551 ASSERTL0(nEdgePts * nEdgePts == npts,
552 "NUMPOINTS should be a square number for"
553 " triangle " +
554 std::to_string(m_globalID));
555
556 for (i = 0; i < kNedges; ++i)
557 {
558 ASSERTL0(m_edges[i]->GetXmap()->GetNcoeffs() == nEdgePts,
559 "Number of edge points does not correspond to "
560 "number of face points in triangle " +
561 std::to_string(m_globalID));
562 }
563
564 for (i = 0; i < m_coordim; ++i)
565 {
566 for (j = 0; j < npts; ++j)
567 {
568 tmp[j] = (m_curve->m_points[j]->GetPtr())[i];
569 }
570
571 // Interpolate curve points to standard triangle
572 // points.
573 LibUtilities::Interp2D(curveKey, curveKey, tmp,
574 m_xmap->GetBasis(0)->GetPointsKey(),
575 m_xmap->GetBasis(1)->GetPointsKey(),
576 phys);
577
578 // Forwards transform to get coefficient space.
579 m_xmap->FwdTrans(phys, m_coeffs[i]);
580 }
581 }
582 else
583 {
584 NEKERROR(ErrorUtil::efatal, "Only 1D/2D points distributions "
585 "supported.");
586 }
587 }
588
589 Array<OneD, unsigned int> mapArray(nEdgeCoeffs);
590 Array<OneD, int> signArray(nEdgeCoeffs);
591
592 for (i = 0; i < kNedges; i++)
593 {
594 m_edges[i]->FillGeom();
595 m_xmap->GetTraceToElementMap(i, mapArray, signArray, m_eorient[i]);
596
597 nEdgeCoeffs = m_edges[i]->GetXmap()->GetNcoeffs();
598
599 for (j = 0; j < m_coordim; j++)
600 {
601 for (k = 0; k < nEdgeCoeffs; k++)
602 {
603 m_coeffs[j][mapArray[k]] =
604 signArray[k] * m_edges[i]->GetCoeffs(j)[k];
605 }
606 }
607 }
608
610}
#define ASSERTL0(condition, msg)
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
GeomState m_state
Enumeration to dictate whether coefficients are filled.
Definition Geometry.h:188
std::vector< Array< OneD, NekDouble > > m_coeffs
Array containing expansion coefficients of m_xmap.
Definition Geometry.h:196
PointsManagerT & PointsManager(void)
void Interp2D(const BasisKey &fbasis0, const BasisKey &fbasis1, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, Array< OneD, NekDouble > &to)
this function interpolates a 2D function evaluated at the quadrature points of the 2D basis,...
Definition Interp.cpp:101
@ eOrtho_A
Principle Orthogonal Functions .
Definition BasisType.h:42
@ eOrtho_B
Principle Orthogonal Functions .
Definition BasisType.h:44
static const NekDouble kVertexTheSameDouble
@ ePtsFilled
Geometric information has been generated.
std::shared_ptr< StdNodalTriExp > StdNodalTriExpSharedPtr
scalarT< T > sqrt(scalarT< T > in)
Definition scalar.hpp:290
LibUtilities::PointsType m_ptype
Points distribution of this curve.
Definition Curve.hpp:57
std::vector< PointGeom * > m_points
Points along the curve.
Definition Curve.hpp:53

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::StdRegions::eBackwards, Nektar::ErrorUtil::efatal, Nektar::StdRegions::eForwards, Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eOrtho_A, Nektar::LibUtilities::eOrtho_B, Nektar::SpatialDomains::ePtsFilled, Nektar::ErrorUtil::ewarning, Nektar::SpatialDomains::Geometry::GetXmap(), Nektar::LibUtilities::Interp2D(), kNedges, Nektar::NekConstants::kVertexTheSameDouble, Nektar::SpatialDomains::Geometry::m_coeffs, Nektar::SpatialDomains::Geometry::m_coordim, Nektar::SpatialDomains::Geometry2D::m_curve, m_edges, m_eorient, Nektar::SpatialDomains::Geometry::m_globalID, Nektar::SpatialDomains::Curve::m_points, Nektar::SpatialDomains::Curve::m_ptype, Nektar::SpatialDomains::Geometry::m_state, m_verts, Nektar::SpatialDomains::Geometry::m_xmap, NEKERROR, Nektar::LibUtilities::PointsManager(), and tinysimd::sqrt().

Referenced by v_CalcGeomType().

◆ v_GenGeomFactors()

GeomFactorsUniquePtr Nektar::SpatialDomains::TriGeom::v_GenGeomFactors ( LibUtilities::PointsKeyVector keyTgt)
overrideprotectedvirtual

Used by Expansion to generate associated GeomFactors.

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 388 of file TriGeom.cpp.

390{
391 GeomType Gtype = CalcGeomType();
392
394 Gtype, m_coordim, m_xmap, m_coeffs, keyTgt);
395}
static std::unique_ptr< DataType, UniquePtrDeleter > AllocateUniquePtr(const Args &...args)

References Nektar::ObjPoolManager< DataType >::AllocateUniquePtr(), Nektar::SpatialDomains::Geometry::CalcGeomType(), Nektar::SpatialDomains::Geometry::m_coeffs, Nektar::SpatialDomains::Geometry::m_coordim, and Nektar::SpatialDomains::Geometry::m_xmap.

◆ v_GetCoord()

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

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

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 193 of file TriGeom.cpp.

195{
196 if (m_state != ePtsFilled)
197 {
198 NEKERROR(ErrorUtil::ewarning, "Geometry is not in physical space");
199 }
200
201 Array<OneD, NekDouble> tmp(m_xmap->GetTotPoints());
202 m_xmap->BwdTrans(m_coeffs[i], tmp);
203
204 return m_xmap->PhysEvaluate(Lcoord, tmp);
205}

References Nektar::SpatialDomains::ePtsFilled, Nektar::ErrorUtil::ewarning, Nektar::SpatialDomains::Geometry::m_coeffs, Nektar::SpatialDomains::Geometry::m_state, Nektar::SpatialDomains::Geometry::m_xmap, and NEKERROR.

◆ v_GetDir()

int Nektar::SpatialDomains::TriGeom::v_GetDir ( const int  i,
const int  j 
) const
overrideprotectedvirtual

Returns the element coordinate direction corresponding to a given face coordinate direction.

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 612 of file TriGeom.cpp.

613{
614 return i == 0 ? 0 : 1;
615}

◆ v_GetEdge()

Geometry1D * Nektar::SpatialDomains::TriGeom::v_GetEdge ( const int  i) const
inlinefinalprotectedvirtual

Returns edge i of this object.

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 109 of file TriGeom.h.

110 {
111 return static_cast<Geometry1D *>(m_edges[i]);
112 }

References m_edges.

◆ v_GetEorient()

StdRegions::Orientation Nektar::SpatialDomains::TriGeom::v_GetEorient ( const int  i) const
inlinefinalprotectedvirtual

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

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 114 of file TriGeom.h.

115 {
116 return m_eorient[i];
117 }

References m_eorient.

◆ v_GetNumEdges()

int Nektar::SpatialDomains::TriGeom::v_GetNumEdges ( ) const
inlinefinalprotectedvirtual

Get the number of edges of this object.

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 99 of file TriGeom.h.

100 {
101 return kNedges;
102 }

References kNedges.

◆ v_GetNumVerts()

int Nektar::SpatialDomains::TriGeom::v_GetNumVerts ( ) const
inlinefinalprotectedvirtual

Get the number of vertices of this object.

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 94 of file TriGeom.h.

95 {
96 return kNverts;
97 }
static const int kNverts
Definition TriGeom.h:58

References kNverts.

◆ v_GetVertex()

PointGeom * Nektar::SpatialDomains::TriGeom::v_GetVertex ( const int  i) const
inlinefinalprotectedvirtual

Returns vertex i of this object.

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 104 of file TriGeom.h.

105 {
106 return m_verts[i];
107 }

References m_verts.

◆ v_Reset()

void Nektar::SpatialDomains::TriGeom::v_Reset ( CurveMap curvedEdges,
CurveMap curvedFaces 
)
overrideprotectedvirtual

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

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 617 of file TriGeom.cpp.

618{
619 Geometry::v_Reset(curvedEdges, curvedFaces);
620 CurveMap::iterator it = curvedFaces.find(m_globalID);
621
622 if (it != curvedFaces.end())
623 {
624 m_curve = it->second.get();
625 }
626
627 for (int i = 0; i < 3; ++i)
628 {
629 m_edges[i]->Reset(curvedEdges, curvedFaces);
630 }
631
632 SetUpXmap();
633 SetUpCoeffs(m_xmap->GetNcoeffs());
634}
void SetUpCoeffs(const int nCoeffs)
Initialise the Geometry::m_coeffs array.
Definition Geometry.h:694
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:366

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

◆ v_Setup()

void Nektar::SpatialDomains::TriGeom::v_Setup ( )
overrideprotectedvirtual

Reimplemented from Nektar::SpatialDomains::Geometry.

Definition at line 636 of file TriGeom.cpp.

637{
638 if (!m_setupState)
639 {
640 for (int i = 0; i < 3; ++i)
641 {
642 m_edges[i]->Setup();
643 }
644 SetUpXmap();
645 SetUpCoeffs(m_xmap->GetNcoeffs());
646
647 // check to see if expansions are linear
648 m_straightEdge = 1;
649 if (m_xmap->GetBasisNumModes(0) != 2 ||
650 m_xmap->GetBasisNumModes(1) != 2)
651 {
652 m_straightEdge = 0;
653 }
654
655 m_setupState = true;
656 }
657}

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

Referenced by v_CalcGeomType().

Member Data Documentation

◆ kNedges

const int Nektar::SpatialDomains::TriGeom::kNedges = 3
static

Definition at line 57 of file TriGeom.h.

Referenced by TriGeom(), TriGeom(), v_FillGeom(), and v_GetNumEdges().

◆ kNfacets

const int Nektar::SpatialDomains::TriGeom::kNfacets = kNedges
static

Definition at line 59 of file TriGeom.h.

◆ kNverts

const int Nektar::SpatialDomains::TriGeom::kNverts = 3
static

◆ m_edges

std::array<SegGeom *, kNedges> Nektar::SpatialDomains::TriGeom::m_edges
protected

◆ m_eorient

std::array<StdRegions::Orientation, kNedges> Nektar::SpatialDomains::TriGeom::m_eorient
protected

Definition at line 121 of file TriGeom.h.

Referenced by TriGeom(), TriGeom(), v_FillGeom(), and v_GetEorient().

◆ m_verts

std::array<PointGeom *, kNverts> Nektar::SpatialDomains::TriGeom::m_verts
protected