Commit 421deb64 authored by Michael Turner's avatar Michael Turner
Browse files

fix memory bug

parent bb8c3700
...@@ -348,6 +348,9 @@ void Generator2D::Process() ...@@ -348,6 +348,9 @@ void Generator2D::Process()
m_mesh->m_element[1].push_back(E2); m_mesh->m_element[1].push_back(E2);
}*/ }*/
//m_mesh->m_expDim = 1;
//m_mesh->m_element[2].clear();
ProcessVertices(); ProcessVertices();
ProcessEdges(); ProcessEdges();
...@@ -355,7 +358,6 @@ void Generator2D::Process() ...@@ -355,7 +358,6 @@ void Generator2D::Process()
ProcessElements(); ProcessElements();
ProcessComposites(); ProcessComposites();
Report(); Report();
} }
void Generator2D::MakeBLPrep() void Generator2D::MakeBLPrep()
...@@ -399,19 +401,20 @@ void Generator2D::MakeBL(int faceid) ...@@ -399,19 +401,20 @@ void Generator2D::MakeBL(int faceid)
Array<OneD, NekDouble> p1, p2; Array<OneD, NekDouble> p1, p2;
p1 = es[j]->m_n1->GetCADSurfInfo(faceid); p1 = es[j]->m_n1->GetCADSurfInfo(faceid);
p2 = es[j]->m_n2->GetCADSurfInfo(faceid); p2 = es[j]->m_n2->GetCADSurfInfo(faceid);
if (edgeo == CADOrientation::eBackwards)
{
swap(p1, p2);
}
Array<OneD, NekDouble> n(2); Array<OneD, NekDouble> n(2);
n[0] = p1[1] - p2[1]; n[0] = p1[1] - p2[1];
n[1] = p2[0] - p1[0]; n[1] = p2[0] - p1[0];
if (edgeo == CADOrientation::eBackwards)
{
n[0] *= -1.0;
n[1] *= -1.0;
}
NekDouble mag = sqrt(n[0] * n[0] + n[1] * n[1]); NekDouble mag = sqrt(n[0] * n[0] + n[1] * n[1]);
n[0] /= mag; n[0] /= mag;
n[1] /= mag; n[1] /= mag;
Array<OneD, NekDouble> np = p1; Array<OneD, NekDouble> np(2);
np[0] += n[0]; np[0] = p1[0] + n[0];
np[1] += n[1]; np[1] = p1[1] + n[1];
Array<OneD, NekDouble> loc = es[j]->m_n1->GetLoc(); Array<OneD, NekDouble> loc = es[j]->m_n1->GetLoc();
Array<OneD, NekDouble> locp = m_mesh->m_cad->GetSurf(faceid)->P(np); Array<OneD, NekDouble> locp = m_mesh->m_cad->GetSurf(faceid)->P(np);
n[0] = locp[0] - loc[0]; n[0] = locp[0] - loc[0];
......
...@@ -61,8 +61,8 @@ void CADSurfOCE::Initialise(int i, TopoDS_Shape in) ...@@ -61,8 +61,8 @@ void CADSurfOCE::Initialise(int i, TopoDS_Shape in)
gp_Pnt ori(0.0, 0.0, 0.0); gp_Pnt ori(0.0, 0.0, 0.0);
transform.SetScale(ori, 1.0 / 1000.0); transform.SetScale(ori, 1.0 / 1000.0);
TopLoc_Location mv(transform); TopLoc_Location mv(transform);
in.Move(mv); in.Move(mv);
m_occSurface = BRepAdaptor_Surface(TopoDS::Face(in)); m_occSurface = BRepAdaptor_Surface(TopoDS::Face(in));
m_id = i; m_id = i;
...@@ -85,12 +85,12 @@ Array<OneD, NekDouble> CADSurfOCE::locuv(Array<OneD, NekDouble> p) ...@@ -85,12 +85,12 @@ Array<OneD, NekDouble> CADSurfOCE::locuv(Array<OneD, NekDouble> p)
Array<OneD, NekDouble> uvr(2); Array<OneD, NekDouble> uvr(2);
gp_Pnt2d p2 = m_sas->ValueOfUV(loc, 1e-8); gp_Pnt2d p2 = m_sas->ValueOfUV(loc, Precision::Confusion());
uvr[0] = p2.X(); uvr[0] = p2.X();
uvr[1] = p2.Y(); uvr[1] = p2.Y();
gp_Pnt p3 = m_sas->Value(p2); gp_Pnt p3 = m_sas->Value(p2);
if (p3.Distance(loc) > 0.001) if (p3.Distance(loc) > 1e-6)
{ {
cout << "large locuv distance " << p3.Distance(loc)/1000.0 << " " << m_id cout << "large locuv distance " << p3.Distance(loc)/1000.0 << " " << m_id
<< endl; << endl;
...@@ -173,13 +173,9 @@ NekDouble CADSurfOCE::DistanceTo(Array<OneD, NekDouble> p) ...@@ -173,13 +173,9 @@ NekDouble CADSurfOCE::DistanceTo(Array<OneD, NekDouble> p)
{ {
gp_Pnt loc(p[0] * 1000.0, p[1] * 1000.0, p[2] * 1000.0); gp_Pnt loc(p[0] * 1000.0, p[1] * 1000.0, p[2] * 1000.0);
// alternative locuv methods gp_Pnt2d p2 = m_sas->ValueOfUV(loc, Precision::Confusion());
ShapeAnalysis_Surface sas(m_s);
sas.SetDomain(m_bounds[0], m_bounds[1], m_bounds[2], m_bounds[3]);
gp_Pnt2d p2 = sas.ValueOfUV(loc, 1e-7);
gp_Pnt p3 = sas.Value(p2); gp_Pnt p3 = m_sas->Value(p2);
return p3.Distance(loc); return p3.Distance(loc);
} }
...@@ -189,13 +185,9 @@ void CADSurfOCE::ProjectTo(Array<OneD, NekDouble> &tp, ...@@ -189,13 +185,9 @@ void CADSurfOCE::ProjectTo(Array<OneD, NekDouble> &tp,
{ {
gp_Pnt loc(tp[0] * 1000.0, tp[1] * 1000.0, tp[2] * 1000.0); gp_Pnt loc(tp[0] * 1000.0, tp[1] * 1000.0, tp[2] * 1000.0);
// alternative locuv methods gp_Pnt2d p2 = m_sas->ValueOfUV(loc, Precision::Confusion());
ShapeAnalysis_Surface sas(m_s);
sas.SetDomain(m_bounds[0], m_bounds[1], m_bounds[2], m_bounds[3]);
gp_Pnt2d p2 = sas.ValueOfUV(loc, 1e-8);
gp_Pnt p3 = sas.Value(p2); gp_Pnt p3 = m_sas->Value(p2);
tp[0] = p3.X() / 1000.0; tp[0] = p3.X() / 1000.0;
tp[1] = p3.Y() / 1000.0; tp[1] = p3.Y() / 1000.0;
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
#include <BRepLProp_SLProps.hxx> #include <BRepLProp_SLProps.hxx>
#include <Standard_Macro.hxx> #include <Standard_Macro.hxx>
#include <ShapeFix_Face.hxx> #include <ShapeFix_Face.hxx>
#include <Precision.hxx>
#include <GeomAPI_PointsToBSpline.hxx> #include <GeomAPI_PointsToBSpline.hxx>
#include <Geom_BSplineCurve.hxx> #include <Geom_BSplineCurve.hxx>
......
...@@ -278,7 +278,7 @@ void HOSurfaceMesh::Process() ...@@ -278,7 +278,7 @@ void HOSurfaceMesh::Process()
Array<OneD, NekDouble> uvb, uve; Array<OneD, NekDouble> uvb, uve;
uvb = e->m_n1->GetCADSurfInfo(surf); uvb = e->m_n1->GetCADSurfInfo(surf);
uve = e->m_n2->GetCADSurfInfo(surf); uve = e->m_n2->GetCADSurfInfo(surf);
e->m_parentCAD = s;
Array<OneD, Array<OneD, NekDouble> > uvi(nq); Array<OneD, Array<OneD, NekDouble> > uvi(nq);
for (int k = 0; k < nq; k++) for (int k = 0; k < nq; k++)
{ {
......
...@@ -225,7 +225,7 @@ void InputMCF::ParseFile(string nm) ...@@ -225,7 +225,7 @@ void InputMCF::ParseFile(string nm)
it = parameters.find("BndLayerProgression"); it = parameters.find("BndLayerProgression");
m_blprog = it != parameters.end() ? it->second : "2.0"; m_blprog = it != parameters.end() ? it->second : "2.0";
} }
it = parameters.find("BndLayerAdjustment"); it = parameters.find("BndLayerAdjustment");
if (it != parameters.end()) if (it != parameters.end())
{ {
...@@ -348,11 +348,11 @@ void InputMCF::Process() ...@@ -348,11 +348,11 @@ void InputMCF::Process()
{ {
mods.back()->RegisterConfig("blcurves", m_blsurfs); mods.back()->RegisterConfig("blcurves", m_blsurfs);
mods.back()->RegisterConfig("blthick", m_blthick); mods.back()->RegisterConfig("blthick", m_blthick);
if (m_adjust) if (m_adjust)
{ {
mods.back()->RegisterConfig("bltadjust", m_adjustment); mods.back()->RegisterConfig("bltadjust", m_adjustment);
if (m_adjustall) if (m_adjustall)
{ {
mods.back()->RegisterConfig("adjustblteverywhere", ""); mods.back()->RegisterConfig("adjustblteverywhere", "");
...@@ -423,11 +423,11 @@ void InputMCF::Process() ...@@ -423,11 +423,11 @@ void InputMCF::Process()
} }
// Run peralign // Run peralign
if (m_periodic.size()) /*if (m_periodic.size())
{ {
mods.clear(); mods.clear();
vector<string> lines; vector<string> lines;
boost::split(lines, m_periodic, boost::is_any_of(":")); boost::split(lines, m_periodic, boost::is_any_of(":"));
...@@ -471,7 +471,7 @@ void InputMCF::Process() ...@@ -471,7 +471,7 @@ void InputMCF::Process()
mods[i]->SetDefaults(); mods[i]->SetDefaults();
mods[i]->Process(); mods[i]->Process();
} }
} }*/
} }
} }
} }
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