46 namespace NekMeshUtils
52 unsigned int Mesh::GetNumElements()
54 return m_element[m_expDim].size();
61 unsigned int Mesh::GetNumBndryElements()
63 unsigned int i, nElmt = 0;
65 for (i = 0; i < m_expDim; ++i)
66 nElmt += m_element[i].size();
75 unsigned int Mesh::GetNumEntities()
77 unsigned int nEnt = 0;
79 for (
unsigned int d = 0; d <= m_expDim; ++d)
81 nEnt += m_element[d].size();
108 int id = m_vertexSet.size();
110 EdgeSet::iterator eit;
111 FaceSet::iterator fit;
113 std::unordered_map<int, EdgeSharedPtr> edgeCopies;
114 std::unordered_map<int, FaceSharedPtr> faceCopies;
118 std::map<LibUtilities::ShapeType, LibUtilities::PointsType> pTypes;
141 ASSERTL1(
false,
"Mesh::MakeOrder does not support this points type.");
151 const int nElmt = m_element[m_expDim].size();
153 for (
int i = 0; i < nElmt; ++i)
162 el->MakeOrder(order, geom, pTypes[el->GetConf().m_e], m_spaceDim,
167 for (eit = m_edgeSet.begin(); eit != m_edgeSet.end(); eit++)
170 (*eit)->m_edgeNodes.clear();
176 for (fit = m_faceSet.begin(); fit != m_faceSet.end(); fit++)
180 for (
int i = 0; i < tmpFace->m_edgeList.size(); ++i)
182 tmpFace->m_edgeList[i] = edgeCopies[tmpFace->m_edgeList[i]->m_id];
185 faceCopies[(*fit)->m_id] = tmpFace;
186 (*fit)->m_faceNodes.clear();
189 std::unordered_set<int> processedEdges, processedFaces, processedVolumes;
197 for (eit = m_edgeSet.begin(); eit != m_edgeSet.end(); eit++, ct++)
202 "MakeOrder: Edges: ");
204 int edgeId = (*eit)->m_id;
206 if (processedEdges.find(edgeId) != processedEdges.end())
217 processedEdges.insert(edgeId);
223 for (fit = m_faceSet.begin(); fit != m_faceSet.end(); fit++, ct++)
228 "MakeOrder: Faces: ");
230 int faceId = (*fit)->m_id;
232 if (processedFaces.find(faceId) != processedFaces.end())
244 (*fit)->MakeOrder(order, geom, pTypes[type], m_spaceDim,
id);
245 processedFaces.insert(faceId);
249 for (
int i = 0; i < m_element[1].size(); ++i)
261 pTypes[el->GetConf().m_e], m_spaceDim, id,
true);
262 el->SetVolumeNodes(edge->m_edgeNodes);
265 for (
int i = 0; i < m_element[2].size(); ++i)
277 pTypes[el->GetConf().m_e], m_spaceDim, id,
true);
278 el->SetVolumeNodes(face->m_faceNodes);
281 for (
int i = 0; i < nElmt; ++i)
283 vector<NodeSharedPtr> tmp = m_element[m_expDim][i]->GetVolumeNodes();
284 for (
int j = 0; j < tmp.size(); ++j)
299 void Mesh::PrintStats(std::ostream &out)
301 out <<
"Mesh statistics" << std::endl
302 <<
"---------------" << std::endl
305 out <<
"Mesh dimension : " << m_spaceDim << std::endl
306 <<
"Element dimension : " << m_expDim << std::endl
307 <<
"Has CAD attached : " << (m_cad ?
"yes" :
"no") << std::endl
308 <<
"Node count : " << m_vertexSet.size() << std::endl;
310 if (m_edgeSet.size() > 0)
312 out <<
"Edge count : " << m_edgeSet.size() << std::endl;
315 if (m_faceSet.size() > 0)
317 out <<
"Face count : " << m_faceSet.size() << std::endl;
320 out <<
"Elements : " << m_element[m_expDim].size() << std::endl
321 <<
"Bnd elements : " << m_element[m_expDim - 1].size()
326 out <<
"Number of composites : " << m_composite.size() << std::endl;
329 auto extent = m_element[m_expDim][0]->GetBoundingBox();
330 for (
int i = 1; i < m_element[m_expDim].size(); ++i)
332 auto el = m_element[m_expDim][i]->GetBoundingBox();
333 extent.first.m_x = std::min(extent.first.m_x, el.first.m_x);
334 extent.first.m_y = std::min(extent.first.m_y, el.first.m_y);
335 extent.first.m_z = std::min(extent.first.m_z, el.first.m_z);
336 extent.second.m_x = std::max(extent.second.m_x, el.second.m_x);
337 extent.second.m_y = std::max(extent.second.m_y, el.second.m_y);
338 extent.second.m_z = std::max(extent.second.m_z, el.second.m_z);
341 out <<
"Lower mesh extent : " << extent.first.m_x <<
" " 342 << extent.first.m_y <<
" " << extent.first.m_z << std::endl
343 <<
"Upper mesh extent : " << extent.second.m_x <<
" " 344 << extent.second.m_y <<
" " << extent.second.m_z << std::endl;
346 std::map<LibUtilities::ShapeType, std::pair<int, int>> elmtCounts;
353 for (
int dim = 0; dim <= 3; ++dim)
355 for (
auto &elmt : m_element[dim])
357 auto &counts = elmtCounts[elmt->GetShapeType()];
359 if (elmt->IsDeformed())
370 out << std::endl <<
"Element counts (regular/deformed/total):" << std::endl;
374 auto counts = elmtCounts[shapeType];
376 if (counts.first + counts.second == 0)
381 out <<
" " << std::setw(14)
383 << setw(12) << counts.first <<
" " << setw(12) << counts.second
384 <<
" " << setw(12) << counts.first + counts.second << std::endl;
int PrintProgressbar(const int position, const int goal, const std::string message, int lastprogress=-1)
Prints a progressbar.
Represents an edge which joins two points.
Represents a face comprised of three or more edges.
std::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge.
const char *const ShapeTypeMap[]
std::shared_ptr< Face > FaceSharedPtr
1D Evenly-spaced points using Lagrange polynomial
std::shared_ptr< Element > ElementSharedPtr
3D Nodal Electrostatic Points on a Tetrahedron
std::shared_ptr< Geometry > GeometrySharedPtr
3D Evenly-spaced points on a Tetrahedron
3D Evenly-spaced points on a Prism
2D Evenly-spaced points on a Triangle
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
1D Gauss-Lobatto-Legendre quadrature points
2D Nodal Electrostatic Points on a Triangle
3D electrostatically spaced points on a Prism