From: Afeef Date: Fri, 10 Sep 2021 14:18:33 +0000 (+0200) Subject: Adds Hextrems HXT algorithm X-Git-Tag: V9_8_0a1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=742fbd94c4fca6f483d388de4388277037ba84db;p=plugins%2Fgmshplugin.git Adds Hextrems HXT algorithm - Activates parallel meshing via HXT algorithm via the Gmsh interface --- diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx index cf413e0..0ab287d 100644 --- a/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx @@ -56,7 +56,8 @@ public: delaunay3, frontal3, mmg3d, - rtree + rtree, + hxt }; diff --git a/src/GMSHPlugin/GMSHPlugin_Mesher.cxx b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx index e95b91c..af6b365 100644 --- a/src/GMSHPlugin/GMSHPlugin_Mesher.cxx +++ b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx @@ -63,6 +63,10 @@ #include #endif +#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=8 +#include +#endif + using namespace std; namespace @@ -206,6 +210,24 @@ void GMSHPlugin_Mesher::SetParameters(const GMSHPlugin_Hypothesis* hyp) } } + +//================================================================================ +/*! + * \brief Set maximum number of threads to be used by Gmsh + */ +//================================================================================ + +#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=8 +void GMSHPlugin_Mesher::SetMaxThreadsGmsh() +{ + MESSAGE("GMSHPlugin_Mesher::SetMaxThreadsGmsh"); + if (_compounds.size() > 0) + _maxThreads = 1; + else + _maxThreads = omp_get_max_threads(); +} +#endif + //================================================================================ /*! * \brief Set Gmsh Options @@ -245,6 +267,7 @@ void GMSHPlugin_Mesher::SetGmshOptions() mapAlgo3d[1]=4; // Frontal mapAlgo3d[2]=7; // MMG3D mapAlgo3d[3]=9; // R-tree + mapAlgo3d[4]=10;// HXT int ok; ok = GmshSetOption("Mesh", "Algorithm" , mapAlgo2d[_algo2d]) ; @@ -288,6 +311,18 @@ void GMSHPlugin_Mesher::SetGmshOptions() ok = GmshSetOption("Mesh", "SecondOrderIncomplete" ,(_useIncomplElem)?1.:0.); ASSERT(ok); } + +#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=8 +/*ok = GmshSetOption("Mesh", "MaxNumThreads1D" , 0. ) ; // Coarse-grain algo threads + ASSERT(ok); + ok = GmshSetOption("Mesh", "MaxNumThreads2D" , 0. ) ; // Coarse-grain algo threads + ASSERT(ok); + ok = GmshSetOption("Mesh", "MaxNumThreads3D" , 0. ) ; // Fine-grain algo threads HXT + ASSERT(ok); +/**/ + ok = GmshSetOption("General", "NumThreads" , _maxThreads ) ; // system default i.e. OMP_NUM_THREADS + ASSERT(ok); +#endif } //================================================================================ @@ -1013,6 +1048,9 @@ bool GMSHPlugin_Mesher::Compute() int err = 0; +#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=8 + SetMaxThreadsGmsh(); +#endif GmshInitialize(); SetGmshOptions(); _gModel = new GModel(); diff --git a/src/GMSHPlugin/GMSHPlugin_Mesher.hxx b/src/GMSHPlugin/GMSHPlugin_Mesher.hxx index 1fdb36c..a8b952a 100644 --- a/src/GMSHPlugin/GMSHPlugin_Mesher.hxx +++ b/src/GMSHPlugin/GMSHPlugin_Mesher.hxx @@ -24,9 +24,9 @@ #include #include "GmshVersion.h" -#if GMSH_MAJOR_VERSION >=4 +#if GMSH_MAJOR_VERSION >=4 #include "gmsh.h" -#else +#else #include "Gmsh.h" #endif #include "GmshConfig.h" @@ -34,7 +34,7 @@ #include "GModelIO_GEO.h" #include "Geo.h" #if GMSH_MAJOR_VERSION >=4 -#include "GEdge.h" +#include "GEdge.h" #include "GFace.h" #else #include "GEdgeCompound.h" @@ -66,7 +66,7 @@ class GMSHPlugin_Hypothesis; */ //============================================================================= -class GMSHPLUGIN_EXPORT GMSHPlugin_Mesher +class GMSHPLUGIN_EXPORT GMSHPlugin_Mesher { public: // ---------- PUBLIC METHODS ---------- @@ -78,7 +78,7 @@ class GMSHPLUGIN_EXPORT GMSHPlugin_Mesher bool Compute(); bool Evaluate(MapShapeNbElems& aResMap); - + static float DistBoundingBox(const SBoundingBox3d& bounds, const SPoint3& point); private: @@ -97,14 +97,19 @@ class GMSHPLUGIN_EXPORT GMSHPlugin_Mesher bool _secondOrder, _useIncomplElem; bool _is2d; GModel* _gModel; - +#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=3 + double _maxThreads; +#endif + std::set _compounds; - + void SetGmshOptions(); void CreateGmshCompounds(); - void SetCompoundMeshVisibility(); void FillSMesh(); - +#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=3 + void SetMaxThreadsGmsh(); + void SetCompoundMeshVisibility(); +#endif class mymsg : public GmshMessage { private: diff --git a/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx b/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx index 61f634d..bdc8a64 100644 --- a/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx @@ -170,8 +170,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_DELAUNAY3") << tr( "GMSH_FRONTAL_DELAUNAY" ) << tr( "GMSH_MMG3D" ) << - tr( "GMSH_R_TREE" ); + types3DAlgo << tr( "GMSH_DELAUNAY3" ) << tr( "GMSH_FRONTAL_DELAUNAY" ) << tr( "GMSH_MMG3D" ) << + tr( "GMSH_R_TREE" ) << tr( "GMSH_HXT" ); 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 e852885..d649a34 100644 --- a/src/GUI/GMSHPlugin_msg_en.ts +++ b/src/GUI/GMSHPlugin_msg_en.ts @@ -107,6 +107,10 @@ GMSH_R_TREE R-tree + + GMSH_HXT + Parallel Delaunay (HXT) + GMSH_2D_RECOMB_ALGO 2D recombination algorithm diff --git a/src/GUI/GMSHPlugin_msg_fr.ts b/src/GUI/GMSHPlugin_msg_fr.ts index 00b0e94..fc1376c 100644 --- a/src/GUI/GMSHPlugin_msg_fr.ts +++ b/src/GUI/GMSHPlugin_msg_fr.ts @@ -111,6 +111,10 @@ GMSH_R_TREE R-tree + + GMSH_HXT + Delaunay Parallèle (HTX) + GMSH_2D_RECOMB_ALGO Algorithme de recombinaison 2D