Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Nektar::NekMeshUtils::Line Class Reference

A 1-dimensional line between two vertex nodes. More...

#include <Line.h>

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

Public Member Functions

NEKMESHUTILS_EXPORT Line (ElmtConfig pConf, std::vector< NodeSharedPtr > pNodeList, std::vector< int > pTagList)
 Create a line element. More...
 
virtual NEKMESHUTILS_EXPORT ~Line ()
 
virtual NEKMESHUTILS_EXPORT void GetCurvedNodes (std::vector< NodeSharedPtr > &nodeList) const
 get list of volume interior nodes More...
 
virtual NEKMESHUTILS_EXPORT SpatialDomains::GeometrySharedPtr GetGeom (int coordDim)
 Generate a Nektar++ geometry object for this element. More...
 
virtual NEKMESHUTILS_EXPORT void MakeOrder (int order, SpatialDomains::GeometrySharedPtr geom, LibUtilities::PointsType pType, 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...
 
- Public Member Functions inherited from Nektar::NekMeshUtils::Element
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...
 
NEKMESHUTILS_EXPORT std::string GetXmlCurveString ()
 Generates a string listing the coordinates of all nodes associated with 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 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...
 

Static Public Member Functions

static ElementSharedPtr create (ElmtConfig pConf, std::vector< NodeSharedPtr > pNodeList, std::vector< int > pTagList)
 Creates an instance of this class. More...
 
static NEKMESHUTILS_EXPORT unsigned int GetNumNodes (ElmtConfig pConf)
 Return the number of nodes defining a line. More...
 

Static Public Attributes

static LibUtilities::ShapeType m_type
 Element type. More...
 

Additional Inherited Members

- Public Attributes inherited from Nektar::NekMeshUtils::Element
CADObjectSharedPtr m_parentCAD
 
- Protected Attributes inherited from Nektar::NekMeshUtils::Element
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

A 1-dimensional line between two vertex nodes.

Definition at line 48 of file Line.h.

Constructor & Destructor Documentation

◆ Line()

Nektar::NekMeshUtils::Line::Line ( ElmtConfig  pConf,
std::vector< NodeSharedPtr pNodeList,
std::vector< int >  pTagList 
)

Create a line element.

Definition at line 53 of file Line.cpp.

References Nektar::NekMeshUtils::Element::m_conf, Nektar::NekMeshUtils::Element::m_dim, Nektar::NekMeshUtils::ElmtConfig::m_order, Nektar::NekMeshUtils::Element::m_tag, Nektar::NekMeshUtils::Element::m_taglist, Nektar::NekMeshUtils::Element::m_vertex, and Nektar::NekMeshUtils::Element::m_volumeNodes.

56  : Element(pConf, GetNumNodes(pConf), pNodeList.size())
57 {
58  m_tag = "S";
59  m_dim = 1;
60  m_taglist = pTagList;
61  int n = m_conf.m_order - 1;
62 
63  // Add vertices
64  for (int i = 0; i < 2; ++i)
65  {
66  m_vertex.push_back(pNodeList[i]);
67  }
68 
69  if (m_conf.m_order > 1)
70  {
71  for (int j = 0; j < n; ++j)
72  {
73  m_volumeNodes.push_back(pNodeList[2 + j]);
74  }
75  }
76 }
ElmtConfig m_conf
Contains configuration of the element.
Definition: Element.h:462
std::vector< int > m_taglist
List of integers specifying properties of the element.
Definition: Element.h:466
unsigned int m_order
Order of the element.
Definition: ElementConfig.h:88
static NEKMESHUTILS_EXPORT unsigned int GetNumNodes(ElmtConfig pConf)
Return the number of nodes defining a line.
Definition: Line.cpp:187
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< NodeSharedPtr > m_volumeNodes
List of element volume nodes.
Definition: Element.h:474
std::string m_tag
Tag character describing the element.
Definition: Element.h:464
NEKMESHUTILS_EXPORT Element(ElmtConfig pConf, unsigned int pNumNodes, unsigned int pGotNodes)
Definition: Element.cpp:50

◆ ~Line()

virtual NEKMESHUTILS_EXPORT Nektar::NekMeshUtils::Line::~Line ( )
inlinevirtual

Definition at line 64 of file Line.h.

References GetCurvedNodes(), GetGeom(), GetNumNodes(), MakeOrder(), and NEKMESHUTILS_EXPORT.

65  {
66  }

Member Function Documentation

◆ create()

static ElementSharedPtr Nektar::NekMeshUtils::Line::create ( ElmtConfig  pConf,
std::vector< NodeSharedPtr pNodeList,
std::vector< int >  pTagList 
)
inlinestatic

Creates an instance of this class.

Definition at line 52 of file Line.h.

55  {
56  return std::make_shared<Line>(pConf, pNodeList, pTagList);
57  }

◆ GetCurvedNodes()

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

get list of volume interior nodes

Reimplemented from Nektar::NekMeshUtils::Element.

Definition at line 114 of file Line.cpp.

References Nektar::NekMeshUtils::Element::m_vertex, and Nektar::NekMeshUtils::Element::m_volumeNodes.

Referenced by ~Line().

115 {
116  nodeList.push_back(m_vertex[0]);
117  for (int i = 0; i < m_volumeNodes.size(); ++i)
118  {
119  nodeList.push_back(m_volumeNodes[i]);
120  }
121  nodeList.push_back(m_vertex[1]);
122 }
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
Definition: Element.h:468
std::vector< NodeSharedPtr > m_volumeNodes
List of element volume nodes.
Definition: Element.h:474

◆ GetGeom()

SpatialDomains::GeometrySharedPtr Nektar::NekMeshUtils::Line::GetGeom ( int  coordDim)
virtual

Generate a Nektar++ geometry object for this element.

Reimplemented from Nektar::NekMeshUtils::Element.

Definition at line 78 of file Line.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::NekMeshUtils::Element::m_curveType, Nektar::NekMeshUtils::Element::m_edge, Nektar::NekMeshUtils::Element::m_id, Nektar::NekMeshUtils::Element::m_vertex, and CellMLToNektar.cellml_metadata::p.

Referenced by ~Line().

79 {
80  // Create edge vertices.
83 
84  p[0] = m_vertex[0]->GetGeom(coordDim);
85  p[1] = m_vertex[1]->GetGeom(coordDim);
86 
87  if (m_edge[0]->m_edgeNodes.size() > 0)
88  {
91  m_id, m_edge[0]->m_curveType);
92 
93  c->m_points.push_back(p[0]);
94  for (int i = 0; i < m_edge[0]->m_edgeNodes.size(); ++i)
95  {
96  c->m_points.push_back(m_edge[0]->m_edgeNodes[i]->GetGeom(coordDim));
97  }
98  c->m_points.push_back(p[1]);
99 
101  m_id, 2, p, c);
102  }
103  else
104  {
106  m_id, 2, p);
107  }
108 
109  ret->Setup();
110  return ret;
111 }
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
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:59
std::shared_ptr< Curve > CurveSharedPtr
Definition: Curve.hpp:61
virtual NEKMESHUTILS_EXPORT SpatialDomains::GeometrySharedPtr GetGeom(int coordDim)
Generate a Nektar++ geometry object for this element.
Definition: Line.cpp:78
unsigned int m_id
ID of the element.
Definition: Element.h:458
LibUtilities::PointsType m_curveType
Volume curve type.
Definition: Element.h:476
std::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:62

