Commit aee9ddbd authored by Michael Turner's avatar Michael Turner

setup parent cad pointers

parent 9ed89b71
......@@ -287,10 +287,6 @@ ELSE( NEKTAR_USE_MEMORY_POOLS )
REMOVE_DEFINITIONS(-DNEKTAR_MEMORY_POOL_ENABLED)
ENDIF( NEKTAR_USE_MEMORY_POOLS )
IF (NEKTAR_USE_MESHGEN)
ADD_DEFINITIONS(-DNEKTAR_USE_MESHGEN)
ENDIF()
SET(Boost_USE_STATIC_LIBS OFF)
IF( WIN32 )
# The auto-linking feature has problems with USE_STATIC_LIBS off, so we use
......
......@@ -57,7 +57,10 @@ public:
/**
* @brief Default constructor.
*/
CADCurve(){};
CADCurve()
{
m_type = CADType::eCurve;
}
~CADCurve()
{
......
......@@ -45,12 +45,15 @@ namespace Nektar
namespace NekMeshUtils
{
namespace CADType
{
enum cadType
{
eVert,
eCurve,
eSurf
};
}
class CADObject
{
......@@ -74,7 +77,7 @@ public:
return m_id;
}
cadType GetType()
CADType::cadType GetType()
{
return m_type;
}
......@@ -83,7 +86,7 @@ protected:
/// ID of the vert.
int m_id;
/// type of the cad object
cadType m_type;
CADType::cadType m_type;
};
typedef boost::shared_ptr<CADObject> CADObjectSharedPtr;
......
......@@ -62,6 +62,7 @@ public:
*/
CADSurf()
{
m_type = CADType::eSurf;
}
~CADSurf()
......
......@@ -63,6 +63,7 @@ public:
*/
CADVert()
{
m_type = CADType::eVert;
}
~CADVert(){};
......
......@@ -91,7 +91,6 @@ public:
m_c = BRep_Tool::Curve(TopoDS::Edge(cp), b[0], b[1]);
m_id = i;
m_type = curve;
}
private:
......
......@@ -59,7 +59,6 @@ void CADSurfOCE::Initialise(int i, TopoDS_Shape in, vector<EdgeLoop> ein)
m_occSurface = BRepAdaptor_Surface(TopoDS::Face(in));
m_correctNormal = true;
m_id = i;
m_type = surf;
}
Array<OneD, NekDouble> CADSurfOCE::GetBounds()
......
......@@ -61,7 +61,6 @@ void CADVertOCE::Initialise(int i, TopoDS_Shape in)
new Node(i - 1, m_occVert.X(), m_occVert.Y(), m_occVert.Z()));
degen = false;
m_type = vert;
}
}
......
......@@ -126,7 +126,7 @@ public:
/// Element(s) which are linked to this edge.
std::vector<std::pair<ElementSharedPtr, int> > m_elLink;
CADObjectSharedPtr parentCAD;
CADObjectSharedPtr m_parentCAD;
private:
SpatialDomains::SegGeomSharedPtr m_geom;
......
......@@ -365,9 +365,7 @@ public:
std::swap(m_vertex[0],m_vertex[1]);
}
#ifdef NEKTAR_USE_MESHGEN
int CADSurfId;
#endif
CADObjectSharedPtr m_parentCAD;
protected:
/// ID of the element.
......
......@@ -74,7 +74,7 @@ public:
: m_vertexList(pSrc.m_vertexList), m_edgeList(pSrc.m_edgeList),
m_faceNodes(pSrc.m_faceNodes), m_curveType(pSrc.m_curveType),
m_geom(pSrc.m_geom){}
NEKMESHUTILS_EXPORT ~Face()
{
}
......@@ -142,7 +142,7 @@ public:
/// Nektar++ representation of geometry
SpatialDomains::Geometry2DSharedPtr m_geom;
CADObjectSharedPtr parentCAD;
CADObjectSharedPtr m_parentCAD;
};
typedef boost::shared_ptr<Face> FaceSharedPtr;
......
......@@ -212,9 +212,7 @@ void CurveMesh::Mesh()
{
EdgeSharedPtr e = boost::shared_ptr<Edge>(
new Edge(m_meshpoints[i], m_meshpoints[i + 1]));
e->CADCurveId = m_id;
e->CADCurve = m_cadcurve;
e->onCurve = true;
e->m_parentCAD = m_cadcurve;
m_mesh->m_edgeSet.insert(e);
}
......
......@@ -606,8 +606,8 @@ void FaceMesh::DiagonalSwap()
ntri1->SetId(id1);
ntri2->SetId(id2);
ntri1->CADSurfId = m_id;
ntri2->CADSurfId = m_id;
ntri1->m_parentCAD = m_cadsurf;
ntri2->m_parentCAD = m_cadsurf;
vector<EdgeSharedPtr> t1es = ntri1->GetEdgeList();
for (int i = 0; i < 3; i++)
......@@ -695,7 +695,7 @@ void FaceMesh::BuildLocalMesh()
tags.push_back(m_id + (over ? 1000 : 100));
ElementSharedPtr E = GetElementFactory().CreateInstance(
LibUtilities::eTriangle, conf, m_connec[i], tags);
E->CADSurfId = m_id;
E->m_parentCAD = m_cadsurf;
vector<NodeSharedPtr> nods = E->GetVertexList();
for (int j = 0; j < nods.size(); j++)
......
......@@ -298,14 +298,13 @@ void HOSurfaceMesh::Process()
i, m_mesh->m_element[2].size(), "\t\tSurface elements");
}
int surf = m_mesh->m_element[2][i]->CADSurfId;
CADSurfSharedPtr s = m_mesh->m_cad->GetSurf(surf);
CADObjectSharedPtr o = m_mesh->m_element[2][i]->m_parentCAD;
CADSurfSharedPtr s = boost::dynamic_pointer_cast<CADSurf>(o);
int surf = s->GetId();
FaceSharedPtr f = m_mesh->m_element[2][i]->GetFaceLink();
f->onSurf = true;
f->CADSurfId = surf;
f->CADSurf = s;
f->m_parentCAD = s;
vector<EdgeSharedPtr> edges = f->m_edgeList;
for (int j = 0; j < edges.size(); j++)
......@@ -329,16 +328,14 @@ void HOSurfaceMesh::Process()
// able to identify how to make it high-order
EdgeSet::iterator it = surfaceEdges.find(e);
ASSERTL0(it != surfaceEdges.end(),"could not find edge in surface");
e->onCurve = (*it)->onCurve;
e->CADCurveId = (*it)->CADCurveId;
e->CADCurve = (*it)->CADCurve;
e->m_parentCAD = (*it)->m_parentCAD;
vector<NodeSharedPtr> honodes(m_mesh->m_nummode - 2);
if (e->onCurve)
if (e->m_parentCAD->GetType() == CADType::eCurve)
{
int cid = e->CADCurveId;
CADCurveSharedPtr c = e->CADCurve;
int cid = e->m_parentCAD->GetId();
CADCurveSharedPtr c = boost::dynamic_pointer_cast<CADCurve>(e->m_parentCAD);
NekDouble tb = e->m_n1->GetCADCurveInfo(cid);
NekDouble te = e->m_n2->GetCADCurveInfo(cid);
......@@ -443,13 +440,10 @@ void HOSurfaceMesh::Process()
else
{
// edge is on surface and needs 2d optimisation
CADSurfSharedPtr s = m_mesh->m_cad->GetSurf(surf);
Array<OneD, NekDouble> uvb, uve;
uvb = e->m_n1->GetCADSurfInfo(surf);
uve = e->m_n2->GetCADSurfInfo(surf);
e->onSurf = true;
e->CADSurf = s;
e->CADSurfId = surf;
e->m_parentCAD = s;
Array<OneD, Array<OneD, NekDouble> > uvi(nq);
for (int k = 0; k < nq; k++)
{
......
......@@ -77,7 +77,7 @@ Array<OneD, NekDouble> OptiEdge::Getxi()
switch (o->GetType())
{
case curve:
case CADType::eCurve:
xi = Array<OneD, NekDouble>(all.num_elements() - 2);
for (int i = 1; i < all.num_elements() - 1; i++)
{
......@@ -85,7 +85,7 @@ Array<OneD, NekDouble> OptiEdge::Getxi()
}
break;
case surf:
case CADType::eSurf:
xi = Array<OneD, NekDouble>(all.num_elements() - 4);
for (int i = 2; i < all.num_elements() - 2; i++)
{
......@@ -93,7 +93,7 @@ Array<OneD, NekDouble> OptiEdge::Getxi()
}
break;
case vert:
case CADType::eVert:
ASSERTL0(false, "Should not be able to pass vert");
}
return xi;
......@@ -105,7 +105,7 @@ Array<OneD, NekDouble> OptiEdge::Getli()
Array<OneD, NekDouble> bnds;
switch (o->GetType())
{
case curve:
case CADType::eCurve:
li = Array<OneD, NekDouble>(all.num_elements() - 2);
bnds = boost::dynamic_pointer_cast<CADCurve>(o)->Bounds();
for (int i = 1; i < all.num_elements() - 1; i++)
......@@ -114,7 +114,7 @@ Array<OneD, NekDouble> OptiEdge::Getli()
}
break;
case surf:
case CADType::eSurf:
li = Array<OneD, NekDouble>(all.num_elements() - 4);
bnds = boost::dynamic_pointer_cast<CADSurf>(o)->GetBounds();
for (int i = 2; i < all.num_elements() - 2; i++)
......@@ -130,7 +130,7 @@ Array<OneD, NekDouble> OptiEdge::Getli()
}
break;
case vert:
case CADType::eVert:
ASSERTL0(false, "Should not be able to pass vert");
}
return li;
......@@ -142,7 +142,7 @@ Array<OneD, NekDouble> OptiEdge::Getui()
Array<OneD, NekDouble> bnds;
switch (o->GetType())
{
case curve:
case CADType::eCurve:
ui = Array<OneD, NekDouble>(all.num_elements() - 2);
bnds = boost::dynamic_pointer_cast<CADCurve>(o)->Bounds();
for (int i = 1; i < all.num_elements() - 1; i++)
......@@ -151,7 +151,7 @@ Array<OneD, NekDouble> OptiEdge::Getui()
}
break;
case surf:
case CADType::eSurf:
ui = Array<OneD, NekDouble>(all.num_elements() - 4);
bnds = boost::dynamic_pointer_cast<CADSurf>(o)->GetBounds();
for (int i = 2; i < all.num_elements() - 2; i++)
......@@ -167,7 +167,7 @@ Array<OneD, NekDouble> OptiEdge::Getui()
}
break;
case vert:
case CADType::eVert:
ASSERTL0(false, "Should not be able to pass vert");
}
return ui;
......@@ -177,7 +177,7 @@ NekDouble OptiEdge::F(Array<OneD, NekDouble> xitst)
{
Array<OneD, NekDouble> val(all.num_elements());
if (o->GetType() == curve)
if (o->GetType() == CADType::eCurve)
{
val[0] = all[0];
for (int i = 0; i < xitst.num_elements(); i++)
......@@ -186,7 +186,7 @@ NekDouble OptiEdge::F(Array<OneD, NekDouble> xitst)
}
val[all.num_elements() - 1] = all[all.num_elements() - 1];
}
else if (o->GetType() == surf)
else if (o->GetType() == CADType::eSurf)
{
val[0] = all[0];
val[1] = all[1];
......@@ -199,7 +199,7 @@ NekDouble OptiEdge::F(Array<OneD, NekDouble> xitst)
}
NekDouble ret = 0.0;
if (o->GetType() == curve)
if (o->GetType() == CADType::eCurve)
{
CADCurveSharedPtr c = boost::dynamic_pointer_cast<CADCurve>(o);
......@@ -211,7 +211,7 @@ NekDouble OptiEdge::F(Array<OneD, NekDouble> xitst)
ret += norm / (z[i + 1] - z[i]);
}
}
else if (o->GetType() == surf)
else if (o->GetType() == CADType::eSurf)
{
CADSurfSharedPtr s = boost::dynamic_pointer_cast<CADSurf>(o);
// need to organise the val array
......@@ -237,7 +237,7 @@ DNekMat OptiEdge::dF(Array<OneD, NekDouble> xitst)
{
Array<OneD, NekDouble> val(all.num_elements());
if (o->GetType() == curve)
if (o->GetType() == CADType::eCurve)
{
val[0] = all[0];
for (int i = 0; i < xitst.num_elements(); i++)
......@@ -246,7 +246,7 @@ DNekMat OptiEdge::dF(Array<OneD, NekDouble> xitst)
}
val[all.num_elements() - 1] = all[all.num_elements() - 1];
}
else if (o->GetType() == surf)
else if (o->GetType() == CADType::eSurf)
{
val[0] = all[0];
val[1] = all[1];
......@@ -260,7 +260,7 @@ DNekMat OptiEdge::dF(Array<OneD, NekDouble> xitst)
DNekMat ret;
if (o->GetType() == curve)
if (o->GetType() == CADType::eCurve)
{
CADCurveSharedPtr c = boost::dynamic_pointer_cast<CADCurve>(o);
vector<Array<OneD, NekDouble> > r;
......@@ -290,7 +290,7 @@ DNekMat OptiEdge::dF(Array<OneD, NekDouble> xitst)
ret = J;
}
else if (o->GetType() == surf)
else if (o->GetType() == CADType::eSurf)
{
CADSurfSharedPtr s = boost::dynamic_pointer_cast<CADSurf>(o);
// need to organise the all array
......@@ -341,14 +341,14 @@ DNekMat OptiEdge::dF(Array<OneD, NekDouble> xitst)
void OptiEdge::Update(Array<OneD, NekDouble> xinew)
{
if (o->GetType() == curve)
if (o->GetType() == CADType::eCurve)
{
for (int i = 0; i < xinew.num_elements(); i++)
{
all[i + 1] = xinew[i];
}
}
else if (o->GetType() == surf)
else if (o->GetType() == CADType::eSurf)
{
for (int i = 0; i < xinew.num_elements(); i++)
{
......
......@@ -37,7 +37,7 @@
#define NEKTAR_MESHUTILS_SURFACEMESH_OPTIMISEFUNCTIONS_H
#include <LocalRegions/MatrixKey.h>
#include <NekMeshUtils/CADSystem/CADObj.h>
#include <NekMeshUtils/CADSystem/CADObject.h>
#include <NekMeshUtils/CADSystem/CADSurf.h>
#include <NekMeshUtils/Optimisation/OptimiseObj.h>
......@@ -53,7 +53,7 @@ public:
OptiEdge(Array<OneD, NekDouble> a,
Array<OneD, NekDouble> dis,
CADObjSharedPtr ob)
CADObjectSharedPtr ob)
{
all = a;
z = dis;
......@@ -75,7 +75,7 @@ public:
};
private:
CADObjSharedPtr o;
CADObjectSharedPtr o;
Array<OneD, NekDouble> z;
Array<OneD, NekDouble> all;
};
......
......@@ -217,20 +217,20 @@ void BLMesh::GrowLayers()
ElementSharedPtr el = m_mesh->m_element[2][i];
vector<unsigned int>::iterator f = find(m_blsurfs.begin(),
m_blsurfs.end(),
el->CADSurfId);
el->m_parentCAD->GetId());
vector<unsigned int>::iterator s = find(m_symSurfs.begin(),
m_symSurfs.end(),
el->CADSurfId);
el->m_parentCAD->GetId());
if(f == m_blsurfs.end() && s == m_symSurfs.end())
{
psElements[el->CADSurfId].push_back(el);
psElements[el->m_parentCAD->GetId()].push_back(el);
}
}
for(int i = 0; i < m_psuedoSurface.size(); i++)
{
psElements[m_psuedoSurface[i]->CADSurfId].push_back(m_psuedoSurface[i]);
psElements[m_psuedoSurface[i]->m_parentCAD->GetId()].push_back(m_psuedoSurface[i]);
}
bgi::rtree<boxI, bgi::quadratic<16> > TopTree;
......@@ -376,7 +376,6 @@ NekDouble BLMesh::Proximity(NodeSharedPtr n, ElementSharedPtr el)
NekDouble d = Dot(E0,BP);
NekDouble e = Dot(E1,BP);
NekDouble f = Dot(BP,BP);
NekDouble det = a*c - b*b;
NekDouble s = b*e-c*d, t = b*d-a*e;
......@@ -756,7 +755,7 @@ void BLMesh::BuildElements()
ElementSharedPtr el = m_mesh->m_element[2][i];
vector<unsigned int>::iterator f = find(m_blsurfs.begin(),
m_blsurfs.end(),
el->CADSurfId);
el->m_parentCAD->GetId());
if(f == m_blsurfs.end())
{
......@@ -788,7 +787,7 @@ void BLMesh::BuildElements()
CreateInstance(LibUtilities::eTriangle, tconf, tn, tags);
m_psuedoSurface.push_back(T);
T->CADSurfId = el->CADSurfId;
T->m_parentCAD = el->m_parentCAD;
m_priToTri[E] = el;
}
......@@ -1009,14 +1008,14 @@ void BLMesh::Setup()
for(int i = 0; i < m_mesh->m_element[2].size(); i++)
{
//orientate the triangle
if(m_mesh->m_cad->GetSurf(m_mesh->m_element[2][i]->CADSurfId)
if(m_mesh->m_cad->GetSurf(m_mesh->m_element[2][i]->m_parentCAD->GetId())
->IsReversedNormal())
{
m_mesh->m_element[2][i]->Flip();
}
vector<unsigned int>::iterator f = find(m_blsurfs.begin(), m_blsurfs.end(),
m_mesh->m_element[2][i]->CADSurfId);
m_mesh->m_element[2][i]->m_parentCAD->GetId());
if(f == m_blsurfs.end())
{
......@@ -1028,7 +1027,7 @@ void BLMesh::Setup()
for(int j = 0; j < ns.size(); j++)
{
m_blData[ns[j]]->els.push_back(m_mesh->m_element[2][i]);
m_blData[ns[j]]->surfs.insert(m_mesh->m_element[2][i]->CADSurfId);
m_blData[ns[j]]->surfs.insert(m_mesh->m_element[2][i]->m_parentCAD->GetId());
}
}
......
......@@ -58,7 +58,7 @@ public:
NekDouble b,
int l,
NekDouble p) :
m_mesh(m), m_blsurfs(bls), m_bl(b), m_layer(l), m_prog(p)
m_mesh(m), m_blsurfs(bls), m_bl(b), m_prog(p), m_layer(l)
{
};
......
......@@ -117,7 +117,7 @@ void VolumeMesh::Process()
{
vector<unsigned int>::iterator f = find(symsurfs.begin(),
symsurfs.end(),
els[i]->CADSurfId);
els[i]->m_parentCAD->GetId());
if(f == symsurfs.end())
{
......@@ -291,7 +291,7 @@ void VolumeMesh::Process()
vector<unsigned int>::iterator f = find(blsurfs.begin(),
blsurfs.end(),
m_mesh->m_element[2][i]->CADSurfId);
m_mesh->m_element[2][i]->m_parentCAD->GetId());
if(f == blsurfs.end())
{
......
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