Nektar++
Public Member Functions | Public Attributes | Private Attributes | List of all members
Nektar::Utilities::Edge Class Reference

Represents an edge which joins two points. More...

#include <MeshElements.h>

Collaboration diagram for Nektar::Utilities::Edge:
Collaboration graph
[legend]

Public Member Functions

 Edge (NodeSharedPtr pVertex1, NodeSharedPtr pVertex2, std::vector< NodeSharedPtr > pEdgeNodes, LibUtilities::PointsType pCurveType)
 Creates a new edge. More...
 
 Edge (const Edge &pSrc)
 Copies an existing edge. More...
 
 ~Edge ()
 
unsigned int GetNodeCount () const
 Returns the total number of nodes defining the edge. More...
 
std::string GetXmlCurveString () const
 Creates a Nektar++ string listing the coordinates of all the nodes. More...
 
SpatialDomains::SegGeomSharedPtr GetGeom (int coordDim)
 Generate a SpatialDomains::SegGeom object for this edge. More...
 

Public Attributes

unsigned int m_id
 ID of edge. More...
 
NodeSharedPtr m_n1
 First vertex node. More...
 
NodeSharedPtr m_n2
 Second vertex node. More...
 
std::vector< NodeSharedPtrm_edgeNodes
 List of control nodes between the first and second vertices. More...
 
LibUtilities::PointsType m_curveType
 Distributions of points along edge. More...
 
vector< pair< ElementSharedPtr, int > > m_elLink
 Element(s) which are linked to this edge. More...
 

Private Attributes

SpatialDomains::SegGeomSharedPtr m_geom
 

Detailed Description

Represents an edge which joins two points.

An edge is defined by two nodes (vertices) and, for high-order edges, a set of control nodes defining the shape of the edge.

Definition at line 227 of file MeshElements.h.

Constructor & Destructor Documentation

Nektar::Utilities::Edge::Edge ( NodeSharedPtr  pVertex1,
NodeSharedPtr  pVertex2,
std::vector< NodeSharedPtr pEdgeNodes,
LibUtilities::PointsType  pCurveType 
)
inline

Creates a new edge.

Definition at line 230 of file MeshElements.h.

233  : m_n1(pVertex1), m_n2(pVertex2), m_edgeNodes(pEdgeNodes),
234  m_curveType(pCurveType), m_geom() {}
NodeSharedPtr m_n2
Second vertex node.
Definition: MeshElements.h:306
SpatialDomains::SegGeomSharedPtr m_geom
Definition: MeshElements.h:315
std::vector< NodeSharedPtr > m_edgeNodes
List of control nodes between the first and second vertices.
Definition: MeshElements.h:308
LibUtilities::PointsType m_curveType
Distributions of points along edge.
Definition: MeshElements.h:310
NodeSharedPtr m_n1
First vertex node.
Definition: MeshElements.h:304
Nektar::Utilities::Edge::Edge ( const Edge pSrc)
inline

Copies an existing edge.

Definition at line 236 of file MeshElements.h.

237  : m_n1(pSrc.m_n1), m_n2(pSrc.m_n2), m_edgeNodes(pSrc.m_edgeNodes),
238  m_curveType(pSrc.m_curveType), m_geom(pSrc.m_geom) {}
NodeSharedPtr m_n2
Second vertex node.
Definition: MeshElements.h:306
SpatialDomains::SegGeomSharedPtr m_geom
Definition: MeshElements.h:315
std::vector< NodeSharedPtr > m_edgeNodes
List of control nodes between the first and second vertices.
Definition: MeshElements.h:308
LibUtilities::PointsType m_curveType
Distributions of points along edge.
Definition: MeshElements.h:310
NodeSharedPtr m_n1
First vertex node.
Definition: MeshElements.h:304
Nektar::Utilities::Edge::~Edge ( )
inline

Definition at line 239 of file MeshElements.h.

239 {}

Member Function Documentation

SpatialDomains::SegGeomSharedPtr Nektar::Utilities::Edge::GetGeom ( int  coordDim)
inline

Generate a SpatialDomains::SegGeom object for this edge.

Definition at line 266 of file MeshElements.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), m_curveType, m_edgeNodes, m_id, m_n1, and m_n2.

