Commit 6561f222 authored by Michael Turner's avatar Michael Turner

fix locuv issue, but 2D tests fail

parent 32304c9f
......@@ -428,8 +428,7 @@ void Generator2D::MakeBL(int faceid)
NodeSharedPtr nn = std::shared_ptr<Node>(
new Node(m_mesh->m_numNodes++, n[0], n[1], 0.0));
CADSurfSharedPtr s = m_mesh->m_cad->GetSurf(faceid);
Array<OneD, NekDouble> uv;
s->locuv(n, uv);
Array<OneD, NekDouble> uv = s->locuv(n);
nn->SetCADSurf(s, uv);
nodeNormals[it->first] = nn;
}
......
......@@ -50,8 +50,7 @@ Array<OneD, NekDouble> CADCurve::NormalWRT(NekDouble t, int surf)
"This will only work in 2D for one surface at the moment");
surface = m_adjSurfs[0];
Array<OneD, NekDouble> uv;
surface.first->locuv(p, uv);
Array<OneD, NekDouble> uv = surface.first->locuv(p);
Array<OneD, NekDouble> d1 = surface.first->D1(uv);
NekDouble t1 = t - 1e-8;
......@@ -62,10 +61,8 @@ Array<OneD, NekDouble> CADCurve::NormalWRT(NekDouble t, int surf)
swap(t1, t2);
}
Array<OneD, NekDouble> uv1;
surface.first->locuv(P(t1), uv1);
Array<OneD, NekDouble> uv2;
surface.first->locuv(P(t2), uv2);
Array<OneD, NekDouble> uv1 = surface.first->locuv(P(t1));
Array<OneD, NekDouble> uv2 = surface.first->locuv(P(t2));
NekDouble du = uv2[1] - uv1[1];
NekDouble dv = -1.0 * (uv2[0] - uv1[0]);
......
......@@ -50,6 +50,16 @@ namespace Nektar
namespace NekMeshUtils
{
Array<OneD, NekDouble> CADSurf::locuv(Array<OneD, NekDouble> p)
{
NekDouble dist;
Array<OneD, NekDouble> uv = locuv(p,dist);
WARNINGL1(dist < 1e-3, "large locuv distance");
return uv;
}
void CADSurf::OrientateEdges(CADSurfSharedPtr surf,
vector<EdgeLoopSharedPtr> &ein)
{
......@@ -70,8 +80,7 @@ void CADSurf::OrientateEdges(CADSurfSharedPtr surf,
{
NekDouble t = bnds[0] + dt * k;
Array<OneD, NekDouble> l = ein[i]->edges[j]->P(t);
Array<OneD, NekDouble> uv(2);
surf->locuv(l, uv);
Array<OneD, NekDouble> uv = surf->locuv(l);
loop.push_back(uv);
}
}
......@@ -81,8 +90,7 @@ void CADSurf::OrientateEdges(CADSurfSharedPtr surf,
{
NekDouble t = bnds[0] + dt * k;
Array<OneD, NekDouble> l = ein[i]->edges[j]->P(t);
Array<OneD, NekDouble> uv(2);
surf->locuv(l, uv);
Array<OneD, NekDouble> uv = surf->locuv(l);
loop.push_back(uv);
}
}
......
......@@ -36,8 +36,8 @@
#ifndef NekMeshUtils_CADSYSTEM_CADSURF
#define NekMeshUtils_CADSYSTEM_CADSURF
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/BasicUtils/NekFactory.hpp>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <NekMeshUtils/CADSystem/CADObject.h>
......@@ -90,8 +90,8 @@ public:
/**
* @brief Static function which orientates the edge loop on a surface
*/
static void OrientateEdges(
CADSurfSharedPtr surf, std::vector<EdgeLoopSharedPtr> &ein);
static void OrientateEdges(CADSurfSharedPtr surf,
std::vector<EdgeLoopSharedPtr> &ein);
/**
* @brief Get the loop structures which bound the cad surface
......@@ -155,7 +155,16 @@ public:
* @param p Array of xyz location
* @return The parametric location of xyz on this surface
*/
virtual NekDouble locuv(Array<OneD, NekDouble> p, Array<OneD, NekDouble> uv) = 0;
virtual Array<OneD, NekDouble> locuv(Array<OneD, NekDouble> p,
NekDouble &dist) = 0;
/**
* @brief overload function of locuv ommiting the dist parameter
* in this case if the projection is greater than a certain distance
* it will produce a warning. To do large distance projection use the other
* locuv method
*/
Array<OneD, NekDouble> locuv(Array<OneD, NekDouble> p);
/**
* @brief Returns the bounding box of the surface
......@@ -168,7 +177,8 @@ public:
virtual NekDouble Curvature(Array<OneD, NekDouble> uv) = 0;
/**
* @brief Is the surface defined by a planar surface (i.e not nurbs and is flat)
* @brief Is the surface defined by a planar surface (i.e not nurbs and is
* flat)
*/
virtual bool IsPlanar() = 0;
......@@ -193,7 +203,7 @@ typedef std::shared_ptr<CADSurf> CADSurfSharedPtr;
typedef LibUtilities::NekFactory<std::string, CADSurf> CADSurfFactory;
CADSurfFactory &GetCADSurfFactory();
}
}
} // namespace NekMeshUtils
} // namespace Nektar
#endif
......@@ -51,7 +51,7 @@ void CADCurveOCE::Initialise(int i, TopoDS_Shape in)
GProp_GProps System;
BRepGProp::LinearProperties(m_occEdge, System);
m_length = System.Mass() / 1.0;
m_length = System.Mass() / 1000.0;
m_b = Array<OneD, NekDouble>(2);
m_c = BRep_Tool::Curve(TopoDS::Edge(in), m_b[0], m_b[1]);
......@@ -75,7 +75,7 @@ NekDouble CADCurveOCE::tAtArcLength(NekDouble s)
t += dt;
m_c->D1(t, P2, drdt2);
len += (drdt1.Magnitude() + drdt2.Magnitude()) / 2.0 * dt / 1.0;
len += (drdt1.Magnitude() + drdt2.Magnitude()) / 2.0 * dt / 1000.0;
}
return t - dt;
......@@ -87,20 +87,20 @@ NekDouble CADCurveOCE::Length(NekDouble ti, NekDouble tf)
TopoDS_Edge NewEdge = BRepBuilderAPI_MakeEdge(NewCurve);
GProp_GProps System;
BRepGProp::LinearProperties(NewEdge, System);
return System.Mass() / 1.0;
return System.Mass() / 1000.0;
}
NekDouble CADCurveOCE::loct(Array<OneD, NekDouble> xyz, NekDouble &t)
{
t = 0.0;
gp_Pnt loc(xyz[0] * 1.0, xyz[1] * 1.0, xyz[2] * 1.0);
gp_Pnt loc(xyz[0] * 1000.0, xyz[1] * 1000.0, xyz[2] * 1000.0);
ShapeAnalysis_Curve sac;
gp_Pnt p;
sac.Project(m_c, loc, 1e-8, p, t);
sac.Project(m_c, loc, Precision::Confusion(), p, t);
return p.Distance(loc) / 1.0;
return p.Distance(loc) / 1000.0;
}
Array<OneD, NekDouble> CADCurveOCE::P(NekDouble t)
......@@ -108,9 +108,9 @@ Array<OneD, NekDouble> CADCurveOCE::P(NekDouble t)
Array<OneD, NekDouble> location(3);
gp_Pnt loc = m_c->Value(t);
location[0] = loc.X()/1.0;
location[1] = loc.Y()/1.0;
location[2] = loc.Z()/1.0;
location[0] = loc.X()/1000.0;
location[1] = loc.Y()/1000.0;
location[2] = loc.Z()/1000.0;
return location;
}
......@@ -122,22 +122,22 @@ Array<OneD, NekDouble> CADCurveOCE::D2(NekDouble t)
gp_Vec d1, d2;
m_c->D2(t, loc, d1, d2);
out[0] = loc.X()/1.0;
out[1] = loc.Y()/1.0;
out[2] = loc.Z()/1.0;
out[3] = d1.X()/1.0;
out[4] = d1.Y()/1.0;
out[5] = d1.Z()/1.0;
out[6] = d2.X()/1.0;
out[7] = d2.Y()/1.0;
out[8] = d2.Z()/1.0;
out[0] = loc.X()/1000.0;
out[1] = loc.Y()/1000.0;
out[2] = loc.Z()/1000.0;
out[3] = d1.X()/1000.0;
out[4] = d1.Y()/1000.0;
out[5] = d1.Z()/1000.0;
out[6] = d2.X()/1000.0;
out[7] = d2.Y()/1000.0;
out[8] = d2.Z()/1000.0;
return out;
}
Array<OneD, NekDouble> CADCurveOCE::N(NekDouble t)
{
GeomLProp_CLProps d(m_c, 2, 1e-8);
GeomLProp_CLProps d(m_c, 2, Precision::Confusion());
d.SetParameter(t + 1e-8);
gp_Vec d2 = d.D2();
......@@ -160,10 +160,10 @@ Array<OneD, NekDouble> CADCurveOCE::N(NekDouble t)
NekDouble CADCurveOCE::Curvature(NekDouble t)
{
GeomLProp_CLProps d(m_c, 2, 1e-8);
GeomLProp_CLProps d(m_c, 2, Precision::Confusion());
d.SetParameter(t);
return d.Curvature() * 1.0;
return d.Curvature() * 1000.0;
}
Array<OneD, NekDouble> CADCurveOCE::GetBounds()
......
......@@ -54,7 +54,7 @@ void CADSurfOCE::Initialise(int i, TopoDS_Shape in)
m_orientation = CADOrientation::eBackwards;
}
m_id = i;
m_id = i;
m_bounds = Array<OneD, NekDouble>(4);
BRepTools::UVBounds(TopoDS::Face(in), m_bounds[0], m_bounds[1], m_bounds[2],
......@@ -64,7 +64,7 @@ void CADSurfOCE::Initialise(int i, TopoDS_Shape in)
m_shape = in;
//m_2Dclass = new BRepTopAdaptor_FClass2d(TopoDS::Face(m_shape), 1e-4);
m_2Dclass = new BRepTopAdaptor_FClass2d(TopoDS::Face(m_shape), 1e-4);
}
Array<OneD, NekDouble> CADSurfOCE::GetBounds()
......@@ -74,7 +74,7 @@ Array<OneD, NekDouble> CADSurfOCE::GetBounds()
bool CADSurfOCE::IsPlanar()
{
if(m_sas->Adaptor3d()->GetType() == GeomAbs_Plane)
if (m_sas->Adaptor3d()->GetType() == GeomAbs_Plane)
{
return true;
}
......@@ -94,36 +94,40 @@ Array<OneD, NekDouble> CADSurfOCE::BoundingBox()
Bnd_Box B;
BRepBndLib::Add(m_shape, B);
NekDouble e = sqrt(B.SquareExtent()) * 0.01;
e = min(e, 5e-3);
e = min(e, 5e-3);
B.Enlarge(e);
Array<OneD, NekDouble> ret(6);
B.Get(ret[0],ret[1],ret[2],ret[3],ret[4],ret[5]);
B.Get(ret[0], ret[1], ret[2], ret[3], ret[4], ret[5]);
return ret;
}
NekDouble CADSurfOCE::locuv(Array<OneD, NekDouble> p, Array<OneD, NekDouble> uv)
Array<OneD, NekDouble> CADSurfOCE::locuv(Array<OneD, NekDouble> p,
NekDouble &dist)
{
gp_Pnt loc(p[0] * 1.0, p[1] * 1.0, p[2] * 1.0);
uv = Array<OneD, NekDouble>(2);
gp_Pnt loc(p[0] * 1000.0, p[1] * 1000.0, p[2] * 1000.0);
Array<OneD, NekDouble> uv(2);
gp_Pnt2d p2 = m_sas->ValueOfUV(loc, Precision::Confusion());
/*TopAbs_State s = m_2Dclass->Perform(p2);
TopAbs_State s = m_2Dclass->Perform(p2);
if(s == TopAbs_OUT)
if (s == TopAbs_OUT)
{
BRepBuilderAPI_MakeVertex v(loc);
BRepExtrema_DistShapeShape dss(BRepTools::OuterWire(TopoDS::Face(m_shape)), v.Shape());
BRepExtrema_DistShapeShape dss(
BRepTools::OuterWire(TopoDS::Face(m_shape)), v.Shape());
dss.Perform();
gp_Pnt np = dss.PointOnShape1(1);
p2 = m_sas->ValueOfUV(np, Precision::Confusion());
}*/
p2 = m_sas->ValueOfUV(np, Precision::Confusion());
}
uv[0] = p2.X();
uv[1] = p2.Y();
uv[0] = p2.X();
uv[1] = p2.Y();
gp_Pnt p3 = m_sas->Value(p2);
return p3.Distance(loc) / 1.0;
dist = p3.Distance(loc) / 1000.0;
return uv;
}
NekDouble CADSurfOCE::Curvature(Array<OneD, NekDouble> uv)
......@@ -132,10 +136,10 @@ NekDouble CADSurfOCE::Curvature(Array<OneD, NekDouble> uv)
Test(uv);
#endif
GeomLProp_SLProps d(m_s,2,1e-8);
d.SetParameters(uv[0],uv[1]);
GeomLProp_SLProps d(m_s, 2, Precision::Confusion());
d.SetParameters(uv[0], uv[1]);
return d.MaxCurvature() * 1.0;
return d.MaxCurvature() * 1000.0;
}
Array<OneD, NekDouble> CADSurfOCE::P(Array<OneD, NekDouble> uv)
......@@ -146,9 +150,9 @@ Array<OneD, NekDouble> CADSurfOCE::P(Array<OneD, NekDouble> uv)
gp_Pnt loc = m_s->Value(uv[0], uv[1]);
Array<OneD, NekDouble> location(3);
location[0] = loc.X()/1.0;
location[1] = loc.Y()/1.0;
location[2] = loc.Z()/1.0;
location[0] = loc.X() / 1000.0;
location[1] = loc.Y() / 1000.0;
location[2] = loc.Z() / 1000.0;
return location;
}
......@@ -158,14 +162,14 @@ Array<OneD, NekDouble> CADSurfOCE::N(Array<OneD, NekDouble> uv)
Test(uv);
#endif
GeomLProp_SLProps d(m_s,2,1e-8);
d.SetParameters(uv[0],uv[1]);
GeomLProp_SLProps d(m_s, 2, Precision::Confusion());
d.SetParameters(uv[0], uv[1]);
Array<OneD, NekDouble> normal(3);
if(!d.IsNormalDefined())
if (!d.IsNormalDefined())
{
normal = Array<OneD, NekDouble>(3,0.0);
normal = Array<OneD, NekDouble>(3, 0.0);
return normal;
}
......@@ -194,15 +198,15 @@ Array<OneD, NekDouble> CADSurfOCE::D1(Array<OneD, NekDouble> uv)
gp_Vec D1U, D1V;
m_s->D1(uv[0], uv[1], Loc, D1U, D1V);
r[0] = Loc.X()/1.0; // x
r[1] = Loc.Y()/1.0; // y
r[2] = Loc.Z()/1.0; // z
r[3] = D1U.X()/1.0; // dx/du
r[4] = D1U.Y()/1.0; // dy/du
r[5] = D1U.Z()/1.0; // dz/du
r[6] = D1V.X()/1.0; // dx/dv
r[7] = D1V.Y()/1.0; // dy/dv
r[8] = D1V.Z()/1.0; // dz/dv
r[0] = Loc.X() / 1000.0; // x
r[1] = Loc.Y() / 1000.0; // y
r[2] = Loc.Z() / 1000.0; // z
r[3] = D1U.X() / 1000.0; // dx/du
r[4] = D1U.Y() / 1000.0; // dy/du
r[5] = D1U.Z() / 1000.0; // dz/du
r[6] = D1V.X() / 1000.0; // dx/dv
r[7] = D1V.Y() / 1000.0; // dy/dv
r[8] = D1V.Z() / 1000.0; // dz/dv
return r;
}
......@@ -218,24 +222,24 @@ Array<OneD, NekDouble> CADSurfOCE::D2(Array<OneD, NekDouble> uv)
gp_Vec D1U, D1V, D2U, D2V, D2UV;
m_s->D2(uv[0], uv[1], Loc, D1U, D1V, D2U, D2V, D2UV);
r[0] = Loc.X()/1.0; // x
r[1] = Loc.Y()/1.0; // y
r[2] = Loc.Z()/1.0; // z
r[3] = D1U.X()/1.0; // dx/dx
r[4] = D1U.Y()/1.0; // dy/dy
r[5] = D1U.Z()/1.0; // dz/dz
r[6] = D1V.X()/1.0; // dx/dx
r[7] = D1V.Y()/1.0; // dy/dy
r[8] = D1V.Z()/1.0; // dz/dz
r[9] = D2U.X()/1.0; // d2x/du2
r[10] = D2U.Y()/1.0; // d2y/du2
r[11] = D2U.Z()/1.0; // d2z/du2
r[12] = D2V.X()/1.0; // d2x/dv2
r[13] = D2V.Y()/1.0; // d2y/dv2
r[14] = D2V.Z()/1.0; // d2z/dv2
r[15] = D2UV.X()/1.0; // d2x/dudv
r[16] = D2UV.Y()/1.0; // d2y/dudv
r[17] = D2UV.Z()/1.0; // d2z/dudv
r[0] = Loc.X() / 1000.0; // x
r[1] = Loc.Y() / 1000.0; // y
r[2] = Loc.Z() / 1000.0; // z
r[3] = D1U.X() / 1000.0; // dx/dx
r[4] = D1U.Y() / 1000.0; // dy/dy
r[5] = D1U.Z() / 1000.0; // dz/dz
r[6] = D1V.X() / 1000.0; // dx/dx
r[7] = D1V.Y() / 1000.0; // dy/dy
r[8] = D1V.Z() / 1000.0; // dz/dz
r[9] = D2U.X() / 1000.0; // d2x/du2
r[10] = D2U.Y() / 1000.0; // d2y/du2
r[11] = D2U.Z() / 1000.0; // d2z/du2
r[12] = D2V.X() / 1000.0; // d2x/dv2
r[13] = D2V.Y() / 1000.0; // d2y/dv2
r[14] = D2V.Z() / 1000.0; // d2z/dv2
r[15] = D2UV.X() / 1000.0; // d2x/dudv
r[16] = D2UV.Y() / 1000.0; // d2y/dudv
r[17] = D2UV.Z() / 1000.0; // d2z/dudv
return r;
}
......@@ -288,5 +292,5 @@ void CADSurfOCE::Test(Array<OneD, NekDouble> uv)
error << " On Surface: " << GetId();
ASSERTL1(passed, "Warning: " + error.str());
}
}
}
} // namespace NekMeshUtils
} // namespace Nektar
......@@ -47,7 +47,6 @@ namespace NekMeshUtils
class CADSurfOCE : public CADSurf
{
public:
static CADSurfSharedPtr create()
{
return MemoryManager<CADSurfOCE>::AllocateSharedPtr();
......@@ -66,11 +65,12 @@ public:
void Initialise(int i, TopoDS_Shape in);
virtual Array<OneD, NekDouble> GetBounds();
virtual Array<OneD, NekDouble> N (Array<OneD, NekDouble> uv);
virtual Array<OneD, NekDouble> D1 (Array<OneD, NekDouble> uv);
virtual Array<OneD, NekDouble> D2 (Array<OneD, NekDouble> uv);
virtual Array<OneD, NekDouble> P (Array<OneD, NekDouble> uv);
virtual NekDouble locuv(Array<OneD, NekDouble> p, Array<OneD, NekDouble> uv);
virtual Array<OneD, NekDouble> N(Array<OneD, NekDouble> uv);
virtual Array<OneD, NekDouble> D1(Array<OneD, NekDouble> uv);
virtual Array<OneD, NekDouble> D2(Array<OneD, NekDouble> uv);
virtual Array<OneD, NekDouble> P(Array<OneD, NekDouble> uv);
virtual Array<OneD, NekDouble> locuv(Array<OneD, NekDouble> p,
NekDouble &dist);
virtual NekDouble Curvature(Array<OneD, NekDouble> uv);
virtual Array<OneD, NekDouble> BoundingBox();
virtual bool IsPlanar();
......@@ -90,7 +90,7 @@ private:
BRepTopAdaptor_FClass2d *m_2Dclass;
};
}
}
} // namespace NekMeshUtils
} // namespace Nektar
#endif
......@@ -35,10 +35,10 @@
#include <mutex>
#include <NekMeshUtils/MeshElements/Edge.h>
#include <LibUtilities/Foundations/ManagerAccess.h>
#include <NekMeshUtils/CADSystem/CADCurve.h>
#include <NekMeshUtils/CADSystem/CADSurf.h>
#include <LibUtilities/Foundations/ManagerAccess.h>
#include <NekMeshUtils/MeshElements/Edge.h>
namespace Nektar
{
......@@ -115,7 +115,7 @@ void Edge::MakeOrder(int order, SpatialDomains::GeometrySharedPtr geom,
LibUtilities::PointsKey edgeKey(nPoints, edgeType);
LibUtilities::PointsManager()[edgeKey]->GetPoints(edgePoints);
Array<OneD, Array<OneD, NekDouble> > phys(coordDim);
Array<OneD, Array<OneD, NekDouble>> phys(coordDim);
for (int i = 0; i < coordDim; ++i)
{
......@@ -148,9 +148,9 @@ void Edge::MakeOrder(int order, SpatialDomains::GeometrySharedPtr geom,
for (int i = 0; i < m_edgeNodes.size(); i++)
{
Array<OneD, NekDouble> loc(3);
loc[0] = m_edgeNodes[i]->m_x;
loc[1] = m_edgeNodes[i]->m_y;
loc[2] = m_edgeNodes[i]->m_z;
loc[0] = m_edgeNodes[i]->m_x;
loc[1] = m_edgeNodes[i]->m_y;
loc[2] = m_edgeNodes[i]->m_z;
NekDouble t;
c->loct(loc, t);
m_edgeNodes[i]->SetCADCurve(c, t);
......@@ -159,12 +159,11 @@ void Edge::MakeOrder(int order, SpatialDomains::GeometrySharedPtr geom,
m_edgeNodes[i]->m_y = loc[1];
m_edgeNodes[i]->m_z = loc[2];
vector<pair<CADSurfSharedPtr, CADOrientation::Orientation> > s =
vector<pair<CADSurfSharedPtr, CADOrientation::Orientation>> s =
c->GetAdjSurf();
for (int j = 0; j < s.size(); j++)
{
Array<OneD, NekDouble> uv(2);
s[j].first->locuv(loc, uv);
Array<OneD, NekDouble> uv = s[j].first->locuv(loc);
m_edgeNodes[i]->SetCADSurf(s[j].first, uv);
}
}
......@@ -176,19 +175,18 @@ void Edge::MakeOrder(int order, SpatialDomains::GeometrySharedPtr geom,
for (int i = 0; i < m_edgeNodes.size(); i++)
{
Array<OneD, NekDouble> loc(3);
loc[0] = m_edgeNodes[i]->m_x;
loc[1] = m_edgeNodes[i]->m_y;
loc[2] = m_edgeNodes[i]->m_z;
Array<OneD, NekDouble> uv(2);
s->locuv(loc, uv);
loc = s->P(uv);
m_edgeNodes[i]->m_x = loc[0];
m_edgeNodes[i]->m_y = loc[1];
m_edgeNodes[i]->m_z = loc[2];
loc[0] = m_edgeNodes[i]->m_x;
loc[1] = m_edgeNodes[i]->m_y;
loc[2] = m_edgeNodes[i]->m_z;
Array<OneD, NekDouble> uv = s->locuv(loc);
loc = s->P(uv);
m_edgeNodes[i]->m_x = loc[0];
m_edgeNodes[i]->m_y = loc[1];
m_edgeNodes[i]->m_z = loc[2];
m_edgeNodes[i]->SetCADSurf(s, uv);
}
}
}
}
}
}
} // namespace NekMeshUtils
} // namespace Nektar
......@@ -268,8 +268,7 @@ void Face::MakeOrder(int order,
loc[0] = m_faceNodes[i]->m_x;
loc[1] = m_faceNodes[i]->m_y;
loc[2] = m_faceNodes[i]->m_z;
Array<OneD, NekDouble> uv(2);
s->locuv(loc,uv);
Array<OneD, NekDouble> uv = s->locuv(loc);
loc = s->P(uv);
m_faceNodes[i]->m_x = loc[0];
m_faceNodes[i]->m_y = loc[1];
......
......@@ -234,11 +234,23 @@ public:
void SetCADCurve(CADCurveSharedPtr c, NekDouble t)
{
auto it = CADCurveList.find(c->GetId());
if(it != CADCurveList.end())
{
//already in list so remove it
CADCurveList.erase(it);
}
CADCurveList.insert(make_pair(c->GetId(), make_pair(c, t)));
}
void SetCADSurf(CADSurfSharedPtr s, Array<OneD, NekDouble> uv)
{
auto it = CADSurfList.find(s->GetId());
if(it != CADSurfList.end())
{
//already in list so remove it
CADSurfList.erase(it);
}
CADSurfList.insert(make_pair(s->GetId(), make_pair(s, uv)));
}
......@@ -294,7 +306,7 @@ public:
m_y = l[1];
m_z = l[2];
CADSurfSharedPtr su = CADSurfList[s].first;
CADSurfList.insert(make_pair(s, make_pair(su, uv)));
SetCADSurf(su, uv);
}
void Move(Array<OneD, NekDouble> l, int c, NekDouble t)
......@@ -303,7 +315,7 @@ public:
m_y = l[1];
m_z = l[2];
CADCurveSharedPtr cu = CADCurveList[c].first;
CADCurveList.insert(make_pair(c, make_pair(cu, t)));
SetCADCurve(cu, t);
}
NekDouble Angle(Array<OneD, NekDouble> locA, Array<OneD, NekDouble> locB,
......
......@@ -854,8 +854,7 @@ void Octree::CompileSourcePointList()
vector<pair<CADSurfSharedPtr, CADOrientation::Orientation> > ss =
curve->GetAdjSurf();
Array<OneD, NekDouble> uv;
ss[0].first->locuv(loc, uv);
Array<OneD, NekDouble> uv = ss[0].first->locuv(loc);
if (C != 0.0)
{
......
......@@ -156,8 +156,7 @@ void CurveMesh::Mesh()
continue;
}
Array<OneD, NekDouble> uv;
s[j].first->locuv(loc, uv);
Array<OneD, NekDouble> uv = s[j].first->locuv(loc);
n->SetCADSurf(s[j].first, uv);
}
m_meshpoints.push_back(n);
......@@ -171,8 +170,7 @@ void CurveMesh::Mesh()
n2->SetCADCurve(m_cadcurve, t);
for (int j = 0; j < s.size(); j++)
{
Array<OneD, NekDouble> uv;
s[j].first->locuv(loc, uv);
Array<OneD, NekDouble> uv = s[j].first->locuv(loc);
n2->SetCADSurf(s[j].first, uv);
}
m_meshpoints.push_back(n2);
......@@ -191,8 +189,7 @@ void CurveMesh::Mesh()
continue;
}
Array<OneD, NekDouble> uv;
s[j].first->locuv(loc, uv);
Array<OneD, NekDouble> uv = s[j].first->locuv(loc);
n->SetCADSurf(s[j].first, uv);
}
m_meshpoints.push_back(n);
......@@ -409,8 +406,7 @@ void CurveMesh::PeriodicOverwrite(CurveMeshSharedPtr from)
for (int j = 0; j < surfs.size(); j++)
{
Array<OneD, NekDouble> uv;
surfs[j].first->locuv(nn->GetLoc(), uv);
Array<OneD, NekDouble> uv = surfs[j].first->locuv(nn->GetLoc());
nn->SetCADSurf(surfs[j].first, uv);
}
......
......@@ -272,8 +272,7 @@ void HOSurfaceMesh::Process()
nn->SetCADCurve(c, ti[k]);
for (int m = 0; m < s.size(); m++)
{
Array<OneD, NekDouble> uv;
s[m].first->locuv(loc, uv);
Array<OneD, NekDouble> uv = s[m].first->locuv(loc);
nn->SetCADSurf(s[m].first, uv);
}
......@@ -292,7 +291,6 @@ void HOSurfaceMesh::Process()
e->m_parentCAD = s;
Array<OneD, Array<OneD, NekDouble>> uvi(nq);
Array<OneD, Array<OneD, NekDouble>> loci(nq);
for (int k = 0; k < nq; k++)
{
......@@ -302,27 +300,10 @@ void HOSurfaceMesh::Process()
uv[1] = uvb[1] * (1.0 - gll[k]) / 2.0 +
uve[1] * (1.0 + gll[k]) / 2.0;
uvi[k] = uv;
Array<OneD, NekDouble> loc(3);
loc[0] = l1[0] * (1.0 - gll[k]) / 2.0 +
l2[0] * (1.0 + gll[k]) / 2.0;
loc[1] = l1[1] * (1.0 - gll[k]) / 2.0 +
l2[1] * (1.0 + gll[k]) / 2.0;
loc[2] = l1[2] * (1.0 - gll[k]) / 2.0 +
l2[2] * (1.0 + gll[k]) / 2.0;
loci[k] = loc;
Array<OneD, NekDouble> uvNew;
s->locuv(loc,uvNew);