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

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

#include <Pyramid.h>

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

Public Member Functions

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

Constructor & Destructor Documentation

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

Create a pyramidic element.

Definition at line 53 of file Pyramid.cpp.

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

Referenced by create().

56  : Element(pConf, GetNumNodes(pConf), pNodeList.size())
57 {
58  m_tag = "P";
59  m_dim = 3;
60  m_taglist = pTagList;
61  int n = m_conf.m_order - 1;
62 
63  // This edge-node map is based on Nektar++ ordering.
64  map<pair<int, int>, int> edgeNodeMap;
65  map<pair<int, int>, int>::iterator it;
66  edgeNodeMap[pair<int, int>(1, 2)] = 6;
67  edgeNodeMap[pair<int, int>(2, 3)] = 6 + n;
68  edgeNodeMap[pair<int, int>(4, 3)] = 6 + 2 * n;
69  edgeNodeMap[pair<int, int>(1, 4)] = 6 + 3 * n;
70  edgeNodeMap[pair<int, int>(1, 5)] = 6 + 4 * n;
71  edgeNodeMap[pair<int, int>(2, 5)] = 6 + 5 * n;
72  edgeNodeMap[pair<int, int>(3, 5)] = 6 + 6 * n;
73  edgeNodeMap[pair<int, int>(4, 5)] = 6 + 7 * n;
74 
75  // Add vertices
76  for (int i = 0; i < 5; ++i)
77  {
78  m_vertex.push_back(pNodeList[i]);
79  }
80 
81  // Create edges (with corresponding set of edge points)
82  int eid = 0;
83  for (it = edgeNodeMap.begin(); it != edgeNodeMap.end(); ++it)
84  {
85  vector<NodeSharedPtr> edgeNodes;
86  if (m_conf.m_order > 1)
87  {
88  for (int j = it->second; j < it->second + n; ++j)
89  {
90  edgeNodes.push_back(pNodeList[j - 1]);
91  }
92  }
93  m_edge.push_back(EdgeSharedPtr(new Edge(pNodeList[it->first.first - 1],
94  pNodeList[it->first.second - 1],
95  edgeNodes,
97  m_edge.back()->m_id = eid++;
98  }
99 
100  // Create faces
101  int face_ids[5][4] = {{0, 1, 2, 3},
102  {0, 1, 4, -1},
103  {1, 2, 4, -1},
104  {3, 2, 4, -1},
105  {0, 3, 4, -1}};
106  int face_edges[5][4];
107  int faceoffset = 5 + 8 * n;
108  for (int j = 0; j < 5; ++j)
109  {
110  vector<NodeSharedPtr> faceVertices;
111  vector<EdgeSharedPtr> faceEdges;
112  vector<NodeSharedPtr> faceNodes;
113  int nEdge = j > 0 ? 3 : 4;
114 
115  for (int k = 0; k < nEdge; ++k)
116  {
117  faceVertices.push_back(m_vertex[face_ids[j][k]]);
118  NodeSharedPtr a = m_vertex[face_ids[j][k]];
119  NodeSharedPtr b = m_vertex[face_ids[j][(k + 1) % nEdge]];
120  for (unsigned int i = 0; i < m_edge.size(); ++i)
121  {
122  if ((m_edge[i]->m_n1 == a && m_edge[i]->m_n2 == b) ||
123  (m_edge[i]->m_n1 == b && m_edge[i]->m_n2 == a))
124  {
125  faceEdges.push_back(m_edge[i]);
126  face_edges[j][k] = i;
127  break;
128  }
129  }
130  }
131 
132  if (m_conf.m_faceNodes)
133  {
134  int facenodes = j == 0 ? n * n : n * (n - 1) / 2;
135  for (int i = 0; i < facenodes; ++i)
136  {
137  faceNodes.push_back(pNodeList[faceoffset + i]);
138  }
139  faceoffset += facenodes;
140  }
141  m_face.push_back(FaceSharedPtr(new Face(
142  faceVertices, faceNodes, faceEdges, m_conf.m_faceCurveType)));
143  }
144 
145  // Reorder edges to align with Nektar++ order.
146  vector<EdgeSharedPtr> tmp(8);
147  tmp[0] = m_edge[face_edges[0][0]];
148  tmp[1] = m_edge[face_edges[0][1]];
149  tmp[2] = m_edge[face_edges[0][2]];
150  tmp[3] = m_edge[face_edges[0][3]];
151  tmp[4] = m_edge[face_edges[1][2]];
152  tmp[5] = m_edge[face_edges[1][1]];
153  tmp[6] = m_edge[face_edges[3][1]];
154  tmp[7] = m_edge[face_edges[3][2]];
155  m_edge = tmp;
156 }
bool m_faceNodes
Denotes whether the element contains face nodes. For 2D elements, if this is true then the element co...
Definition: Element.h:89
LibUtilities::PointsType m_faceCurveType
Distribution of points in faces.
Definition: Element.h:103
ElmtConfig m_conf
Contains configuration of the element.
Definition: Element.h:493
std::vector< int > m_taglist
List of integers specifying properties of the element.
Definition: Element.h:497
LibUtilities::PointsType m_edgeCurveType
Distribution of points in edges.
Definition: Element.h:101
unsigned int m_order
Order of the element.
Definition: Element.h:96
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
Definition: Element.h:499
unsigned int m_dim
Dimension of the element.
Definition: Element.h:491
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:501
boost::shared_ptr< Node > NodeSharedPtr
Definition: Node.h:50
std::string m_tag
Tag character describing the element.
Definition: Element.h:495
boost::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge.
Definition: Edge.h:196
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
NEKMESHUTILS_EXPORT Element(ElmtConfig pConf, unsigned int pNumNodes, unsigned int pGotNodes)
Definition: Element.cpp:54
static NEKMESHUTILS_EXPORT unsigned int GetNumNodes(ElmtConfig pConf)
Return the number of nodes defining a pyramid.
Definition: Pyramid.cpp:175
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: Element.h:503
boost::shared_ptr< Face > FaceSharedPtr
Shared pointer to a face.
Definition: Face.h:378
NEKMESHUTILS_EXPORT Nektar::NekMeshUtils::Pyramid::Pyramid ( const Pyramid pSrc)
virtual NEKMESHUTILS_EXPORT Nektar::NekMeshUtils::Pyramid::~Pyramid ( )
inlinevirtual

Definition at line 73 of file Pyramid.h.

74  {
75  }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 53 of file Pyramid.h.

References Pyramid().

56  {
58  boost::shared_ptr<Element>(new Pyramid(pConf, pNodeList, pTagList));
59  vector<FaceSharedPtr> faces = e->GetFaceList();
60  for (int i = 0; i < faces.size(); ++i)
61  {
62  faces[i]->m_elLink.push_back(pair<ElementSharedPtr, int>(e, i));
63  }
64  return e;
65  }
boost::shared_ptr< Element > ElementSharedPtr
Definition: Edge.h:52
NEKMESHUTILS_EXPORT Pyramid(ElmtConfig pConf, std::vector< NodeSharedPtr > pNodeList, std::vector< int > pTagList)
Create a pyramidic element.
Definition: Pyramid.cpp:53
SpatialDomains::GeometrySharedPtr Nektar::NekMeshUtils::Pyramid::GetGeom ( int  coordDim)
virtual

Generate a Nektar++ geometry object for this element.

Reimplemented from Nektar::NekMeshUtils::Element.

Definition at line 158 of file Pyramid.cpp.

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

159 {
161 
162  for (int i = 0; i < 5; ++i)
163  {
164  faces[i] = m_face[i]->GetGeom(coordDim);
165  }
166 
168 
169  return m_geom;
170 }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< Geometry2D > Geometry2DSharedPtr
Definition: Geometry2D.h:59
SpatialDomains::GeometrySharedPtr m_geom
Nektar++ geometry object for this element.
Definition: Element.h:516
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: Element.h:503
unsigned int Nektar::NekMeshUtils::Pyramid::GetNumNodes ( ElmtConfig  pConf)
static

Return the number of nodes defining a pyramid.

Definition at line 175 of file Pyramid.cpp.

References Nektar::NekMeshUtils::ElmtConfig::m_order.

176 {
177  int n = pConf.m_order;
178  return 5 + 8 * (n - 1);
179 }

Member Data Documentation

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

Orientation of pyramid.

Definition at line 84 of file Pyramid.h.

LibUtilities::ShapeType Nektar::NekMeshUtils::Pyramid::type
static
Initial value:

Element type.

Definition at line 67 of file Pyramid.h.