Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | 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, const SegGeomSharedPtr edges[], const CurveSharedPtr curve=CurveSharedPtr())
 
 ~TriGeom () override
 
- Public Member Functions inherited from Nektar::SpatialDomains::Geometry2D
 Geometry2D ()
 
 Geometry2D (const int coordim, CurveSharedPtr curve)
 
 ~Geometry2D () override
 
CurveSharedPtr GetCurve ()
 
- 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...
 
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)\). 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 &dist)
 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...
 
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. More...
 
bool MinMaxCheck (const Array< OneD, const NekDouble > &gloCoord)
 Check if given global coord is within the BoundingBox of the element. More...
 
bool ClampLocCoords (Array< OneD, NekDouble > &locCoord, NekDouble tol=std::numeric_limits< NekDouble >::epsilon())
 Clamp local coords to be within standard regions [-1, 1]^dim. More...
 
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. 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...
 
int GetEdgeNormalToFaceVert (int i, int j) const
 Returns the standard lement edge IDs that are normal to a given face vertex. More...
 
int GetDir (const int i, const int j=0) const
 Returns the element coordinate direction corresponding to a given face coordinate direction. 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 ResetNonRecursive (CurveMap &curvedEdges, CurveMap &curvedFaces)
 Reset this geometry object non-recursively: unset the current state, zero Geometry::m_coeffs and remove allocated GeomFactors. More...
 
void Setup ()
 
void GenGeomFactors ()
 Handles generation of geometry factors. More...
 

Static Public Member Functions

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

Static Public Attributes

static const int kNedges = 3
 Get the orientation of face1. More...
 
static const int kNverts = 3
 
- 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. More...
 
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. More...
 
void v_Reset (CurveMap &curvedEdges, CurveMap &curvedFaces) override
 Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated GeomFactors. More...
 
void v_Setup () override
 
- 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. More...
 
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_AllLeftCheck (const Array< OneD, const NekDouble > &gloCoord) override
 
int v_GetShapeDim () const override
 Get the object's shape dimension. More...
 
PointGeomSharedPtr v_GetVertex (int i) const override
 
Geometry1DSharedPtr v_GetEdge (int i) const override
 Returns edge i of this object. More...
 
int v_GetNumVerts () const override
 Get the number of vertices of this object. More...
 
int v_GetNumEdges () const override
 Get the number of edges of this object. More...
 
StdRegions::Orientation v_GetEorient (const int i) const override
 Returns the orientation of edge i with respect to the ordering of edges in the standard element. More...
 
NekDouble v_FindDistance (const Array< OneD, const NekDouble > &xs, Array< OneD, NekDouble > &xi) override
 
- Protected Member Functions inherited from Nektar::SpatialDomains::Geometry
virtual PointGeomSharedPtr v_GetVertex (int i) const =0
 
virtual Geometry1DSharedPtr v_GetEdge (int i) const
 Returns edge i of this object. More...
 
virtual Geometry2DSharedPtr v_GetFace (int i) const
 Returns face i of this object. More...
 
virtual StdRegions::Orientation v_GetEorient (const int i) const
 Returns the orientation of edge i with respect to the ordering of edges in the standard element. More...
 
virtual StdRegions::Orientation v_GetForient (const int i) const
 Returns the orientation of face i with respect to the ordering of faces in the standard element. More...
 
virtual int v_GetNumVerts () const
 Get the number of vertices of this object. More...
 
virtual int v_GetNumEdges () const
 Get the number of edges of this object. More...
 
virtual int v_GetNumFaces () const
 Get the number of faces of this object. More...
 
virtual int v_GetShapeDim () const
 Get the object's shape dimension. More...
 
virtual StdRegions::StdExpansionSharedPtr v_GetXmap () const
 Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standard element to physical element. More...
 
virtual void v_FillGeom ()
 Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements. More...
 
