Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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.
 Hexahedron (const Hexahedron &pSrc)
virtual ~Hexahedron ()
virtual
SpatialDomains::GeometrySharedPtr 
GetGeom (int coordDim)
 Generate a Nektar++ geometry object for this element.
- 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).
unsigned int GetDim () const
 Returns the expansion dimension of the element.
ElmtConfig GetConf () const
 Returns the configuration of the element.
std::string GetTag () const
 Returns the tag which defines the element shape.
NodeSharedPtr GetVertex (unsigned int i) const
 Access a vertex node.
EdgeSharedPtr GetEdge (unsigned int i) const
 Access an edge.
FaceSharedPtr GetFace (unsigned int i) const
 Access a face.
std::vector< NodeSharedPtrGetVertexList () const
 Access the list of vertex nodes.
std::vector< EdgeSharedPtrGetEdgeList () const
 Access the list of edges.
std::vector< FaceSharedPtrGetFaceList () const
 Access the list of faces.
std::vector< NodeSharedPtrGetVolumeNodes () const
 Access the list of volume nodes.
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).
std::vector< int > GetTagList () const
 Access the list of tags associated with this element.
unsigned int GetVertexCount () const
 Returns the number of vertices.
unsigned int GetEdgeCount () const
 Returns the number of edges.
unsigned int GetFaceCount () const
 Returns the number of faces.
void SetId (unsigned int p)
 Change the ID of the element.
void SetVertex (unsigned int p, NodeSharedPtr pNew)
 Replace a vertex with another vertex object.
void SetEdge (unsigned int p, EdgeSharedPtr pNew)
 Replace an edge with another edge object.
void SetFace (unsigned int p, FaceSharedPtr pNew)
 Replace a face with another face object.
void SetEdgeLink (EdgeSharedPtr pLink)
 Set a correspondence between this element and an edge (2D boundary element).
EdgeSharedPtr GetEdgeLink ()
 Get correspondence between this element and an edge.
void SetFaceLink (FaceSharedPtr pLink)
 Set a correspondence between this element and a face (3D boundary element).
FaceSharedPtr GetFaceLink ()
 Get correspondence between this element and a face.
void SetBoundaryLink (int i, int j)
 Set a correspondence between edge or face i and its representative boundary element m->element[expDim-1][j].
int GetBoundaryLink (int i)
 Get the location of the boundary face/edge i for this element.
void SetTagList (const std::vector< int > &tags)
 Set the list of tags associated with this element.
virtual std::string GetXmlString () const
 Generate a list of vertices (1D), edges (2D), or faces (3D).
std::string GetXmlCurveString () const
 Generates a string listing the coordinates of all nodes associated with this element.
int GetMaxOrder ()
 Obtain the order of an element by looking at edges.
virtual void Complete (int order)
 Complete this object.
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.
static unsigned int GetNumNodes (ElmtConfig pConf)
 Return the number of nodes defining a hexahedron.

Static Public Attributes

static LibUtilities::ShapeType m_type
 Element type.

Additional Inherited Members

- Protected Attributes inherited from Nektar::Utilities::Element
unsigned int m_id
 ID of the element.
unsigned int m_dim
 Dimension of the element.
ElmtConfig m_conf
 Contains configuration of the element.
std::string m_tag
 Tag character describing the element.
std::vector< int > m_taglist
 List of integers specifying properties of the element.
std::vector< NodeSharedPtrm_vertex
 List of element vertex nodes.
std::vector< EdgeSharedPtrm_edge
 List of element edges.
std::vector< FaceSharedPtrm_face
 List of element faces.
std::vector< NodeSharedPtrm_volumeNodes
 List of element volume nodes.
LibUtilities::PointsType m_curveType
 Volume curve type.
EdgeSharedPtr m_edgeLink
 Pointer to the corresponding edge if element is a 2D boundary.
FaceSharedPtr m_faceLink
 Pointer to the corresponding face if element is a 3D boundary.
std::map< int, int > m_boundaryLinks
 Array mapping faces/edges to the location of the appropriate boundary elements in m->element.
SpatialDomains::GeometrySharedPtr m_geom
 Nektar++ geometry object for this element.

Detailed Description

A 3-dimensional six-faced element.

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

