Nektar++
Public Member Functions | Public Attributes | Protected Attributes | List of all members
Nektar::NekMeshUtils::Element Class Reference

Base class for element definitions. More...

#include <Element.h>

Inheritance diagram for Nektar::NekMeshUtils::Element:
[legend]

Public Member Functions

NEKMESHUTILS_EXPORT Element (ElmtConfig pConf, unsigned int pNumNodes, unsigned int pGotNodes)
 
NEKMESHUTILS_EXPORT unsigned int GetId () const
 Returns the ID of the element (or associated edge or face for boundary elements). More...
 
NEKMESHUTILS_EXPORT unsigned int GetDim () const
 Returns the expansion dimension of the element. More...
 
NEKMESHUTILS_EXPORT ElmtConfig GetConf () const
 Returns the configuration of the element. More...
 
NEKMESHUTILS_EXPORT LibUtilities::ShapeType GetShapeType () const
 returns the shapetype More...
 
NEKMESHUTILS_EXPORT std::string GetTag () const
 Returns the tag which defines the element shape. More...
 
NEKMESHUTILS_EXPORT NodeSharedPtr GetVertex (unsigned int i) const
 Access a vertex node. More...
 
NEKMESHUTILS_EXPORT EdgeSharedPtr GetEdge (unsigned int i) const
 Access an edge. More...
 
NEKMESHUTILS_EXPORT FaceSharedPtr GetFace (unsigned int i) const
 Access a face. More...
 
NEKMESHUTILS_EXPORT std::vector< NodeSharedPtrGetVertexList () const
 Access the list of vertex nodes. More...
 
NEKMESHUTILS_EXPORT std::vector< EdgeSharedPtrGetEdgeList () const
 Access the list of edges. More...
 
NEKMESHUTILS_EXPORT std::vector< FaceSharedPtrGetFaceList () const
 Access the list of faces. More...
 
NEKMESHUTILS_EXPORT std::vector< NodeSharedPtrGetVolumeNodes () const
 Access the list of volume nodes. More...
 
NEKMESHUTILS_EXPORT void SetVolumeNodes (std::vector< NodeSharedPtr > &nodes)
 
NEKMESHUTILS_EXPORT LibUtilities::PointsType GetCurveType () const
 
NEKMESHUTILS_EXPORT void SetCurveType (LibUtilities::PointsType cT)
 
NEKMESHUTILS_EXPORT unsigned int GetNodeCount ()
 Returns the total number of nodes (vertices, edge nodes and face nodes and volume nodes). More...
 
NEKMESHUTILS_EXPORT std::vector< int > GetTagList () const
 Access the list of tags associated with this element. More...
 
NEKMESHUTILS_EXPORT unsigned int GetVertexCount () const
 Returns the number of vertices. More...
 
NEKMESHUTILS_EXPORT unsigned int GetEdgeCount () const
 Returns the number of edges. More...
 
NEKMESHUTILS_EXPORT unsigned int GetFaceCount () const
 Returns the number of faces. More...
 
NEKMESHUTILS_EXPORT void SetId (unsigned int p)
 Change the ID of the element. More...
 
NEKMESHUTILS_EXPORT void SetVertex (unsigned int p, NodeSharedPtr pNew, bool descend=true)
 Replace a vertex in the element. More...
 
NEKMESHUTILS_EXPORT void SetEdge (unsigned int p, EdgeSharedPtr pNew, bool descend=true)
 Replace an edge in the element. More...
 
NEKMESHUTILS_EXPORT void SetFace (unsigned int p, FaceSharedPtr pNew)
 Replace a face in the element. More...
 
NEKMESHUTILS_EXPORT void SetEdgeLink (EdgeSharedPtr pLink)
 Set a correspondence between this element and an edge (2D boundary element). More...
 
NEKMESHUTILS_EXPORT EdgeSharedPtr GetEdgeLink ()
 Get correspondence between this element and an edge. More...
 
NEKMESHUTILS_EXPORT void SetFaceLink (FaceSharedPtr pLink)
 Set a correspondence between this element and a face (3D boundary element). More...
 
NEKMESHUTILS_EXPORT FaceSharedPtr GetFaceLink ()
 Get correspondence between this element and a face. More...
 
NEKMESHUTILS_EXPORT void SetBoundaryLink (int i, int j)
 Set a correspondence between edge or face i and its representative boundary element m->element[expDim-1][j]. More...
 
NEKMESHUTILS_EXPORT int GetBoundaryLink (int i)
 Get the location of the boundary face/edge i for this element. More...
 
NEKMESHUTILS_EXPORT bool HasBoundaryLinks ()
 Is this element connected to a boundary. More...
 
NEKMESHUTILS_EXPORT void SetTagList (const std::vector< int > &tags)
 Set the list of tags associated with this element. More...
 
virtual NEKMESHUTILS_EXPORT std::string GetXmlString ()
 Generate a list of vertices (1D), edges (2D), or faces (3D). More...
 
virtual NEKMESHUTILS_EXPORT void GetCurvedNodes (std::vector< NodeSharedPtr > &nodeList) const
 get list of volume interior nodes More...
 
