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 ()
 
- Public Member Functions inherited from Nektar::SpatialDomains::Geometry2D
 Geometry2D ()
 
 Geometry2D (const int coordim, CurveSharedPtr curve)
 
virtual ~Geometry2D ()
 
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...
 
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 Setup ()
 

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

virtual 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...
 
virtual void v_GenGeomFactors () override
 
virtual void v_FillGeom () override
 
virtual int v_GetDir (const int faceidx, const int facedir) const override
 Returns the element coordinate direction corresponding to a given face coordinate direction. More...
 
virtual 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...
 
virtual void v_Setup () override
 
- Protected Member Functions inherited from Nektar::SpatialDomains::Geometry2D
virtual 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)
 
virtual int v_GetShapeDim () const override
 Get the object's shape dimension. More...
 
virtual PointGeomSharedPtr v_GetVertex (int i) const override
 
virtual Geometry1DSharedPtr v_GetEdge (int i) const override
 Returns edge i of this object. More...
 
virtual int v_GetNumVerts () const override
 Get the number of vertices of this object. More...
 
virtual int v_GetNumEdges () const override
 Get the number of edges of this object. More...
 
virtual 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...
 
virtual NekDouble v_FindDistance (const Array< OneD, const NekDouble > &xs, Array< OneD, NekDouble > &xi) override
 
- Protected Member Functions inherited from Nektar::SpatialDomains::Geometry
void GenGeomFactors ()
 Handles generation of geometry factors. More...
 
virtual Geometry2DSharedPtr v_GetFace (int i) const
 Returns face i of this object. More...
 
virtual StdRegions::Orientation v_GetForient (const int i) const
 Returns the orientation of face i with respect to the ordering of faces in the standard element. More...
 
virtual int v_GetNumFaces () const
 Get the number of faces of this object. More...
 
virtual StdRegions::StdExpansionSharedPtr v_GetXmap () const
 Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standard element to physical element. More...
 
virtual bool v_ContainsPoint (const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, NekDouble &dist)
 
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...
 
void SetUpCoeffs (const int nCoeffs)
 Initialise the Geometry::m_coeffs array. More...
 

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

Detailed Description

Definition at line 61 of file TriGeom.h.

Constructor & Destructor Documentation

◆ TriGeom() [1/3]

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

Definition at line 51 of file TriGeom.cpp.

52 {
54 }
LibUtilities::ShapeType m_shapeType
Type of shape.
Definition: Geometry.h:198

References Nektar::LibUtilities::eTriangle.

◆ TriGeom() [2/3]

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

Definition at line 85 of file TriGeom.cpp.

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

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

