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, const CurveSharedPtr curve=CurveSharedPtr())
 
 ~TriGeom () override=default
 
- Public Member Functions inherited from Nektar::SpatialDomains::Geometry2D
 Geometry2D ()
 
 Geometry2D (const int coordim, CurveSharedPtr curve)
 
 ~Geometry2D () override=default
 
CurveSharedPtr GetCurve ()
 
- 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).
 
GeomFactorsSharedPtr GetGeomFactors ()
 Get the geometric factors for this object, generating them if required.
 
GeomFactorsSharedPtr GetRefGeomFactors (const Array< OneD, const LibUtilities::BasisSharedPtr > &tbasis)
 
GeomFactorsSharedPtr GetMetricInfo ()
 Get the geometric factors for this object.
 
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.
 
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 ()
 
void GenGeomFactors ()
 Handles generation of geometry factors.
 

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.
 
void v_GenGeomFactors () override
 
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 (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
CurveSharedPtr m_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.
 
GeomFactorsSharedPtr m_geomFactors
 Geometric factors.
 
GeomState m_geomFactorsState
 State of the geometric factors.
 
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.
 
GeomType m_geomType
 Type of geometry.
 
LibUtilities::ShapeType m_shapeType
 Type of shape.
 
int m_globalID
 Global ID.
 
Array< OneD, 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 ()
 

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.
 
- Static Protected Attributes inherited from Nektar::SpatialDomains::Geometry
static GeomFactorsVector m_regGeomFactorsManager
 

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 87 of file TriGeom.cpp.

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

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,
const CurveSharedPtr  curve = CurveSharedPtr() 
)

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 ASSERTL0(m_coordim > 1, "Cannot call function with dim == 1");
85}
#define ASSERTL0(condition, msg)
PointGeom * GetVertex(int i) const
Returns vertex i of this object.
Definition Geometry.h:361
int GetCoordim() const
Return the coordinate dimension of this object (i.e. the dimension of the space in which this object ...
Definition Geometry.h:279
int m_coordim
Coordinate dimension of this geometry object.
Definition Geometry.h:183
static StdRegions::Orientation GetEdgeOrientation(const SegGeom &edge1, const SegGeom &edge2)
Get the orientation of edge1.
Definition SegGeom.cpp:209

References ASSERTL0, Nektar::StdRegions::eBackwards, 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, and m_verts.

◆ ~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 201 of file TriGeom.cpp.

206{
207 return GetFaceOrientation(face1.m_verts, face2.m_verts, doRot, dir, angle,
208 tol);
209}
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:201

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 642 of file TriGeom.cpp.

643{
644 int order0 = m_edges[0]->GetXmap()->GetBasis(0)->GetNumModes();
645 int order1 = std::max(
646 order0, std::max(m_edges[1]->GetXmap()->GetBasis(0)->GetNumModes(),
647 m_edges[2]->GetXmap()->GetBasis(0)->GetNumModes()));
648
649 std::array<LibUtilities::BasisKey, 2> basis = {
650 LibUtilities::BasisKey(
652 LibUtilities::PointsKey(order0 + 1,
654 LibUtilities::BasisKey(
656 LibUtilities::PointsKey(order1,
657 LibUtilities::eGaussRadauMAlpha1Beta0))};
658
659 m_xmap = GetStdTriFactory().CreateInstance(basis);
660}
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition Geometry.h:189
StdRegions::StdExpansionSharedPtr GetXmap() const
Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standar...
Definition Geometry.h:439
@ 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 104 of file TriGeom.cpp.

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

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_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 394 of file TriGeom.cpp.

395{
396 // check to see if geometry structure is already filled
397 if (m_state == ePtsFilled)
398 {
399 return;
400 }
401
402 int i, j, k;
403 int nEdgeCoeffs = m_xmap->GetTraceNcoeffs(0);
404
405 if (m_curve)
406 {
407 int pdim = LibUtilities::PointsManager()[LibUtilities::PointsKey(
408 2, m_curve->m_ptype)]
409 ->GetPointsDim();
410
411 // Deal with 2D points type separately
412 // (e.g. electrostatic or Fekete points) to 1D tensor
413 // product.
414 if (pdim == 2)
415 {
416 int N = m_curve->m_points.size();
417 int nEdgePts =
418 (-1 + (int)sqrt(static_cast<NekDouble>(8 * N + 1))) / 2;
419
420 ASSERTL0(nEdgePts * (nEdgePts + 1) / 2 == N,
421 "NUMPOINTS should be a triangle number for"
422 " triangle curved face " +
423 std::to_string(m_globalID));
424
425 // Sanity check 1: are curved vertices consistent with
426 // triangle vertices?
427 for (i = 0; i < 3; ++i)
428 {
429 NekDouble dist = m_verts[i]->dist(*(m_curve->m_points[i]));
431 {
432 std::stringstream ss;
433 ss << "Curved vertex " << i << " of triangle " << m_globalID
434 << " is separated from expansion vertex by"
435 << " more than " << NekConstants::kVertexTheSameDouble
436 << " (dist = " << dist << ")";
437 NEKERROR(ErrorUtil::ewarning, ss.str().c_str());
438 }
439 }
440
441 // Sanity check 2: are curved edges from the face curvature
442 // consistent with curved edges?
443 for (i = 0; i < kNedges; ++i)
444 {
445 CurveSharedPtr edgeCurve = m_edges[i]->GetCurve();
446
447 ASSERTL0(edgeCurve->m_points.size() == nEdgePts,
448 "Number of edge points does not correspond "
449 "to number of face points in triangle " +
450 std::to_string(m_globalID));
451
452 const int offset = 3 + i * (nEdgePts - 2);
453 NekDouble maxDist = 0.0;
454
455 // Account for different ordering of nodal coordinates
456 // vs. Cartesian ordering of element.
458
459 if (i == 2)
460 {
461 orient = orient == StdRegions::eForwards
464 }
465
466 if (orient == StdRegions::eForwards)
467 {
468 for (j = 0; j < nEdgePts - 2; ++j)
469 {
470 NekDouble dist = m_curve->m_points[offset + j]->dist(
471 *(edgeCurve->m_points[j + 1]));
472 maxDist = dist > maxDist ? dist : maxDist;
473 }
474 }
475 else
476 {
477 for (j = 0; j < nEdgePts - 2; ++j)
478 {
479 NekDouble dist = m_curve->m_points[offset + j]->dist(
480 *(edgeCurve->m_points[nEdgePts - 2 - j]));
481 maxDist = dist > maxDist ? dist : maxDist;
482 }
483 }
484
486 {
487 std::stringstream ss;
488 ss << "Curved edge " << i << " of triangle " << m_globalID
489 << " has a point separated from edge interior"
490 << " points by more than "
492 << " (maxdist = " << maxDist << ")";
493 NEKERROR(ErrorUtil::ewarning, ss.str().c_str());
494 }
495 }
496
497 const LibUtilities::PointsKey P0(
499 const LibUtilities::PointsKey P1(
500 nEdgePts, LibUtilities::eGaussRadauMAlpha1Beta0);
501 const LibUtilities::BasisKey T0(LibUtilities::eOrtho_A, nEdgePts,
502 P0);
503 const LibUtilities::BasisKey T1(LibUtilities::eOrtho_B, nEdgePts,
504 P1);
505 Array<OneD, NekDouble> phys(
506 std::max(nEdgePts * nEdgePts, m_xmap->GetTotPoints()));
507 Array<OneD, NekDouble> tmp(nEdgePts * nEdgePts);
508
509 for (i = 0; i < m_coordim; ++i)
510 {
511 // Create a StdNodalTriExp.
514 AllocateSharedPtr(T0, T1, m_curve->m_ptype);
515
516 for (j = 0; j < N; ++j)
517 {
518 phys[j] = (m_curve->m_points[j]->GetPtr())[i];
519 }
520
521 t->BwdTrans(phys, tmp);
522
523 // Interpolate points to standard region.
525 P0, P1, tmp, m_xmap->GetBasis(0)->GetPointsKey(),
526 m_xmap->GetBasis(1)->GetPointsKey(), phys);
527
528 // Forwards transform to get coefficient space.
529 m_xmap->FwdTrans(phys, m_coeffs[i]);
530 }
531 }
532 else if (pdim == 1)
533 {
534 int npts = m_curve->m_points.size();
535 int nEdgePts = (int)sqrt(static_cast<NekDouble>(npts));
536 Array<OneD, NekDouble> tmp(npts);
537 Array<OneD, NekDouble> phys(m_xmap->GetTotPoints());
538 LibUtilities::PointsKey curveKey(nEdgePts, m_curve->m_ptype);
539
540 // Sanity checks:
541 // - Curved faces should have square number of points;
542 // - Each edge should have sqrt(npts) points.
543 ASSERTL0(nEdgePts * nEdgePts == npts,
544 "NUMPOINTS should be a square number for"
545 " triangle " +
546 std::to_string(m_globalID));
547
548 for (i = 0; i < kNedges; ++i)
549 {
550 ASSERTL0(m_edges[i]->GetXmap()->GetNcoeffs() == nEdgePts,
551 "Number of edge points does not correspond to "
552 "number of face points in triangle " +
553 std::to_string(m_globalID));
554 }
555
556 for (i = 0; i < m_coordim; ++i)
557 {
558 for (j = 0; j < npts; ++j)
559 {
560 tmp[j] = (m_curve->m_points[j]->GetPtr())[i];
561 }
562
563 // Interpolate curve points to standard triangle
564 // points.
565 LibUtilities::Interp2D(curveKey, curveKey, tmp,
566 m_xmap->GetBasis(0)->GetPointsKey(),
567 m_xmap->GetBasis(1)->GetPointsKey(),
568 phys);
569
570 // Forwards transform to get coefficient space.
571 m_xmap->FwdTrans(phys, m_coeffs[i]);
572 }
573 }
574 else
575 {
576 ASSERTL0(false, "Only 1D/2D points distributions "
577 "supported.");
578 }
579 }
580
581 Array<OneD, unsigned int> mapArray(nEdgeCoeffs);
582 Array<OneD, int> signArray(nEdgeCoeffs);
583
584 for (i = 0; i < kNedges; i++)
585 {
586 m_edges[i]->FillGeom();
587 m_xmap->GetTraceToElementMap(i, mapArray, signArray, m_eorient[i]);
588
589 nEdgeCoeffs = m_edges[i]->GetXmap()->GetNcoeffs();
590
591 for (j = 0; j < m_coordim; j++)
592 {
593 for (k = 0; k < nEdgeCoeffs; k++)
594 {
595 m_coeffs[j][mapArray[k]] =
596 signArray[k] * m_edges[i]->GetCoeffs(j)[k];
597 }
598 }
599 }
600
602}
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
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:191
Array< OneD, Array< OneD, NekDouble > > m_coeffs
Array containing expansion coefficients of m_xmap.
Definition Geometry.h:201
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
std::shared_ptr< Curve > CurveSharedPtr
Definition Curve.hpp:60
@ ePtsFilled
Geometric information has been generated.
std::shared_ptr< StdNodalTriExp > StdNodalTriExpSharedPtr
scalarT< T > sqrt(scalarT< T > in)
Definition scalar.hpp:290

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::StdRegions::eBackwards, 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::Geometry::m_state, m_verts, Nektar::SpatialDomains::Geometry::m_xmap, NEKERROR, Nektar::LibUtilities::PointsManager(), and tinysimd::sqrt().

Referenced by v_GenGeomFactors().

◆ v_GenGeomFactors()

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

Implements Nektar::SpatialDomains::Geometry.

Definition at line 311 of file TriGeom.cpp.

312{
313 if (!m_setupState)
314 {
316 }
317
319 {
320 GeomType Gtype = eRegular;
321
323
324 // check to see if expansions are linear
325 m_straightEdge = 1;
326 if (m_xmap->GetBasisNumModes(0) != 2 ||
327 m_xmap->GetBasisNumModes(1) != 2)
328 {
329 Gtype = eDeformed;
330 m_straightEdge = 0;
331 }
332
333 m_manifold = Array<OneD, int>(m_coordim);
334 m_manifold[0] = 0;
335 m_manifold[1] = 1;
336 if (m_coordim == 3)
337 {
338 PointGeom e01, e21, norm;
339 e01.Sub(*m_verts[0], *m_verts[1]);
340 e21.Sub(*m_verts[2], *m_verts[1]);
341 norm.Mult(e01, e21);
342 int tmpi = 0;
343 double tmp = std::fabs(norm[0]);
344 if (tmp < fabs(norm[1]))
345 {
346 tmp = fabs(norm[1]);
347 tmpi = 1;
348 }
349 if (tmp < fabs(norm[2]))
350 {
351 tmpi = 2;
352 }
353 m_manifold[0] = (tmpi + 1) % 3;
354 m_manifold[1] = (tmpi + 2) % 3;
355 m_manifold[2] = (tmpi + 3) % 3;
356 }
357 if (Gtype == eRegular)
358 {
359 Array<OneD, Array<OneD, NekDouble>> verts(m_verts.size());
360 for (int i = 0; i < m_verts.size(); ++i)
361 {
362 verts[i] = Array<OneD, NekDouble>(3);
363 m_verts[i]->GetCoords(verts[i]);
364 }
365 // a00 + a01 xi1 + a02 xi2
366 // a10 + a11 xi1 + a12 xi2
367 m_isoParameter = Array<OneD, Array<OneD, NekDouble>>(2);
368 for (int i = 0; i < 2; ++i)
369 {
370 unsigned int d = m_manifold[i];
371 m_isoParameter[i] = Array<OneD, NekDouble>(3, 0.);
372 NekDouble A = verts[0][d];
373 NekDouble B = verts[1][d];
374 NekDouble C = verts[2][d];
375 m_isoParameter[i][0] = 0.5 * (B + C); // 1
376 m_isoParameter[i][1] = 0.5 * (-A + B); // xi1
377 m_isoParameter[i][2] = 0.5 * (-A + C); // xi2
378 }
380 }
381
383 Gtype, m_coordim, m_xmap, m_coeffs);
384
386 }
387}
bool m_setupState
Wether or not the setup routines have been run.
Definition Geometry.h:193
Array< OneD, Array< OneD, NekDouble > > m_isoParameter
Definition Geometry.h:204
GeomState m_geomFactorsState
State of the geometric factors.
Definition Geometry.h:187
GeomFactorsSharedPtr m_geomFactors
Geometric factors.
Definition Geometry.h:185
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::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_isoParameter, Nektar::SpatialDomains::Geometry2D::m_manifold, Nektar::SpatialDomains::Geometry::m_setupState, Nektar::SpatialDomains::Geometry::m_straightEdge, 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_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 190 of file TriGeom.cpp.

192{
193 ASSERTL1(m_state == ePtsFilled, "Geometry is not in physical space");
194
195 Array<OneD, NekDouble> tmp(m_xmap->GetTotPoints());
196 m_xmap->BwdTrans(m_coeffs[i], tmp);
197
198 return m_xmap->PhysEvaluate(Lcoord, tmp);
199}
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....

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

◆ 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 604 of file TriGeom.cpp.

605{
606 return i == 0 ? 0 : 1;
607}

◆ 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 106 of file TriGeom.h.

107 {
108 return static_cast<Geometry1D *>(m_edges[i]);
109 }

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 111 of file TriGeom.h.

112 {
113 return m_eorient[i];
114 }

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 96 of file TriGeom.h.

97 {
98 return kNedges;
99 }

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 91 of file TriGeom.h.

92 {
93 return kNverts;
94 }
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 101 of file TriGeom.h.

102 {
103 return m_verts[i];
104 }

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 609 of file TriGeom.cpp.

610{
611 Geometry::v_Reset(curvedEdges, curvedFaces);
612 CurveMap::iterator it = curvedFaces.find(m_globalID);
613
614 if (it != curvedFaces.end())
615 {
616 m_curve = it->second;
617 }
618
619 for (int i = 0; i < 3; ++i)
620 {
621 m_edges[i]->Reset(curvedEdges, curvedFaces);
622 }
623
624 SetUpXmap();
625 SetUpCoeffs(m_xmap->GetNcoeffs());
626}
void SetUpCoeffs(const int nCoeffs)
Initialise the Geometry::m_coeffs array.
Definition Geometry.h:704
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:372

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 628 of file TriGeom.cpp.

629{
630 if (!m_setupState)
631 {
632 for (int i = 0; i < 3; ++i)
633 {
634 m_edges[i]->Setup();
635 }
636 SetUpXmap();
637 SetUpCoeffs(m_xmap->GetNcoeffs());
638 m_setupState = true;
639 }
640}

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

Referenced by v_GenGeomFactors().

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 118 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