NEKMESHUTILS_EXPORT std::string GetXmlCurveString ()
 Generates a string listing the coordinates of all nodes associated with this element. More...
 
virtual NEKMESHUTILS_EXPORT SpatialDomains::GeometrySharedPtr GetGeom (int coordDim)
 Generate a Nektar++ geometry object for this element. More...
 
NEKMESHUTILS_EXPORT int GetMaxOrder ()
 Obtain the order of an element by looking at edges. More...
 
NEKMESHUTILS_EXPORT bool IsDeformed ()
 Determines whether an element is deformed by inspecting whether there are any edge, face or volume interior nodes. More...
 
NEKMESHUTILS_EXPORT std::pair< Node, NodeGetBoundingBox ()
 Returns the approximate bounding box of this element based on the coordinates of all vertices, edges and faces of the element. Note that this does not robustly take into account the curvature of the element. More...
 
virtual NEKMESHUTILS_EXPORT void MakeOrder (int order, SpatialDomains::GeometrySharedPtr geom, LibUtilities::PointsType edgeType, int coordDim, int &id, bool justConfig=false)
 Insert interior (i.e. volume) points into this element to make the geometry an order order representation. More...
 
virtual NEKMESHUTILS_EXPORT StdRegions::Orientation GetEdgeOrient (int edgeId, EdgeSharedPtr edge)
 Get the edge orientation of edge with respect to the local element, which lies at edge index edgeId. More...
 
virtual NEKMESHUTILS_EXPORT int GetFaceVertex (int i, int j)
 Returns the local index of vertex j of face i. More...
 
NEKMESHUTILS_EXPORT void Print ()
 
virtual NEKMESHUTILS_EXPORT Array< OneD, NekDoubleNormal (bool inward=false)
 returns the normal to the element More...
 

Public Attributes

CADObjectSharedPtr m_parentCAD
 

Protected Attributes

unsigned int m_id
 ID of the element. More...
 
unsigned int m_dim
 Dimension of the element. More...
 
ElmtConfig m_conf
 Contains configuration of the element. More...
 
std::string m_tag
 Tag character describing the element. More...
 
std::vector< int > m_taglist
 List of integers specifying properties of the element. More...
 
std::vector< NodeSharedPtrm_vertex
 List of element vertex nodes. More...
 
std::vector< EdgeSharedPtrm_edge
 List of element edges. More...
 
std::vector< FaceSharedPtrm_face
 List of element faces. More...
 
std::vector< NodeSharedPtrm_volumeNodes
 List of element volume nodes. More...
 
LibUtilities::PointsType m_curveType
 Volume curve type. More...
 
EdgeSharedPtr m_edgeLink
 Pointer to the corresponding edge if element is a 2D boundary. More...
 
FaceSharedPtr m_faceLink
 Pointer to the corresponding face if element is a 3D boundary. More...
 
std::map< int, int > m_boundaryLinks
 Array mapping faces/edges to the location of the appropriate boundary elements in m->element. More...
 
SpatialDomains::GeometrySharedPtr m_geom
 Nektar++ geometry object for this element. More...
 

Detailed Description

Base class for element definitions.

An element is defined by a list of vertices, edges and faces (depending on the dimension of the problem). This base class provides the underlying structure.

Definition at line 60 of file Element.h.

Constructor & Destructor Documentation

◆ Element()

Nektar::NekMeshUtils::Element::Element ( ElmtConfig  pConf,
unsigned int  pNumNodes,
unsigned int  pGotNodes 
)

Definition at line 50 of file Element.cpp.

References Nektar::NekMeshUtils::ElmtConfig::m_e.

53 {
54  if (pNumNodes != pGotNodes)
55  {
56  cerr << "Number of modes mismatch for type " << pConf.m_e
57  << "! Should be " << pNumNodes << " but got " << pGotNodes
58  << " nodes." << endl;
59  abort();
60  }
61 }
ElmtConfig m_conf
Contains configuration of the element.
Definition: Element.h:462
1D Evenly-spaced points using Lagrange polynomial
Definition: PointsType.h:64
SpatialDomains::GeometrySharedPtr m_geom
Nektar++ geometry object for this element.
Definition: Element.h:485
LibUtilities::PointsType m_curveType
Volume curve type.
Definition: Element.h:476

Member Function Documentation

◆ GetBoundaryLink()

NEKMESHUTILS_EXPORT int Nektar::NekMeshUtils::Element::GetBoundaryLink ( int  i)
inline

Get the location of the boundary face/edge i for this element.

Definition at line 240 of file Element.h.

References m_boundaryLinks.

241  {
242  std::map<int, int>::iterator it = m_boundaryLinks.find(i);
243  if (it == m_boundaryLinks.end())
244  {
245  return -1;
246  }
247  else
248  {
249  return it->second;
250  }
251  }
std::map< int, int > m_boundaryLinks
Array mapping faces/edges to the location of the appropriate boundary elements in m->element...
Definition: Element.h:483

◆ GetBoundingBox()

NEKMESHUTILS_EXPORT std::pair<Node, Node> Nektar::NekMeshUtils::Element::GetBoundingBox ( )
inline

