Commit cd81bd9b authored by Michael Turner's avatar Michael Turner

fix tatarclength function

parent 24617c15
......@@ -188,7 +188,7 @@ void Generator2D::Process()
nodes);
}
}
if (m_mesh->m_verbose)
{
cout << endl << "\tFace meshing:" << endl << endl;
......@@ -226,9 +226,6 @@ void Generator2D::Process()
m_mesh->m_element[1].push_back(E2);
}
// m_mesh->m_expDim = 1;
// m_mesh->m_element[2].clear();
ProcessVertices();
ProcessEdges();
ProcessFaces();
......
......@@ -61,24 +61,9 @@ void CADCurveOCE::Initialise(int i, TopoDS_Shape in)
NekDouble CADCurveOCE::tAtArcLength(NekDouble s)
{
NekDouble dt = (m_b[1] - m_b[0]) / (1000);
NekDouble t = m_b[0];
NekDouble len = 0.0;
while (len <= s)
{
gp_Pnt P1, P2;
gp_Vec drdt1, drdt2;
m_c->D1(t, P1, drdt1);
t += dt;
m_c->D1(t, P2, drdt2);
len += (drdt1.Magnitude() + drdt2.Magnitude()) / 2.0 * dt / 1000.0;
}
return t - dt;
GeomAdaptor_Curve c(m_c);
GCPnts_AbscissaPoint ap(c, s*1000.0, m_b[0]);
return ap.Parameter();
}
NekDouble CADCurveOCE::Length(NekDouble ti, NekDouble tf)
......
......@@ -68,6 +68,7 @@
#include <ShapeAnalysis_Curve.hxx>
#include <BRepBndLib.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <GCPnts_AbscissaPoint.hxx>
/// Shape fixing classes
#include <ShapeFix_Face.hxx>
......
......@@ -836,14 +836,25 @@ int Octree::CountElemt()
void Octree::CompileSourcePointList()
{
int totalEnt = m_mesh->m_cad->GetNumSurf();
int preEnt = 0;
if(m_mesh->m_cad->Is2D())
{
totalEnt += m_mesh->m_cad->GetNumCurve();
preEnt += m_mesh->m_cad->GetNumCurve();
for (int i = 1; i <= m_mesh->m_cad->GetNumCurve(); i++)
{
if (m_mesh->m_verbose)
{
LibUtilities::PrintProgressbar(i, totalEnt,
"\tCompiling source points");
}
CADCurveSharedPtr curve = m_mesh->m_cad->GetCurve(i);
Array<OneD, NekDouble> bds = curve->GetBounds();
int samples = 100;
//this works assuming the curves are not distorted
int samples = ceil(curve->Length(bds[0],bds[1]) / m_minDelta) * 2;
samples = max(40, samples);
NekDouble dt = (bds[1] - bds[0]) / (samples + 1);
for (int j = 1; j < samples - 1; j++) // dont want first and last point
{
......@@ -891,7 +902,7 @@ void Octree::CompileSourcePointList()
{
if (m_mesh->m_verbose)
{
LibUtilities::PrintProgressbar(i, m_mesh->m_cad->GetNumSurf(),
LibUtilities::PrintProgressbar(preEnt + i, totalEnt,
"\tCompiling source points");
}
......@@ -959,8 +970,10 @@ void Octree::CompileSourcePointList()
// these are the acutal number of sample points in each parametric
// direction
int nu = ceil(DeltaU / m_minDelta) * 40 * 2;
int nv = ceil(DeltaV / m_minDelta) * 40 * 2;
int nu = ceil(DeltaU * 40 / m_minDelta) * 2;
int nv = ceil(DeltaV * 40 / m_minDelta) * 2;
nu = max(40, nu);
nv = max(40, nv);
for (int j = 0; j < nu; j++)
{
......
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