Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
Nektar::Utilities::Face Class Reference

Represents a face comprised of three or more edges. More...

#include <MeshElements.h>

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

Public Member Functions

 Face (std::vector< NodeSharedPtr > pVertexList, std::vector< NodeSharedPtr > pFaceNodes, std::vector< EdgeSharedPtr > pEdgeList, LibUtilities::PointsType pCurveType)
 Create a new face.
 Face (const Face &pSrc)
 Copy an existing face.
 ~Face ()
bool operator== (Face &pSrc)
 Equality is defined by matching all vertices.
unsigned int GetNodeCount () const
 Returns the total number of nodes (vertices, edge nodes and face nodes).
std::string GetXmlCurveString () const
 Generates a string listing the coordinates of all nodes associated with this face.
SpatialDomains::Geometry2DSharedPtr GetGeom (int coordDim)
 Generate either SpatialDomains::TriGeom or SpatialDomains::QuadGeom for this element.

Public Attributes

unsigned int m_id
 ID of the face.
std::vector< NodeSharedPtrm_vertexList
 List of vertex nodes.
std::vector< EdgeSharedPtrm_edgeList
 List of corresponding edges.
std::vector< NodeSharedPtrm_faceNodes
 List of face-interior nodes defining the shape of the face.
LibUtilities::PointsType m_curveType
 Distribution of points in this face.
vector< pair< ElementSharedPtr,
int > > 
m_elLink
 Element(s) which are linked to this face.
SpatialDomains::Geometry2DSharedPtr m_geom

Detailed Description

Represents a face comprised of three or more edges.

A face is defined by a list of vertices, a list of edges joining these vertices, and a list of control nodes within the interior of the face, defining the shape of the face.

Definition at line 352 of file MeshElements.h.

Constructor & Destructor Documentation

Nektar::Utilities::Face::Face ( std::vector< NodeSharedPtr pVertexList,
std::vector< NodeSharedPtr pFaceNodes,
std::vector< EdgeSharedPtr pEdgeList,
LibUtilities::PointsType  pCurveType 
)
inline

Create a new face.

Definition at line 355 of file MeshElements.h.

: m_vertexList(pVertexList),
m_edgeList (pEdgeList),
m_faceNodes (pFaceNodes),
m_curveType (pCurveType),
m_geom () {}
Nektar::Utilities::Face::Face ( const Face pSrc)
inline

Copy an existing face.

Definition at line 366 of file MeshElements.h.

: m_vertexList(pSrc.m_vertexList), m_edgeList (pSrc.m_edgeList),
m_faceNodes (pSrc.m_faceNodes), m_curveType (pSrc.m_curveType),
m_geom (pSrc.m_geom) {}
Nektar::Utilities::Face::~Face ( )
inline

Definition at line 370 of file MeshElements.h.

{}

Member Function Documentation

SpatialDomains::Geometry2DSharedPtr Nektar::Utilities::Face::GetGeom ( int  coordDim)
inline

Generate either SpatialDomains::TriGeom or SpatialDomains::QuadGeom for this element.

Definition at line 501 of file MeshElements.h.

References Nektar::SpatialDomains::SegGeom::GetEdgeOrientation(), m_edgeList, and m_id.

{
int nEdge = m_edgeList.size();
for (int i = 0; i < nEdge; ++i)
{
edges[i] = m_edgeList[i]->GetGeom(coordDim);
}
for (int i = 0; i < nEdge; ++i)
{
*edges[i], *edges[(i+1) % nEdge]);
}
if (nEdge == 3)
{
ret = MemoryManager<SpatialDomains::TriGeom>::
AllocateSharedPtr(m_id, edges, edgeo);
}
else
{
ret = MemoryManager<SpatialDomains::QuadGeom>::
AllocateSharedPtr(m_id, edges, edgeo);
}
return ret;
}
unsigned int Nektar::Utilities::Face::GetNodeCount ( ) const
inline

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

Definition at line 389 of file MeshElements.h.

References m_edgeList, m_faceNodes, and m_vertexList.

Referenced by GetXmlCurveString().

{
unsigned int n = m_faceNodes.size();
for (int i = 0; i < m_edgeList.size(); ++i)
{
n += m_edgeList[i]->GetNodeCount();
}
n -= m_vertexList.size();
return n;
}
std::string Nektar::Utilities::Face::GetXmlCurveString ( ) const
inline

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

Definition at line 402 of file MeshElements.h.

References ASSERTL0, Nektar::LibUtilities::eNodalTriElec, Nektar::LibUtilities::eNodalTriEvenlySpaced, Nektar::LibUtilities::eNodalTriFekete, GetNodeCount(), m_curveType, m_edgeList, m_faceNodes, and m_vertexList.

