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

#include <Mesh.h>

Collaboration diagram for Nektar::NekMeshUtils::Mesh:
Collaboration graph
[legend]

Public Member Functions

NEKMESHUTILS_EXPORT Mesh ()
 
NEKMESHUTILS_EXPORT unsigned int GetNumElements ()
 Returns the total number of elements in the mesh with dimension expDim. More...
 
NEKMESHUTILS_EXPORT unsigned int GetNumBndryElements ()
 Returns the total number of elements in the mesh with dimension < expDim. More...
 
NEKMESHUTILS_EXPORT unsigned int GetNumEntities ()
 Returns the total number of entities in the mesh. More...
 
NEKMESHUTILS_EXPORT void MakeOrder (int order, LibUtilities::PointsType distType)
 Convert this mesh into a mesh of uniform polynomial order order with a curve point distribution distType. More...
 

Public Attributes

bool m_verbose
 Verbose flag. More...
 
unsigned int m_expDim
 Dimension of the expansion. More...
 
unsigned int m_spaceDim
 Dimension of the space in which the mesh is defined. More...
 
unsigned int m_nummode
 a order tag to aid output, a bit of a hack More...
 
std::vector< NodeSharedPtrm_node
 List of mesh nodes. More...
 
NodeSet m_vertexSet
 Set of element vertices. More...
 
int m_numNodes
 used for meshing purposes to keep trac of ids More...
 
EdgeSet m_edgeSet
 Set of element edges. More...
 
FaceSet m_faceSet
 Set of element faces. More...
 
ElementMap m_element
 Map for elements. More...
 
CompositeMap m_composite
 Map for composites. More...
 
ConditionMap m_condition
 Boundary conditions maps tag to condition. More...
 
std::vector< std::string > m_fields
 List of fields names. More...
 
boost::unordered_map< int, Nodem_vertexNormals
 Map of vertex normals. More...
 
std::set< std::pair< int, int > > m_spherigonSurfs
 Set of all pairs of element ID and edge/face number on which to apply spherigon surface smoothing. More...
 
std::map< int, std::string > m_faceLabels
 List of face labels for composite annotation. More...
 
CADSystemSharedPtr m_cad
 CAD system pointer, if there is no cad its empty. More...
 
OctreeSharedPtr m_octree
 Octree system pointer, if there is no octree its empty. More...
 

Detailed Description

Definition at line 88 of file Mesh.h.

Constructor & Destructor Documentation

NEKMESHUTILS_EXPORT Nektar::NekMeshUtils::Mesh::Mesh ( )
inline

Definition at line 91 of file Mesh.h.

91  : m_verbose(false), m_nummode(0)
92  {
93  }
unsigned int m_nummode
a order tag to aid output, a bit of a hack
Definition: Mesh.h:102
bool m_verbose
Verbose flag.
Definition: Mesh.h:96

Member Function Documentation

unsigned int Mesh::GetNumBndryElements ( )

Returns the total number of elements in the mesh with dimension < expDim.

Return the number of boundary elements (i.e. one below the expansion dimension).

Definition at line 59 of file Mesh.cpp.

60 {
61  unsigned int i, nElmt = 0;
62 
63  for (i = 0; i < m_expDim; ++i)
64  nElmt += m_element[i].size();
65 
66  return nElmt;
67 }
unsigned int m_expDim
Dimension of the expansion.
Definition: Mesh.h:98
ElementMap m_element
Map for elements.
Definition: Mesh.h:114
unsigned int Mesh::GetNumElements ( )

Returns the total number of elements in the mesh with dimension expDim.

Return the number of elements of the expansion dimension.

Definition at line 50 of file Mesh.cpp.

51 {
52  return m_element[m_expDim].size();
53 }
unsigned int m_expDim
Dimension of the expansion.
Definition: Mesh.h:98
ElementMap m_element
Map for elements.
Definition: Mesh.h:114
unsigned int Mesh::GetNumEntities ( )

Returns the total number of entities in the mesh.

Return the total number of entities in the mesh (i.e. all elements, regardless of dimension).