Returns the approximate bounding box of this element based on the coordinates of all vertices, edges and faces of the element. Note that this does not robustly take into account the curvature of the element.

Definition at line 326 of file Element.h.

References m_edge, m_face, m_vertex, and SWAP_NODE.

327  {
328 #define SWAP_NODE(a) \
329  lower.m_x = std::min(lower.m_x, a->m_x); \
330  lower.m_y = std::min(lower.m_y, a->m_y); \
331  lower.m_z = std::min(lower.m_z, a->m_z); \
332  upper.m_x = std::max(upper.m_x, a->m_x); \
333  upper.m_y = std::max(upper.m_y, a->m_y); \
334  upper.m_z = std::max(upper.m_z, a->m_z);
335 
336  Node lower(*m_vertex[0]), upper(*m_vertex[0]);
337 
338  for (int i = 1; i < m_vertex.size(); ++i)
339  {
340  SWAP_NODE(m_vertex[i])
341  }
342  for (auto &edge : m_edge)
343  {
344  for (auto &edgeNode : edge->m_edgeNodes)
345  {
346  SWAP_NODE(edgeNode);
347  }
348  }
349  for (auto &face : m_face)
350  {
351  for (auto &faceNode : face->m_faceNodes)
352  {
353  SWAP_NODE(faceNode);
354  }
355  }
356 
357  return std::make_pair(lower, upper);
358 #undef SWAP_NODE
359  }
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
Definition: Element.h:468
#define SWAP_NODE(a)
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:470
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: Element.h:472

◆ GetConf()

NEKMESHUTILS_EXPORT ElmtConfig Nektar::NekMeshUtils::Element::GetConf ( ) const
inline

Returns the configuration of the element.

Definition at line 82 of file Element.h.

References m_conf.

83  {
84  return m_conf;
85  }
ElmtConfig m_conf
Contains configuration of the element.
Definition: Element.h:462

◆ GetCurvedNodes()

virtual NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Element::GetCurvedNodes ( std::vector< NodeSharedPtr > &  nodeList) const
inlinevirtual

get list of volume interior nodes

Reimplemented in Nektar::NekMeshUtils::Triangle, Nektar::NekMeshUtils::Prism, Nektar::NekMeshUtils::Quadrilateral, Nektar::NekMeshUtils::Tetrahedron, and Nektar::NekMeshUtils::Line.

Definition at line 265 of file Element.h.

References Nektar::ErrorUtil::efatal, GetXmlCurveString(), NEKERROR, and NEKMESHUTILS_EXPORT.

Referenced by GetXmlCurveString().

267  {
268  boost::ignore_unused(nodeList);
270  "This function should be implemented at a shape level.");
271  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ GetCurveType()

NEKMESHUTILS_EXPORT LibUtilities::PointsType Nektar::NekMeshUtils::Element::GetCurveType ( ) const
inline

Definition at line 139 of file Element.h.

References m_curveType.

140  {
141  return m_curveType;
142  }
LibUtilities::PointsType m_curveType
Volume curve type.
Definition: Element.h:476

◆ GetDim()

NEKMESHUTILS_EXPORT unsigned int Nektar::NekMeshUtils::Element::GetDim ( ) const
inline

Returns the expansion dimension of the element.

Definition at line 77 of file Element.h.

References m_dim.

78  {
79  return m_dim;
80  }
unsigned int m_dim
Dimension of the element.
Definition: Element.h:460

◆ GetEdge()

NEKMESHUTILS_EXPORT EdgeSharedPtr Nektar::NekMeshUtils::Element::GetEdge ( unsigned int  i) const
inline

Access an edge.

Definition at line 106 of file Element.h.

References m_edge.

107  {
108  return m_edge[i];
109  }
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:470

◆ GetEdgeCount()

NEKMESHUTILS_EXPORT unsigned int Nektar::NekMeshUtils::Element::GetEdgeCount ( ) const
inline

Returns the number of edges.

Definition at line 161 of file Element.h.

References m_edge.

162  {
163  return m_edge.size();
164  }
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:470

◆ GetEdgeLink()

NEKMESHUTILS_EXPORT EdgeSharedPtr Nektar::NekMeshUtils::Element::GetEdgeLink ( )
inline

Get correspondence between this element and an edge.

Definition at line 218 of file Element.h.

References m_edgeLink.

219  {
220  return m_edgeLink;
221  }
EdgeSharedPtr m_edgeLink
Pointer to the corresponding edge if element is a 2D boundary.
Definition: Element.h:478

◆ GetEdgeList()

NEKMESHUTILS_EXPORT std::vector<EdgeSharedPtr> Nektar::NekMeshUtils::Element::GetEdgeList ( ) const
inline

Access the list of edges.

Definition at line 121 of file Element.h.

References m_edge.

122  {
123  return m_edge;
124  }
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:470

◆ GetEdgeOrient()

virtual NEKMESHUTILS_EXPORT StdRegions::Orientation Nektar::NekMeshUtils::Element::GetEdgeOrient ( int  edgeId,
EdgeSharedPtr  edge 
)
inlinevirtual

Get the edge orientation of edge with respect to the local element, which lies at edge index edgeId.