267  {
268  // Create edge vertices.
271 
272  p[0] = m_n1->GetGeom(coordDim);
273  p[1] = m_n2->GetGeom(coordDim);
274 
275  // Create a curve if high-order information exists.
276  if (m_edgeNodes.size() > 0)
277  {
281 
282  c->m_points.push_back(p[0]);
283  for (int i = 0; i < m_edgeNodes.size(); ++i)
284  {
285  c->m_points.push_back(m_edgeNodes[i]->GetGeom(coordDim));
286  }
287  c->m_points.push_back(p[1]);
288 
290  AllocateSharedPtr(m_id, coordDim, p, c);
291  }
292  else
293  {
295  AllocateSharedPtr(m_id, coordDim, p);
296  }
297 
298  return ret;
299  }
NodeSharedPtr m_n2
Second vertex node.
Definition: MeshElements.h:306
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
unsigned int m_id
ID of edge.
Definition: MeshElements.h:302
std::vector< NodeSharedPtr > m_edgeNodes
List of control nodes between the first and second vertices.
Definition: MeshElements.h:308
boost::shared_ptr< Curve > CurveSharedPtr
Definition: Curve.hpp:62
boost::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:60
LibUtilities::PointsType m_curveType
Distributions of points along edge.
Definition: MeshElements.h:310
SpatialDomains::SegGeomSharedPtr GetGeom(int coordDim)
Generate a SpatialDomains::SegGeom object for this edge.
Definition: MeshElements.h:266
NodeSharedPtr m_n1
First vertex node.
Definition: MeshElements.h:304
boost::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:60
unsigned int Nektar::Utilities::Edge::GetNodeCount ( ) const
inline

Returns the total number of nodes defining the edge.

Definition at line 242 of file MeshElements.h.

References m_edgeNodes.

243  {
244  return m_edgeNodes.size() + 2;
245  }
std::vector< NodeSharedPtr > m_edgeNodes
List of control nodes between the first and second vertices.
Definition: MeshElements.h:308
std::string Nektar::Utilities::Edge::GetXmlCurveString ( ) const
inline

Creates a Nektar++ string listing the coordinates of all the nodes.

Definition at line 249 of file MeshElements.h.

References m_edgeNodes, m_n1, and m_n2.

250  {
251  std::stringstream s;
252  std::string str;
253  s << std::scientific << std::setprecision(8) << " "
254  << m_n1->m_x << " " << m_n1->m_y << " " << m_n1->m_z << " ";
255  for (int k = 0; k < m_edgeNodes.size(); ++k) {
256  s << std::scientific << std::setprecision(8) << " "
257  << m_edgeNodes[k]->m_x << " " << m_edgeNodes[k]->m_y
258  << " " << m_edgeNodes[k]->m_z << " ";
259  }
260  s << std::scientific << std::setprecision(8) << " "
261  << m_n2->m_x << " " << m_n2->m_y << " " << m_n2->m_z;
262  return s.str();
263  }
NodeSharedPtr m_n2
Second vertex node.
Definition: MeshElements.h:306
std::vector< NodeSharedPtr > m_edgeNodes
List of control nodes between the first and second vertices.
Definition: MeshElements.h:308
NodeSharedPtr m_n1
First vertex node.
Definition: MeshElements.h:304

Member Data Documentation

LibUtilities::PointsType Nektar::Utilities::Edge::m_curveType

Distributions of points along edge.

Definition at line 310 of file MeshElements.h.

Referenced by GetGeom().

std::vector<NodeSharedPtr> Nektar::Utilities::Edge::m_edgeNodes

List of control nodes between the first and second vertices.

Definition at line 308 of file MeshElements.h.

Referenced by GetGeom(), GetNodeCount(), and GetXmlCurveString().

vector<pair<ElementSharedPtr, int> > Nektar::Utilities::Edge::m_elLink

Element(s) which are linked to this edge.

Definition at line 312 of file MeshElements.h.

SpatialDomains::SegGeomSharedPtr Nektar::Utilities::Edge::m_geom
private

Definition at line 315 of file MeshElements.h.

unsigned int Nektar::Utilities::Edge::m_id

ID of edge.

Definition at line 302 of file MeshElements.h.

Referenced by GetGeom().

NodeSharedPtr Nektar::Utilities::Edge::m_n1

First vertex node.

Definition at line 304 of file MeshElements.h.

Referenced by GetGeom(), and GetXmlCurveString().

NodeSharedPtr Nektar::Utilities::Edge::m_n2

Second vertex node.

Definition at line 306 of file MeshElements.h.

Referenced by GetGeom(), and GetXmlCurveString().