Definition at line 73 of file Mesh.cpp.

74 {
75  unsigned int nEnt = 0;
76 
77  for (unsigned int d = 0; d <= m_expDim; ++d)
78  {
79  nEnt += m_element[d].size();
80  }
81 
82  return nEnt;
83 }
unsigned int m_expDim
Dimension of the expansion.
Definition: Mesh.h:98
ElementMap m_element
Map for elements.
Definition: Mesh.h:114
void Mesh::MakeOrder ( int  order,
LibUtilities::PointsType  distType 
)

Convert this mesh into a mesh of uniform polynomial order order with a curve point distribution distType.

This routine adds curvature points into a mesh so that the resulting elements are all of a uniform order order and all high-order vertices are consistently ordered. It proceeds in a bottom-up fashion:

  • First construct all edge, face and elemental geometry mappings.
  • Then call the local MakeOrder functions on each edge, face and element of dimension Mesh::m_expDim.
  • Finally, any boundary elements are updated so that they have the same interior degrees of freedom as their corresponding edge or face links.

Definition at line 99 of file Mesh.cpp.

References ASSERTL1, Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eHexahedron, Nektar::LibUtilities::eNodalPrismElec, Nektar::LibUtilities::eNodalPrismEvenlySpaced, Nektar::LibUtilities::eNodalTetElec, Nektar::LibUtilities::eNodalTetEvenlySpaced, Nektar::LibUtilities::eNodalTriElec, Nektar::LibUtilities::eNodalTriEvenlySpaced, Nektar::LibUtilities::ePolyEvenlySpaced, Nektar::LibUtilities::ePrism, Nektar::LibUtilities::eQuadrilateral, Nektar::LibUtilities::eSegment, Nektar::LibUtilities::eTetrahedron, Nektar::LibUtilities::eTriangle, Nektar::iterator, and Nektar::LibUtilities::PrintProgressbar().

