Nektar++
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Nektar::Utilities::Pyramid Class Reference

A 3-dimensional square-based pyramidic element. More...

#include <MeshElements.h>

Inheritance diagram for Nektar::Utilities::Pyramid:
Inheritance graph
[legend]
Collaboration diagram for Nektar::Utilities::Pyramid:
Collaboration graph
[legend]

Public Member Functions

 Pyramid (ElmtConfig pConf, std::vector< NodeSharedPtr > pNodeList, std::vector< int > pTagList)
 Create a pyramidic element. More...
 
 Pyramid (const Pyramid &pSrc)
 
virtual ~Pyramid ()
 
virtual SpatialDomains::GeometrySharedPtr GetGeom (int coordDim)
 Generate a Nektar++ geometry object for this element. More...
 
- Public Member Functions inherited from Nektar::Utilities::Element
 Element (ElmtConfig pConf, unsigned int pNumNodes, unsigned int pGotNodes)
 
unsigned int GetId () const
 Returns the ID of the element (or associated edge or face for boundary elements). More...
 
unsigned int GetDim () const
 Returns the expansion dimension of the element. More...
 
ElmtConfig GetConf () const
 Returns the configuration of the element. More...
 
std::string GetTag () const
 Returns the tag which defines the element shape. More...
 
NodeSharedPtr GetVertex (unsigned int i) const
 Access a vertex node. More...
 
EdgeSharedPtr GetEdge (unsigned int i) const
 Access an edge. More...
 
FaceSharedPtr GetFace (unsigned int i) const
 Access a face. More...
 
std::vector< NodeSharedPtrGetVertexList () const
 Access the list of vertex nodes. More...
 
std::vector< EdgeSharedPtrGetEdgeList () const
 Access the list of edges. More...
 
std::vector< FaceSharedPtrGetFaceList () const
 Access the list of faces. More...
 
std::vector< NodeSharedPtrGetVolumeNodes () const
 Access the list of volume nodes. More...
 
void SetVolumeNodes (std::vector< NodeSharedPtr > &nodes)
 
LibUtilities::PointsType GetCurveType () const
 
void SetCurveType (LibUtilities::PointsType cT)
 
unsigned int GetNodeCount () const
 Returns the total number of nodes (vertices, edge nodes and face nodes and volume nodes). More...
 
std::vector< int > GetTagList () const
 Access the list of tags associated with this element. More...
 
unsigned int GetVertexCount () const
 Returns the number of vertices. More...
 
unsigned int GetEdgeCount () const
 Returns the number of edges. More...
 
unsigned int GetFaceCount () const
 Returns the number of faces. More...
 
void SetId (unsigned int p)
 Change the ID of the element. More...
 
void SetVertex (unsigned int p, NodeSharedPtr pNew)
 Replace a vertex with another vertex object. More...
 
void SetEdge (unsigned int p, EdgeSharedPtr pNew)
 Replace an edge with another edge object. More...
 
void SetFace (unsigned int p, FaceSharedPtr pNew)
 Replace a face with another face object. More...
 
void SetEdgeLink (EdgeSharedPtr pLink)
 Set a correspondence between this element and an edge (2D boundary element). More...
 
EdgeSharedPtr GetEdgeLink ()
 Get correspondence between this element and an edge. More...
 
void SetFaceLink (FaceSharedPtr pLink)
 Set a correspondence between this element and a face (3D boundary element). More...
 
FaceSharedPtr GetFaceLink ()
 Get correspondence between this element and a face. More...
 
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...
 
int GetBoundaryLink (int i)
 Get the location of the boundary face/edge i for this element. More...
 
void SetTagList (const std::vector< int > &tags)
 Set the list of tags associated with this element. More...
 
virtual std::string GetXmlString () const
 Generate a list of vertices (1D), edges (2D), or faces (3D). More...
 
std::string GetXmlCurveString () const
 Generates a string listing the coordinates of all nodes associated with this element. More...
 
int GetMaxOrder ()
 Obtain the order of an element by looking at edges. More...
 
virtual void Complete (int order)
 Complete this object. More...
 
void Print ()
 

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 unsigned int GetNumNodes (ElmtConfig pConf)
 Return the number of nodes defining a pyramid. More...
 

Public Attributes

int orientationMap [5]
 

Static Public Attributes

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

Additional Inherited Members

- Protected Attributes inherited from Nektar::Utilities::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 3-dimensional square-based pyramidic element.

Definition at line 1460 of file MeshElements.h.

Constructor & Destructor Documentation

Nektar::Utilities::Pyramid::Pyramid ( ElmtConfig  pConf,
std::vector< NodeSharedPtr pNodeList,
std::vector< int >  pTagList 
)

Create a pyramidic element.

Definition at line 1319 of file MeshElements.cpp.

