Commit dbd631ba authored by David Moxey's avatar David Moxey

Apply patches to NekMesh

parent 68226f7a
......@@ -55,56 +55,6 @@ public:
{
}
/**
* @brief Generate a Nektar++ string describing the composite.
*
* The list of composites may include individual element IDs or ranges of
* element IDs.
*/
NEKMESHUTILS_EXPORT std::string GetXmlString(bool doSort = true)
{
std::stringstream st;
std::vector<ElementSharedPtr>::iterator it;
bool range = false;
int vId = m_items[0]->GetId();
int prevId = vId;
st << " " << m_tag << "[" << vId;
for (it = m_items.begin() + 1; it != m_items.end(); ++it)
{
// store previous element ID and get current one
prevId = vId;
vId = (*it)->GetId();
// continue an already started range
if (prevId > -1 && vId == prevId + 1)
{
range = true;
// if this is the last element, it's the end of a range, so
// write
if (*it == m_items.back())
{
st << "-" << vId;
}
continue;
}
// terminate a range, if present
if (range)
{
st << "-" << prevId;
range = false;
}
// write what will be either a single entry or start of new range
st << "," << vId;
}
// terminate
st << "] ";
return st.str();
}
/// ID of composite.
unsigned int m_id;
/// Element type tag.
......
......@@ -102,6 +102,8 @@ SpatialDomains::SegGeomSharedPtr Edge::GetGeom(int coordDim)
m_id, coordDim, p);
}
ret->Setup();
return ret;
}
......
......@@ -334,7 +334,7 @@ SpatialDomains::Geometry2DSharedPtr Face::GetGeom(int coordDim)
}
ret = MemoryManager<SpatialDomains::TriGeom>::AllocateSharedPtr(
m_id, edges, edgeo, c);
m_id, edges, c);
}
else
{
......@@ -399,7 +399,7 @@ SpatialDomains::Geometry2DSharedPtr Face::GetGeom(int coordDim)
ret =
MemoryManager<SpatialDomains::QuadGeom>::AllocateSharedPtr(
m_id, edges, edgeo, c);
m_id, edges, c);
}
}
else
......@@ -407,16 +407,17 @@ SpatialDomains::Geometry2DSharedPtr Face::GetGeom(int coordDim)
if (nEdge == 3)
{
ret = MemoryManager<SpatialDomains::TriGeom>::AllocateSharedPtr(
m_id, edges, edgeo);
m_id, edges);
}
else
{
ret =
MemoryManager<SpatialDomains::QuadGeom>::AllocateSharedPtr(
m_id, edges, edgeo);
m_id, edges);
}
}
ret->Setup();
return ret;
}
......
......@@ -170,8 +170,10 @@ SpatialDomains::GeometrySharedPtr Hexahedron::GetGeom(int coordDim)
m_face[i]->GetGeom(coordDim));
}
ret = MemoryManager<SpatialDomains::HexGeom>::AllocateSharedPtr(faces);
ret = MemoryManager<SpatialDomains::HexGeom>::AllocateSharedPtr(
m_id, faces);
ret->Setup();
return ret;
}
......
......@@ -107,6 +107,7 @@ SpatialDomains::GeometrySharedPtr Line::GetGeom(int coordDim)
m_id, 2, p);
}
ret->Setup();
return ret;
}
......
......@@ -36,6 +36,8 @@
#ifndef NEKMESHUTILS_MESHELEMENTS_MESH
#define NEKMESHUTILS_MESHELEMENTS_MESH
#include <set>
#include <NekMeshUtils/NekMeshUtilsDeclspec.h>
#include <NekMeshUtils/MeshElements/Element.h>
#include <NekMeshUtils/MeshElements/Composite.h>
......
......@@ -253,8 +253,10 @@ SpatialDomains::GeometrySharedPtr Prism::GetGeom(int coordDim)
faces[i] = m_face[i]->GetGeom(coordDim);
}
ret = MemoryManager<SpatialDomains::PrismGeom>::AllocateSharedPtr(faces);
ret = MemoryManager<SpatialDomains::PrismGeom>::AllocateSharedPtr(
m_id, faces);
ret->Setup();
return ret;
}
......
......@@ -164,7 +164,9 @@ SpatialDomains::GeometrySharedPtr Pyramid::GetGeom(int coordDim)
faces[i] = m_face[i]->GetGeom(coordDim);
}
m_geom = MemoryManager<SpatialDomains::PyrGeom>::AllocateSharedPtr(faces);
m_geom = MemoryManager<SpatialDomains::PyrGeom>::AllocateSharedPtr(
m_id, faces);
m_geom->Setup();
return m_geom;
}
......
......@@ -205,24 +205,17 @@ void Quadrilateral::MakeOrder(int order,
SpatialDomains::GeometrySharedPtr Quadrilateral::GetGeom(int coordDim)
{
SpatialDomains::SegGeomSharedPtr edges[4];
SpatialDomains::PointGeomSharedPtr verts[4];
SpatialDomains::QuadGeomSharedPtr ret;
for (int i = 0; i < 4; ++i)
{
edges[i] = m_edge[i]->GetGeom(coordDim);
verts[i] = m_vertex[i]->GetGeom(coordDim);
}
StdRegions::Orientation edgeorient[4] = {
SpatialDomains::SegGeom::GetEdgeOrientation(*edges[0], *edges[1]),
SpatialDomains::SegGeom::GetEdgeOrientation(*edges[1], *edges[2]),
SpatialDomains::SegGeom::GetEdgeOrientation(*edges[2], *edges[3]),
SpatialDomains::SegGeom::GetEdgeOrientation(*edges[3], *edges[0])};
ret = MemoryManager<SpatialDomains::QuadGeom>::AllocateSharedPtr(
m_id, verts, edges, edgeorient);
m_id, edges);
ret->Setup();
return ret;
}
......
......@@ -239,7 +239,9 @@ SpatialDomains::GeometrySharedPtr Tetrahedron::GetGeom(int coordDim)
m_face[i]->GetGeom(coordDim));
}
ret = MemoryManager<SpatialDomains::TetGeom>::AllocateSharedPtr(tfaces);
ret = MemoryManager<SpatialDomains::TetGeom>::AllocateSharedPtr(
m_id, tfaces);
ret->Setup();
return ret;
}
......
......@@ -121,22 +121,16 @@ Triangle::Triangle(ElmtConfig pConf,
SpatialDomains::GeometrySharedPtr Triangle::GetGeom(int coordDim)
{
SpatialDomains::SegGeomSharedPtr edges[3];
SpatialDomains::PointGeomSharedPtr verts[3];
SpatialDomains::TriGeomSharedPtr ret;
for (int i = 0; i < 3; ++i)
{
edges[i] = m_edge[i]->GetGeom(coordDim);
verts[i] = m_vertex[i]->GetGeom(coordDim);
}
StdRegions::Orientation edgeorient[3] = {
SpatialDomains::SegGeom::GetEdgeOrientation(*edges[0], *edges[1]),
SpatialDomains::SegGeom::GetEdgeOrientation(*edges[1], *edges[2]),
SpatialDomains::SegGeom::GetEdgeOrientation(*edges[2], *edges[0])};
ret = MemoryManager<SpatialDomains::TriGeom>::AllocateSharedPtr(
m_id, verts, edges, edgeorient);
m_id, edges);
ret->Setup();
return ret;
}
......
......@@ -71,6 +71,7 @@ void InputMCF::ParseFile(string nm)
filename.push_back(nm);
LibUtilities::SessionReaderSharedPtr pSession =
LibUtilities::SessionReader::CreateInstance(0, NULL, filename);
pSession->InitSession();
ASSERTL0(pSession->DefinesElement("NEKTAR/MESHING"), "no meshing tag");
ASSERTL0(pSession->DefinesElement("NEKTAR/MESHING/INFORMATION"),
......
......@@ -81,11 +81,11 @@ void InputNekpp::Process()
// Copy vertices.
map<int, NodeSharedPtr> vIdMap;
for (auto &vit : graph->GetVertSet())
for (auto &vit : graph->GetAllPointGeoms())
{
SpatialDomains::PointGeomSharedPtr vert = vit.second;
NodeSharedPtr n(
new Node(vert->GetVid(), (*vert)(0), (*vert)(1), (*vert)(2)));
new Node(vert->GetGlobalID(), (*vert)(0), (*vert)(1), (*vert)(2)));
m_mesh->m_vertexSet.insert(n);
vIdMap[vert->GetVid()] = n;
}
......@@ -107,13 +107,13 @@ void InputNekpp::Process()
int id0 = it.second->GetVid(0);
int id1 = it.second->GetVid(1);
LibUtilities::PointsType ptype =
it.second->GetPointsKeys()[0].GetPointsType();
it.second->GetXmap()->GetPointsKeys()[0].GetPointsType();
EdgeSharedPtr ed =
EdgeSharedPtr(new Edge(vIdMap[id0], vIdMap[id1], curve, ptype));
auto testIns = m_mesh->m_edgeSet.insert(ed);
(*(testIns.first))->m_id = it.second->GetEid();
eIdMap[it.second->GetEid()] = ed;
(*(testIns.first))->m_id = it.second->GetGlobalID();
eIdMap[it.second->GetGlobalID()] = ed;
}
}
......@@ -142,8 +142,8 @@ void InputNekpp::Process()
faceEdges,
LibUtilities::ePolyEvenlySpaced));
auto testIns = m_mesh->m_faceSet.insert(fac);
(*(testIns.first))->m_id = it.second->GetFid();
fIdMap[it.second->GetFid()] = fac;
(*(testIns.first))->m_id = it.second->GetGlobalID();
fIdMap[it.second->GetGlobalID()] = fac;
}
for (auto &it : graph->GetAllQuadGeoms())
......@@ -169,8 +169,8 @@ void InputNekpp::Process()
faceEdges,
LibUtilities::ePolyEvenlySpaced));
auto testIns = m_mesh->m_faceSet.insert(fac);
(*(testIns.first))->m_id = it.second->GetFid();
fIdMap[it.second->GetFid()] = fac;
(*(testIns.first))->m_id = it.second->GetGlobalID();
fIdMap[it.second->GetGlobalID()] = fac;
}
}
......@@ -241,10 +241,10 @@ void InputNekpp::Process()
for (auto &compIt : graph->GetComposites())
{
// Get hold of dimension
int dim = (*compIt.second)[0]->GetShapeDim();
int dim = compIt.second->m_geomVec[0]->GetShapeDim();
// compIt->second is a GeometryVector
for (auto &geomIt : *compIt.second)
for (auto &geomIt : compIt.second->m_geomVec)
{
ElmtConfig conf(geomIt->GetShapeType(), 1, true, true, false);
......
......@@ -36,8 +36,6 @@
#ifndef UTILITIES_NEKMESH_OUTPUTNEKPP
#define UTILITIES_NEKMESH_OUTPUTNEKPP
#include <tinyxml.h>
#include <NekMeshUtils/Module/Module.h>
namespace Nektar
......@@ -54,7 +52,7 @@ public:
{
return MemoryManager<OutputNekpp>::AllocateSharedPtr(m);
}
static NekMeshUtils::ModuleKey className;
static NekMeshUtils::ModuleKey className1, className2;
OutputNekpp(NekMeshUtils::MeshSharedPtr m);
virtual ~OutputNekpp();
......@@ -63,24 +61,13 @@ public:
virtual void Process();
private:
/// Writes the <NODES> section of the XML file.
void WriteXmlNodes(TiXmlElement *pRoot);
/// Writes the <EDGES> section of the XML file.
void WriteXmlEdges(TiXmlElement *pRoot);
/// Writes the <FACES> section of the XML file if needed.
void WriteXmlFaces(TiXmlElement *pRoot);
/// Writes the <ELEMENTS> section of the XML file.
void WriteXmlElements(TiXmlElement *pRoot);
/// Writes the <CURVES> section of the XML file if needed.
void WriteXmlCurves(TiXmlElement *pRoot);
/// Writes the <COMPOSITES> section of the XML file.
void WriteXmlComposites(TiXmlElement *pRoot);
/// Writes the <DOMAIN> section of the XML file.
void WriteXmlDomain(TiXmlElement *pRoot);
/// Writes the <EXPANSIONS> section of the XML file.
void WriteXmlExpansions(TiXmlElement *pRoot);
/// Writes the <CONDITIONS> section of the XML file.
void WriteXmlConditions(TiXmlElement *pRoot);
void TransferVertices(SpatialDomains::MeshGraphSharedPtr graph);
void TransferEdges(SpatialDomains::MeshGraphSharedPtr graph);
void TransferFaces(SpatialDomains::MeshGraphSharedPtr graph);
void TransferElements(SpatialDomains::MeshGraphSharedPtr graph);
void TransferCurves(SpatialDomains::MeshGraphSharedPtr graph);
void TransferComposites(SpatialDomains::MeshGraphSharedPtr graph);
void TransferDomain(SpatialDomains::MeshGraphSharedPtr graph);
};
}
}
......
......@@ -197,7 +197,7 @@ void ProcessBL::BoundaryLayer2D()
if (surf.size() > 0)
{
vector<unsigned int> surfs;
ParseUtils::GenerateSeqVector(surf, surfs);
ParseUtils::GenerateVector(surf, surfs);
sort(surfs.begin(), surfs.end());
// If surface is defined, process list of elements to find those
......@@ -729,7 +729,7 @@ void ProcessBL::BoundaryLayer3D()
if (surf.size() > 0)
{
vector<unsigned int> surfs;
ParseUtils::GenerateSeqVector(surf, surfs);
ParseUtils::GenerateVector(surf, surfs);
sort(surfs.begin(), surfs.end());
// If surface is defined, process list of elements to find those
......
......@@ -98,7 +98,7 @@ void ProcessJac::Process()
// Generate geometric factors.
SpatialDomains::GeomFactorsSharedPtr gfac = geom->GetGeomFactors();
LibUtilities::PointsKeyVector p = geom->GetPointsKeys();
LibUtilities::PointsKeyVector p = geom->GetXmap()->GetPointsKeys();
SpatialDomains::DerivStorage deriv = gfac->GetDeriv(p);
const int pts = deriv[0][0].num_elements();
Array<OneD,NekDouble> jc(pts);
......
......@@ -264,7 +264,7 @@ bool ProcessLinear::Invalid(ElementSharedPtr el, NekDouble thr)
SpatialDomains::GeometrySharedPtr geomL = elL->GetGeom(m_mesh->m_spaceDim);
SpatialDomains::GeomFactorsSharedPtr gfacL = geomL->GetGeomFactors();
LibUtilities::PointsKeyVector p = geom->GetPointsKeys();
LibUtilities::PointsKeyVector p = geom->GetXmap()->GetPointsKeys();
SpatialDomains::DerivStorage deriv = gfac->GetDeriv(p);
SpatialDomains::DerivStorage derivL = gfacL->GetDeriv(p);
const int pts = deriv[0][0].num_elements();
......
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