Reimplemented in Nektar::NekMeshUtils::Hexahedron, Nektar::NekMeshUtils::Triangle, Nektar::NekMeshUtils::Prism, Nektar::NekMeshUtils::Quadrilateral, and Nektar::NekMeshUtils::Tetrahedron.

Definition at line 395 of file Element.h.

References Nektar::ErrorUtil::efatal, Nektar::StdRegions::eNoOrientation, and NEKERROR.

397  {
398  boost::ignore_unused(edgeId, edge);
400  "This function should be implemented at a shape level.");
402  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ GetFace()

NEKMESHUTILS_EXPORT FaceSharedPtr Nektar::NekMeshUtils::Element::GetFace ( unsigned int  i) const
inline

Access a face.

Definition at line 111 of file Element.h.

References m_face.

112  {
113  return m_face[i];
114  }
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: Element.h:472

◆ GetFaceCount()

NEKMESHUTILS_EXPORT unsigned int Nektar::NekMeshUtils::Element::GetFaceCount ( ) const
inline

Returns the number of faces.

Definition at line 166 of file Element.h.

References m_face.

167  {
168  return m_face.size();
169  }
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: Element.h:472

◆ GetFaceLink()

NEKMESHUTILS_EXPORT FaceSharedPtr Nektar::NekMeshUtils::Element::GetFaceLink ( )
inline

Get correspondence between this element and a face.

Definition at line 229 of file Element.h.

References m_faceLink.

230  {
231  return m_faceLink;
232  }
FaceSharedPtr m_faceLink
Pointer to the corresponding face if element is a 3D boundary.
Definition: Element.h:480

◆ GetFaceList()

NEKMESHUTILS_EXPORT std::vector<FaceSharedPtr> Nektar::NekMeshUtils::Element::GetFaceList ( ) const
inline

Access the list of faces.

Definition at line 126 of file Element.h.

References m_face.

127  {
128  return m_face;
129  }
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: Element.h:472

◆ GetFaceVertex()

virtual NEKMESHUTILS_EXPORT int Nektar::NekMeshUtils::Element::GetFaceVertex ( int  i,
int  j 
)
inlinevirtual

Returns the local index of vertex j of face i.

Reimplemented in Nektar::NekMeshUtils::Hexahedron, Nektar::NekMeshUtils::Prism, Nektar::NekMeshUtils::Tetrahedron, and Nektar::NekMeshUtils::Pyramid.

Definition at line 407 of file Element.h.

References Nektar::ErrorUtil::efatal, and NEKERROR.

408  {
409  boost::ignore_unused(i, j);
411  "This function should be implemented at a shape level.");
412  return 0;
413  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ GetGeom()

virtual NEKMESHUTILS_EXPORT SpatialDomains::GeometrySharedPtr Nektar::NekMeshUtils::Element::GetGeom ( int  coordDim)
inlinevirtual

Generate a Nektar++ geometry object for this element.

Reimplemented in Nektar::NekMeshUtils::Hexahedron, Nektar::NekMeshUtils::Line, Nektar::NekMeshUtils::Triangle, Nektar::NekMeshUtils::Prism, Nektar::NekMeshUtils::Quadrilateral, Nektar::NekMeshUtils::Tetrahedron, and Nektar::NekMeshUtils::Pyramid.

Definition at line 277 of file Element.h.

References Nektar::ErrorUtil::efatal, GetMaxOrder(), NEKERROR, and NEKMESHUTILS_EXPORT.

279  {
280  boost::ignore_unused(coordDim);
282  "This function should be implemented at a shape level.");
283  return std::shared_ptr<SpatialDomains::Geometry>();
284  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ GetId()

NEKMESHUTILS_EXPORT unsigned int Nektar::NekMeshUtils::Element::GetId ( ) const
inline

Returns the ID of the element (or associated edge or face for boundary elements).

Definition at line 68 of file Element.h.

References m_edgeLink, m_faceLink, and m_id.

69  {
70  if (m_faceLink.get() != 0)
71  return m_faceLink->m_id;
72  if (m_edgeLink.get() != 0)
73  return m_edgeLink->m_id;
74  return m_id;
75  }
FaceSharedPtr m_faceLink
Pointer to the corresponding face if element is a 3D boundary.
Definition: Element.h:480
EdgeSharedPtr m_edgeLink
Pointer to the corresponding edge if element is a 2D boundary.
Definition: Element.h:478
unsigned int m_id
ID of the element.
Definition: Element.h:458

◆ GetMaxOrder()

int Nektar::NekMeshUtils::Element::GetMaxOrder ( )

Obtain the order of an element by looking at edges.

Definition at line 135 of file Element.cpp.

References m_edge.

Referenced by GetGeom().

136 {
137  int i, ret = 1;
138 
139  for (i = 0; i < m_edge.size(); ++i)
140  {
141  int edgeOrder = m_edge[i]->GetNodeCount() - 1;
142  if (edgeOrder > ret)
143  {
144  ret = edgeOrder;
145  }
146  }
147 
148  return ret;
149 }
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:470

◆ GetNodeCount()

unsigned int Nektar::NekMeshUtils::Element::GetNodeCount ( )

Returns the total number of nodes (vertices, edge nodes and face nodes and volume nodes).

Definition at line 151 of file Element.cpp.

References m_dim, m_edge, m_face, m_vertex, and m_volumeNodes.

Referenced by SetCurveType().

152 {
153  unsigned int n = m_volumeNodes.size();
154  if (m_dim == 1)
155  {
156  n += 2;
157  }
158  else if (m_dim == 2)
159  {
160  for (int i = 0; i < m_edge.size(); ++i)
161  {
162  n += m_edge[i]->GetNodeCount();
163  }
164  n -= m_vertex.size();
165  }
166  else
167  {
168  for (int i = 0; i < m_face.size(); ++i)
169  {
170  n += m_face[i]->GetNodeCount();
171  }
172  for (int i = 0; i < m_edge.size(); ++i)
173  {
174  n -= m_edge[i]->GetNodeCount();
175  }
176  n += m_vertex.size();
177  std::cerr << "Not supported." << std::endl;
178  exit(1);
179  }
180  return n;
181 }
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
Definition: Element.h:468
unsigned int m_dim
Dimension of the element.
Definition: Element.h:460
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:470
std::vector< NodeSharedPtr > m_volumeNodes
List of element volume nodes.
Definition: Element.h:474
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: Element.h:472

◆ GetShapeType()

NEKMESHUTILS_EXPORT LibUtilities::ShapeType Nektar::NekMeshUtils::Element::GetShapeType ( void  ) const
inline

returns the shapetype

Definition at line 87 of file Element.h.

References m_conf, and Nektar::NekMeshUtils::ElmtConfig::m_e.

88  {
89  return m_conf.m_e;
90  }
ElmtConfig m_conf
Contains configuration of the element.
Definition: Element.h:462
LibUtilities::ShapeType m_e
Element type (e.g. triangle, quad, etc).
Definition: ElementConfig.h:78

◆ GetTag()

NEKMESHUTILS_EXPORT std::string Nektar::NekMeshUtils::Element::GetTag ( ) const
inline

Returns the tag which defines the element shape.

Definition at line 92 of file Element.h.

References m_edgeLink, m_faceLink, and m_tag.

93  {
94  if (m_faceLink.get() != 0)
95  return "F";
96  if (m_edgeLink.get() != 0)
97  return "E";
98  return m_tag;
99  }
FaceSharedPtr m_faceLink
Pointer to the corresponding face if element is a 3D boundary.
Definition: Element.h:480
EdgeSharedPtr m_edgeLink
Pointer to the corresponding edge if element is a 2D boundary.
Definition: Element.h:478
std::string m_tag
Tag character describing the element.
Definition: Element.h:464

◆ GetTagList()

NEKMESHUTILS_EXPORT std::vector<int> Nektar::NekMeshUtils::Element::GetTagList ( ) const
inline

Access the list of tags associated with this element.

Definition at line 151 of file Element.h.

References m_taglist.

152  {
153  return m_taglist;
154  }
std::vector< int > m_taglist
List of integers specifying properties of the element.
Definition: Element.h:466

◆ GetVertex()

NEKMESHUTILS_EXPORT NodeSharedPtr Nektar::NekMeshUtils::Element::GetVertex ( unsigned int  i) const
inline

Access a vertex node.

Definition at line 101 of file Element.h.

References m_vertex.

Referenced by Nektar::Utilities::InputNek::Process().

102  {
103  return m_vertex[i];
104  }
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
Definition: Element.h:468

◆ GetVertexCount()

NEKMESHUTILS_EXPORT unsigned int Nektar::NekMeshUtils::Element::GetVertexCount ( ) const
inline

Returns the number of vertices.

Definition at line 156 of file Element.h.

References m_vertex.

157  {
158  return m_vertex.size();
159  }
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
Definition: Element.h:468

◆ GetVertexList()

NEKMESHUTILS_EXPORT std::vector<NodeSharedPtr> Nektar::NekMeshUtils::Element::GetVertexList ( ) const
inline

Access the list of vertex nodes.

Definition at line 116 of file Element.h.

References m_vertex.

117  {
118  return m_vertex;
119  }
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
Definition: Element.h:468

◆ GetVolumeNodes()

NEKMESHUTILS_EXPORT std::vector<NodeSharedPtr> Nektar::NekMeshUtils::Element::GetVolumeNodes ( ) const
inline

Access the list of volume nodes.

Definition at line 131 of file Element.h.

References m_volumeNodes.

132  {
133  return m_volumeNodes;
134  }
std::vector< NodeSharedPtr > m_volumeNodes
List of element volume nodes.
Definition: Element.h:474

◆ GetXmlCurveString()

string Nektar::NekMeshUtils::Element::GetXmlCurveString ( )

Generates a string listing the coordinates of all nodes associated with this element.

Definition at line 210 of file Element.cpp.

References GetCurvedNodes().

Referenced by GetCurvedNodes().

211 {
212  // Temporary node list for reordering
213  std::vector<NodeSharedPtr> nodeList;
214 
215  GetCurvedNodes(nodeList);
216 
217  // Finally generate the XML string corresponding to our new
218  // node reordering.
219  std::stringstream s;
220  std::string str;
221  for (int k = 0; k < nodeList.size(); ++k)
222  {
223  s << std::scientific << std::setprecision(8) << " "
224  << nodeList[k]->m_x << " " << nodeList[k]->m_y << " "
225  << nodeList[k]->m_z << " ";
226  }
227  return s.str();
228 }
virtual NEKMESHUTILS_EXPORT void GetCurvedNodes(std::vector< NodeSharedPtr > &nodeList) const
get list of volume interior nodes
Definition: Element.h:265

◆ GetXmlString()

string Nektar::NekMeshUtils::Element::GetXmlString ( )
virtual

Generate a list of vertices (1D), edges (2D), or faces (3D).

Definition at line 183 of file Element.cpp.

References m_dim, m_edge, m_face, and m_vertex.

Referenced by SetTagList().

184 {
185  std::stringstream s;
186  switch (m_dim)
187  {
188  case 1:
189  for (int j = 0; j < m_vertex.size(); ++j)
190  {
191  s << std::setw(5) << m_vertex[j]->m_id << " ";
192  }
193  break;
194  case 2:
195  for (int j = 0; j < m_edge.size(); ++j)
196  {
197  s << std::setw(5) << m_edge[j]->m_id << " ";
198  }
199  break;
200  case 3:
201  for (int j = 0; j < m_face.size(); ++j)
202  {
203  s << std::setw(5) << m_face[j]->m_id << " ";
204  }
205  break;
206  }
207  return s.str();
208 }
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
Definition: Element.h:468
unsigned int m_dim
Dimension of the element.
Definition: Element.h:460
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:470
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: Element.h:472

◆ HasBoundaryLinks()

NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::Element::HasBoundaryLinks ( )
inline

Is this element connected to a boundary.

Definition at line 253 of file Element.h.

References m_boundaryLinks.

254  {
255  return m_boundaryLinks.size() > 0;
256  }
std::map< int, int > m_boundaryLinks
Array mapping faces/edges to the location of the appropriate boundary elements in m->element...
Definition: Element.h:483

◆ IsDeformed()

NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::Element::IsDeformed ( )
inline

Determines whether an element is deformed by inspecting whether there are any edge, face or volume interior nodes.

Definition at line 295 of file Element.h.

References m_edge, m_face, and m_volumeNodes.

296  {
297  if (m_volumeNodes.size() > 0)
298  {
299  return true;
300  }
301 
302  for (auto &edge : m_edge)
303  {
304  if (edge->m_edgeNodes.size() > 0)
305  {
306  return true;
307  }
308  }
309 
310  for (auto &face : m_face)
311  {
312  if (face->m_faceNodes.size() > 0)
313  {
314  return true;
315  }
316  }
317 
318  return false;
319  }
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:470
std::vector< NodeSharedPtr > m_volumeNodes
List of element volume nodes.
Definition: Element.h:474
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: Element.h:472

◆ MakeOrder()

virtual NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Element::MakeOrder ( int  order,
SpatialDomains::GeometrySharedPtr  geom,
LibUtilities::PointsType  edgeType,
int  coordDim,
int &  id,
bool  justConfig = false 
)
inlinevirtual

Insert interior (i.e. volume) points into this element to make the geometry an order order representation.

Parameters
orderThe desired polynomial order.
geomThe geometry object used to describe the curvature mapping.
edgeTypeThe points distribution to use on the volume.
coordDimThe coordinate (i.e. space) dimension.
idCounter which should be incremented to supply consistent vertex IDs.
justConfigIf true, then the configuration Element::m_conf will be updated but no nodes will be generated. This is used when considering boundary elements, which just require copying of face or edge interior nodes.

Reimplemented in Nektar::NekMeshUtils::Hexahedron, Nektar::NekMeshUtils::Triangle, Nektar::NekMeshUtils::Prism, Nektar::NekMeshUtils::Quadrilateral, Nektar::NekMeshUtils::Tetrahedron, and Nektar::NekMeshUtils::Line.

Definition at line 378 of file Element.h.

References Nektar::ErrorUtil::efatal, and NEKERROR.

385  {
386  boost::ignore_unused(order, geom, edgeType, coordDim, id, justConfig);
388  "This function should be implemented at a shape level.");
389  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ Normal()

virtual NEKMESHUTILS_EXPORT Array<OneD, NekDouble> Nektar::NekMeshUtils::Element::Normal ( bool  inward = false)
inlinevirtual

returns the normal to the element

Reimplemented in Nektar::NekMeshUtils::Triangle.

Definition at line 446 of file Element.h.

References Nektar::ErrorUtil::efatal, and NEKERROR.

447  {
448  boost::ignore_unused(inward);
450  "This function should be implemented at a shape level.");
451  return Array<OneD, NekDouble>();
452  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209

◆ Print()

NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Element::Print ( )
inline

Definition at line 415 of file Element.h.

References m_edge, m_face, and m_vertex.

