From 97588853ccdc16597e781a0b28ec5a9d784d5fed Mon Sep 17 00:00:00 2001 From: cconopoima Date: Sun, 26 Mar 2023 12:25:48 -0300 Subject: [PATCH] Doc improvement. Define new Set... methods in GHS3DPluginBuilder.py --- doc/salome/gui/GHS3DPLUGIN/input/index.doc | 4 +- src/GHS3DPlugin/GHS3DPluginBuilder.py | 37 ++++++++++++++++ src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx | 13 +++--- src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx | 23 ++-------- src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx | 3 +- src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx | 5 ++- src/GUI/GHS3DPlugin_msg_en.ts | 10 ++--- src/GUI/GHS3DPlugin_msg_fr.ts | 44 ++++++++++++++++++++ 8 files changed, 103 insertions(+), 36 deletions(-) diff --git a/doc/salome/gui/GHS3DPLUGIN/input/index.doc b/doc/salome/gui/GHS3DPLUGIN/input/index.doc index 9313082..8fd532e 100644 --- a/doc/salome/gui/GHS3DPLUGIN/input/index.doc +++ b/doc/salome/gui/GHS3DPLUGIN/input/index.doc @@ -3,9 +3,9 @@ \mainpage Introduction to MG-Tetra plug-in MG-Tetra plug-in adds two meshing algorithm to the SALOME Mesh: -\b MG-Tetra (former GHS3D) and MG-Tetra Optimization. + MG-Tetra or MG-Tetra HPC (former GHS3D) and MG-Tetra Optimization. -\b MG-Tetra meshing algorithm is destined for: + MG-Tetra or MG-Tetra HPC meshing algorithm is destined for: - Meshing 3D geometric entities: solids are split into tetrahedral (pyramidal) elements. - Generating 3D meshes from 2D meshes (triangles and quadrangles), working without geometrical objects. diff --git a/src/GHS3DPlugin/GHS3DPluginBuilder.py b/src/GHS3DPlugin/GHS3DPluginBuilder.py index 06f1a87..8ce03ed 100644 --- a/src/GHS3DPlugin/GHS3DPluginBuilder.py +++ b/src/GHS3DPlugin/GHS3DPluginBuilder.py @@ -222,6 +222,43 @@ class GHS3D_Algorithm(Mesh_Algorithm): self.Parameters().SetToRemoveCentralPoint(toRemove) pass + ## To set the algorithm id + # @param algorithm ID 0 MGTetra HPC - 1 MGTetra + def SetAlgorithm(self,algoId): + self.Parameters().SetAlgorithm(algoId) + pass + + ## To use parallel mode + # @param toUseNumOfThreads "use max number of threads" flag value + def SetUseNumOfThreads(self,useThreads): + self.Parameters().SetUseNumOfThreads(useThreads) + pass + + ## To set the number of threads to be used + # @param numberOfThreads define max_num_threads for MGTetra and MGTetra HPC + def SetNumOfThreads(self,numThreads): + self.Parameters().SetNumOfThreads(numThreads) + pass + + ## Set SetPthreadMode. + # @param pthreadMode for parallel algorithm in MGTetra + # - 0 - none + # - 1 - aggresive + # - 2 - safe + def SetPthreadMode(self,pthreadMode): + self.Parameters().SetPthreadMode(pthreadMode) + pass + + ## Set SetParallelMode. + # @param parallelMode for parallel algorithm in MGTetra HPC + # - 0 - none + # - 1 - reproducible_given_max_number_of_threads + # - 2 - reproducible + # - 3 - aggressive + def SetPthreadMode(self,parallelMode): + self.Parameters().SetParallelMode(parallelMode) + pass + ## To set an enforced vertex. # @param x : x coordinate # @param y : y coordinate diff --git a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx index b4e93a8..4bf5cef 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx @@ -2204,7 +2204,7 @@ bool GHS3DPlugin_GHS3D::ComputeMGTetraHPC(SMESH_Mesh& theMesh, std::string _MEDName = "DOMAIN\0"; bool verbose = _hyp ? !_hyp->HasOptionDefined("verbose") : true; bool proximity = _hyp->GetUseVolumeProximity(); - bool _Multithread = _hyp->GetUseNumOfThreads(); + bool isMultithread = _hyp->GetUseNumOfThreads(); double minSize = _hyp->GetMinSize(); double maxSize = _hyp->GetMaxSize(); @@ -2261,20 +2261,21 @@ bool GHS3DPlugin_GHS3D::ComputeMGTetraHPC(SMESH_Mesh& theMesh, TCollection_AsciiString cmd = TCollection_AsciiString(); std::string _AdvOptions; - if (_Multithread) + if (isMultithread) cmd += "mg-tetra_hpc.exe"; else cmd = cmd + "mpirun --n " + NbPart + " mg-tetra_hpc_mpi.exe"; cmd = cmd + " --in=" + GHS3DPRL_In; - if (_Multithread) + + if (isMultithread) { cmd = cmd + " --max_number_of_threads " + SMESH_Comment( _hyp->GetNumOfThreads() ); const char* parallelMode[] = { "none", "reproducible_given_max_number_of_threads", "reproducible", "aggressive" }; const short myMode = _hyp->GetParallelMode(); - if ( myMode >= 0 && myMode < 4 ) { + if ( myMode >= 1 && myMode < 4 ) { cmd += " --parallel_mode "; cmd += parallelMode[ myMode ]; } @@ -2329,7 +2330,7 @@ bool GHS3DPlugin_GHS3D::ComputeMGTetraHPC(SMESH_Mesh& theMesh, return error(log); } - if (!_Multithread) + if (!isMultithread) { fileskinmed=path + casenamemed + "_skin.med"; cout<<" Write file "<first; value = this->GetOptionValue( option, &isDefault ); - std::cout << option << ", " << value << std::endl; if ( isDefault ) continue; @@ -1784,7 +1783,6 @@ void GHS3DPlugin_Hypothesis::SetAdvancedOptionsInCommandLine( std::string & cmd, * \brief Return command to run MG-Tetra mesher excluding file prefix (-f) */ //================================================================================ - std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp, const bool hasShapeToMesh, const bool forExecutable) @@ -1822,6 +1820,7 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h if ( aInitialMemory > 0 ) cmd += SMESH_Comment( int( aInitialMemory )); else cmd += "100"; } + // component to mesh if ( comp && !useBndRecovery ) { // We always run MG-Tetra with "to mesh holes'==TRUE (see PAL19680) @@ -1862,16 +1861,6 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h cmd += " --verbose " + SMESH_Comment( hyp->myVerboseLevel ); } - // boundary recovery version - // if ( useBndRecovery ) { - // cmd += " -C"; - // } - - // to use FEM correction - // if ( fem && hyp && hyp->myToUseFemCorrection) { - // cmd += " -FEM"; - // } - // to remove initial central point. if ( rem && hyp->myToRemoveCentralPoint ) { if ( forExecutable ) @@ -1880,12 +1869,6 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h cmd += " --centralpoint no"; } - // options as text - // if ( !hyp->myTextOption.empty() ) { - // cmd += " " + hyp->myTextOption; - // } - - if ( hyp->GetMinSize() > 0 ) cmd += " --min_size " + SMESH_Comment( hyp->GetMinSize() ); @@ -1900,7 +1883,7 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h { cmd += " --max_number_of_threads " + SMESH_Comment( hyp->GetNumOfThreads() ); const char* pthreadMode[] = { "none" , "aggressive" , "safe" }; - if ( hyp->myPthreadModeMG >= 0 && hyp->myPthreadModeMG < 3 ) { + if ( hyp->myPthreadModeMG >= 1 && hyp->myPthreadModeMG < 3 ) { cmd += " --pthreads_mode "; cmd += pthreadMode[ hyp->myPthreadModeMG ]; } diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx index 97e0162..c2cfc2e 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx @@ -270,6 +270,8 @@ public: void ClearOption(const std::string& optionName); TOptionValues GetOptionValues() const; const TOptionValues& GetCustomOptionValues() const { return _customOption2value; } + + bool isMGTetraHPCOptions( std::string & option ) const; /*! * \brief To set the advanced options in the execution command line */ @@ -424,7 +426,6 @@ protected: TOptionValues _option2value, _customOption2value; // user defined values TOptionValues _defaultOptionValues; // default values TOptionNames _doubleOptions, _charOptions, _boolOptions; // to find a type of option - std::vector _commonMGTetraAdvancedOptions; // common advanced options for MGTetra and MGTetraHPC TGHS3DEnforcedVertexList _enfVertexList; TGHS3DEnforcedVertexCoordsValues _enfVertexCoordsSizeList; diff --git a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx index 65ef921..b9df09b 100644 --- a/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx +++ b/src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx @@ -109,13 +109,14 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i: void SetNumOfThreads(CORBA::Short numThreads); CORBA::Short GetNumOfThreads(); /*! + * For MGTetra * PthreadMode: 0-PThreadNone, 1-PThreadAggressive, 2-Safe */ void SetPthreadMode(CORBA::Short pThreadMode); CORBA::Short GetPthreadMode(); /*! - * SetParallelMode level: 0-ParallelNone, 1-ReproducibleGivenMaxNumThreads, 2-Reproducible, 3-ParallelAggressive - + * For MGTetra HPC + * SetParallelMode level: 0-ParallelNone, 1-ReproducibleGivenMaxNumThreads, 2-Reproducible, 3-ParallelAggressive */ void SetParallelMode(CORBA::Short parallelMode); CORBA::Short GetParallelMode(); diff --git a/src/GUI/GHS3DPlugin_msg_en.ts b/src/GUI/GHS3DPlugin_msg_en.ts index d01899e..e5cca7c 100644 --- a/src/GUI/GHS3DPlugin_msg_en.ts +++ b/src/GUI/GHS3DPlugin_msg_en.ts @@ -59,13 +59,17 @@ LEVEL_LIGHT Light + + LEVEL_MEDIUM + Medium (standard) + GHS3D_PTHREAD_MODE Pthread Mode GHS3D_PARALLE_STRAT - Paralle Stategy (HPC) + Parallel Strategy (HPC) MODE_NONE @@ -103,10 +107,6 @@ GHS3D_THREADS_SIZE Maximal number of threads - - LEVEL_MEDIUM - Medium (standard) - LEVEL_STANDARDPLUS Standard+ diff --git a/src/GUI/GHS3DPlugin_msg_fr.ts b/src/GUI/GHS3DPlugin_msg_fr.ts index 37f7e4a..b42f7bb 100644 --- a/src/GUI/GHS3DPlugin_msg_fr.ts +++ b/src/GUI/GHS3DPlugin_msg_fr.ts @@ -63,6 +63,50 @@ LEVEL_MEDIUM Moyen (standard) + + GHS3D_PTHREAD_MODE + Mode Pthread + + + GHS3D_PARALLE_STRAT + Statégie Parallèle(HPC) + + + MODE_NONE + Zéro + + + MODE_AGGRESSIVE + Agressif + + + MODE_SAFE + Sûr + + + MODE_REPRODUCIBLE + Reproductible + + + MODE_REPRODUCIBLE_GIVEN_MAX_THREADS + Reproductible étant donné le nombre max de threads + + + GHS3D_ALGO_SELECTION + Sélection d'algorithme + + + GHS3D_ALGO_MGTETRA + MG-Tetra + + + GHS3D_ALGO_MGTETRAHPC + MG-Tetra HPC + + + GHS3D_THREADS_SIZE + Nombre max de threads + LEVEL_STANDARDPLUS Standard+ -- 2.39.2