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::NekMeshUtils::Quadrilateral Class Reference

A 2-dimensional four-sided element. More...

#include <Quadrilateral.h>

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

Public Member Functions

NEKMESHUTILS_EXPORT Quadrilateral (ElmtConfig pConf, std::vector< NodeSharedPtr > pNodeList, std::vector< int > pTagList)
 Create a quadrilateral element. More...
 
NEKMESHUTILS_EXPORT Quadrilateral (const Quadrilateral &pSrc)
 
virtual NEKMESHUTILS_EXPORT ~Quadrilateral ()
 
virtual NEKMESHUTILS_EXPORT
SpatialDomains::GeometrySharedPtr 
GetGeom (int coordDim)
 Generate a Nektar++ geometry object for this element. More...
 
virtual NEKMESHUTILS_EXPORT void Complete (int order)
 Complete this object. 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...
 
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 quadrilateral. More...
 

Static Public Attributes

static LibUtilities::ShapeType m_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 2-dimensional four-sided element.

Definition at line 49 of file Quadrilateral.h.

Constructor & Destructor Documentation

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

Create a quadrilateral element.

Definition at line 53 of file Quadrilateral.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::ElmtConfig::m_faceNodes, Nektar::NekMeshUtils::ElmtConfig::m_order, Nektar::NekMeshUtils::ElmtConfig::m_reorient, Nektar::NekMeshUtils::Element::m_tag, Nektar::NekMeshUtils::Element::m_taglist, Nektar::NekMeshUtils::Element::m_vertex, and Nektar::NekMeshUtils::Element::m_volumeNodes.

Referenced by create().