101 {
102  int id = m_vertexSet.size();
103 
104  EdgeSet::iterator eit;
105  FaceSet::iterator fit;
106 
107  boost::unordered_map<int, SpatialDomains::Geometry1DSharedPtr> edgeGeoms;
108  boost::unordered_map<int, SpatialDomains::Geometry2DSharedPtr> faceGeoms;
109  boost::unordered_map<int, SpatialDomains::GeometrySharedPtr> volGeoms;
110 
111  // Decide on distribution of points to use for each shape type based on the
112  // input we've been supplied.
113  std::map<LibUtilities::ShapeType, LibUtilities::PointsType> pTypes;
114  if (distType == LibUtilities::ePolyEvenlySpaced)
115  {
123  }
124  else if (distType == LibUtilities::eGaussLobattoLegendre)
125  {
133  }
134  else
135  {
136  ASSERTL1(false, "Mesh::MakeOrder does not support this points type.");
137  }
138 
139  // Begin by generating Nektar++ geometry objects for edges, faces and
140  // elements so that we don't affect any neighbouring elements in the mesh as
141  // we process each element.
142  for(eit = m_edgeSet.begin(); eit != m_edgeSet.end(); eit++)
143  {
145  (*eit)->GetGeom(m_spaceDim);
146  geom->FillGeom();
147  edgeGeoms[(*eit)->m_id] = geom;
148  }
149 
150  for(fit = m_faceSet.begin(); fit != m_faceSet.end(); fit++)
151  {
153  (*fit)->GetGeom(m_spaceDim);
154  geom->FillGeom();
155  faceGeoms[(*fit)->m_id] = geom;
156  }
157 
158  for(int i = 0; i < m_element[m_expDim].size(); i++)
159  {
162  el->GetGeom(m_spaceDim);
163  geom->FillGeom();
164  volGeoms[el->GetId()] = geom;
165  }
166 
167  boost::unordered_set<int> processedEdges, processedFaces, processedVolumes;
168 
169  // note if CAD previously existed on the face or edge, the new points need
170  // to be projected onto the CAD entity.
171 
172  // Call MakeOrder with our generated geometries on each edge to fill in edge
173  // interior nodes.
174  int ct = 0;
175  for (eit = m_edgeSet.begin(); eit != m_edgeSet.end(); eit++, ct++)
176  {
177  if (m_verbose)
178  {
180  ct, m_edgeSet.size(), "MakeOrder: Edges: ");
181  }
182  int edgeId = (*eit)->m_id;
183 
184  if (processedEdges.find(edgeId) != processedEdges.end())
185  {
186  continue;
187  }
188 
189  (*eit)->MakeOrder(order, edgeGeoms[edgeId],
190  pTypes[LibUtilities::eSegment], m_spaceDim, id);
191  processedEdges.insert(edgeId);
192  }
193 
194  // Call MakeOrder with our generated geometries on each face to fill in face
195  // interior nodes.
196  ct = 0;
197  for (fit = m_faceSet.begin(); fit != m_faceSet.end(); fit++, ct++)
198  {
199  if (m_verbose)
200  {
202  ct, m_faceSet.size(), "MakeOrder: Faces: ");
203  }
204  int faceId = (*fit)->m_id;
205 
206  if (processedFaces.find(faceId) != processedFaces.end())
207  {
208  continue;
209  }
210 
211  LibUtilities::ShapeType type = (*fit)->m_vertexList.size() == 3 ?
213  (*fit)->MakeOrder(order, faceGeoms[faceId], pTypes[type], m_spaceDim,
214  id);
215  processedFaces.insert(faceId);
216  }
217 
218  // Copy curvature into boundary conditions
219  for (int i = 0; i < m_element[1].size(); ++i)
220  {
221  ElementSharedPtr el = m_element[1][i];
222  EdgeSharedPtr edge = el->GetEdgeLink();
223 
224  if (!edge)
225  {
226  continue;
227  }
228 
229  // Copy face curvature
230  el->MakeOrder(order, SpatialDomains::GeometrySharedPtr(),
231  pTypes[el->GetConf().m_e], m_spaceDim, id, true);
232  el->SetVolumeNodes(edge->m_edgeNodes);
233  }
234 
235  for (int i = 0; i < m_element[2].size(); ++i)
236  {
237  ElementSharedPtr el = m_element[2][i];
238  FaceSharedPtr face = el->GetFaceLink();
239 
240  if (!face)
241  {
242  continue;
243  }
244 
245  // Copy face curvature
246  el->MakeOrder(order, SpatialDomains::GeometrySharedPtr(),
247  pTypes[el->GetConf().m_e], m_spaceDim, id, true);
248  el->SetVolumeNodes(face->m_faceNodes);
249  }
250 
251  // Finally, fill in volumes.
252  const int nElmt = m_element[m_expDim].size();
253  for (int i = 0; i < nElmt; ++i)
254  {
255  if (m_verbose)
256  {
257  LibUtilities::PrintProgressbar(i, nElmt, "MakeOrder: Elements: ");
258  }
260  el->MakeOrder(order, volGeoms[el->GetId()], pTypes[el->GetConf().m_e],
261  m_spaceDim, id);
262  }
263 
264  if (m_verbose)
265  {
266  cout << endl;
267  }
268 }
FaceSet m_faceSet
Set of element faces.
Definition: Mesh.h:112
int PrintProgressbar(const int position, const int goal, const string message, int lastprogress=-1)
Prints a progressbar.
Definition: Progressbar.hpp:69
unsigned int m_spaceDim
Dimension of the space in which the mesh is defined.
Definition: Mesh.h:100
unsigned int m_expDim
Dimension of the expansion.
Definition: Mesh.h:98
1D Evenly-spaced points using Lagrange polynomial
Definition: PointsType.h:65
ElementMap m_element
Map for elements.
Definition: Mesh.h:114
NodeSet m_vertexSet
Set of element vertices.
Definition: Mesh.h:106
3D Nodal Electrostatic Points on a Tetrahedron
Definition: PointsType.h:74
EdgeSet m_edgeSet
Set of element edges.
Definition: Mesh.h:110
bool m_verbose
Verbose flag.
Definition: Mesh.h:96
3D Evenly-spaced points on a Tetrahedron
Definition: PointsType.h:73
boost::shared_ptr< Geometry2D > Geometry2DSharedPtr
Definition: Geometry2D.h:59
boost::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge.
Definition: Edge.h:135
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
boost::shared_ptr< Geometry1D > Geometry1DSharedPtr
Definition: Geometry1D.h:48
3D Evenly-spaced points on a Prism
Definition: PointsType.h:75
2D Evenly-spaced points on a Triangle
Definition: PointsType.h:72
boost::shared_ptr< Element > ElementSharedPtr
Definition: Edge.h:49
boost::shared_ptr< Face > FaceSharedPtr
Definition: Face.h:148
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
boost::shared_ptr< Geometry > GeometrySharedPtr
Definition: Geometry.h:53
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:52
2D Nodal Electrostatic Points on a Triangle
Definition: PointsType.h:70
3D electrostatically spaced points on a Prism
Definition: PointsType.h:76

