Nektar++
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. More...
 
 Face (const Face &pSrc)
 Copy an existing face. More...
 
 ~Face ()
 
bool operator== (Face &pSrc)
 Equality is defined by matching all vertices. More...
 
unsigned int GetNodeCount () const
 Returns the total number of nodes (vertices, edge nodes and face nodes). More...
 
std::string GetXmlCurveString () const
 Generates a string listing the coordinates of all nodes associated with this face. More...
 
SpatialDomains::Geometry2DSharedPtr GetGeom (int coordDim)
 Generate either SpatialDomains::TriGeom or SpatialDomains::QuadGeom for this element. More...
 

Public Attributes

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

359  : m_vertexList(pVertexList),
360  m_edgeList (pEdgeList),
361  m_faceNodes (pFaceNodes),
362  m_curveType (pCurveType),
363  m_geom () {}
LibUtilities::PointsType m_curveType
Distribution of points in this face.
Definition: MeshElements.h:543
std::vector< NodeSharedPtr > m_vertexList
List of vertex nodes.
Definition: MeshElements.h:537
SpatialDomains::Geometry2DSharedPtr m_geom
Definition: MeshElements.h:547
std::vector< NodeSharedPtr > m_faceNodes
List of face-interior nodes defining the shape of the face.
Definition: MeshElements.h:541
std::vector< EdgeSharedPtr > m_edgeList
List of corresponding edges.
Definition: MeshElements.h:539
Nektar::Utilities::Face::Face ( const Face pSrc)
inline

Copy an existing face.

Definition at line 366 of file MeshElements.h.

367  : m_vertexList(pSrc.m_vertexList), m_edgeList (pSrc.m_edgeList),
368  m_faceNodes (pSrc.m_faceNodes), m_curveType (pSrc.m_curveType),
369  m_geom (pSrc.m_geom) {}
LibUtilities::PointsType m_curveType
Distribution of points in this face.
Definition: MeshElements.h:543
std::vector< NodeSharedPtr > m_vertexList
List of vertex nodes.
Definition: MeshElements.h:537
SpatialDomains::Geometry2DSharedPtr m_geom
Definition: MeshElements.h:547
std::vector< NodeSharedPtr > m_faceNodes
List of face-interior nodes defining the shape of the face.
Definition: MeshElements.h:541
std::vector< EdgeSharedPtr > m_edgeList
List of corresponding edges.
Definition: MeshElements.h:539
Nektar::Utilities::Face::~Face ( )
inline

Definition at line 370 of file MeshElements.h.

370 {}

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::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::SpatialDomains::SegGeom::GetEdgeOrientation(), m_edgeList, and m_id.

502  {
503  int nEdge = m_edgeList.size();
504 
507  StdRegions::Orientation edgeo[4];
508 
509  for (int i = 0; i < nEdge; ++i)
510  {
511  edges[i] = m_edgeList[i]->GetGeom(coordDim);
512  }
513 
514  for (int i = 0; i < nEdge; ++i)
515  {
517  *edges[i], *edges[(i+1) % nEdge]);
518  }
519 
520  if (nEdge == 3)
521  {
523  AllocateSharedPtr(m_id, edges, edgeo);
524  }
525  else
526  {
528  AllocateSharedPtr(m_id, edges, edgeo);
529  }
530 
531  return ret;
532  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
static StdRegions::Orientation GetEdgeOrientation(const SegGeom &edge1, const SegGeom &edge2)
Get the orientation of edge1.
Definition: SegGeom.cpp:293
boost::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:60
unsigned int m_id
ID of the face.
Definition: MeshElements.h:535
boost::shared_ptr< Geometry2D > Geometry2DSharedPtr
Definition: Geometry2D.h:59
std::vector< EdgeSharedPtr > m_edgeList
List of corresponding edges.
Definition: MeshElements.h:539
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().

390  {
391  unsigned int n = m_faceNodes.size();
392  for (int i = 0; i < m_edgeList.size(); ++i)
393  {
394  n += m_edgeList[i]->GetNodeCount();
395  }
396  n -= m_vertexList.size();
397  return n;
398  }
std::vector< NodeSharedPtr > m_vertexList
List of vertex nodes.
Definition: MeshElements.h:537
std::vector< NodeSharedPtr > m_faceNodes
List of face-interior nodes defining the shape of the face.
Definition: MeshElements.h:541
std::vector< EdgeSharedPtr > m_edgeList
List of corresponding edges.
Definition: MeshElements.h:539
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.

