Salome HOME
Doc improvement. Define new Set... methods in GHS3DPluginBuilder.py
authorcconopoima <cesar.conopoima@gmail.com>
Sun, 26 Mar 2023 15:25:48 +0000 (12:25 -0300)
committercconopoima <cesar.conopoima@gmail.com>
Sun, 26 Mar 2023 15:25:48 +0000 (12:25 -0300)
doc/salome/gui/GHS3DPLUGIN/input/index.doc
src/GHS3DPlugin/GHS3DPluginBuilder.py
src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx
src/GUI/GHS3DPlugin_msg_en.ts
src/GUI/GHS3DPlugin_msg_fr.ts

index 9313082eac8cde69d589552d3ee336c32f5d3cb2..8fd532ee4caff63c51b3235563395a53da68a033 100644 (file)
@@ -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 <b>MG-Tetra Optimization</b>.
+<b> MG-Tetra or MG-Tetra HPC</b> (former GHS3D) and <b>MG-Tetra Optimization</b>.
 
-\b MG-Tetra meshing algorithm is destined for:
+<b> MG-Tetra or MG-Tetra HPC</b> 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.
 
index 06f1a875a8afd1121dcddf1a1c3ce7a8945bd777..8ce03ed1bf556716680f81fcfb1d7d18dfae6ca5 100644 (file)
@@ -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
index b4e93a839684366538252b01abcfb0e963d92a91..4bf5cef0d1103b22a069a66f6c4c738675024613 100644 (file)
@@ -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 "<<fileskinmed<<"...";
@@ -2341,7 +2342,7 @@ bool GHS3DPlugin_GHS3D::ComputeMGTetraHPC(SMESH_Mesh&         theMesh,
   // Check the real need for calling this program in production!!!
 
   // ... continue the original code!
-  if (_Multithread)
+  if (isMultithread)
   {
     // check the med file has been created (only one med file, since multithread)
     TCollection_AsciiString resuMedFile = TCollection_AsciiString(path) + casenamemed + "_1.med";
index 26f97394bb46dd8726ba5ae379086fcccc8c86e5..ef7a0d961af55371b6d9e6a46e1f3d436db5ce6a 100644 (file)
@@ -103,7 +103,7 @@ GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, SMESH_Gen * gen)
                                     "split_overconstrained_tetrahedra", // no
                                     "" // mark of end
   };
-  _commonMGTetraAdvancedOptions = { "split_overconstrained_tetrahedra" };
+
   int i = 0;
   while (boolOptionNames[i][0])
   {
@@ -1751,7 +1751,6 @@ void GHS3DPlugin_Hypothesis::SetAdvancedOptionsInCommandLine( std::string & cmd,
     {
       option = o2v->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 ];
       }
index 97e0162e71ba4b6a2b45614e725358e956ea3559..c2cfc2e8901dc7abe34a4fd53af8e61dfe8a38ff 100644 (file)
@@ -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<std::string>  _commonMGTetraAdvancedOptions;  // common advanced options for MGTetra and MGTetraHPC
 
   TGHS3DEnforcedVertexList         _enfVertexList;
   TGHS3DEnforcedVertexCoordsValues _enfVertexCoordsSizeList;
index 65ef9214aac4ee6c8ba115746186aee9a54be444..b9df09b72bbc44574a32db0579d077d863721ab8 100644 (file)
@@ -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();
index d01899ef02bdab7d961e2a1fa7f480dfed0f174f..e5cca7c5c58596c7e5b571479d40fa6f7753fbcc 100644 (file)
         <source>LEVEL_LIGHT</source>
         <translation>Light</translation>
     </message>
+    <message>
+    <source>LEVEL_MEDIUM</source>
+    <translation>Medium (standard)</translation>
+    </message>
     <message>
         <source>GHS3D_PTHREAD_MODE</source>
         <translation>Pthread Mode</translation>
     </message>
     <message>
     <source>GHS3D_PARALLE_STRAT</source>
-    <translation>Paralle Stategy (HPC)</translation>
+    <translation>Parallel Strategy (HPC)</translation>
     </message>
      <message>
     <source>MODE_NONE</source>
         <source>GHS3D_THREADS_SIZE</source>
         <translation>Maximal number of threads</translation>
     </message>
-    <message>
-        <source>LEVEL_MEDIUM</source>
-        <translation>Medium (standard)</translation>
-    </message>
     <message>
         <source>LEVEL_STANDARDPLUS</source>
         <translation>Standard+</translation>
index 37f7e4a4486ed08b0a8f19ce8b7d92fd74dc9667..b42f7bbab77d646b75e88fdeb4884d7d4f071f1e 100644 (file)
         <source>LEVEL_MEDIUM</source>
         <translation>Moyen (standard)</translation>
     </message>
+    <message>
+        <source>GHS3D_PTHREAD_MODE</source>
+        <translation>Mode Pthread</translation>
+    </message>
+    <message>
+    <source>GHS3D_PARALLE_STRAT</source>
+    <translation>Statégie Parallèle(HPC)</translation>
+    </message>
+     <message>
+    <source>MODE_NONE</source>
+    <translation>Zéro</translation>
+    </message>
+    <message>
+        <source>MODE_AGGRESSIVE</source>
+        <translation>Agressif</translation>
+    </message>
+    <message>
+        <source>MODE_SAFE</source>
+        <translation>Sûr</translation>
+    </message>
+    <message>
+    <source>MODE_REPRODUCIBLE</source>
+    <translation>Reproductible</translation>
+    </message>
+    <message>
+    <source>MODE_REPRODUCIBLE_GIVEN_MAX_THREADS</source>
+    <translation>Reproductible étant donné le nombre max de threads</translation>
+    </message>
+    <message>
+        <source>GHS3D_ALGO_SELECTION</source>
+        <translation>Sélection d&apos;algorithme</translation>
+    </message>
+    <message>
+        <source>GHS3D_ALGO_MGTETRA</source>
+        <translation>MG-Tetra</translation>
+    </message>
+    <message>
+        <source>GHS3D_ALGO_MGTETRAHPC</source>
+        <translation>MG-Tetra HPC</translation>
+    </message>
+    <message>
+        <source>GHS3D_THREADS_SIZE</source>
+        <translation>Nombre max de threads</translation>
+    </message>
     <message>
         <source>LEVEL_STANDARDPLUS</source>
         <translation>Standard+</translation>