diff --git a/library/NekMeshUtils/2DGenerator/2DGenerator.cpp b/library/NekMeshUtils/2DGenerator/2DGenerator.cpp index dd7671d63020c0d8ebe8f86eea326e0f581a5059..6d561ee109fcb2bb5e3721786eec2bf4a6fdbfb9 100644 --- a/library/NekMeshUtils/2DGenerator/2DGenerator.cpp +++ b/library/NekMeshUtils/2DGenerator/2DGenerator.cpp @@ -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(); diff --git a/library/NekMeshUtils/CADSystem/OCE/CADCurveOCE.cpp b/library/NekMeshUtils/CADSystem/OCE/CADCurveOCE.cpp index 55402842586f5eac9566ae885156110392e4a289..6aba0a8f4839b63b56d839d2555236e83de511e5 100644 --- a/library/NekMeshUtils/CADSystem/OCE/CADCurveOCE.cpp +++ b/library/NekMeshUtils/CADSystem/OCE/CADCurveOCE.cpp @@ -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) diff --git a/library/NekMeshUtils/CADSystem/OCE/OpenCascade.h b/library/NekMeshUtils/CADSystem/OCE/OpenCascade.h index 281862a52cf68df85a6f78392be00b4551544f2c..3bbdb1b444ca9742c1120caede402da7cc421515 100644 --- a/library/NekMeshUtils/CADSystem/OCE/OpenCascade.h +++ b/library/NekMeshUtils/CADSystem/OCE/OpenCascade.h @@ -68,6 +68,7 @@ #include #include #include +#include /// Shape fixing classes #include diff --git a/library/NekMeshUtils/Octree/Octree.cpp b/library/NekMeshUtils/Octree/Octree.cpp index a65d673e9834f85fde773079aa30725637965068..7addacbc012f7e79e096df0553059bfad0a09e21 100644 --- a/library/NekMeshUtils/Octree/Octree.cpp +++ b/library/NekMeshUtils/Octree/Octree.cpp @@ -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 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++) {