: Element(pConf, GetNumNodes(pConf), pNodeList.size())
{
m_tag = "H";
m_dim = 3;
m_taglist = pTagList;
int n = m_conf.m_order-1;
// Create a map to relate edge nodes to a pair of vertices defining an edge
// This is based on the ordering produced by gmsh.
map<pair<int,int>, int> edgeNodeMap;
map<pair<int,int>, int>::iterator it;
edgeNodeMap[pair<int,int>(1,2)] = 9;
edgeNodeMap[pair<int,int>(2,3)] = 9 + n;
edgeNodeMap[pair<int,int>(3,4)] = 9 + 2*n;
edgeNodeMap[pair<int,int>(4,1)] = 9 + 3*n;
edgeNodeMap[pair<int,int>(1,5)] = 9 + 4*n;
edgeNodeMap[pair<int,int>(2,6)] = 9 + 5*n;
edgeNodeMap[pair<int,int>(3,7)] = 9 + 6*n;
edgeNodeMap[pair<int,int>(4,8)] = 9 + 7*n;
edgeNodeMap[pair<int,int>(5,6)] = 9 + 8*n;
edgeNodeMap[pair<int,int>(6,7)] = 9 + 9*n;
edgeNodeMap[pair<int,int>(7,8)] = 9 + 10*n;
edgeNodeMap[pair<int,int>(8,5)] = 9 + 11*n;
// Add vertices
for (int i = 0; i < 8; ++i) {
m_vertex.push_back(pNodeList[i]);
}
// Create edges (with corresponding set of edge points)
for (it = edgeNodeMap.begin(); it != edgeNodeMap.end(); ++it)
{
vector<NodeSharedPtr> edgeNodes;
if (m_conf.m_order > 1) {
for (int j = it->second; j < it->second + n; ++j) {
edgeNodes.push_back(pNodeList[j-1]);
}
}
m_edge.push_back(EdgeSharedPtr(new Edge(pNodeList[it->first.first-1],
pNodeList[it->first.second-1],
edgeNodes,
}
// Create faces
int face_edges[6][4];
int face_ids[6][4] = {
{0,1,2,3},{0,1,5,4},{1,2,6,5},{3,2,6,7},{0,3,7,4},{4,5,6,7}};
for (int j = 0; j < 6; ++j)
{
vector<NodeSharedPtr> faceVertices;
vector<EdgeSharedPtr> faceEdges;
vector<NodeSharedPtr> faceNodes;
for (int k = 0; k < 4; ++k)
{
faceVertices.push_back(m_vertex[face_ids[j][k]]);
NodeSharedPtr a = m_vertex[face_ids[j][k]];
NodeSharedPtr b = m_vertex[face_ids[j][(k+1)%4]];
for (unsigned int i = 0; i < m_edge.size(); ++i)
{
if ( ((*(m_edge[i]->m_n1)==*a) && (*(m_edge[i]->m_n2)==*b))
|| ((*(m_edge[i]->m_n1)==*b) && (*(m_edge[i]->m_n2) == *a)) )
{
face_edges[j][k] = i;
faceEdges.push_back(m_edge[i]);
break;
}
}
}
{
int N = 8 + 12*n + j*n*n;
for (int i = 0; i < n*n; ++i)
{
faceNodes.push_back(pNodeList[N+i]);
}
}
m_face.push_back(FaceSharedPtr(
new Face(faceVertices, faceNodes, faceEdges, m_conf.m_faceCurveType)));
}
// Reorder edges to be consistent with Nektar++ ordering.
vector<EdgeSharedPtr> tmp(12);
tmp[ 0] = m_edge[face_edges[0][0]];
tmp[ 1] = m_edge[face_edges[0][1]];
tmp[ 2] = m_edge[face_edges[0][2]];
tmp[ 3] = m_edge[face_edges[0][3]];
tmp[ 4] = m_edge[face_edges[1][3]];
tmp[ 5] = m_edge[face_edges[1][1]];
tmp[ 6] = m_edge[face_edges[2][1]];
tmp[ 7] = m_edge[face_edges[4][1]];
tmp[ 8] = m_edge[face_edges[5][0]];
tmp[ 9] = m_edge[face_edges[5][1]];
tmp[10] = m_edge[face_edges[5][2]];
tmp[11] = m_edge[face_edges[5][3]];
m_edge = tmp;
}
Nektar::Utilities::Hexahedron::Hexahedron ( const Hexahedron pSrc)
virtual Nektar::Utilities::Hexahedron::~Hexahedron ( )
inlinevirtual

Definition at line 1549 of file MeshElements.h.

{}

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 1528 of file MeshElements.h.

References Nektar::Utilities::Element::GetFaceList().

{
ElementSharedPtr e = boost::shared_ptr<Element>(
new Hexahedron(pConf, pNodeList, pTagList));
vector<FaceSharedPtr> faces = e->GetFaceList();
for (int i = 0; i < faces.size(); ++i)
{
faces[i]->m_elLink.push_back(pair<ElementSharedPtr, int>(e,i));
}
return e;
}
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 1891 of file MeshElements.cpp.

References Nektar::Utilities::Element::m_face.

{
for (int i = 0; i < 6; ++i)
{
faces[i] = boost::dynamic_pointer_cast
<SpatialDomains::QuadGeom>(m_face[i]->GetGeom(coordDim));
}
ret = MemoryManager<SpatialDomains::HexGeom>::
AllocateSharedPtr(faces);
return ret;
}
unsigned int Nektar::Utilities::Hexahedron::GetNumNodes ( ElmtConfig  pConf)
static

Return the number of nodes defining a hexahedron.

Definition at line 1911 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().

{
int n = pConf.m_order;
if (pConf.m_faceNodes && pConf.m_volumeNodes)
return (n+1)*(n+1)*(n+1);
else if (pConf.m_faceNodes && !pConf.m_volumeNodes)
return 6*(n+1)*(n+1)-12*(n+1)+8;
else
return 12*(n+1)-16;
}

Member Data Documentation

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

Element type.

Definition at line 1543 of file MeshElements.h.