56  : Element(pConf, GetNumNodes(pConf), pNodeList.size())
57 {
58  m_tag = "Q";
59  m_dim = 2;
60  m_taglist = pTagList;
61  int n = m_conf.m_order - 1;
62 
63  // Create a map to relate edge nodes to a pair of vertices
64  // defining an edge. This is based on the ordering produced by
65  // gmsh.
66  map<pair<int, int>, int> edgeNodeMap;
67  map<pair<int, int>, int>::iterator it;
68  edgeNodeMap[pair<int, int>(1, 2)] = 5;
69  edgeNodeMap[pair<int, int>(2, 3)] = 5 + n;
70  edgeNodeMap[pair<int, int>(3, 4)] = 5 + 2 * n;
71  edgeNodeMap[pair<int, int>(4, 1)] = 5 + 3 * n;
72 
73  // Add vertices. This logic will determine (in 2D) whether the
74  // element is clockwise (sum > 0) or counter-clockwise (sum < 0).
75  NekDouble sum = 0.0;
76  for (int i = 0; i < 4; ++i)
77  {
78  int o = (i + 1) % 4;
79  m_vertex.push_back(pNodeList[i]);
80  sum += (pNodeList[o]->m_x - pNodeList[i]->m_x) *
81  (pNodeList[o]->m_y + pNodeList[i]->m_y);
82  }
83 
84  // Create edges (with corresponding set of edge points)
85  for (it = edgeNodeMap.begin(); it != edgeNodeMap.end(); ++it)
86  {
87  vector<NodeSharedPtr> edgeNodes;
88  if (m_conf.m_order > 1)
89  {
90  for (int j = it->second; j < it->second + n; ++j)
91  {
92  edgeNodes.push_back(pNodeList[j - 1]);
93  }
94  }
95  m_edge.push_back(EdgeSharedPtr(new Edge(pNodeList[it->first.first - 1],
96  pNodeList[it->first.second - 1],
97  edgeNodes,
99  }
100 
101  if (pConf.m_reorient)
102  {
103  if (sum > 0.0)
104  {
105  reverse(m_edge.begin(), m_edge.end());
106  }
107  }
108 
109  if (m_conf.m_faceNodes)
110  {
111  m_volumeNodes.insert(m_volumeNodes.begin(),
112  pNodeList.begin() + 4 * m_conf.m_order,
113  pNodeList.end());
114  }
115 }
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
static NEKMESHUTILS_EXPORT unsigned int GetNumNodes(ElmtConfig pConf)
Return the number of nodes defining a quadrilateral.
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
double NekDouble
std::vector< NodeSharedPtr > m_volumeNodes
List of element volume nodes.
Definition: Element.h:505
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
NEKMESHUTILS_EXPORT Nektar::NekMeshUtils::Quadrilateral::Quadrilateral ( const Quadrilateral pSrc)
virtual NEKMESHUTILS_EXPORT Nektar::NekMeshUtils::Quadrilateral::~Quadrilateral ( )
inlinevirtual

Definition at line 73 of file Quadrilateral.h.

74  {
75  }

Member Function Documentation

void Nektar::NekMeshUtils::Quadrilateral::Complete ( int  order)
virtual

Complete this object.

Reimplemented from Nektar::NekMeshUtils::Element.

Definition at line 117 of file Quadrilateral.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eOrtho_A, GetGeom(), Nektar::NekMeshUtils::Element::m_conf, Nektar::NekMeshUtils::Element::m_edge, Nektar::NekMeshUtils::ElmtConfig::m_faceNodes, Nektar::NekMeshUtils::ElmtConfig::m_order, Nektar::NekMeshUtils::ElmtConfig::m_volumeNodes, and Nektar::NekMeshUtils::Element::m_volumeNodes.

118 {
119  LibUtilities::BasisKey C0(
121  order + 1,
122  LibUtilities::PointsKey(order + 1,
124 
126  boost::dynamic_pointer_cast<SpatialDomains::QuadGeom>(this->GetGeom(3));
127 
128  // Create a quad.
131 
132  // Get coordinate array for quadrilateral.
133  int nqtot = quad->GetTotPoints();
134  Array<OneD, NekDouble> alloc(3 * nqtot);
135  Array<OneD, NekDouble> x(alloc);
136  Array<OneD, NekDouble> y(alloc + 1 * nqtot);
137  Array<OneD, NekDouble> z(alloc + 2 * nqtot);
138 
139  quad->GetCoords(x, y, z);
140 
141  // Now extract points from the co-ordinate arrays into the edge
142  // and face nodes. First, extract edge-interior nodes.
143  int edgeMap[4][2] = {{0, 1},
144  {order, order + 1},
145  {nqtot - 1, -1},
146  {order * (order + 1), -order - 1}};
147 
148  for (int i = 0; i < 4; ++i)
149  {
150  int pos = edgeMap[i][0] + edgeMap[i][1];
151  m_edge[i]->m_edgeNodes.clear();
152  for (int j = 1; j < order; ++j, pos += edgeMap[i][1])
153  {
154  m_edge[i]->m_edgeNodes.push_back(
155  NodeSharedPtr(new Node(0, x[pos], y[pos], z[pos])));
156  }
157  }
158 
159  // Extract face-interior nodes.
160  m_volumeNodes.clear();
161  for (int i = 1; i < order; ++i)
162  {
163  int pos = i * (order + 1);
164  for (int j = 1; j < order; ++j)
165  {
166  m_volumeNodes.push_back(
167  NodeSharedPtr(new Node(0, x[pos + j], y[pos + j], z[pos + j])));
168  }
169  }
170 
171  m_conf.m_order = order;
172  m_conf.m_faceNodes = true;
173  m_conf.m_volumeNodes = true;
174 }
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
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
virtual NEKMESHUTILS_EXPORT SpatialDomains::GeometrySharedPtr GetGeom(int coordDim)
Generate a Nektar++ geometry object for this element.
boost::shared_ptr< QuadGeom > QuadGeomSharedPtr
Definition: QuadGeom.h:54
ElmtConfig m_conf
Contains configuration of the element.
Definition: Element.h:493
unsigned int m_order
Order of the element.
Definition: Element.h:96
bool m_volumeNodes
Denotes whether the element contains volume (i.e. interior) nodes. These are not supported by either ...
Definition: Element.h:94
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:501
boost::shared_ptr< Node > NodeSharedPtr
Definition: Node.h:50
Principle Orthogonal Functions .
Definition: BasisType.h:46
boost::shared_ptr< QuadExp > QuadExpSharedPtr
Definition: QuadExp.h:293
std::vector< NodeSharedPtr > m_volumeNodes
List of element volume nodes.
Definition: Element.h:505
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:50
static ElementSharedPtr Nektar::NekMeshUtils::Quadrilateral::create ( ElmtConfig  pConf,
std::vector< NodeSharedPtr pNodeList,
std::vector< int >  pTagList 
)
inlinestatic

Creates an instance of this class.

Definition at line 53 of file Quadrilateral.h.

References Quadrilateral().

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

Generate a Nektar++ geometry object for this element.

Reimplemented from Nektar::NekMeshUtils::Element.

Definition at line 176 of file Quadrilateral.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::SpatialDomains::SegGeom::GetEdgeOrientation(), Nektar::NekMeshUtils::Element::m_edge, Nektar::NekMeshUtils::Element::m_id, and Nektar::NekMeshUtils::Element::m_vertex.

Referenced by Complete().

177 {
181 
182  for (int i = 0; i < 4; ++i)
183  {
184  edges[i] = m_edge[i]->GetGeom(coordDim);
185  verts[i] = m_vertex[i]->GetGeom(coordDim);
186  }
187 
188  StdRegions::Orientation edgeorient[4] = {
189  SpatialDomains::SegGeom::GetEdgeOrientation(*edges[0], *edges[1]),
190  SpatialDomains::SegGeom::GetEdgeOrientation(*edges[1], *edges[2]),
191  SpatialDomains::SegGeom::GetEdgeOrientation(*edges[2], *edges[3]),
192  SpatialDomains::SegGeom::GetEdgeOrientation(*edges[3], *edges[0])};
193 
195  m_id, verts, edges, edgeorient);
196 
197  return ret;
198 }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< QuadGeom > QuadGeomSharedPtr
Definition: QuadGeom.h:54
static StdRegions::Orientation GetEdgeOrientation(const SegGeom &edge1, const SegGeom &edge2)
Get the orientation of edge1.
Definition: SegGeom.cpp:293
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
Definition: Element.h:499
boost::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:60
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:501
unsigned int m_id
ID of the element.
Definition: Element.h:489
boost::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:60
unsigned int Nektar::NekMeshUtils::Quadrilateral::GetNumNodes ( ElmtConfig  pConf)
static

Return the number of nodes defining a quadrilateral.

Definition at line 203 of file Quadrilateral.cpp.

References Nektar::NekMeshUtils::ElmtConfig::m_faceNodes, and Nektar::NekMeshUtils::ElmtConfig::m_order.

204 {
205  int n = pConf.m_order;
206  if (!pConf.m_faceNodes)
207  return 4 * n;
208  else
209  return (n + 1) * (n + 1);
210 }

Member Data Documentation

LibUtilities::ShapeType Nektar::NekMeshUtils::Quadrilateral::m_type
static
Initial value:

Element type.

Definition at line 67 of file Quadrilateral.h.