virtual bool v_ContainsPoint (const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, NekDouble &dist)
 Determine whether an element contains a particular Cartesian coordinate \(\vec{x} = (x,y,z)\). More...
 
virtual int v_AllLeftCheck (const Array< OneD, const NekDouble > &gloCoord)
 
virtual NekDouble v_GetCoord (const int i, const Array< OneD, const NekDouble > &Lcoord)
 Given local collapsed coordinate Lcoord, return the value of physical coordinate in direction i. More...
 
virtual NekDouble v_GetLocCoords (const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
 Determine the local collapsed coordinates that correspond to a given Cartesian coordinate for this geometry object. More...
 
virtual NekDouble v_FindDistance (const Array< OneD, const NekDouble > &xs, Array< OneD, NekDouble > &xi)
 
virtual int v_GetVertexEdgeMap (int i, int j) const
 Returns the standard element edge IDs that are connected to a given vertex. More...
 
virtual int v_GetVertexFaceMap (int i, int j) const
 Returns the standard element face IDs that are connected to a given vertex. More...
 
virtual int v_GetEdgeFaceMap (int i, int j) const
 Returns the standard element edge IDs that are connected to a given face. More...
 
virtual int v_GetEdgeNormalToFaceVert (const int i, const int j) const
 Returns the standard lement edge IDs that are normal to a given face vertex. More...
 
virtual int v_GetDir (const int faceidx, const int facedir) const
 Returns the element coordinate direction corresponding to a given face coordinate direction. More...
 
virtual void v_Reset (CurveMap &curvedEdges, CurveMap &curvedFaces)
 Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated GeomFactors. More...
 
virtual void v_Setup ()
 
virtual void v_GenGeomFactors ()=0
 
void SetUpCoeffs (const int nCoeffs)
 Initialise the Geometry::m_coeffs array. More...
 
virtual void v_CalculateInverseIsoParam ()
 

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. More...
 
- Protected Attributes inherited from Nektar::SpatialDomains::Geometry2D
PointGeomVector m_verts
 
SegGeomVector m_edges
 
std::vector< StdRegions::Orientationm_eorient
 
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. 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...
 
Array< OneD, NekDoublem_boundingBox
 Array containing bounding box. More...
 
Array< OneD, Array< OneD, NekDouble > > m_isoParameter
 
Array< OneD, Array< OneD, NekDouble > > m_invIsoParam
 
int m_straightEdge
 
- Static Protected Attributes inherited from Nektar::SpatialDomains::Geometry
static GeomFactorsVector m_regGeomFactorsManager
 

Detailed Description

Definition at line 59 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 83 of file TriGeom.cpp.

83 : Geometry2D(in)
84{
85 // From Geometry
86 m_shapeType = in.m_shapeType;
87
88 // From TriFaceComponent
89 m_globalID = in.m_globalID;
90
91 // From TriGeom
92 m_verts = in.m_verts;
93 m_edges = in.m_edges;
94 for (int i = 0; i < kNedges; i++)
95 {
96 m_eorient[i] = in.m_eorient[i];
97 }
98}
std::vector< StdRegions::Orientation > m_eorient
Definition: Geometry2D.h:81
static const int kNedges
Get the orientation of face1.
Definition: TriGeom.h:70

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

◆ TriGeom() [3/3]

Nektar::SpatialDomains::TriGeom::TriGeom ( const int  id,
const SegGeomSharedPtr  edges[],
const CurveSharedPtr  curve = CurveSharedPtr() 
)

Definition at line 54 of file TriGeom.cpp.

56 : Geometry2D(edges[0]->GetVertex(0)->GetCoordim(), curve)
57{
58 int j;
59
61 m_globalID = id;
62
63 // Copy the edge shared pointers.
64 m_edges.insert(m_edges.begin(), edges, edges + TriGeom::kNedges);
65 m_eorient.resize(kNedges);
66
67 for (j = 0; j < kNedges; ++j)
68 {
69 m_eorient[j] =
70 SegGeom::GetEdgeOrientation(*edges[j], *edges[(j + 1) % kNedges]);
71 m_verts.push_back(
72 edges[j]->GetVertex(m_eorient[j] == StdRegions::eForwards ? 0 : 1));
73 }
74
78
79 m_coordim = edges[0]->GetVertex(0)->GetCoordim();
80 ASSERTL0(m_coordim > 1, "Cannot call function with dim == 1");
81}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
PointGeomSharedPtr GetVertex(int i) const
Returns vertex i of this object.
Definition: Geometry.h:358
int GetCoordim() const
Return the coordinate dimension of this object (i.e. the dimension of the space in which this object ...
Definition: Geometry.h:284
int m_coordim
Coordinate dimension of this geometry object.
Definition: Geometry.h:189
static StdRegions::Orientation GetEdgeOrientation(const SegGeom &edge1, const SegGeom &edge2)
Get the orientation of edge1.
Definition: SegGeom.cpp:194

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

◆ ~TriGeom()

Nektar::SpatialDomains::TriGeom::~TriGeom ( )
override

Definition at line 100 of file TriGeom.cpp.

101{
102}

Member Function Documentation

◆ GetFaceOrientation() [1/2]

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

Definition at line 125 of file TriGeom.cpp.

128{
129 int i, j, vmap[3] = {-1, -1, -1};
130
131 if (doRot)
132 {
133 PointGeom rotPt;
134
135 for (i = 0; i < 3; ++i)
136 {
137 rotPt.Rotate((*face1[i]), dir, angle);
138 for (j = 0; j < 3; ++j)
139 {
140 if (rotPt.dist(*face2[j]) < tol)
141 {
142 vmap[j] = i;
143 break;
144 }
145 }
146 }
147 }
148 else
149 {
150
151 NekDouble x, y, z, x1, y1, z1, cx = 0.0, cy = 0.0, cz = 0.0;
152
153 // For periodic faces, we calculate the vector between the centre
154 // points of the two faces. (For connected faces this will be
155 // zero). We can then use this to determine alignment later in the
156 // algorithm.
157 for (i = 0; i < 3; ++i)
158 {
159 cx += (*face2[i])(0) - (*face1[i])(0);
160 cy += (*face2[i])(1) - (*face1[i])(1);
161 cz += (*face2[i])(2) - (*face1[i])(2);
162 }
163 cx /= 3;
164 cy /= 3;
165 cz /= 3;
166
167 // Now construct a mapping which takes us from the vertices of one
168 // face to the other. That is, vertex j of face2 corresponds to
169 // vertex vmap[j] of face1.
170 for (i = 0; i < 3; ++i)
171 {
172 x = (*face1[i])(0);
173 y = (*face1[i])(1);
174 z = (*face1[i])(2);
175 for (j = 0; j < 3; ++j)
176 {
177 x1 = (*face2[j])(0) - cx;
178 y1 = (*face2[j])(1) - cy;
179 z1 = (*face2[j])(2) - cz;
180 if (sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y) +
181 (z1 - z) * (z1 - z)) < 1e-8)
182 {
183 vmap[j] = i;
184 break;
185 }
186 }
187 }
188 }
189
190 if (vmap[1] == (vmap[0] + 1) % 3)
191 {
192 switch (vmap[0])
193 {
194 case 0:
196 break;
197 case 1:
199 break;
200 case 2:
202 break;
203 }
204 }
205 else
206 {
207 switch (vmap[0])
208 {
209 case 0:
211 break;
212 case 1:
214 break;
215 case 2:
217 break;
218 }
219 }
220
221 ASSERTL0(false, "Unable to determine triangle orientation");
223}
std::vector< double > z(NPUPPER)
double NekDouble
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:294