References Nektar::iterator, Nektar::Utilities::Element::m_conf, Nektar::Utilities::Element::m_dim, Nektar::Utilities::Element::m_edge, Nektar::Utilities::ElmtConfig::m_edgeCurveType, Nektar::Utilities::Element::m_face, Nektar::Utilities::ElmtConfig::m_faceCurveType, Nektar::Utilities::ElmtConfig::m_faceNodes, Nektar::Utilities::ElmtConfig::m_order, Nektar::Utilities::Element::m_tag, Nektar::Utilities::Element::m_taglist, and Nektar::Utilities::Element::m_vertex.

1322  : Element(pConf, GetNumNodes(pConf), pNodeList.size())
1323  {
1324  m_tag = "P";
1325  m_dim = 3;
1326  m_taglist = pTagList;
1327  int n = m_conf.m_order-1;
1328 
1329  // This edge-node map is based on Nektar++ ordering.
1330  map<pair<int,int>, int> edgeNodeMap;
1331  map<pair<int,int>, int>::iterator it;
1332  edgeNodeMap[pair<int,int>(1,2)] = 6;
1333  edgeNodeMap[pair<int,int>(2,3)] = 6 + n;
1334  edgeNodeMap[pair<int,int>(4,3)] = 6 + 2*n;
1335  edgeNodeMap[pair<int,int>(1,4)] = 6 + 3*n;
1336  edgeNodeMap[pair<int,int>(1,5)] = 6 + 4*n;
1337  edgeNodeMap[pair<int,int>(2,5)] = 6 + 5*n;
1338  edgeNodeMap[pair<int,int>(3,5)] = 6 + 6*n;
1339  edgeNodeMap[pair<int,int>(4,5)] = 6 + 7*n;
1340 
1341  // Add vertices
1342  for (int i = 0; i < 5; ++i)
1343  {
1344  m_vertex.push_back(pNodeList[i]);
1345  }
1346 
1347  // Create edges (with corresponding set of edge points)
1348  int eid = 0;
1349  for (it = edgeNodeMap.begin(); it != edgeNodeMap.end(); ++it)
1350  {
1351  vector<NodeSharedPtr> edgeNodes;
1352  if (m_conf.m_order > 1)
1353  {
1354  for (int j = it->second; j < it->second + n; ++j)
1355  {
1356  edgeNodes.push_back(pNodeList[j-1]);
1357  }
1358  }
1359  m_edge.push_back(
1360  EdgeSharedPtr(new Edge(pNodeList[it->first.first-1],
1361  pNodeList[it->first.second-1],
1362  edgeNodes,
1364  m_edge.back()->m_id = eid++;
1365  }
1366 
1367  // Create faces
1368  int face_ids[5][4] = {
1369  {0,1,2,3}, {0,1,4,-1}, {1,2,4,-1}, {3,2,4,-1}, {0,3,4,-1}
1370  };
1371  int face_edges[5][4];
1372  int faceoffset = 5 + 8*n;
1373  for (int j = 0; j < 5; ++j)
1374  {
1375  vector<NodeSharedPtr> faceVertices;
1376  vector<EdgeSharedPtr> faceEdges;
1377  vector<NodeSharedPtr> faceNodes;
1378  int nEdge = j > 0 ? 3 : 4;
1379 
1380  for (int k = 0; k < nEdge; ++k)
1381  {
1382  faceVertices.push_back(m_vertex[face_ids[j][k]]);
1383  NodeSharedPtr a = m_vertex[face_ids[j][k]];
1384  NodeSharedPtr b = m_vertex[face_ids[j][(k+1) % nEdge]];
1385  for (unsigned int i = 0; i < m_edge.size(); ++i)
1386  {
1387  if ((m_edge[i]->m_n1 == a && m_edge[i]->m_n2 == b) ||
1388  (m_edge[i]->m_n1 == b && m_edge[i]->m_n2 == a))
1389  {
1390  faceEdges.push_back(m_edge[i]);
1391  face_edges[j][k] = i;
1392  break;
1393  }
1394  }
1395  }
1396 
1397  if (m_conf.m_faceNodes)
1398  {
1399  int facenodes = j == 0 ? n*n : n*(n-1)/2;
1400  for (int i = 0; i < facenodes; ++i)
1401  {
1402  faceNodes.push_back(pNodeList[faceoffset+i]);
1403  }
1404  faceoffset += facenodes;
1405  }
1406  m_face.push_back(FaceSharedPtr(
1407  new Face(faceVertices, faceNodes, faceEdges, m_conf.m_faceCurveType)));
1408  }
1409 
1410  // Reorder edges to align with Nektar++ order.
1411  vector<EdgeSharedPtr> tmp(8);
1412  tmp[0] = m_edge[face_edges[0][0]];
1413  tmp[1] = m_edge[face_edges[0][1]];
1414  tmp[2] = m_edge[face_edges[0][2]];
1415  tmp[3] = m_edge[face_edges[0][3]];
1416  tmp[4] = m_edge[face_edges[1][2]];
1417  tmp[5] = m_edge[face_edges[1][1]];
1418  tmp[6] = m_edge[face_edges[3][1]];
1419  tmp[7] = m_edge[face_edges[3][2]];
1420  m_edge = tmp;
1421  }
std::vector< int > m_taglist
List of integers specifying properties of the element.
Definition: MeshElements.h:984
boost::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge.
Definition: MeshElements.h:318
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: MeshElements.h:990
boost::shared_ptr< Face > FaceSharedPtr
Shared pointer to a face.
Definition: MeshElements.h:550
boost::shared_ptr< Node > NodeSharedPtr
Shared pointer to a Node.
Definition: MeshElements.h:195
unsigned int m_order
Order of the element.
Definition: MeshElements.h:629
static unsigned int GetNumNodes(ElmtConfig pConf)
Return the number of nodes defining a pyramid.
LibUtilities::PointsType m_faceCurveType
Distribution of points in faces.
Definition: MeshElements.h:636
bool m_faceNodes
Denotes whether the element contains face nodes. For 2D elements, if this is true then the element co...
Definition: MeshElements.h:622
std::string m_tag
Tag character describing the element.
Definition: MeshElements.h:982
unsigned int m_dim
Dimension of the element.
Definition: MeshElements.h:978
LibUtilities::PointsType m_edgeCurveType
Distribution of points in edges.
Definition: MeshElements.h:634
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
Definition: MeshElements.h:986
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: MeshElements.h:988
Element(ElmtConfig pConf, unsigned int pNumNodes, unsigned int pGotNodes)
ElmtConfig m_conf
Contains configuration of the element.
Definition: MeshElements.h:980
Nektar::Utilities::Pyramid::Pyramid ( const Pyramid pSrc)
virtual Nektar::Utilities::Pyramid::~Pyramid ( )
inlinevirtual

Definition at line 1484 of file MeshElements.h.

1484 {}

Member Function Documentation

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

Creates an instance of this class.

Definition at line 1463 of file MeshElements.h.

1467  {
1468  ElementSharedPtr e = boost::shared_ptr<Element>(
1469  new Pyramid(pConf, pNodeList, pTagList));
1470  vector<FaceSharedPtr> faces = e->GetFaceList();
1471  for (int i = 0; i < faces.size(); ++i)
1472  {
1473  faces[i]->m_elLink.push_back(pair<ElementSharedPtr, int>(e,i));
1474  }
1475  return e;
1476  }
boost::shared_ptr< Element > ElementSharedPtr
Shared pointer to an element.
Definition: MeshElements.h:63
Pyramid(ElmtConfig pConf, std::vector< NodeSharedPtr > pNodeList, std::vector< int > pTagList)
Create a pyramidic element.
SpatialDomains::GeometrySharedPtr Nektar::Utilities::Pyramid::GetGeom ( int  coordDim)
virtual

Generate a Nektar++ geometry object for this element.

Reimplemented from Nektar::Utilities::Element.

Definition at line 1423 of file MeshElements.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::Utilities::Element::m_face, and Nektar::Utilities::Element::m_geom.

1424  {
1426 
1427  for (int i = 0; i < 5; ++i)
1428  {
1429  faces[i] = m_face[i]->GetGeom(coordDim);
1430  }
1431 
1433  AllocateSharedPtr(faces);
1434 
1435  return m_geom;
1436  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: MeshElements.h:990
SpatialDomains::GeometrySharedPtr m_geom
Nektar++ geometry object for this element.
boost::shared_ptr< Geometry2D > Geometry2DSharedPtr
Definition: Geometry2D.h:59
unsigned int Nektar::Utilities::Pyramid::GetNumNodes ( ElmtConfig  pConf)
static

Return the number of nodes defining a pyramid.

Definition at line 1441 of file MeshElements.cpp.

References Nektar::Utilities::ElmtConfig::m_order.

Referenced by Nektar::Utilities::InputGmsh::GetNnodes().

1442  {
1443  int n = pConf.m_order;
1444  return 5 + 8*(n-1);
1445  }

Member Data Documentation

int Nektar::Utilities::Pyramid::orientationMap[5]

Orientation of pyramid.

Definition at line 1492 of file MeshElements.h.

LibUtilities::ShapeType Nektar::Utilities::Pyramid::type
static
Initial value:
RegisterCreatorFunction(LibUtilities::ePyramid, Pyramid::create, "Pyramid")

Element type.

Definition at line 1478 of file MeshElements.h.