Commit d61fc059 authored by Dave Moxey's avatar Dave Moxey
Browse files

Merge branch 'fix/gmsh_writer' into 'master'

fix/gmsh-writer

See merge request !747
parents b1bf964a 4cf3f60c
...@@ -11,6 +11,11 @@ v4.5.0 ...@@ -11,6 +11,11 @@ v4.5.0
**Documentation**: **Documentation**:
- Added the developer-guide repository as a submodule (!751) - Added the developer-guide repository as a submodule (!751)
v4.4.1
------
**NekMesh**:
- Fix memory consumption issue with Gmsh output (!747)
v4.4.0 v4.4.0
------ ------
**Library**: **Library**:
......
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
// //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <NekMeshUtils/MeshElements/Mesh.h>
#include <LibUtilities/Foundations/ManagerAccess.h>
#include <LibUtilities/BasicUtils/Progressbar.hpp> #include <LibUtilities/BasicUtils/Progressbar.hpp>
#include <LibUtilities/Foundations/ManagerAccess.h>
#include <NekMeshUtils/MeshElements/Mesh.h>
using namespace std; using namespace std;
...@@ -96,17 +96,22 @@ unsigned int Mesh::GetNumEntities() ...@@ -96,17 +96,22 @@ unsigned int Mesh::GetNumEntities()
* - Finally, any boundary elements are updated so that they have the same * - Finally, any boundary elements are updated so that they have the same
* interior degrees of freedom as their corresponding edge or face links. * interior degrees of freedom as their corresponding edge or face links.
*/ */
void Mesh::MakeOrder(int order, void Mesh::MakeOrder(int order, LibUtilities::PointsType distType)
LibUtilities::PointsType distType)
{ {
// going to make a copy of the curavture information
// cheaper that geom objects
// currently the geometry objects which make up a 3D element
// dont use the volume nodes, they are just stored,
// so we can get away without copying them
int id = m_vertexSet.size(); int id = m_vertexSet.size();
EdgeSet::iterator eit; EdgeSet::iterator eit;
FaceSet::iterator fit; FaceSet::iterator fit;
boost::unordered_map<int, SpatialDomains::Geometry1DSharedPtr> edgeGeoms; boost::unordered_map<int, EdgeSharedPtr> edgeCopies;
boost::unordered_map<int, SpatialDomains::Geometry2DSharedPtr> faceGeoms; boost::unordered_map<int, FaceSharedPtr> faceCopies;
boost::unordered_map<int, SpatialDomains::GeometrySharedPtr> volGeoms;
// Decide on distribution of points to use for each shape type based on the // Decide on distribution of points to use for each shape type based on the
// input we've been supplied. // input we've been supplied.
...@@ -127,7 +132,7 @@ void Mesh::MakeOrder(int order, ...@@ -127,7 +132,7 @@ void Mesh::MakeOrder(int order,
pTypes[LibUtilities::eTriangle] = LibUtilities::eNodalTriElec; pTypes[LibUtilities::eTriangle] = LibUtilities::eNodalTriElec;
pTypes[LibUtilities::eQuadrilateral] = pTypes[LibUtilities::eQuadrilateral] =
LibUtilities::eGaussLobattoLegendre; LibUtilities::eGaussLobattoLegendre;
pTypes[LibUtilities::ePrism] = LibUtilities::eNodalPrismElec; pTypes[LibUtilities::ePrism] = LibUtilities::eNodalPrismElec;
pTypes[LibUtilities::eTetrahedron] = LibUtilities::eNodalTetElec; pTypes[LibUtilities::eTetrahedron] = LibUtilities::eNodalTetElec;
pTypes[LibUtilities::eHexahedron] = LibUtilities::eGaussLobattoLegendre; pTypes[LibUtilities::eHexahedron] = LibUtilities::eGaussLobattoLegendre;
} }
...@@ -136,32 +141,20 @@ void Mesh::MakeOrder(int order, ...@@ -136,32 +141,20 @@ void Mesh::MakeOrder(int order,
ASSERTL1(false, "Mesh::MakeOrder does not support this points type."); ASSERTL1(false, "Mesh::MakeOrder does not support this points type.");
} }
// Begin by generating Nektar++ geometry objects for edges, faces and // Begin by coping mesh objects for edges, faces
// elements so that we don't affect any neighbouring elements in the mesh as // so that we don't affect any neighbouring elements in the mesh as
// we process each element. // we process each element.
for(eit = m_edgeSet.begin(); eit != m_edgeSet.end(); eit++) // at the same time we delete the curvature from the original edge
{ for (eit = m_edgeSet.begin(); eit != m_edgeSet.end(); eit++)
SpatialDomains::Geometry1DSharedPtr geom =
(*eit)->GetGeom(m_spaceDim);
geom->FillGeom();
edgeGeoms[(*eit)->m_id] = geom;
}
for(fit = m_faceSet.begin(); fit != m_faceSet.end(); fit++)
{ {
SpatialDomains::Geometry2DSharedPtr geom = edgeCopies[(*eit)->m_id] = EdgeSharedPtr(new Edge(*(*eit)));
(*fit)->GetGeom(m_spaceDim); (*eit)->m_edgeNodes.clear();
geom->FillGeom();
faceGeoms[(*fit)->m_id] = geom;
} }
for(int i = 0; i < m_element[m_expDim].size(); i++) for (fit = m_faceSet.begin(); fit != m_faceSet.end(); fit++)
{ {
ElementSharedPtr el = m_element[m_expDim][i]; faceCopies[(*fit)->m_id] = FaceSharedPtr(new Face(*(*fit)));
SpatialDomains::GeometrySharedPtr geom = (*fit)->m_faceNodes.clear();
el->GetGeom(m_spaceDim);
geom->FillGeom();
volGeoms[el->GetId()] = geom;
} }
boost::unordered_set<int> processedEdges, processedFaces, processedVolumes; boost::unordered_set<int> processedEdges, processedFaces, processedVolumes;
...@@ -176,8 +169,8 @@ void Mesh::MakeOrder(int order, ...@@ -176,8 +169,8 @@ void Mesh::MakeOrder(int order,
{ {
if (m_verbose) if (m_verbose)
{ {
LibUtilities::PrintProgressbar( LibUtilities::PrintProgressbar(ct, m_edgeSet.size(),
ct, m_edgeSet.size(), "MakeOrder: Edges: "); "MakeOrder: Edges: ");
} }
int edgeId = (*eit)->m_id; int edgeId = (*eit)->m_id;
...@@ -186,8 +179,12 @@ void Mesh::MakeOrder(int order, ...@@ -186,8 +179,12 @@ void Mesh::MakeOrder(int order,
continue; continue;
} }
(*eit)->MakeOrder(order, edgeGeoms[edgeId], EdgeSharedPtr cpEdge = edgeCopies[edgeId];
pTypes[LibUtilities::eSegment], m_spaceDim, id); SpatialDomains::GeometrySharedPtr geom = cpEdge->GetGeom(m_spaceDim);
geom->FillGeom();
(*eit)->MakeOrder(order, geom, pTypes[LibUtilities::eSegment],
m_spaceDim, id);
processedEdges.insert(edgeId); processedEdges.insert(edgeId);
} }
...@@ -198,8 +195,8 @@ void Mesh::MakeOrder(int order, ...@@ -198,8 +195,8 @@ void Mesh::MakeOrder(int order,
{ {
if (m_verbose) if (m_verbose)
{ {
LibUtilities::PrintProgressbar( LibUtilities::PrintProgressbar(ct, m_faceSet.size(),
ct, m_faceSet.size(), "MakeOrder: Faces: "); "MakeOrder: Faces: ");
} }
int faceId = (*fit)->m_id; int faceId = (*fit)->m_id;
...@@ -208,10 +205,14 @@ void Mesh::MakeOrder(int order, ...@@ -208,10 +205,14 @@ void Mesh::MakeOrder(int order,
continue; continue;
} }
LibUtilities::ShapeType type = (*fit)->m_vertexList.size() == 3 ? FaceSharedPtr cpFace = faceCopies[faceId];
LibUtilities::eTriangle : LibUtilities::eQuadrilateral; SpatialDomains::GeometrySharedPtr geom = cpFace->GetGeom(m_spaceDim);
(*fit)->MakeOrder(order, faceGeoms[faceId], pTypes[type], m_spaceDim, geom->FillGeom();
id);
LibUtilities::ShapeType type = (*fit)->m_vertexList.size() == 3
? LibUtilities::eTriangle
: LibUtilities::eQuadrilateral;
(*fit)->MakeOrder(order, geom, pTypes[type], m_spaceDim, id);
processedFaces.insert(faceId); processedFaces.insert(faceId);
} }
...@@ -219,7 +220,7 @@ void Mesh::MakeOrder(int order, ...@@ -219,7 +220,7 @@ void Mesh::MakeOrder(int order,
for (int i = 0; i < m_element[1].size(); ++i) for (int i = 0; i < m_element[1].size(); ++i)
{ {
ElementSharedPtr el = m_element[1][i]; ElementSharedPtr el = m_element[1][i];
EdgeSharedPtr edge = el->GetEdgeLink(); EdgeSharedPtr edge = el->GetEdgeLink();
if (!edge) if (!edge)
{ {
...@@ -235,7 +236,7 @@ void Mesh::MakeOrder(int order, ...@@ -235,7 +236,7 @@ void Mesh::MakeOrder(int order,
for (int i = 0; i < m_element[2].size(); ++i) for (int i = 0; i < m_element[2].size(); ++i)
{ {
ElementSharedPtr el = m_element[2][i]; ElementSharedPtr el = m_element[2][i];
FaceSharedPtr face = el->GetFaceLink(); FaceSharedPtr face = el->GetFaceLink();
if (!face) if (!face)
{ {
...@@ -256,9 +257,10 @@ void Mesh::MakeOrder(int order, ...@@ -256,9 +257,10 @@ void Mesh::MakeOrder(int order,
{ {
LibUtilities::PrintProgressbar(i, nElmt, "MakeOrder: Elements: "); LibUtilities::PrintProgressbar(i, nElmt, "MakeOrder: Elements: ");
} }
ElementSharedPtr el = m_element[m_expDim][i]; ElementSharedPtr el = m_element[m_expDim][i];
el->MakeOrder(order, volGeoms[el->GetId()], pTypes[el->GetConf().m_e], SpatialDomains::GeometrySharedPtr geom = el->GetGeom(m_spaceDim);
m_spaceDim, id); geom->FillGeom();
el->MakeOrder(order, geom, pTypes[el->GetConf().m_e], m_spaceDim, id);
} }
if (m_verbose) if (m_verbose)
...@@ -266,6 +268,5 @@ void Mesh::MakeOrder(int order, ...@@ -266,6 +268,5 @@ void Mesh::MakeOrder(int order,
cout << endl; cout << endl;
} }
} }
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment