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

A 3-dimensional six-faced element. More...

#include <MeshElements.h>

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

Public Member Functions

 Hexahedron (ElmtConfig pConf, std::vector< NodeSharedPtr > pNodeList, std::vector< int > pTagList)
 Create a hexahedral element. More...
 
 Hexahedron (const Hexahedron &pSrc)
 
virtual ~Hexahedron ()
 
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 hexahedron. More...
 

Static Public Attributes

static LibUtilities::ShapeType m_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 six-faced element.

Definition at line 1544 of file MeshElements.h.

Constructor & Destructor Documentation

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

Create a hexahedral element.

Definition at line 1843 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.

1846  : Element(pConf, GetNumNodes(pConf), pNodeList.size())
1847  {
1848  m_tag = "H";
1849  m_dim = 3;
1850  m_taglist = pTagList;
1851  int n = m_conf.m_order-1;
1852 
1853  // Create a map to relate edge nodes to a pair of vertices defining an edge
1854  // This is based on the ordering produced by gmsh.
1855  map<pair<int,int>, int> edgeNodeMap;
1856  map<pair<int,int>, int>::iterator it;
1857  edgeNodeMap[pair<int,int>(1,2)] = 9;
1858  edgeNodeMap[pair<int,int>(2,3)] = 9 + n;
1859  edgeNodeMap[pair<int,int>(3,4)] = 9 + 2*n;
1860  edgeNodeMap[pair<int,int>(4,1)] = 9 + 3*n;
1861  edgeNodeMap[pair<int,int>(1,5)] = 9 + 4*n;
1862  edgeNodeMap[pair<int,int>(2,6)] = 9 + 5*n;
1863  edgeNodeMap[pair<int,int>(3,7)] = 9 + 6*n;
1864  edgeNodeMap[pair<int,int>(4,8)] = 9 + 7*n;
1865  edgeNodeMap[pair<int,int>(5,6)] = 9 + 8*n;
1866  edgeNodeMap[pair<int,int>(6,7)] = 9 + 9*n;
1867  edgeNodeMap[pair<int,int>(7,8)] = 9 + 10*n;
1868  edgeNodeMap[pair<int,int>(8,5)] = 9 + 11*n;
1869 
1870  // Add vertices
1871  for (int i = 0; i < 8; ++i) {
1872  m_vertex.push_back(pNodeList[i]);
1873  }
1874 
1875  // Create edges (with corresponding set of edge points)
1876  for (it = edgeNodeMap.begin(); it != edgeNodeMap.end(); ++it)
1877  {
1878  vector<NodeSharedPtr> edgeNodes;
1879  if (m_conf.m_order > 1) {
1880  for (int j = it->second; j < it->second + n; ++j) {
1881  edgeNodes.push_back(pNodeList[j-1]);
1882  }
1883  }
1884  m_edge.push_back(EdgeSharedPtr(new Edge(pNodeList[it->first.first-1],
1885  pNodeList[it->first.second-1],
1886  edgeNodes,
1888  }
1889 
1890  // Create faces
1891  int face_edges[6][4];
1892  int face_ids[6][4] = {
1893  {0,1,2,3},{0,1,5,4},{1,2,6,5},{3,2,6,7},{0,3,7,4},{4,5,6,7}};
1894  for (int j = 0; j < 6; ++j)
1895  {
1896  vector<NodeSharedPtr> faceVertices;
1897  vector<EdgeSharedPtr> faceEdges;
1898  vector<NodeSharedPtr> faceNodes;
1899  for (int k = 0; k < 4; ++k)
1900  {
1901  faceVertices.push_back(m_vertex[face_ids[j][k]]);
1902  NodeSharedPtr a = m_vertex[face_ids[j][k]];
1903  NodeSharedPtr b = m_vertex[face_ids[j][(k+1)%4]];
1904  for (unsigned int i = 0; i < m_edge.size(); ++i)
1905  {
1906  if ( ((*(m_edge[i]->m_n1)==*a) && (*(m_edge[i]->m_n2)==*b))
1907  || ((*(m_edge[i]->m_n1)==*b) && (*(m_edge[i]->m_n2) == *a)) )
1908  {
1909  face_edges[j][k] = i;
1910  faceEdges.push_back(m_edge[i]);
1911  break;
1912  }
1913  }
1914  }
1915 
1916  if (m_conf.m_faceNodes)
1917  {
1918  int N = 8 + 12*n + j*n*n;
1919  for (int i = 0; i < n*n; ++i)
1920  {
1921  faceNodes.push_back(pNodeList[N+i]);
1922  }
1923  }
1924  m_face.push_back(FaceSharedPtr(
1925  new Face(faceVertices, faceNodes, faceEdges, m_conf.m_faceCurveType)));
1926  }
1927 
1928  // Reorder edges to be consistent with Nektar++ ordering.
1929  vector<EdgeSharedPtr> tmp(12);
1930  tmp[ 0] = m_edge[face_edges[0][0]];
1931  tmp[ 1] = m_edge[face_edges[0][1]];
1932  tmp[ 2] = m_edge[face_edges[0][2]];
1933  tmp[ 3] = m_edge[face_edges[0][3]];
1934  tmp[ 4] = m_edge[face_edges[1][3]];
1935  tmp[ 5] = m_edge[face_edges[1][1]];
1936  tmp[ 6] = m_edge[face_edges[2][1]];
1937  tmp[ 7] = m_edge[face_edges[4][1]];
1938  tmp[ 8] = m_edge[face_edges[5][0]];
1939  tmp[ 9] = m_edge[face_edges[5][1]];
1940  tmp[10] = m_edge[face_edges[5][2]];
1941  tmp[11] = m_edge[face_edges[5][3]];
1942  m_edge = tmp;
1943  }
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 hexahedron.
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::Hexahedron::Hexahedron ( const Hexahedron pSrc)
virtual Nektar::Utilities::Hexahedron::~Hexahedron ( )
inlinevirtual

Definition at line 1568 of file MeshElements.h.

1568 {}

Member Function Documentation

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

Creates an instance of this class.

Definition at line 1547 of file MeshElements.h.

1551  {
1552  ElementSharedPtr e = boost::shared_ptr<Element>(
1553  new Hexahedron(pConf, pNodeList, pTagList));
1554  vector<FaceSharedPtr> faces = e->GetFaceList();
1555  for (int i = 0; i < faces.size(); ++i)
1556  {
1557  faces[i]->m_elLink.push_back(pair<ElementSharedPtr, int>(e,i));
1558  }
1559  return e;
1560  }
Hexahedron(ElmtConfig pConf, std::vector< NodeSharedPtr > pNodeList, std::vector< int > pTagList)
Create a hexahedral element.
boost::shared_ptr< Element > ElementSharedPtr
Shared pointer to an element.
Definition: MeshElements.h:63
SpatialDomains::GeometrySharedPtr Nektar::Utilities::Hexahedron::GetGeom ( int  coordDim)
virtual

Generate a Nektar++ geometry object for this element.

Reimplemented from Nektar::Utilities::Element.

Definition at line 1945 of file MeshElements.cpp.

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

1946  {
1949 
1950  for (int i = 0; i < 6; ++i)
1951  {
1952  faces[i] = boost::dynamic_pointer_cast
1953  <SpatialDomains::QuadGeom>(m_face[i]->GetGeom(coordDim));
1954  }
1955 
1957  AllocateSharedPtr(faces);
1958 
1959  return ret;
1960  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< QuadGeom > QuadGeomSharedPtr
Definition: QuadGeom.h:54
std::vector< FaceSharedPtr > m_face
List of element faces.
Definition: MeshElements.h:990
boost::shared_ptr< HexGeom > HexGeomSharedPtr
Definition: HexGeom.h:110
unsigned int Nektar::Utilities::Hexahedron::GetNumNodes ( ElmtConfig  pConf)
static

Return the number of nodes defining a hexahedron.

Definition at line 1965 of file MeshElements.cpp.

References Nektar::Utilities::ElmtConfig::m_faceNodes, Nektar::Utilities::ElmtConfig::m_order, and Nektar::Utilities::ElmtConfig::m_volumeNodes.

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

1966  {
1967  int n = pConf.m_order;
1968  if (pConf.m_faceNodes && pConf.m_volumeNodes)
1969  return (n+1)*(n+1)*(n+1);
1970  else if (pConf.m_faceNodes && !pConf.m_volumeNodes)
1971  return 6*(n+1)*(n+1)-12*(n+1)+8;
1972  else
1973  return 12*(n+1)-16;
1974  }

Member Data Documentation

LibUtilities::ShapeType Nektar::Utilities::Hexahedron::m_type
static
Initial value:
RegisterCreatorFunction(LibUtilities::eHexahedron, Hexahedron::create, "Hexahedron")

Element type.

Definition at line 1562 of file MeshElements.h.