Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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.
 Edge (const Edge &pSrc)
 Copies an existing edge.
 ~Edge ()
unsigned int GetNodeCount () const
 Returns the total number of nodes defining the edge.
std::string GetXmlCurveString () const
 Creates a Nektar++ string listing the coordinates of all the nodes.
SpatialDomains::SegGeomSharedPtr GetGeom (int coordDim)
 Generate a SpatialDomains::SegGeom object for this edge.

Public Attributes

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

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.

: m_n1(pVertex1), m_n2(pVertex2), m_edgeNodes(pEdgeNodes),
m_curveType(pCurveType), m_geom() {}
Nektar::Utilities::Edge::Edge ( const Edge pSrc)
inline

Copies an existing edge.

Definition at line 236 of file MeshElements.h.

: m_n1(pSrc.m_n1), m_n2(pSrc.m_n2), m_edgeNodes(pSrc.m_edgeNodes),
m_curveType(pSrc.m_curveType), m_geom(pSrc.m_geom) {}
Nektar::Utilities::Edge::~Edge ( )
inline

Definition at line 239 of file MeshElements.h.

{}

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 m_curveType, m_edgeNodes, m_id, m_n1, and m_n2.

{
// Create edge vertices.
p[0] = m_n1->GetGeom(coordDim);
p[1] = m_n2->GetGeom(coordDim);
// Create a curve if high-order information exists.
if (m_edgeNodes.size() > 0)
{
MemoryManager<SpatialDomains::Curve>::
AllocateSharedPtr(m_id, m_curveType);
c->m_points.push_back(p[0]);
for (int i = 0; i < m_edgeNodes.size(); ++i)
{
c->m_points.push_back(m_edgeNodes[i]->GetGeom(coordDim));
}
c->m_points.push_back(p[1]);
ret = MemoryManager<SpatialDomains::SegGeom>::
AllocateSharedPtr(m_id, coordDim, p, c);
}
else
{
ret = MemoryManager<SpatialDomains::SegGeom>::
AllocateSharedPtr(m_id, coordDim, p);
}
return ret;
}
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.

{
return m_edgeNodes.size() + 2;
}
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.

{
std::stringstream s;
std::string str;
s << std::scientific << std::setprecision(8) << " "
<< m_n1->m_x << " " << m_n1->m_y << " " << m_n1->m_z << " ";
for (int k = 0; k < m_edgeNodes.size(); ++k) {
s << std::scientific << std::setprecision(8) << " "
<< m_edgeNodes[k]->m_x << " " << m_edgeNodes[k]->m_y
<< " " << m_edgeNodes[k]->m_z << " ";
}
s << std::scientific << std::setprecision(8) << " "
<< m_n2->m_x << " " << m_n2->m_y << " " << m_n2->m_z;
return s.str();
}

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