References ASSERTL0, Nektar::SpatialDomains::PointGeom::dist(), Nektar::StdRegions::eDir1BwdDir1_Dir2BwdDir2, Nektar::StdRegions::eDir1BwdDir1_Dir2FwdDir2, Nektar::StdRegions::eDir1BwdDir2_Dir2BwdDir1, Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, Nektar::StdRegions::eDir1FwdDir2_Dir2BwdDir1, Nektar::StdRegions::eDir1FwdDir2_Dir2FwdDir1, Nektar::StdRegions::eNoOrientation, Nektar::SpatialDomains::PointGeom::Rotate(), tinysimd::sqrt(), and Nektar::UnitTests::z().

◆ GetFaceOrientation() [2/2]

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

Definition at line 115 of file TriGeom.cpp.

120{
121 return GetFaceOrientation(face1.m_verts, face2.m_verts, doRot, dir, angle,
122 tol);
123}
static StdRegions::Orientation GetFaceOrientation(const TriGeom &face1, const TriGeom &face2, bool doRot, int dir, NekDouble angle, NekDouble tol)
Definition: TriGeom.cpp:115

References GetFaceOrientation(), and Nektar::SpatialDomains::Geometry2D::m_verts.

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

◆ SetUpXmap()

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

Definition at line 556 of file TriGeom.cpp.