{
std::stringstream s;
std::string str;
// Treat 2D point distributions differently to 3D.
{
vector<NodeSharedPtr> tmp;
int n = m_edgeList[0]->GetNodeCount();
tmp.insert(tmp.end(), m_vertexList.begin(), m_vertexList.end());
for (int k = 0; k < m_edgeList.size(); ++k)
{
tmp.insert(tmp.end(), m_edgeList[k]->m_edgeNodes.begin(),
m_edgeList[k]->m_edgeNodes.end());
if (m_edgeList[k]->m_n1 != m_vertexList[k])
{
// If edge orientation is reversed relative to node
// ordering, we need to reverse order of nodes.
std::reverse(tmp.begin() + 3 + k*(n-2),
tmp.begin() + 3 + (k+1)*(n-2));
}
}
tmp.insert(tmp.end(), m_faceNodes.begin(), m_faceNodes.end());
for (int k = 0; k < tmp.size(); ++k) {
s << std::scientific << std::setprecision(8) << " "
<< tmp[k]->m_x << " " << tmp[k]->m_y
<< " " << tmp[k]->m_z << " ";
}
return s.str();
}
else
{
// Write out in 2D tensor product order.
ASSERTL0(m_vertexList.size() == 4,
"Face nodes of tensor product only supported "
"for quadrilaterals.");
int n = (int)sqrt((NekDouble)GetNodeCount());
vector<NodeSharedPtr> tmp(n*n);
ASSERTL0(n*n == GetNodeCount(), "Wrong number of modes?");
// Write vertices
tmp[0] = m_vertexList[0];
tmp[n-1] = m_vertexList[1];
tmp[n*n-1] = m_vertexList[2];
tmp[n*(n-1)] = m_vertexList[3];
// Write edge-interior
int skips[4][2] = {{0,1}, {n-1,n}, {n*(n-1),1}, {0,n}};
for (int i = 0; i < 4; ++i)
{
bool reverseEdge = m_edgeList[i]->m_n1 == m_vertexList[i];
if (reverseEdge)
{
for (int j = n-2; j > 0; --j)
{
tmp[skips[i][0] + j*skips[i][1]] =
m_edgeList[i]->m_edgeNodes[j-1];
}
}
else
{
for (int j = 1; j < n-1; ++j)
{
tmp[skips[i][0] + j*skips[i][1]] =
m_edgeList[i]->m_edgeNodes[j-1];
}
}
}
// Write interior
for (int i = 1; i < n-1; ++i)
{
for (int j = 1; j < n-1; ++j)
{
tmp[i*n+j] = m_faceNodes[(i-1)*(n-2)+(j-1)];
}
}
for (int k = 0; k < tmp.size(); ++k) {
s << std::scientific << std::setprecision(8) << " "
<< tmp[k]->m_x << " " << tmp[k]->m_y
<< " " << tmp[k]->m_z << " ";
}
return s.str();
}
}
bool Nektar::Utilities::Face::operator== ( Face pSrc)
inline

Equality is defined by matching all vertices.

Definition at line 373 of file MeshElements.h.

References Nektar::StdRegions::find(), Nektar::iterator, and m_vertexList.

{
for (it1 = m_vertexList.begin(); it1 != m_vertexList.end(); ++it1)
{
if (find(pSrc.m_vertexList.begin(), pSrc.m_vertexList.end(), *it1)
== pSrc.m_vertexList.end())
{
return false;
}
}
return true;
}

Member Data Documentation

LibUtilities::PointsType Nektar::Utilities::Face::m_curveType

Distribution of points in this face.

Definition at line 543 of file MeshElements.h.

Referenced by Nektar::Utilities::Element::GetCurveType(), GetXmlCurveString(), and Nektar::Utilities::Element::SetCurveType().

std::vector<EdgeSharedPtr> Nektar::Utilities::Face::m_edgeList

List of corresponding edges.

Definition at line 539 of file MeshElements.h.

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

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

Element(s) which are linked to this face.

Definition at line 545 of file MeshElements.h.

std::vector<NodeSharedPtr> Nektar::Utilities::Face::m_faceNodes

List of face-interior nodes defining the shape of the face.

Definition at line 541 of file MeshElements.h.

Referenced by GetNodeCount(), and GetXmlCurveString().

SpatialDomains::Geometry2DSharedPtr Nektar::Utilities::Face::m_geom

Definition at line 547 of file MeshElements.h.

unsigned int Nektar::Utilities::Face::m_id

ID of the face.

Definition at line 535 of file MeshElements.h.

Referenced by GetGeom(), Nektar::Utilities::Element::GetId(), and Nektar::Utilities::Element::SetId().

std::vector<NodeSharedPtr> Nektar::Utilities::Face::m_vertexList

List of vertex nodes.

Definition at line 537 of file MeshElements.h.

Referenced by GetNodeCount(), GetXmlCurveString(), and operator==().