403  {
404  std::stringstream s;
405  std::string str;
406 
407  // Treat 2D point distributions differently to 3D.
411  {
412  vector<NodeSharedPtr> tmp;
413  int n = m_edgeList[0]->GetNodeCount();
414 
415  tmp.insert(tmp.end(), m_vertexList.begin(), m_vertexList.end());
416  for (int k = 0; k < m_edgeList.size(); ++k)
417  {
418  tmp.insert(tmp.end(), m_edgeList[k]->m_edgeNodes.begin(),
419  m_edgeList[k]->m_edgeNodes.end());
420  if (m_edgeList[k]->m_n1 != m_vertexList[k])
421  {
422  // If edge orientation is reversed relative to node
423  // ordering, we need to reverse order of nodes.
424  std::reverse(tmp.begin() + 3 + k*(n-2),
425  tmp.begin() + 3 + (k+1)*(n-2));
426  }
427  }
428  tmp.insert(tmp.end(), m_faceNodes.begin(), m_faceNodes.end());
429 
430  for (int k = 0; k < tmp.size(); ++k) {
431  s << std::scientific << std::setprecision(8) << " "
432  << tmp[k]->m_x << " " << tmp[k]->m_y
433  << " " << tmp[k]->m_z << " ";
434  }
435 
436  return s.str();
437  }
438  else
439  {
440  // Write out in 2D tensor product order.
441  ASSERTL0(m_vertexList.size() == 4,
442  "Face nodes of tensor product only supported "
443  "for quadrilaterals.");
444 
445  int n = (int)sqrt((NekDouble)GetNodeCount());
446  vector<NodeSharedPtr> tmp(n*n);
447 
448  ASSERTL0(n*n == GetNodeCount(), "Wrong number of modes?");
449 
450  // Write vertices
451  tmp[0] = m_vertexList[0];
452  tmp[n-1] = m_vertexList[1];
453  tmp[n*n-1] = m_vertexList[2];
454  tmp[n*(n-1)] = m_vertexList[3];
455 
456  // Write edge-interior
457  int skips[4][2] = {{0,1}, {n-1,n}, {n*n-1,-1}, {n*(n-1),-n}};
458  for (int i = 0; i < 4; ++i)
459  {
460  bool reverseEdge = m_edgeList[i]->m_n1 == m_vertexList[i];
461 
462  if (!reverseEdge)
463  {
464  for (int j = 1; j < n-1; ++j)
465  {
466  tmp[skips[i][0] + j*skips[i][1]] =
467  m_edgeList[i]->m_edgeNodes[n-2-j];
468  }
469  }
470  else
471  {
472  for (int j = 1; j < n-1; ++j)
473  {
474  tmp[skips[i][0] + j*skips[i][1]] =
475  m_edgeList[i]->m_edgeNodes[j-1];
476  }
477  }
478  }
479 
480  // Write interior
481  for (int i = 1; i < n-1; ++i)
482  {
483  for (int j = 1; j < n-1; ++j)
484  {
485  tmp[i*n+j] = m_faceNodes[(i-1)*(n-2)+(j-1)];
486  }
487  }
488 
489  for (int k = 0; k < tmp.size(); ++k) {
490  s << std::scientific << std::setprecision(8) << " "
491  << tmp[k]->m_x << " " << tmp[k]->m_y
492  << " " << tmp[k]->m_z << " ";
493  }
494 
495  return s.str();
496  }
497  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
LibUtilities::PointsType m_curveType
Distribution of points in this face.
Definition: MeshElements.h:543
std::vector< NodeSharedPtr > m_vertexList
List of vertex nodes.
Definition: MeshElements.h:537
double NekDouble
std::vector< NodeSharedPtr > m_faceNodes
List of face-interior nodes defining the shape of the face.
Definition: MeshElements.h:541
2D Nodal Fekete Points on a Triangle
Definition: PointsType.h:69
std::vector< EdgeSharedPtr > m_edgeList
List of corresponding edges.
Definition: MeshElements.h:539
2D Evenly-spaced points on a Triangle
Definition: PointsType.h:70
unsigned int GetNodeCount() const
Returns the total number of nodes (vertices, edge nodes and face nodes).
Definition: MeshElements.h:389
2D Nodal Electrostatic Points on a Triangle
Definition: PointsType.h:68
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.

374  {
376  for (it1 = m_vertexList.begin(); it1 != m_vertexList.end(); ++it1)
377  {
378  if (find(pSrc.m_vertexList.begin(), pSrc.m_vertexList.end(), *it1)
379  == pSrc.m_vertexList.end())
380  {
381  return false;
382  }
383  }
384  return true;
385  }
std::vector< NodeSharedPtr > m_vertexList
List of vertex nodes.
Definition: MeshElements.h:537
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Definition: StdRegions.hpp:312

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