From be0f52965488b3b078d371e06b5ff873c136b43e Mon Sep 17 00:00:00 2001 From: Afeef Date: Mon, 2 Aug 2021 15:56:43 +0200 Subject: [PATCH] Fixes 3D meshing algorithm for gmsh [cf. spns 24634] * 3D meshing is now possible via Delaunay, Frontal, MMG3D, and R-Tree * Delaunay algorithm is now default for 3D meshing (as in gmsh) * Removed Frontal-Delaunay and Forntal-Hex algo. as these were experimental --- src/GMSHPlugin/GMSHPlugin_Hypothesis.cxx | 2 +- src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx | 1 + src/GMSHPlugin/GMSHPlugin_Mesher.cxx | 21 +++++++++++++++++---- src/GUI/GMSHPluginGUI_HypothesisCreator.cxx | 11 +++++++---- src/GUI/GMSHPlugin_msg_en.ts | 20 +++++++++++++++----- src/GUI/GMSHPlugin_msg_fr.ts | 18 ++++++++++++++---- 6 files changed, 55 insertions(+), 18 deletions(-) diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis.cxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis.cxx index 99634f6..ccbabde 100644 --- a/src/GMSHPlugin/GMSHPlugin_Hypothesis.cxx +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis.cxx @@ -32,7 +32,7 @@ GMSHPlugin_Hypothesis::GMSHPlugin_Hypothesis (int hypId, SMESH_Gen * gen) : SMESH_Hypothesis(hypId, gen), _algo2d (automatic), - _algo3d (frontal3), + _algo3d (delaunay3), _recomb2DAlgo (standard), _recombineAll (false), _subdivAlgo (none), diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx index ded2dbf..75210e3 100644 --- a/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx @@ -52,6 +52,7 @@ public: enum Algo3D { + delaunay3, frontal3, frontaldelaunay, fontalhex, diff --git a/src/GMSHPlugin/GMSHPlugin_Mesher.cxx b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx index 9d21d3d..25264f8 100644 --- a/src/GMSHPlugin/GMSHPlugin_Mesher.cxx +++ b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx @@ -241,16 +241,29 @@ void GMSHPlugin_Mesher::SetGmshOptions() //*/ std::map mapAlgo2d; - mapAlgo2d[0]=2; mapAlgo2d[1]=1; mapAlgo2d[2]=5; mapAlgo2d[3]=6; mapAlgo2d[4]=8; mapAlgo2d[5]=9; + mapAlgo2d[0]=2; // Automatic + mapAlgo2d[1]=1; // MeshAdapt + mapAlgo2d[2]=5; // Delaunay + mapAlgo2d[3]=6; // Frontal + mapAlgo2d[4]=8; // DelQuad + mapAlgo2d[5]=9; // Packing of parallelograms + std::map mapAlgo3d; - mapAlgo3d[0]=1; mapAlgo3d[1]=4; mapAlgo3d[2]=5; mapAlgo3d[3]=6; mapAlgo3d[4]=7; mapAlgo3d[5]=9; + mapAlgo3d[0]=1; // Delaunay + mapAlgo3d[1]=4; // Frontal + /* + mapAlgo3d[2]=5; // Frontal-Delaunay + mapAlgo3d[3]=6; // Frontal-Hex + */ + mapAlgo3d[2]=7; // MMG3D + mapAlgo3d[3]=9; // R-tree int ok; ok = GmshSetOption("Mesh", "Algorithm" , mapAlgo2d[_algo2d]) ; ASSERT(ok); if ( !_is2d) { - ok = GmshSetOption("Mesh", "Algorithm3D" , mapAlgo2d[_algo3d]) ; + ok = GmshSetOption("Mesh", "Algorithm3D" , mapAlgo3d[_algo3d]) ; ASSERT(ok); } ok = GmshSetOption("Mesh", "RecombinationAlgorithm" , (double)_recomb2DAlgo) ; @@ -942,7 +955,7 @@ void GMSHPlugin_Mesher::mymsg::operator()(std::string level, std::string msg) throw oss.str(); } else - printf(oss.str().c_str()); + printf("%s\n", oss.str().c_str()); } } diff --git a/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx b/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx index 11227f0..e26b584 100644 --- a/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx @@ -58,9 +58,12 @@ enum Algo2D enum Algo3D { + delaunay3, frontal3, + /* frontaldelaunay, fontalhex, + */ mmg3d, rtree }; @@ -149,8 +152,8 @@ QFrame* GMSHPluginGUI_HypothesisCreator::buildFrame() aGroupLayout->addWidget( new QLabel( tr( "GMSH_2D_ALGO" ), GroupC1 ), row, 0 ); my2DAlgo = new QComboBox( GroupC1 ); QStringList types2DAlgo; - types2DAlgo << tr( "GMSH_AUTOMATIC" ) << tr( "GMSH_MESH_ADAPT" ) << tr( "GMSH_DELAUNAY" ) << - tr( "GMSH_FRONTAL" ) << tr( "GMSH_DELAUNAY_FOR_QUAD" ) << tr( "GMSH_PACKING_OF_PARALLELOGRAMS" ); + types2DAlgo << tr( "GMSH_AUTOMATIC" ) << tr( "GMSH_MESH_ADAPT" ) << tr( "GMSH_DELAUNAY" ) << + tr( "GMSH_FRONTAL" ) << tr( "GMSH_DELAUNAY_FOR_QUAD" ) << tr( "GMSH_PACKING_OF_PARALLELOGRAMS" ); my2DAlgo->addItems( types2DAlgo ); aGroupLayout->addWidget( my2DAlgo, row, 1 ); row++; @@ -161,8 +164,8 @@ QFrame* GMSHPluginGUI_HypothesisCreator::buildFrame() aGroupLayout->addWidget( new QLabel( tr( "GMSH_3D_ALGO" ), GroupC1 ), row, 0 ); my3DAlgo = new QComboBox( GroupC1 ); QStringList types3DAlgo; - types3DAlgo << tr( "GMSH_FRONTAL_DELAUNAY" ) << tr( "GMSH_FRONTAL_HEX" ) << tr( "GMSH_MMG3D" ) << - tr( "GMSH_R_TREE" ); + types3DAlgo << tr( "GMSH_DELAUNAY3" ) << tr( "GMSH_FRONTAL3" ) /*<< tr( "GMSH_FRONTAL_DELAUNAY" ) << + tr( "GMSH_FRONTAL_HEX" )*/ << tr( "GMSH_MMG3D" ) << tr( "GMSH_R_TREE" ); my3DAlgo->addItems( types3DAlgo ); aGroupLayout->addWidget( my3DAlgo, row, 1 ); row++; diff --git a/src/GUI/GMSHPlugin_msg_en.ts b/src/GUI/GMSHPlugin_msg_en.ts index 98d0638..94e0387 100644 --- a/src/GUI/GMSHPlugin_msg_en.ts +++ b/src/GUI/GMSHPlugin_msg_en.ts @@ -53,7 +53,7 @@ GMSH_2D_ALGO - 2D algorithm + 2D algorithm GMSH_AUTOMATIC @@ -84,13 +84,23 @@ 3D Algorithm - GMSH_FRONTAL_DELAUNAY - Frontal Delaunay + GMSH_DELAUNAY3 + Delaunay - GMSH_FRONTAL_HEX - Frontal Hex + GMSH_FRONTAL3 + Frontal + GMSH_MMG3D MMG3D diff --git a/src/GUI/GMSHPlugin_msg_fr.ts b/src/GUI/GMSHPlugin_msg_fr.ts index b796525..08faed5 100644 --- a/src/GUI/GMSHPlugin_msg_fr.ts +++ b/src/GUI/GMSHPlugin_msg_fr.ts @@ -88,13 +88,23 @@ Algorithme 3D - GMSH_FRONTAL_DELAUNAY - Frontal Delaunay + GMSH_DELAUNAY3 + Delaunay - GMSH_FRONTAL_HEX - Frontal Hex + GMSH_FRONTAL3 + Frontal + GMSH_MMG3D MMG3D -- 2.39.2