From 9e11bf5908c3bbbf19781d458a4c9dbab0c11023 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@uliege.be> Date: Thu, 5 May 2022 16:33:34 +0200 Subject: [PATCH] new option Mesh.HighOrderFixBoundaryNodes --- src/common/Context.h | 2 +- src/common/DefaultOptions.h | 2 ++ src/common/Options.cpp | 6 ++++++ src/common/Options.h | 1 + src/mesh/Generator.cpp | 27 ++++++++++++++------------- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/common/Context.h b/src/common/Context.h index fde6d0b98e..3cf6f789d2 100644 --- a/src/common/Context.h +++ b/src/common/Context.h @@ -36,7 +36,7 @@ struct contextMeshOptions { int meshOnlyVisible, meshOnlyEmpty; int minCircleNodes, minCurveNodes, minLineNodes; int hoOptimize, hoPeriodic, hoNLayers, hoPrimSurfMesh, hoIterMax, hoPassMax; - int hoDistCAD, hoSavePeriodic; + int hoDistCAD, hoSavePeriodic, hoFixBndNodes; double hoThresholdMin, hoThresholdMax, hoPoissonRatio; bool hoNewFastCurvingAlgo; int hoCurveOuterBL; diff --git a/src/common/DefaultOptions.h b/src/common/DefaultOptions.h index 68b39ea39b..539a6e7adb 100644 --- a/src/common/DefaultOptions.h +++ b/src/common/DefaultOptions.h @@ -1162,6 +1162,8 @@ StringXNumber MeshOptions_Number[] = { { F|O, "HighOrderDistCAD", opt_mesh_ho_dist_cad, 0, "Try to optimize distance to CAD in high-order optimizer?"}, + { F|O, "HighOrderFixBoundaryNodes", opt_mesh_ho_fix_bnd_nodes, 0, + "Fix boundary nodes during high-order optimization?"}, { F|O, "HighOrderIterMax", opt_mesh_ho_iter_max, 100, "Maximum number of iterations in high-order optimization pass"}, { F|O, "HighOrderNumLayers", opt_mesh_ho_nlayers, 6., diff --git a/src/common/Options.cpp b/src/common/Options.cpp index 21578b6b7d..674e31f2d4 100644 --- a/src/common/Options.cpp +++ b/src/common/Options.cpp @@ -6261,6 +6261,12 @@ double opt_mesh_ho_max_in_angle(OPT_ARGS_NUM) return CTX::instance()->mesh.hoMaxInnerAngle; } +double opt_mesh_ho_fix_bnd_nodes(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) CTX::instance()->mesh.hoFixBndNodes = val; + return CTX::instance()->mesh.hoFixBndNodes; +} + double opt_mesh_second_order_linear(OPT_ARGS_NUM) { if(action & GMSH_SET) { diff --git a/src/common/Options.h b/src/common/Options.h index 2c9b95f008..96cc661f6a 100644 --- a/src/common/Options.h +++ b/src/common/Options.h @@ -568,6 +568,7 @@ double opt_mesh_ho_curve_outer_BL(OPT_ARGS_NUM); double opt_mesh_ho_max_rho(OPT_ARGS_NUM); double opt_mesh_ho_max_angle(OPT_ARGS_NUM); double opt_mesh_ho_max_in_angle(OPT_ARGS_NUM); +double opt_mesh_ho_fix_bnd_nodes(OPT_ARGS_NUM); double opt_mesh_second_order_linear(OPT_ARGS_NUM); double opt_mesh_second_order_incomplete(OPT_ARGS_NUM); double opt_mesh_cgns_import_order(OPT_ARGS_NUM); diff --git a/src/mesh/Generator.cpp b/src/mesh/Generator.cpp index 15cbaf84e5..4e542c2878 100644 --- a/src/mesh/Generator.cpp +++ b/src/mesh/Generator.cpp @@ -1015,6 +1015,7 @@ void OptimizeMesh(GModel *m, const std::string &how, bool force, int niter) p.BARRIER_MAX = CTX::instance()->mesh.hoThresholdMax; p.itMax = CTX::instance()->mesh.hoIterMax; p.optPassMax = CTX::instance()->mesh.hoPassMax; + p.fixBndNodes = CTX::instance()->mesh.hoFixBndNodes; p.dim = m->getDim(); p.optPrimSurfMesh = CTX::instance()->mesh.hoPrimSurfMesh; p.optCAD = CTX::instance()->mesh.hoDistCAD; @@ -1065,49 +1066,49 @@ void OptimizeMesh(GModel *m, const std::string &how, bool force, int niter) } } else if(how == "DiskQuadrangulation") { - for(GFace *gf : m->getFaces()) + for(GFace *gf : m->getFaces()) { if(gf->meshStatistics.status == GFace::DONE) { gf->meshStatistics.status = GFace::PENDING; } - + } transferSeamGEdgesVerticesToGFace(m); optimizeTopologyWithDiskQuadrangulationRemeshing(m); - - for(GFace *gf : m->getFaces()) + for(GFace *gf : m->getFaces()) { if(gf->meshStatistics.status == GFace::PENDING) { gf->meshStatistics.status = GFace::DONE; } + } } else if(how == "QuadCavityRemeshing") { - for(GFace *gf : m->getFaces()) + for(GFace *gf : m->getFaces()) { if(gf->meshStatistics.status == GFace::DONE) { gf->meshStatistics.status = GFace::PENDING; } - + } transferSeamGEdgesVerticesToGFace(m); optimizeTopologyWithCavityRemeshing(m); - - for(GFace *gf : m->getFaces()) + for(GFace *gf : m->getFaces()) { if(gf->meshStatistics.status == GFace::PENDING) { gf->meshStatistics.status = GFace::DONE; } + } } else if(how == "QuadQuasiStructured") { // The following methods only act on faces whose status is PENDING - for(GFace *gf : m->getFaces()) + for(GFace *gf : m->getFaces()) { if(gf->meshStatistics.status == GFace::DONE) { gf->meshStatistics.status = GFace::PENDING; } - + } transferSeamGEdgesVerticesToGFace(m); quadMeshingOfSimpleFacesWithPatterns(m); optimizeTopologyWithDiskQuadrangulationRemeshing(m); optimizeTopologyWithCavityRemeshing(m); - - for(GFace *gf : m->getFaces()) + for(GFace *gf : m->getFaces()) { if(gf->meshStatistics.status == GFace::PENDING) { gf->meshStatistics.status = GFace::DONE; } + } } else if(how == "UntangleMeshGeometry") { #if defined(HAVE_WINSLOWUNTANGLER) @@ -1120,7 +1121,7 @@ void OptimizeMesh(GModel *m, const std::string &how, bool force, int niter) untangleGFaceMeshConstrained(gf, nIterWinslow, timeMax); } else { - Msg::Debug("- Face %i: not planar, do not apply Winslow untangling", + Msg::Debug("- Surface %i: not planar, do not apply Winslow untangling", gf->tag()); } } -- GitLab