416  {
417  int i, j;
418  for (i = 0; i < m_vertex.size(); ++i)
419  {
420  std::cout << m_vertex[i]->m_x << " " << m_vertex[i]->m_y << " "
421  << m_vertex[i]->m_z << std::endl;
422  }
423  for (i = 0; i < m_edge.size(); ++i)
424  {
425  for (j = 0; j < m_edge[i]->m_edgeNodes.size(); ++j)
426  {
427  NodeSharedPtr n = m_edge[i]->m_edgeNodes[j];
428  std::cout << n->m_x << " " << n->m_y << " " << n->m_z
429  << std::endl;
430  }
431  }
432  for (i = 0; i < m_face.size(); ++i)
433  {
434  for (j = 0; j < m_face[i]->m_faceNodes.size(); ++j)
435  {
436  NodeSharedPtr n = m_face[i]->m_faceNodes[j];
437  std::cout << n->m_x << " " << n->m_y << " " << n->m_z
438  << std::endl;
439  }
440  }
441  }
std::shared_ptr< Node > NodeSharedPtr
Definition: CADVert.h:49
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
Definition: Element.h:468
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:470
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: Element.h:472

◆ SetBoundaryLink()

NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Element::SetBoundaryLink ( int  i,
int  j 
)
inline

Set a correspondence between edge or face i and its representative boundary element m->element[expDim-1][j].

Definition at line 235 of file Element.h.

References m_boundaryLinks.

236  {
237  m_boundaryLinks[i] = j;
238  }
std::map< int, int > m_boundaryLinks
Array mapping faces/edges to the location of the appropriate boundary elements in m->element...
Definition: Element.h:483

◆ SetCurveType()

NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Element::SetCurveType ( LibUtilities::PointsType  cT)
inline

Definition at line 143 of file Element.h.

References GetNodeCount(), m_curveType, and NEKMESHUTILS_EXPORT.

144  {
145  m_curveType = cT;
146  }
LibUtilities::PointsType m_curveType
Volume curve type.
Definition: Element.h:476

◆ SetEdge()

void Nektar::NekMeshUtils::Element::SetEdge ( unsigned int  p,
EdgeSharedPtr  pNew,
bool  descend = true 
)

Replace an edge in the element.

When an edge is replaced, the element faces are also searched and the corresponding face edges are updated to maintain consistency.

Parameters
pIndex of the edge to replace.
pNewNew edge.
descendIf true, we loop over faces and replace the corresponding face edge with pNew.

Definition at line 108 of file Element.cpp.

References m_edge, m_face, and CellMLToNektar.cellml_metadata::p.

Referenced by SetId().

109 {
110  EdgeSharedPtr vOld = m_edge[p];
111  m_edge[p] = pNew;
112 
113  if (!descend)
114  {
115  return;
116  }
117 
118  for (unsigned int i = 0; i < m_face.size(); ++i)
119  {
120  for (unsigned int j = 0; j < m_face[i]->m_edgeList.size(); ++j)
121  {
122  if (m_face[i]->m_edgeList[j] == vOld)
123  {
124  m_face[i]->m_edgeList[j] = pNew;
125  }
126  }
127  }
128 }
std::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge.
Definition: Edge.h:136
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:470
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: Element.h:472

◆ SetEdgeLink()

NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Element::SetEdgeLink ( EdgeSharedPtr  pLink)
inline

Set a correspondence between this element and an edge (2D boundary element).

Definition at line 213 of file Element.h.

References m_edgeLink.

214  {
215  m_edgeLink = pLink;
216  }
EdgeSharedPtr m_edgeLink
Pointer to the corresponding edge if element is a 2D boundary.
Definition: Element.h:478

◆ SetFace()

void Nektar::NekMeshUtils::Element::SetFace ( unsigned int  p,
FaceSharedPtr  pNew 
)

Replace a face in the element.

When a face is replaced, no other consistency checks are required.

Parameters
pIndex of the face to replace.
pNewNew face.

Definition at line 130 of file Element.cpp.

References m_face, and CellMLToNektar.cellml_metadata::p.

Referenced by SetId().

131 {
132  m_face[p] = pNew;
133 }
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: Element.h:472

◆ SetFaceLink()

NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Element::SetFaceLink ( FaceSharedPtr  pLink)
inline

Set a correspondence between this element and a face (3D boundary element).

Definition at line 224 of file Element.h.

References m_faceLink.

225  {
226  m_faceLink = pLink;
227  }
FaceSharedPtr m_faceLink
Pointer to the corresponding face if element is a 3D boundary.
Definition: Element.h:480

◆ SetId()

NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Element::SetId ( unsigned int  p)
inline

Change the ID of the element.

Definition at line 171 of file Element.h.

References m_id, NEKMESHUTILS_EXPORT, CellMLToNektar.cellml_metadata::p, SetEdge(), SetFace(), and SetVertex().

172  {
173  m_id = p;
174  }
unsigned int m_id
ID of the element.
Definition: Element.h:458

◆ SetTagList()

NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Element::SetTagList ( const std::vector< int > &  tags)
inline

Set the list of tags associated with this element.

Definition at line 258 of file Element.h.

References GetXmlString(), m_taglist, and NEKMESHUTILS_EXPORT.

259  {
260  m_taglist = tags;
261  }
std::vector< int > m_taglist
List of integers specifying properties of the element.
Definition: Element.h:466

◆ SetVertex()