557{
558 int order0 = m_edges[0]->GetXmap()->GetBasis(0)->GetNumModes();
559 int order1 =
560 max(order0, max(m_edges[1]->GetXmap()->GetBasis(0)->GetNumModes(),
561 m_edges[2]->GetXmap()->GetBasis(0)->GetNumModes()));
562
563 const LibUtilities::BasisKey B0(
565 LibUtilities::PointsKey(order0 + 1,
567 const LibUtilities::BasisKey B1(
569 LibUtilities::PointsKey(order1, LibUtilities::eGaussRadauMAlpha1Beta0));
570
572}
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition: Geometry.h:195
StdRegions::StdExpansionSharedPtr GetXmap() const
Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standar...
Definition: Geometry.h:436
@ 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

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eModified_A, Nektar::LibUtilities::eModified_B, Nektar::SpatialDomains::Geometry::GetXmap(), Nektar::SpatialDomains::Geometry2D::m_edges, and Nektar::SpatialDomains::Geometry::m_xmap.

Referenced by v_Reset(), 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 308 of file TriGeom.cpp.

309{
310 // check to see if geometry structure is already filled
311 if (m_state == ePtsFilled)
312 {
313 return;
314 }
315
316 int i, j, k;
317 int nEdgeCoeffs = m_xmap->GetTraceNcoeffs(0);
318
319 if (m_curve)
320 {
321 int pdim = LibUtilities::PointsManager()[LibUtilities::PointsKey(
322 2, m_curve->m_ptype)]
323 ->GetPointsDim();
324
325 // Deal with 2D points type separately
326 // (e.g. electrostatic or Fekete points) to 1D tensor
327 // product.
328 if (pdim == 2)
329 {
330 int N = m_curve->m_points.size();
331 int nEdgePts =
332 (-1 + (int)sqrt(static_cast<NekDouble>(8 * N + 1))) / 2;
333
334 ASSERTL0(nEdgePts * (nEdgePts + 1) / 2 == N,
335 "NUMPOINTS should be a triangle number for"
336 " triangle curved face " +
337 boost::lexical_cast<string>(m_globalID));
338
339 // Sanity check 1: are curved vertices consistent with
340 // triangle vertices?
341 for (i = 0; i < 3; ++i)
342 {
343 NekDouble dist = m_verts[i]->dist(*(m_curve->m_points[i]));
345 {
346 std::stringstream ss;
347 ss << "Curved vertex " << i << " of triangle " << m_globalID
348 << " is separated from expansion vertex by"
349 << " more than " << NekConstants::kVertexTheSameDouble
350 << " (dist = " << dist << ")";
351 NEKERROR(ErrorUtil::ewarning, ss.str().c_str());
352 }
353 }
354
355 // Sanity check 2: are curved edges from the face curvature
356 // consistent with curved edges?
357 for (i = 0; i < kNedges; ++i)
358 {
359 CurveSharedPtr edgeCurve = m_edges[i]->GetCurve();
360
361 ASSERTL0(edgeCurve->m_points.size() == nEdgePts,
362 "Number of edge points does not correspond "
363 "to number of face points in triangle " +
364 boost::lexical_cast<string>(m_globalID));
365
366 const int offset = 3 + i * (nEdgePts - 2);
367 NekDouble maxDist = 0.0;
368
369 // Account for different ordering of nodal coordinates
370 // vs. Cartesian ordering of element.
372
373 if (i == 2)
374 {
375 orient = orient == StdRegions::eForwards
378 }
379
380 if (orient == StdRegions::eForwards)
381 {
382 for (j = 0; j < nEdgePts - 2; ++j)
383 {
384 NekDouble dist = m_curve->m_points[offset + j]->dist(
385 *(edgeCurve->m_points[j + 1]));
386 maxDist = dist > maxDist ? dist : maxDist;
387 }
388 }
389 else
390 {
391 for (j = 0; j < nEdgePts - 2; ++j)
392 {
393 NekDouble dist = m_curve->m_points[offset + j]->dist(
394 *(edgeCurve->m_points[nEdgePts - 2 - j]));
395 maxDist = dist > maxDist ? dist : maxDist;
396 }
397 }
398
400 {
401 std::stringstream ss;
402 ss << "Curved edge " << i << " of triangle " << m_globalID
403 << " has a point separated from edge interior"
404 << " points by more than "
406 << " (maxdist = " << maxDist << ")";
407 NEKERROR(ErrorUtil::ewarning, ss.str().c_str());
408 }
409 }
410
411 const LibUtilities::PointsKey P0(
413 const LibUtilities::PointsKey P1(
414 nEdgePts, LibUtilities::eGaussRadauMAlpha1Beta0);
415 const LibUtilities::BasisKey T0(LibUtilities::eOrtho_A, nEdgePts,
416 P0);
417 const LibUtilities::BasisKey T1(LibUtilities::eOrtho_B, nEdgePts,
418 P1);
419 Array<OneD, NekDouble> phys(
420 max(nEdgePts * nEdgePts, m_xmap->GetTotPoints()));
421 Array<OneD, NekDouble> tmp(nEdgePts * nEdgePts);
422
423 for (i = 0; i < m_coordim; ++i)
424 {
425 // Create a StdNodalTriExp.
428 AllocateSharedPtr(T0, T1, m_curve->m_ptype);
429
430 for (j = 0; j < N; ++j)
431 {
432 phys[j] = (m_curve->m_points[j]->GetPtr())[i];
433 }
434
435 t->BwdTrans(phys, tmp);
436
437 // Interpolate points to standard region.
439 P0, P1, tmp, m_xmap->GetBasis(0)->GetPointsKey(),
440 m_xmap->GetBasis(1)->GetPointsKey(), phys);
441
442 // Forwards transform to get coefficient space.
443 m_xmap->FwdTrans(phys, m_coeffs[i]);
444 }
445 }
446 else if (pdim == 1)
447 {
448 int npts = m_curve->m_points.size();
449 int nEdgePts = (int)sqrt(static_cast<NekDouble>(npts));
450 Array<OneD, NekDouble> tmp(npts);
451 Array<OneD, NekDouble> phys(m_xmap->GetTotPoints());
452 LibUtilities::PointsKey curveKey(nEdgePts, m_curve->m_ptype);
453
454 // Sanity checks:
455 // - Curved faces should have square number of points;
456 // - Each edge should have sqrt(npts) points.
457 ASSERTL0(nEdgePts * nEdgePts == npts,
458 "NUMPOINTS should be a square number for"
459 " triangle " +
460 boost::lexical_cast<string>(m_globalID));
461
462 for (i = 0; i < kNedges; ++i)
463 {
464 ASSERTL0(m_edges[i]->GetXmap()->GetNcoeffs() == nEdgePts,
465 "Number of edge points does not correspond to "
466 "number of face points in triangle " +
467 boost::lexical_cast<string>(m_globalID));
468 }
469
470 for (i = 0; i < m_coordim; ++i)
471 {
472 for (j = 0; j < npts; ++j)
473 {
474 tmp[j] = (m_curve->m_points[j]->GetPtr())[i];
475 }
476
477 // Interpolate curve points to standard triangle
478 // points.
479 LibUtilities::Interp2D(curveKey, curveKey, tmp,
480 m_xmap->GetBasis(0)->GetPointsKey(),
481 m_xmap->GetBasis(1)->GetPointsKey(),
482 phys);
483
484 // Forwards transform to get coefficient space.
485 m_xmap->FwdTrans(phys, m_coeffs[i]);
486 }
487 }
488 else
489 {
490 ASSERTL0(false, "Only 1D/2D points distributions "
491 "supported.");
492 }
493 }
494
495 Array<OneD, unsigned int> mapArray(nEdgeCoeffs);
496 Array<OneD, int> signArray(nEdgeCoeffs);
497
498 for (i = 0; i < kNedges; i++)
499 {
500 m_edges[i]->FillGeom();
501 m_xmap->GetTraceToElementMap(i, mapArray, signArray, m_eorient[i]);
502
503 nEdgeCoeffs = m_edges[i]->GetXmap()->GetNcoeffs();
504
505 for (j = 0; j < m_coordim; j++)
506 {
507 for (k = 0; k < nEdgeCoeffs; k++)
508 {
509 m_coeffs[j][mapArray[k]] =
510 signArray[k] * m_edges[i]->GetCoeffs(j)[k];
511 }
512 }
513 }
514
516}
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202
GeomState m_state
Enumeration to dictate whether coefficients are filled.
Definition: Geometry.h:197
Array< OneD, Array< OneD, NekDouble > > m_coeffs
Array containing expansion coefficients of m_xmap.
Definition: Geometry.h:207
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:58
@ ePtsFilled
Geometric information has been generated.
std::shared_ptr< StdNodalTriExp > StdNodalTriExpSharedPtr

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, Nektar::SpatialDomains::Geometry2D::m_edges, Nektar::SpatialDomains::Geometry2D::m_eorient, Nektar::SpatialDomains::Geometry::m_globalID, Nektar::SpatialDomains::Geometry::m_state, Nektar::SpatialDomains::Geometry2D::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 225 of file TriGeom.cpp.

226{
227 if (!m_setupState)
228 {
230 }
231
233 {
234 GeomType Gtype = eRegular;
235
237
238 // check to see if expansions are linear
239 m_straightEdge = 1;
240 if (m_xmap->GetBasisNumModes(0) != 2 ||
241 m_xmap->GetBasisNumModes(1) != 2)
242 {
243 Gtype = eDeformed;
244 m_straightEdge = 0;
245 }
246
247 m_manifold = Array<OneD, int>(m_coordim);
248 m_manifold[0] = 0;
249 m_manifold[1] = 1;
250 if (m_coordim == 3)
251 {
252 PointGeom e01, e21, norm;
253 e01.Sub(*m_verts[0], *m_verts[1]);
254 e21.Sub(*m_verts[2], *m_verts[1]);
255 norm.Mult(e01, e21);
256 int tmpi = 0;
257 double tmp = std::fabs(norm[0]);
258 if (tmp < fabs(norm[1]))
259 {
260 tmp = fabs(norm[1]);
261 tmpi = 1;
262 }
263 if (tmp < fabs(norm[2]))
264 {
265 tmpi = 2;
266 }
267 m_manifold[0] = (tmpi + 1) % 3;
268 m_manifold[1] = (tmpi + 2) % 3;
269 m_manifold[2] = (tmpi + 3) % 3;
270 }
271 if (Gtype == eRegular)
272 {
273 Array<OneD, Array<OneD, NekDouble>> verts(m_verts.size());
274 for (int i = 0; i < m_verts.size(); ++i)
275 {
276 verts[i] = Array<OneD, NekDouble>(3);
277 m_verts[i]->GetCoords(verts[i]);
278 }
279 // a00 + a01 xi1 + a02 xi2
280 // a10 + a11 xi1 + a12 xi2
281 m_isoParameter = Array<OneD, Array<OneD, NekDouble>>(2);
282 for (int i = 0; i < 2; ++i)
283 {
284 unsigned int d = m_manifold[i];
285 m_isoParameter[i] = Array<OneD, NekDouble>(3, 0.);
286 NekDouble A = verts[0][d];
287 NekDouble B = verts[1][d];
288 NekDouble C = verts[2][d];
289 m_isoParameter[i][0] = 0.5 * (B + C); // 1
290 m_isoParameter[i][1] = 0.5 * (-A + B); // xi1
291 m_isoParameter[i][2] = 0.5 * (-A + C); // xi2
292 }
294 }
295
297 Gtype, m_coordim, m_xmap, m_coeffs);
298
300 }
301}
Array< OneD, int > m_manifold
Definition: Geometry2D.h:83
void v_CalculateInverseIsoParam() override
Definition: Geometry2D.cpp:626
bool m_setupState
Wether or not the setup routines have been run.
Definition: Geometry.h:199
Array< OneD, Array< OneD, NekDouble > > m_isoParameter
Definition: Geometry.h:210
GeomState m_geomFactorsState
State of the geometric factors.
Definition: Geometry.h:193
GeomFactorsSharedPtr m_geomFactors
Geometric factors.
Definition: Geometry.h:191
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::UnitTests::d(), 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, Nektar::SpatialDomains::Geometry2D::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 104 of file TriGeom.cpp.

106{
107 ASSERTL1(m_state == ePtsFilled, "Geometry is not in physical space");
108
109 Array<OneD, NekDouble> tmp(m_xmap->GetTotPoints());
110 m_xmap->BwdTrans(m_coeffs[i], tmp);
111
112 return m_xmap->PhysEvaluate(Lcoord, tmp);
113}
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242

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

519{
520 return i == 0 ? 0 : 1;
521}

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

524{
525 Geometry::v_Reset(curvedEdges, curvedFaces);
526 CurveMap::iterator it = curvedFaces.find(m_globalID);
527
528 if (it != curvedFaces.end())
529 {
530 m_curve = it->second;
531 }
532
533 for (int i = 0; i < 3; ++i)
534 {
535 m_edges[i]->Reset(curvedEdges, curvedFaces);
536 }
537
538 SetUpXmap();
539 SetUpCoeffs(m_xmap->GetNcoeffs());
540}
void SetUpCoeffs(const int nCoeffs)
Initialise the Geometry::m_coeffs array.
Definition: Geometry.h:701
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:395

References Nektar::SpatialDomains::Geometry2D::m_curve, Nektar::SpatialDomains::Geometry2D::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 542 of file TriGeom.cpp.

543{
544 if (!m_setupState)
545 {
546 for (int i = 0; i < 3; ++i)
547 {
548 m_edges[i]->Setup();
549 }
550 SetUpXmap();
551 SetUpCoeffs(m_xmap->GetNcoeffs());
552 m_setupState = true;
553 }
554}

References Nektar::SpatialDomains::Geometry2D::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

◆ kNverts

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

Definition at line 71 of file TriGeom.h.

Referenced by Nektar::SpatialDomains::TetGeom::SetUpFaceOrientation().