◆ GetNumNodes()

unsigned int Nektar::NekMeshUtils::Line::GetNumNodes ( ElmtConfig  pConf)
static

Return the number of nodes defining a line.

Definition at line 187 of file Line.cpp.

References Nektar::NekMeshUtils::ElmtConfig::m_order.

Referenced by Nektar::Utilities::InputGmsh::GetNnodes(), and ~Line().

188 {
189  return pConf.m_order + 1;
190 }

◆ MakeOrder()

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

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 from Nektar::NekMeshUtils::Element.

Definition at line 123 of file Line.cpp.

References ASSERTL1, Nektar::LibUtilities::PointsKey::GetPointsDim(), Nektar::NekMeshUtils::Element::m_conf, Nektar::NekMeshUtils::Element::m_curveType, Nektar::NekMeshUtils::ElmtConfig::m_faceNodes, Nektar::NekMeshUtils::ElmtConfig::m_order, Nektar::NekMeshUtils::ElmtConfig::m_volumeNodes, Nektar::NekMeshUtils::Element::m_volumeNodes, class_topology::Node, and Nektar::LibUtilities::PointsManager().

Referenced by ~Line().

129 {
130  m_conf.m_order = order;
131  m_curveType = pType;
132  m_conf.m_volumeNodes = false;
133  m_volumeNodes.clear();
134 
135  // Lines of order == 1 have no interior volume points.
136  if (order == 1)
137  {
138  m_conf.m_faceNodes = false;
139  return;
140  }
141 
142  m_conf.m_faceNodes = true;
143 
144  if (justConfig)
145  {
146  return;
147  }
148 
149  int nPoints = order + 1;
150  StdRegions::StdExpansionSharedPtr xmap = geom->GetXmap();
151 
152  Array<OneD, NekDouble> px;
153  LibUtilities::PointsKey pKey(nPoints, pType);
154  ASSERTL1(pKey.GetPointsDim() == 1, "Points distribution must be 1D");
155  LibUtilities::PointsManager()[pKey]->GetPoints(px);
156 
157  Array<OneD, Array<OneD, NekDouble> > phys(coordDim);
158 
159  for (int i = 0; i < coordDim; ++i)
160  {
161  phys[i] = Array<OneD, NekDouble>(xmap->GetTotPoints());
162  xmap->BwdTrans(geom->GetCoeffs(i), phys[i]);
163  }
164 
165  int nQuadIntPts = (nPoints - 2) * (nPoints - 2);
166  m_volumeNodes.resize(nQuadIntPts);
167 
168  for (int i = 1, cnt = 0; i < nPoints-1; ++i)
169  {
170  Array<OneD, NekDouble> xp(1);
171  xp[0] = px[i];
172 
173  Array<OneD, NekDouble> x(3, 0.0);
174  for (int k = 0; k < coordDim; ++k)
175  {
176  x[k] = xmap->PhysEvaluate(xp, phys[k]);
177  }
178 
179  m_volumeNodes[cnt] = std::shared_ptr<Node>(
180  new Node(id++, x[0], x[1], x[2]));
181  }
182 }
bool m_faceNodes
Denotes whether the element contains face nodes. For 2D elements, if this is true then the element co...
Definition: ElementConfig.h:81
ElmtConfig m_conf
Contains configuration of the element.
Definition: Element.h:462
unsigned int m_order
Order of the element.
Definition: ElementConfig.h:88
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
bool m_volumeNodes
Denotes whether the element contains volume (i.e. interior) nodes. These are not supported by either ...
Definition: ElementConfig.h:86
PointsManagerT & PointsManager(void)
std::vector< NodeSharedPtr > m_volumeNodes
List of element volume nodes.
Definition: Element.h:474
LibUtilities::PointsType m_curveType
Volume curve type.
Definition: Element.h:476
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

Member Data Documentation

◆ m_type

LibUtilities::ShapeType Nektar::NekMeshUtils::Line::m_type
static
Initial value:

Element type.

Definition at line 59 of file Line.h.