58  : Geometry2D(edges[0]->GetVertex(0)->GetCoordim(), curve)
59 {
60  int j;
61 
63  m_globalID = id;
64 
65  // Copy the edge shared pointers.
66  m_edges.insert(m_edges.begin(), edges, edges + TriGeom::kNedges);
67  m_eorient.resize(kNedges);
68 
69  for (j = 0; j < kNedges; ++j)
70  {
71  m_eorient[j] =
72  SegGeom::GetEdgeOrientation(*edges[j], *edges[(j + 1) % kNedges]);
73  m_verts.push_back(
74  edges[j]->GetVertex(m_eorient[j] == StdRegions::eForwards ? 0 : 1));
75  }
76 
80 
81  m_coordim = edges[0]->GetVertex(0)->GetCoordim();
82  ASSERTL0(m_coordim > 1, "Cannot call function with dim == 1");
83 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
PointGeomSharedPtr GetVertex(int i) const
Returns vertex i of this object.
Definition: Geometry.h:351
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:196

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 ( )

Definition at line 102 of file TriGeom.cpp.

103 {
104 }

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

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

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

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

References Nektar::SpatialDomains::Geometry2D::m_verts.

Referenced by Nektar::MultiRegions::DisContField::FindPeriodicTraces().

◆ SetUpXmap()

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

Definition at line 512 of file TriGeom.cpp.

513 {
514  int order0 = m_edges[0]->GetXmap()->GetBasis(0)->GetNumModes();
515  int order1 =
516  max(order0, max(m_edges[1]->GetXmap()->GetBasis(0)->GetNumModes(),
517  m_edges[2]->GetXmap()->GetBasis(0)->GetNumModes()));
518 
519  const LibUtilities::BasisKey B0(
521  LibUtilities::PointsKey(order0 + 1,
523  const LibUtilities::BasisKey B1(
525  LibUtilities::PointsKey(order1, LibUtilities::eGaussRadauMAlpha1Beta0));
526 
528 }
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:190
StdRegions::StdExpansionSharedPtr GetXmap() const
Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standar...
Definition: Geometry.h:429
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:53
@ eModified_B
Principle Modified Functions .
Definition: BasisType.h:51
@ eModified_A
Principle Modified Functions .
Definition: BasisType.h:50

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

263 {
264  // check to see if geometry structure is already filled
265  if (m_state == ePtsFilled)
266  {
267  return;
268  }
269 
270  int i, j, k;
271  int nEdgeCoeffs = m_xmap->GetTraceNcoeffs(0);
272 
273  if (m_curve)
274  {
275  int pdim = LibUtilities::PointsManager()[LibUtilities::PointsKey(
276  2, m_curve->m_ptype)]
277  ->GetPointsDim();
278 
279  // Deal with 2D points type separately
280  // (e.g. electrostatic or Fekete points) to 1D tensor
281  // product.
282  if (pdim == 2)
283  {
284  int N = m_curve->m_points.size();
285  int nEdgePts =
286  (-1 + (int)sqrt(static_cast<NekDouble>(8 * N + 1))) / 2;
287 
288  ASSERTL0(nEdgePts * (nEdgePts + 1) / 2 == N,
289  "NUMPOINTS should be a triangle number for"
290  " triangle curved face " +
291  boost::lexical_cast<string>(m_globalID));
292 
293  // Sanity check 1: are curved vertices consistent with
294  // triangle vertices?
295  for (i = 0; i < 3; ++i)
296  {
297  NekDouble dist = m_verts[i]->dist(*(m_curve->m_points[i]));
299  {
300  std::stringstream ss;
301  ss << "Curved vertex " << i << " of triangle " << m_globalID
302  << " is separated from expansion vertex by"
303  << " more than " << NekConstants::kVertexTheSameDouble
304  << " (dist = " << dist << ")";
305  NEKERROR(ErrorUtil::ewarning, ss.str().c_str());
306  }
307  }
308 
309  // Sanity check 2: are curved edges from the face curvature
310  // consistent with curved edges?
311  for (i = 0; i < kNedges; ++i)
312  {
313  CurveSharedPtr edgeCurve = m_edges[i]->GetCurve();
314 
315  ASSERTL0(edgeCurve->m_points.size() == nEdgePts,
316  "Number of edge points does not correspond "
317  "to number of face points in triangle " +
318  boost::lexical_cast<string>(m_globalID));
319 
320  const int offset = 3 + i * (nEdgePts - 2);
321  NekDouble maxDist = 0.0;
322 
323  // Account for different ordering of nodal coordinates
324  // vs. Cartesian ordering of element.
326 
327  if (i == 2)
328  {
329  orient = orient == StdRegions::eForwards
332  }
333 
334  if (orient == StdRegions::eForwards)
335  {
336  for (j = 0; j < nEdgePts - 2; ++j)
337  {
338  NekDouble dist = m_curve->m_points[offset + j]->dist(
339  *(edgeCurve->m_points[j + 1]));
340  maxDist = dist > maxDist ? dist : maxDist;
341  }
342  }
343  else
344  {
345  for (j = 0; j < nEdgePts - 2; ++j)
346  {
347  NekDouble dist = m_curve->m_points[offset + j]->dist(
348  *(edgeCurve->m_points[nEdgePts - 2 - j]));
349  maxDist = dist > maxDist ? dist : maxDist;
350  }
351  }
352 
354  {
355  std::stringstream ss;
356  ss << "Curved edge " << i << " of triangle " << m_globalID
357  << " has a point separated from edge interior"
358  << " points by more than "
360  << " (maxdist = " << maxDist << ")";
361  NEKERROR(ErrorUtil::ewarning, ss.str().c_str());
362  }
363  }
364 
365  const LibUtilities::PointsKey P0(
367  const LibUtilities::PointsKey P1(
368  nEdgePts, LibUtilities::eGaussRadauMAlpha1Beta0);
369  const LibUtilities::BasisKey T0(LibUtilities::eOrtho_A, nEdgePts,
370  P0);
371  const LibUtilities::BasisKey T1(LibUtilities::eOrtho_B, nEdgePts,
372  P1);
373  Array<OneD, NekDouble> phys(
374  max(nEdgePts * nEdgePts, m_xmap->GetTotPoints()));
375  Array<OneD, NekDouble> tmp(nEdgePts * nEdgePts);
376 
377  for (i = 0; i < m_coordim; ++i)
378  {
379  // Create a StdNodalTriExp.
382  AllocateSharedPtr(T0, T1, m_curve->m_ptype);
383 
384  for (j = 0; j < N; ++j)
385  {
386  phys[j] = (m_curve->m_points[j]->GetPtr())[i];
387  }
388 
389  t->BwdTrans(phys, tmp);
390 
391  // Interpolate points to standard region.
393  P0, P1, tmp, m_xmap->GetBasis(0)->GetPointsKey(),
394  m_xmap->GetBasis(1)->GetPointsKey(), phys);
395 
396  // Forwards transform to get coefficient space.
397  m_xmap->FwdTrans(phys, m_coeffs[i]);
398  }
399  }
400  else if (pdim == 1)
401  {
402  int npts = m_curve->m_points.size();
403  int nEdgePts = (int)sqrt(static_cast<NekDouble>(npts));
404  Array<OneD, NekDouble> tmp(npts);
405  Array<OneD, NekDouble> phys(m_xmap->GetTotPoints());
406  LibUtilities::PointsKey curveKey(nEdgePts, m_curve->m_ptype);
407 
408  // Sanity checks:
409  // - Curved faces should have square number of points;
410  // - Each edge should have sqrt(npts) points.
411  ASSERTL0(nEdgePts * nEdgePts == npts,
412  "NUMPOINTS should be a square number for"
413  " triangle " +
414  boost::lexical_cast<string>(m_globalID));
415 
416  for (i = 0; i < kNedges; ++i)
417  {
418  ASSERTL0(m_edges[i]->GetXmap()->GetNcoeffs() == nEdgePts,
419  "Number of edge points does not correspond to "
420  "number of face points in triangle " +
421  boost::lexical_cast<string>(m_globalID));
422  }
423 
424  for (i = 0; i < m_coordim; ++i)
425  {
426  for (j = 0; j < npts; ++j)
427  {
428  tmp[j] = (m_curve->m_points[j]->GetPtr())[i];
429  }
430 
431  // Interpolate curve points to standard triangle
432  // points.
433  LibUtilities::Interp2D(curveKey, curveKey, tmp,
434  m_xmap->GetBasis(0)->GetPointsKey(),
435  m_xmap->GetBasis(1)->GetPointsKey(),
436  phys);
437 
438  // Forwards transform to get coefficient space.
439  m_xmap->FwdTrans(phys, m_coeffs[i]);
440  }
441  }
442  else
443  {
444  ASSERTL0(false, "Only 1D/2D points distributions "
445  "supported.");
446  }
447  }
448 
449  Array<OneD, unsigned int> mapArray(nEdgeCoeffs);
450  Array<OneD, int> signArray(nEdgeCoeffs);
451 
452  for (i = 0; i < kNedges; i++)
453  {
454  m_edges[i]->FillGeom();
455  m_xmap->GetTraceToElementMap(i, mapArray, signArray, m_eorient[i]);
456 
457  nEdgeCoeffs = m_edges[i]->GetXmap()->GetNcoeffs();
458 
459  for (j = 0; j < m_coordim; j++)
460  {
461  for (k = 0; k < nEdgeCoeffs; k++)
462  {
463  m_coeffs[j][mapArray[k]] =
464  signArray[k] * m_edges[i]->GetCoeffs(j)[k];
465  }
466  }
467  }
468 
470 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:209
GeomState m_state
Enumeration to dictate whether coefficients are filled.
Definition: Geometry.h:192
Array< OneD, Array< OneD, NekDouble > > m_coeffs
Array containing expansion coefficients of m_xmap.
Definition: Geometry.h:202
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:106
@ eOrtho_A
Principle Orthogonal Functions .
Definition: BasisType.h:44
@ eOrtho_B
Principle Orthogonal Functions .
Definition: BasisType.h:46
static const NekDouble kVertexTheSameDouble
std::shared_ptr< Curve > CurveSharedPtr
Definition: Curve.hpp:60
@ 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 227 of file TriGeom.cpp.

228 {
229  if (!m_setupState)
230  {
232  }
233 
235  {
236  GeomType Gtype = eRegular;
237 
239 
240  // check to see if expansions are linear
241  for (int i = 0; i < m_coordim; ++i)
242  {
243  if (m_xmap->GetBasisNumModes(0) != 2 ||
244  m_xmap->GetBasisNumModes(1) != 2)
245  {
246  Gtype = eDeformed;
247  }
248  }
249 
251  Gtype, m_coordim, m_xmap, m_coeffs);
252 
254  }
255 }
bool m_setupState
Wether or not the setup routines have been run.
Definition: Geometry.h:194
GeomState m_geomFactorsState
State of the geometric factors.
Definition: Geometry.h:188
GeomFactorsSharedPtr m_geomFactors
Geometric factors.
Definition: Geometry.h:186
virtual void v_FillGeom() override
Definition: TriGeom.cpp:262
virtual void v_Setup() override
Definition: TriGeom.cpp:498
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.

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

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

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

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

473 {
474  boost::ignore_unused(j); // required in 3D shapes
475 
476  return i == 0 ? 0 : 1;
477 }

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

480 {
481  Geometry::v_Reset(curvedEdges, curvedFaces);
482  CurveMap::iterator it = curvedFaces.find(m_globalID);
483 
484  if (it != curvedFaces.end())
485  {
486  m_curve = it->second;
487  }
488 
489  for (int i = 0; i < 3; ++i)
490  {
491  m_edges[i]->Reset(curvedEdges, curvedFaces);
492  }
493 
494  SetUpXmap();
495  SetUpCoeffs(m_xmap->GetNcoeffs());
496 }
void SetUpCoeffs(const int nCoeffs)
Initialise the Geometry::m_coeffs array.
Definition: Geometry.h:683
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:376

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

499 {
500  if (!m_setupState)
501  {
502  for (int i = 0; i < 3; ++i)
503  {
504  m_edges[i]->Setup();
505  }
506  SetUpXmap();
507  SetUpCoeffs(m_xmap->GetNcoeffs());
508  m_setupState = true;
509  }
510 }

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

Get the orientation of face1.

Definition at line 72 of file TriGeom.h.

Referenced by TriGeom(), and v_FillGeom().

◆ kNverts

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

Definition at line 73 of file TriGeom.h.

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