void Nektar::NekMeshUtils::Element::SetVertex ( unsigned int  p,
NodeSharedPtr  pNew,
bool  descend = true 
)

Replace a vertex in the element.

When a vertex is replaced, the element edges and faces are also searched and the corresponding edge/face nodes are updated to maintain consistency.

Parameters
pIndex of the vertex to replace.
pNewNew vertex.
descendIf true, we loop over edges and faces and replace the corresponding vertices with pNew.

Definition at line 63 of file Element.cpp.

References m_edge, m_face, m_vertex, and CellMLToNektar.cellml_metadata::p.

Referenced by SetId().

64 {
65  NodeSharedPtr vOld = m_vertex[p];
66  m_vertex[p] = pNew;
67 
68  if (!descend)
69  {
70  return;
71  }
72 
73  for (unsigned int i = 0; i < m_edge.size(); ++i)
74  {
75  if (m_edge[i]->m_n1 == vOld)
76  {
77  m_edge[i]->m_n1 = pNew;
78  }
79  else if (m_edge[i]->m_n2 == vOld)
80  {
81  m_edge[i]->m_n2 = pNew;
82  }
83  }
84  for (unsigned int i = 0; i < m_face.size(); ++i)
85  {
86  // Replace vertices in faces
87  for (unsigned int j = 0; j < m_face[i]->m_vertexList.size(); ++j)
88  {
89  if (m_face[i]->m_vertexList[j] == vOld)
90  {
91  m_face[i]->m_vertexList[j] = pNew;
92  }
93  }
94  for (unsigned int j = 0; j < m_face[i]->m_edgeList.size(); ++j)
95  {
96  if (m_face[i]->m_edgeList[j]->m_n1 == vOld)
97  {
98  m_face[i]->m_edgeList[j]->m_n1 = pNew;
99  }
100  else if (m_face[i]->m_edgeList[j]->m_n2 == vOld)
101  {
102  m_face[i]->m_edgeList[j]->m_n2 = pNew;
103  }
104  }
105  }
106 }
std::shared_ptr< Node > NodeSharedPtr
Definition: CADVert.h:49
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
Definition: Element.h:468
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:470
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: Element.h:472

◆ SetVolumeNodes()

NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Element::SetVolumeNodes ( std::vector< NodeSharedPtr > &  nodes)
inline

Definition at line 135 of file Element.h.

References m_volumeNodes.

136  {
137  m_volumeNodes = nodes;
138  }
std::vector< NodeSharedPtr > m_volumeNodes
List of element volume nodes.
Definition: Element.h:474

Member Data Documentation

◆ m_boundaryLinks

std::map<int, int> Nektar::NekMeshUtils::Element::m_boundaryLinks
protected

Array mapping faces/edges to the location of the appropriate boundary elements in m->element.

Definition at line 483 of file Element.h.

Referenced by GetBoundaryLink(), HasBoundaryLinks(), and SetBoundaryLink().

◆ m_conf

ElmtConfig Nektar::NekMeshUtils::Element::m_conf
protected

◆ m_curveType

LibUtilities::PointsType Nektar::NekMeshUtils::Element::m_curveType
protected

◆ m_dim

unsigned int Nektar::NekMeshUtils::Element::m_dim
protected

◆ m_edge

std::vector<EdgeSharedPtr> Nektar::NekMeshUtils::Element::m_edge
protected

◆ m_edgeLink

EdgeSharedPtr Nektar::NekMeshUtils::Element::m_edgeLink
protected

Pointer to the corresponding edge if element is a 2D boundary.

Definition at line 478 of file Element.h.

Referenced by GetEdgeLink(), GetId(), GetTag(), and SetEdgeLink().

◆ m_face

std::vector<FaceSharedPtr> Nektar::NekMeshUtils::Element::m_face
protected

◆ m_faceLink

FaceSharedPtr Nektar::NekMeshUtils::Element::m_faceLink
protected

Pointer to the corresponding face if element is a 3D boundary.

Definition at line 480 of file Element.h.

Referenced by GetFaceLink(), GetId(), GetTag(), and SetFaceLink().

◆ m_geom

SpatialDomains::GeometrySharedPtr Nektar::NekMeshUtils::Element::m_geom
protected

Nektar++ geometry object for this element.

Definition at line 485 of file Element.h.

Referenced by Nektar::NekMeshUtils::Pyramid::GetGeom().

◆ m_id

unsigned int Nektar::NekMeshUtils::Element::m_id
protected

◆ m_parentCAD

CADObjectSharedPtr Nektar::NekMeshUtils::Element::m_parentCAD

Definition at line 454 of file Element.h.

Referenced by Nektar::NekMeshUtils::Triangle::Normal().

◆ m_tag

std::string Nektar::NekMeshUtils::Element::m_tag
protected

◆ m_taglist

std::vector<int> Nektar::NekMeshUtils::Element::m_taglist
protected

◆ m_vertex

std::vector<NodeSharedPtr> Nektar::NekMeshUtils::Element::m_vertex
protected

◆ m_volumeNodes

std::vector<NodeSharedPtr> Nektar::NekMeshUtils::Element::m_volumeNodes
protected