Member Data Documentation

CADSystemSharedPtr Nektar::NekMeshUtils::Mesh::m_cad

CAD system pointer, if there is no cad its empty.

Definition at line 129 of file Mesh.h.

CompositeMap Nektar::NekMeshUtils::Mesh::m_composite

Map for composites.

Definition at line 116 of file Mesh.h.

ConditionMap Nektar::NekMeshUtils::Mesh::m_condition

Boundary conditions maps tag to condition.

Definition at line 118 of file Mesh.h.

EdgeSet Nektar::NekMeshUtils::Mesh::m_edgeSet

Set of element edges.

Definition at line 110 of file Mesh.h.

ElementMap Nektar::NekMeshUtils::Mesh::m_element

Map for elements.

Definition at line 114 of file Mesh.h.

unsigned int Nektar::NekMeshUtils::Mesh::m_expDim

Dimension of the expansion.

Definition at line 98 of file Mesh.h.

std::map<int, std::string> Nektar::NekMeshUtils::Mesh::m_faceLabels

List of face labels for composite annotation.

Definition at line 127 of file Mesh.h.

FaceSet Nektar::NekMeshUtils::Mesh::m_faceSet

Set of element faces.

Definition at line 112 of file Mesh.h.

std::vector<std::string> Nektar::NekMeshUtils::Mesh::m_fields

List of fields names.

Definition at line 120 of file Mesh.h.

std::vector<NodeSharedPtr> Nektar::NekMeshUtils::Mesh::m_node

List of mesh nodes.

Definition at line 104 of file Mesh.h.

unsigned int Nektar::NekMeshUtils::Mesh::m_nummode

a order tag to aid output, a bit of a hack

Definition at line 102 of file Mesh.h.

int Nektar::NekMeshUtils::Mesh::m_numNodes

used for meshing purposes to keep trac of ids

Definition at line 108 of file Mesh.h.

OctreeSharedPtr Nektar::NekMeshUtils::Mesh::m_octree

Octree system pointer, if there is no octree its empty.

Definition at line 131 of file Mesh.h.

unsigned int Nektar::NekMeshUtils::Mesh::m_spaceDim

Dimension of the space in which the mesh is defined.

Definition at line 100 of file Mesh.h.

std::set<std::pair<int, int> > Nektar::NekMeshUtils::Mesh::m_spherigonSurfs

Set of all pairs of element ID and edge/face number on which to apply spherigon surface smoothing.

Definition at line 125 of file Mesh.h.

bool Nektar::NekMeshUtils::Mesh::m_verbose

Verbose flag.

Definition at line 96 of file Mesh.h.

boost::unordered_map<int, Node> Nektar::NekMeshUtils::Mesh::m_vertexNormals

Map of vertex normals.

Definition at line 122 of file Mesh.h.

NodeSet Nektar::NekMeshUtils::Mesh::m_vertexSet

Set of element vertices.

Definition at line 106 of file Mesh.h.