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().

100 {
101  // Going to make a copy of the curavture information, since this is cheaper
102  // than using Nektar's Geometry objects. Currently, the geometry objects
103  // which make up a 3D element dont use the volume nodes, they are just
104  // stored, so we can get away without copying them.
105 
106  int id = m_vertexSet.size();
107 
108  EdgeSet::iterator eit;
109  FaceSet::iterator fit;
110 
111  boost::unordered_map<int, EdgeSharedPtr> edgeCopies;
112  boost::unordered_map<int, FaceSharedPtr> faceCopies;
113 
114  // Decide on distribution of points to use for each shape type based on the
115  // input we've been supplied.
116  std::map<LibUtilities::ShapeType, LibUtilities::PointsType> pTypes;
117  if (distType == LibUtilities::ePolyEvenlySpaced)
118  {
126  }
127  else if (distType == LibUtilities::eGaussLobattoLegendre)
128  {
136  }
137  else
138  {
139  ASSERTL1(false, "Mesh::MakeOrder does not support this points type.");
140  }
141 
142  // Begin by copying mesh objects for edges and faces so that we don't affect
143  // any neighbouring elements in the mesh as we process each element. At the
144  // same time we delete the curvature from the original edge and face, which
145  // will be re-added with the MakeOrder routine.
146 
147  // First, we fill in the volume-interior nodes. This preserves the original
148  // curvature of the mesh.
149  const int nElmt = m_element[m_expDim].size();
150  int tmpId = 0;
151  for (int i = 0; i < nElmt; ++i)
152  {
153  if (m_verbose)
154  {
155  LibUtilities::PrintProgressbar(i, nElmt, "MakeOrder: Elements: ");
156  }
158  SpatialDomains::GeometrySharedPtr geom = el->GetGeom(m_spaceDim);
159  geom->FillGeom();
160  el->MakeOrder(order, geom, pTypes[el->GetConf().m_e], m_spaceDim, tmpId);
161  }
162 
163  // Now make copies of each of the edges.
164  for (eit = m_edgeSet.begin(); eit != m_edgeSet.end(); eit++)
165  {
166  edgeCopies[(*eit)->m_id] = EdgeSharedPtr(new Edge(*(*eit)));
167  (*eit)->m_edgeNodes.clear();
168  }
169 
170  // Now copy faces. Make sure that this is a "deep copy", so that the face's
171  // edge list corresponds to the copied edges, otherwise we end up in a
172  // non-consistent state.
173  for (fit = m_faceSet.begin(); fit != m_faceSet.end(); fit++)
174  {
175  FaceSharedPtr tmpFace = FaceSharedPtr(new Face(*(*fit)));
176 
177  for (int i = 0; i < tmpFace->m_edgeList.size(); ++i)
178  {
179  tmpFace->m_edgeList[i] = edgeCopies[tmpFace->m_edgeList[i]->m_id];
180  }
181 
182  faceCopies[(*fit)->m_id] = tmpFace;
183  (*fit)->m_faceNodes.clear();
184  }
185 
186  boost::unordered_set<int> processedEdges, processedFaces, processedVolumes;
187 
188  // note if CAD previously existed on the face or edge, the new points need
189  // to be projected onto the CAD entity.
190 
191  // Call MakeOrder with our generated geometries on each edge to fill in edge
192  // interior nodes.
193  int ct = 0;
194  for (eit = m_edgeSet.begin(); eit != m_edgeSet.end(); eit++, ct++)
195  {
196  if (m_verbose)
197  {
199  "MakeOrder: Edges: ");
200  }
201  int edgeId = (*eit)->m_id;
202 
203  if (processedEdges.find(edgeId) != processedEdges.end())
204  {
205  continue;
206  }
207 
208  EdgeSharedPtr cpEdge = edgeCopies[edgeId];
209  SpatialDomains::GeometrySharedPtr geom = cpEdge->GetGeom(m_spaceDim);
210  geom->FillGeom();
211 
212  (*eit)->MakeOrder(order, geom, pTypes[LibUtilities::eSegment],
213  m_spaceDim, id);
214  processedEdges.insert(edgeId);
215  }
216 
217  // Call MakeOrder with our generated geometries on each face to fill in face
218  // interior nodes.
219  ct = 0;
220  for (fit = m_faceSet.begin(); fit != m_faceSet.end(); fit++, ct++)
221  {
222  if (m_verbose)
223  {
225  "MakeOrder: Faces: ");
226  }
227  int faceId = (*fit)->m_id;
228 
229  if (processedFaces.find(faceId) != processedFaces.end())
230  {
231  continue;
232  }
233 
234  FaceSharedPtr cpFace = faceCopies[faceId];
235  SpatialDomains::GeometrySharedPtr geom = cpFace->GetGeom(m_spaceDim);
236  geom->FillGeom();
237 
238  LibUtilities::ShapeType type = (*fit)->m_vertexList.size() == 3
241  (*fit)->MakeOrder(order, geom, pTypes[type], m_spaceDim, id);
242  processedFaces.insert(faceId);
243  }
244 
245  // Copy curvature into boundary conditions
246  for (int i = 0; i < m_element[1].size(); ++i)
247  {
248  ElementSharedPtr el = m_element[1][i];
249  EdgeSharedPtr edge = el->GetEdgeLink();
250 
251  if (!edge)
252  {
253  continue;
254  }
255 
256  // Copy face curvature
257  el->MakeOrder(order, SpatialDomains::GeometrySharedPtr(),
258  pTypes[el->GetConf().m_e], m_spaceDim, id, true);
259  el->SetVolumeNodes(edge->m_edgeNodes);
260  }
261 
262  for (int i = 0; i < m_element[2].size(); ++i)
263  {
264  ElementSharedPtr el = m_element[2][i];
265  FaceSharedPtr face = el->GetFaceLink();
266 
267  if (!face)
268  {
269  continue;
270  }
271 
272  // Copy face curvature
273  el->MakeOrder(order, SpatialDomains::GeometrySharedPtr(),
274  pTypes[el->GetConf().m_e], m_spaceDim, id, true);
275  el->SetVolumeNodes(face->m_faceNodes);
276  }
277 
278  for (int i = 0; i < nElmt; ++i)
279  {
280  vector<NodeSharedPtr> tmp = m_element[m_expDim][i]->GetVolumeNodes();
281  for (int j = 0; j < tmp.size(); ++j)
282  {
283  tmp[j]->m_id = id++;
284  }
285  }
286 
287  if (m_verbose)
288  {
289  cout << endl;
290  }
291 }
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< Edge > EdgeSharedPtr
Shared pointer to an edge.
Definition: Edge.h:136
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
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:153
#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.