From b0e535f0414194374b9919da922eed6d2252ac5b Mon Sep 17 00:00:00 2001 From: Oliver Gloth Date: Wed, 10 Apr 2013 14:31:04 +0200 Subject: [PATCH] possibility to use old and new surface projection strategy --- src/libengrid/guicreatesurfacemesh.ui | 238 +++++++++++++++++++--------------- src/libengrid/guisurfacemesher.cpp | 2 + src/libengrid/guisurfacemesher.ui | 22 +++- src/libengrid/laplacesmoother.cpp | 8 +- src/libengrid/surfacealgorithm.cpp | 2 + src/libengrid/surfaceoperation.cpp | 2 +- src/libengrid/surfaceoperation.h | 5 +- 7 files changed, 164 insertions(+), 115 deletions(-) diff --git a/src/libengrid/guicreatesurfacemesh.ui b/src/libengrid/guicreatesurfacemesh.ui index 3149a10..9171b4a 100644 --- a/src/libengrid/guicreatesurfacemesh.ui +++ b/src/libengrid/guicreatesurfacemesh.ui @@ -6,8 +6,8 @@ 0 0 - 770 - 512 + 641 + 462 @@ -27,112 +27,134 @@ general - - - - - - - maximal edge length: - - - - - - - 1000 - - - - - - - minimal edge length - - - - - - - 0 - - - - - - - cell growth factor: - - - - - - - 1.5 - - - - - - - nodes per quarter circle - - - - - - - true - - - 0.500000000000000 - - - 0.000000000000000 - - - - - - - nodes per 2D feature - - - - - - - nodes per 3D feature - - - - - - - true - - - 0.500000000000000 - - - 0.000000000000000 - - - - - - - true - - - 0.500000000000000 - - - 0.000000000000000 - - - - + + + + + nodes per 2D feature + + + + + + + true + + + 0.500000000000000 + + + 0.000000000000000 + + + + + + + nodes per 3D feature + + + + + + + 1000 + + + + + + + maximal edge length: + + + + + + + true + + + 0.500000000000000 + + + 0.000000000000000 + + + + + + + minimal edge length + + + + + + + nodes per quarter circle + + + + + + + true + + + 0.500000000000000 + + + 0.000000000000000 + + + + + + + 0 + + + + + + + 1.5 + + + + + + + cell growth factor: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + diff --git a/src/libengrid/guisurfacemesher.cpp b/src/libengrid/guisurfacemesher.cpp index c74f040..493c2e2 100644 --- a/src/libengrid/guisurfacemesher.cpp +++ b/src/libengrid/guisurfacemesher.cpp @@ -28,6 +28,7 @@ void GuiSurfaceMesher::before() m_Ui.m_SpinBoxDelaunaySweeps->setValue(m_NumDelaunaySweeps); m_Ui.m_SpinBoxSmoothSteps->setValue(m_NumSmoothSteps); m_Ui.m_CheckBoxSmooth->setChecked(m_CorrectCurvature); + m_Ui.m_CheckBoxBCodesFeatures->setChecked(m_BCodeFeatureDefinition); } void GuiSurfaceMesher::operate() @@ -38,5 +39,6 @@ void GuiSurfaceMesher::operate() setCorrectCurvature(m_Ui.m_CheckBoxSmooth->isChecked()); setDeleteNodes(m_Ui.m_CheckBoxDelete->isChecked()); setInsertNodes(m_Ui.m_CheckBoxInsert->isChecked()); + setBCodesFeatureDefinition(m_Ui.m_CheckBoxBCodesFeatures->isChecked()); SurfaceMesher::operate(); } diff --git a/src/libengrid/guisurfacemesher.ui b/src/libengrid/guisurfacemesher.ui index 502bb59..4ca6268 100644 --- a/src/libengrid/guisurfacemesher.ui +++ b/src/libengrid/guisurfacemesher.ui @@ -6,8 +6,8 @@ 0 0 - 329 - 195 + 322 + 272 @@ -112,6 +112,23 @@ + + + + + + + true + + + + + + + feature edges defined by boundary codes + + + @@ -146,6 +163,7 @@ m_CheckBoxInsert m_CheckBoxDelete m_CheckBoxSmooth + m_CheckBoxBCodesFeatures buttonBox diff --git a/src/libengrid/laplacesmoother.cpp b/src/libengrid/laplacesmoother.cpp index 06fa4b3..0dc703c 100644 --- a/src/libengrid/laplacesmoother.cpp +++ b/src/libengrid/laplacesmoother.cpp @@ -60,7 +60,6 @@ bool LaplaceSmoother::setNewPosition(vtkIdType id_node, vec3_t x_new) if(m_NoCheck) { return move; } - /* QVector old_cell_normals(m_Part.n2cGSize(id_node)); EG_VTKDCC(vtkIntArray, cell_code, m_Grid, "cell_code"); for (int i = 0; i < m_Part.n2cGSize(id_node); ++i) { @@ -75,7 +74,6 @@ bool LaplaceSmoother::setNewPosition(vtkIdType id_node, vec3_t x_new) break; } } - */ if (!move) { m_Grid->GetPoints()->SetPoint(id_node, x_old.data()); } @@ -274,6 +272,12 @@ void LaplaceSmoother::fixNodes(const QVector &fixnodes) void LaplaceSmoother::operate() { + if (m_BCodeFeatureDefinition) { + m_FeatureMagic = 0.0; + m_NoCheck = false; + } else { + m_NoCheck = true; + } if (m_Fixed.size() != m_Grid->GetNumberOfPoints()) { m_Fixed.fill(false, m_Grid->GetNumberOfPoints()); } diff --git a/src/libengrid/surfacealgorithm.cpp b/src/libengrid/surfacealgorithm.cpp index e3f57b2..f88d2e7 100644 --- a/src/libengrid/surfacealgorithm.cpp +++ b/src/libengrid/surfacealgorithm.cpp @@ -116,6 +116,7 @@ void SurfaceAlgorithm::swap() swap.setFeatureAngle(m_FeatureAngle); swap.setMaxNumLoops(m_NumDelaunaySweeps); swap.setSmallAreaSwap(m_AllowSmallAreaSwapping); + swap.setBCodesFeatureDefinition(m_BCodeFeatureDefinition); QSet rest_bcs = GuiMainWindow::pointer()->getAllBoundaryCodes(); rest_bcs -= m_BoundaryCodes; swap.setBoundaryCodes(rest_bcs); @@ -132,6 +133,7 @@ void SurfaceAlgorithm::smooth(int N_iter, bool correct_curveture) lap.setNumberOfIterations(N_iter); lap.setBoundaryCodes(m_BoundaryCodes);//IMPORTANT: so that unselected nodes become fixed when node types are updated! lap.setCorrectCurvature(correct_curveture); + lap.setBCodesFeatureDefinition(m_BCodeFeatureDefinition); if (m_UseProjectionForSmoothing) { lap.setProjectionOn(); } else { diff --git a/src/libengrid/surfaceoperation.cpp b/src/libengrid/surfaceoperation.cpp index badc5e2..b3c42d5 100644 --- a/src/libengrid/surfaceoperation.cpp +++ b/src/libengrid/surfaceoperation.cpp @@ -37,10 +37,10 @@ SurfaceOperation::SurfaceOperation() : Operation() //default values for determining node types and for smoothing operations getSet("surface meshing", "edge angle to determine fixed vertices", 180, m_EdgeAngle); getSet("surface meshing", "feature angle", 180, m_FeatureAngle); + getSet("surface meshing", "boundary codes define features", true, m_BCodeFeatureDefinition); m_FeatureAngle = GeometryTools::deg2rad(m_FeatureAngle); m_EdgeAngle = GeometryTools::deg2rad(m_EdgeAngle); setEdgeAngle(m_EdgeAngle); - m_BoundarySmoothing = 1; m_StretchingFactor = 0; m_UniformSnapPoints = false; m_StrictFeatureSnap = true; diff --git a/src/libengrid/surfaceoperation.h b/src/libengrid/surfaceoperation.h index ccec320..db2ab53 100644 --- a/src/libengrid/surfaceoperation.h +++ b/src/libengrid/surfaceoperation.h @@ -58,9 +58,9 @@ protected: // attributes double m_FeatureAngle; double m_EdgeAngle; - int m_BoundarySmoothing; bool m_UniformSnapPoints; bool m_StrictFeatureSnap; + bool m_BCodeFeatureDefinition; QVector m_NodeNormal; ///< node normal vectors @@ -91,7 +91,8 @@ public: void setFeatureAngle(double FA) { m_FeatureAngle = FA; } void setEdgeAngle(double EA) { m_EdgeAngle = EA; } - void setBoundarySmoothing(int BS) { m_BoundarySmoothing = BS; } + + void setBCodesFeatureDefinition(bool flag) { m_BCodeFeatureDefinition = flag; } double currentVertexAvgDist(vtkIdType id_node); ///< Returns the average distance of id_node to its neighbours double CurrentMeshDensity( vtkIdType id_node ); ///< Returns 1/CurrentVertexAvgDist(id_node) -- 2.11.4.GIT