Salome HOME
23307: [EDF 7315] Improvement of DISTENE meshing plugins
authoreap <eap@opencascade.com>
Tue, 9 Aug 2016 16:48:29 +0000 (19:48 +0300)
committereap <eap@opencascade.com>
Tue, 9 Aug 2016 16:48:29 +0000 (19:48 +0300)
14 files changed:
doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_advanced.png [new file with mode: 0644]
doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_basic.png
doc/salome/gui/GHS3DPRLPLUGIN/input/ghs3dprl_hypo.doc
idl/GHS3DPRLPlugin_Algorithm.idl
src/GHS3DPRLPlugin/GHS3DPRLPluginBuilder.py
src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx
src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.hxx
src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.cxx
src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis.hxx
src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.cxx
src/GHS3DPRLPlugin/GHS3DPRLPlugin_Hypothesis_i.hxx
src/gui/CMakeLists.txt
src/gui/GHS3DPRLPluginGUI_HypothesisCreator.cxx
src/gui/GHS3DPRLPluginGUI_HypothesisCreator.h

diff --git a/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_advanced.png b/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_advanced.png
new file mode 100644 (file)
index 0000000..74265b7
Binary files /dev/null and b/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_advanced.png differ
index 78b369556114e5d4ab9ee5edcf3ae43e7e62c5af..32a7c36333646a55f6f8af1b339132e392d02544 100644 (file)
Binary files a/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_basic.png and b/doc/salome/gui/GHS3DPRLPLUGIN/images/ghs3dprl_parameters_basic.png differ
index 1d1404987d53b56ad6c509e3d9cc6d3158020b66..fa0a8c1eaebe1e8a7a00728ac65bdec0fa10db9a 100644 (file)
@@ -72,6 +72,13 @@ combination with the <b>Merge subdomains</b> option).
 (mesh, global numbering and interfaces).
 </li>
 
+\image html ghs3dprl_parameters_advanced.png
+
+In \b Advanced tab page you can specify not exposed options of MG_Tetra-hpc.
+
+<b>Add option</b> adds a line to the table where you can type an option and its value as text.
+A check box in the first column activates/deactivates the option of the current row. A deactivated option will be erased upon pressing \a Ok.
+
 <h1>Modifying MG-Tetra-hpc Advanced Parameters</h1><br>
 MG-Tetra Parallel plug-in launches a standalone binary
 executable <b>tetrahpc2med</b>.<br>
index adefb3a36eb6462eae1b8caf00af1ef33de631bb..8726bdeba56c0ae4fb46547ed98ce3547e87e63d 100755 (executable)
@@ -74,6 +74,8 @@ module GHS3DPRLPlugin
     void SetMaxSize(in float value);
     float GetMaxSize();
 
+    void SetAdvancedOption( in string optAndVals );
+    string GetAdvancedOption();
   };
 
 };
index b6747ccac3b2f51cc118ac1cc40645adc342482c..195d31dea61ea56ba173031e341c582cef1958e0 100644 (file)
@@ -139,4 +139,10 @@ class GHS3DPRL_Algorithm(Mesh_Algorithm):
         self.Parameters().SetMaxSize(value)
         pass
     
+    ## Sets command line option as text.
+    #  @param option command line option
+    def SetAdvancedOption(self, option):
+        self.Parameters().SetAdvancedOption(option)
+        pass
+
     pass # end of GHS3DPRL_Algorithm class
index 6db5e048d2a6c6ae04545b2738afef5add5b3ad4..9b75f7bd2ccf78e81891ecb4c4e53aa9c14cdf36 100755 (executable)
@@ -246,15 +246,15 @@ void GHS3DPRLPlugin_GHS3DPRL::SetParameters(const GHS3DPRLPlugin_Hypothesis* hyp
 {
   if (hyp) {
     MESSAGE("GHS3DPRLPlugin_GHS3DPRL::SetParameters");
-    _MEDName = hyp->GetMEDName();  //"DOMAIN\0"
-    _NbPart = hyp->GetNbPart();
-    _KeepFiles = hyp->GetKeepFiles();
-    _Background = hyp->GetBackground();
+    _MEDName     = hyp->GetMEDName();  //"DOMAIN\0"
+    _NbPart      = hyp->GetNbPart();
+    _KeepFiles   = hyp->GetKeepFiles();
+    _Background  = hyp->GetBackground();
     _Multithread = hyp->GetMultithread();
-    //_ToMergeSubdomains = hyp->GetToMergeSubdomains();
-    _Gradation = hyp->GetGradation();
-    _MinSize = hyp->GetMinSize();
-    _MaxSize = hyp->GetMaxSize();
+    _Gradation   = hyp->GetGradation();
+    _MinSize     = hyp->GetMinSize();
+    _MaxSize     = hyp->GetMaxSize();
+    _AdvOptions  = hyp->GetAdvancedOption();
   }
 }
 
@@ -288,181 +288,183 @@ static TCollection_AsciiString getTmpDir()
 
 //=============================================================================
 // Here we are going to use the GHS3DPRL mesher for tetra-hpc (formerly tepal in v3 (2014))
-bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh,
-                                     const TopoDS_Shape& theShape)
+bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh&        theMesh,
+                                      const TopoDS_Shape& theShape)
 {
-   bool Ok=false;
-   TCollection_AsciiString pluginerror("ghs3dprl: ");
-   SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
-   //cout<<"GetMeshDS done\n";
-   if (_countSubMesh==0){
-      MESSAGE("GHS3DPRLPlugin_GHS3DPRL::Compute for tetra-hpc");
-      _countTotal=0;
-      TopExp_Explorer expf(meshDS->ShapeToMesh(), TopAbs_SOLID);
-      for ( ; expf.More(); expf.Next() ) _countTotal++;
-   }
-   _countSubMesh++;
-   //cout<<"Compute _countSubMesh "<<_countSubMesh<<endl;
-   //no stuff if multiples submesh, multiple call compute
-   //mesh all in one pass tepal (the last)
-   if (_countSubMesh != _countTotal ) return true;
-
-   //stuff on last call 
-   if (_hypothesis==NULL){
-      pluginerror += "No existing parameters/hypothesis for GHS3DPRL";
-      cout <<"\n"<<pluginerror<<"\n\n";
-      error(COMPERR_ALGO_FAILED, pluginerror.ToCString() );
-      return false;
-   }
-   SetParameters(_hypothesis);
-   cout << "\n" << _name << " parameters:" << endl;
-   cout << "   generic path/name of MED Files = " << _MEDName << endl;
-   cout << "   number of partitions = " << _NbPart << endl;
-   cout << "   gradation = " << _Gradation << endl;
-   cout << "   min_size = " << _MinSize << endl;
-   cout << "   max_size = " << _MaxSize << endl;
-   cout << "   keep intermediates files (from tetra-hpc) = " << _KeepFiles << endl;
-   cout << "   background (from tetra-hpc) = " << _Background << "\n";
-   cout << "   multithread = " << _Multithread << "\n\n";
-
-      //string tmpDir=getTmpDir_new();
-      TCollection_AsciiString
-         tmpDir=getTmpDir(),
-         GHS3DPRL_In,
-         GHS3DPRL_Out,
-         GHS3DPRL_Outxml,
-         run_GHS3DPRL("tetrahpc2med "),
-         rm("rm -f "),
-         run_nokeep_files,
-         NbPart,
-         Gradation,
-         MinSize,
-         MaxSize,
-         fileskinmed(""),
-         fileskinmesh(""),
-         path,
-         casenamemed;  //_MEDName.c_str());
-
-      casenamemed += (char *)_MEDName.c_str();
-      int n=casenamemed.SearchFromEnd('/');
-      if (n>0) {
-         path=casenamemed.SubString(1,n);
-         casenamemed=casenamemed.SubString(n+1,casenamemed.Length()); 
-      }
-      else
-         path=tmpDir;
-
-      if (casenamemed.Length()>20){
-         casenamemed=casenamemed.SubString(1,20);
-         cerr<<"MEDName truncated (no more 20 characters) = "<<casenamemed<<endl;
-      }
-      //cout<<"path="<<path<<endl;
-      //cout<<"casenamemed="<<casenamemed<<endl;
-
-      map <int,int> aSmdsToGHS3DPRLIdMap;
-      map <int,const SMDS_MeshNode*> aGHS3DPRLIdToNodeMap;
-      GHS3DPRL_In = path + "GHS3DPRL";
-      GHS3DPRL_Out = path + casenamemed;
-      GHS3DPRL_Outxml = path + casenamemed + ".xml"; //master file
-      NbPart=_NbPart;
-      Gradation=_Gradation;
-      MinSize=_MinSize;
-      MaxSize=_MaxSize;
-      
-      //an example:
-      //tetrahpc2med --casename=/home/whoami/tmp/GHS3DPRL --number=5 --medname=DOMAIN 
-      //             --gradation=1.05 --min_size=1e-3 --max_size=1e-2
-      //             --verbose=0 --menu=no --launchtetra=yes;
-      
-      run_GHS3DPRL = run_GHS3DPRL +
-                     " --casename=" + GHS3DPRL_In + 
-                     " --number=" + NbPart +
-                     " --medname=" + GHS3DPRL_Out +
-                     " --launchtetra=yes" +
-                     " --gradation=" + Gradation +
-                     " --min_size=" + MinSize +
-                     " --max_size=" + MaxSize +
-                     " --verbose=3";
-      if (_Background) run_GHS3DPRL += " --background=yes"; else run_GHS3DPRL += " --background=no";
-      if (_Multithread) run_GHS3DPRL += " --multithread=yes"; else run_GHS3DPRL += " --multithread=no";
-      run_nokeep_files = rm +GHS3DPRL_In + "* " + path + "tetrahpc.log";
-      system( run_nokeep_files.ToCString() ); //clean files
-      run_nokeep_files = rm + GHS3DPRL_In + "* ";
-
-      cout<<"GHS3DPRL command :\n  "<<run_GHS3DPRL.ToCString()<<endl;
-      fileskinmesh=path + "GHS3DPRL.mesh";
-      cout<<"  Write input file for tetra_hpc.exe "<<fileskinmesh<<"...";
-      GHS3DPRL_Out = path + casenamemed;
-      removeFile( GHS3DPRL_Outxml ); //only the master xml file
-      //Ok=writeGHS3DPRLFiles(GHS3DPRL_In, meshDS, aSmdsToGHS3DPRLIdMap, aGHS3DPRLIdToNodeMap);
-      bool toCreateGroups = false;
-      theMesh.ExportGMF(fileskinmesh.ToCString(), meshDS, toCreateGroups );
-      cout<<" ...done\n";
-      //else {
-      //   cout<<" ...NOT done\n";
-      //   pluginerror = pluginerror + "problem writing input tepal files " + GHS3DPRL_In + ".mesh";
-
-      //Ecriture dans un fichier MED ?v2.? meme si not Ok
-      //create empty file -> avoid warning message
-      //med_idt fid=MEDouvrir((const char *)fileskinmed.ToCString(),MED_CREATION);
-      //med_err ret=MEDfermer(fid);
-      //fileskinmed=fileskinmed + "cp /home/wambeke/empty.med "+ path + "GHS3DPRL_skin.med";
-      //system( fileskinmed.ToCString() );
-      fileskinmed=path + "GHS3DPRL_skin.med";
-      cout<<"  Write file "<<fileskinmed<<"...";
-      theMesh.ExportMED(fileskinmed.ToCString(),"SKIN_INITIAL",true,1);
-      cout<<" ...done\n\n";
-
-
-      //sometimes it is better to wait flushing files on slow filesystem...
-      system( "sleep 3" );
-      //launch tetrahpc2med which launch mg-tetra_hpc.py which launch mg-tetra_hpc(_mpi?).exe
-      system( run_GHS3DPRL.ToCString() );
-      system( "sleep 3" );
-
-      if (_Background) {
-         pluginerror = pluginerror + "backgrounding... plugin is not waiting for output files "+ casenamemed + "_*.med";
-         cout<<pluginerror<<endl;
-         error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
-         return false; //but it is not a problem but if true my message is overwritten
-         //return true; //but it is not a problem, 
-      }
-
-      // read a result, GHS3DPRL_Out is the name of master file (previous xml format)
-      FILE * aResultFile = fopen( GHS3DPRL_Outxml.ToCString(), "r" );
-      if (aResultFile){
-          //Ok = readResult( aResultFile, meshDS, theShape, aGHS3DPRLIdToNodeMap, GHS3DPRL_Out, _nodeRefNumber );
-          Ok = true;
-          Ok = false; //but it is not a problem but if true my message is overwritten
-          fclose(aResultFile);
-          cout<<"GHS3DPRL OK output master file "<<casenamemed<<".xml exist !\n\n";
-          pluginerror = pluginerror + "new tetraedra not in memory, but stored in files "+ casenamemed + "_*.med";
-          cout<<pluginerror<<endl;
-          error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
-          if (!_KeepFiles) system( run_nokeep_files.ToCString() );
-      }
-      else{
-          Ok = false; //it is a problem AND my message is NOT overwritten
-          pluginerror = pluginerror + "output master file " + casenamemed + ".xml do not exist";
-          cout<<pluginerror<<endl;
-          error(COMPERR_ALGO_FAILED, pluginerror.ToCString() );
-          cout<<"GHS3DPRL KO output files "<<GHS3DPRL_Out<<" do not exist ! see intermediates files keeped:\n";
-          TCollection_AsciiString run_list_files("ls -alt ");
-          run_list_files +=  GHS3DPRL_Out + "* " + GHS3DPRL_In + "* " + path + "tetrahpc.log";
-          system( run_list_files.ToCString() );
-          cout<<endl;
-      }
-      _countSubMesh=0;
-
-
-    return Ok;
+  bool Ok=false;
+  TCollection_AsciiString pluginerror("ghs3dprl: ");
+  SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
+  //cout<<"GetMeshDS done\n";
+  if (_countSubMesh==0){
+    MESSAGE("GHS3DPRLPlugin_GHS3DPRL::Compute for tetra-hpc");
+    _countTotal=0;
+    TopExp_Explorer expf(meshDS->ShapeToMesh(), TopAbs_SOLID);
+    for ( ; expf.More(); expf.Next() ) _countTotal++;
+  }
+  _countSubMesh++;
+  //cout<<"Compute _countSubMesh "<<_countSubMesh<<endl;
+  //no stuff if multiples submesh, multiple call compute
+  //mesh all in one pass tepal (the last)
+  if (_countSubMesh != _countTotal ) return true;
+
+  //stuff on last call
+  if (_hypothesis==NULL){
+    pluginerror += "No existing parameters/hypothesis for GHS3DPRL";
+    cout <<"\n"<<pluginerror<<"\n\n";
+    error(COMPERR_ALGO_FAILED, pluginerror.ToCString() );
+    return false;
+  }
+  SetParameters(_hypothesis);
+  cout << "\n" << _name << " parameters:" << endl;
+  cout << "   generic path/name of MED Files = " << _MEDName << endl;
+  cout << "   number of partitions = " << _NbPart << endl;
+  cout << "   gradation = " << _Gradation << endl;
+  cout << "   min_size = " << _MinSize << endl;
+  cout << "   max_size = " << _MaxSize << endl;
+  cout << "   keep intermediates files (from tetra-hpc) = " << _KeepFiles << endl;
+  cout << "   background (from tetra-hpc) = " << _Background << "\n";
+  cout << "   multithread = " << _Multithread << "\n\n";
+  cout << "   adv. options = '" << _AdvOptions << "'\n\n";
+
+  //string tmpDir=getTmpDir_new();
+  TCollection_AsciiString
+    tmpDir=getTmpDir(),
+    GHS3DPRL_In,
+    GHS3DPRL_Out,
+    GHS3DPRL_Outxml,
+    run_GHS3DPRL("tetrahpc2med "),
+    rm("rm -f "),
+    run_nokeep_files,
+    NbPart,
+    Gradation,
+    MinSize,
+    MaxSize,
+    fileskinmed(""),
+    fileskinmesh(""),
+    path,
+    casenamemed;  //_MEDName.c_str());
+
+  casenamemed += (char *)_MEDName.c_str();
+  int n=casenamemed.SearchFromEnd('/');
+  if (n>0) {
+    path=casenamemed.SubString(1,n);
+    casenamemed=casenamemed.SubString(n+1,casenamemed.Length());
+  }
+  else
+    path=tmpDir;
+
+  if (casenamemed.Length()>20){
+    casenamemed=casenamemed.SubString(1,20);
+    cerr<<"MEDName truncated (no more 20 characters) = "<<casenamemed<<endl;
+  }
+  //cout<<"path="<<path<<endl;
+  //cout<<"casenamemed="<<casenamemed<<endl;
+
+  map <int,int> aSmdsToGHS3DPRLIdMap;
+  map <int,const SMDS_MeshNode*> aGHS3DPRLIdToNodeMap;
+  GHS3DPRL_In = path + "GHS3DPRL";
+  GHS3DPRL_Out = path + casenamemed;
+  GHS3DPRL_Outxml = path + casenamemed + ".xml"; //master file
+  NbPart=_NbPart;
+  Gradation=_Gradation;
+  MinSize=_MinSize;
+  MaxSize=_MaxSize;
+
+  //an example:
+  //tetrahpc2med --casename=/home/whoami/tmp/GHS3DPRL --number=5 --medname=DOMAIN
+  //             --gradation=1.05 --min_size=1e-3 --max_size=1e-2
+  //             --verbose=0 --menu=no --launchtetra=yes;
+
+  run_GHS3DPRL = run_GHS3DPRL +
+    " --casename=" + GHS3DPRL_In +
+    " --number=" + NbPart +
+    " --medname=" + GHS3DPRL_Out +
+    " --launchtetra=yes" +
+    " --gradation=" + Gradation +
+    " --min_size=" + MinSize +
+    " --max_size=" + MaxSize +
+    " --verbose=3" +
+    " " + _AdvOptions.c_str();
+  if (_Background) run_GHS3DPRL += " --background=yes"; else run_GHS3DPRL += " --background=no";
+  if (_Multithread) run_GHS3DPRL += " --multithread=yes"; else run_GHS3DPRL += " --multithread=no";
+  run_nokeep_files = rm +GHS3DPRL_In + "* " + path + "tetrahpc.log";
+  system( run_nokeep_files.ToCString() ); //clean files
+  run_nokeep_files = rm + GHS3DPRL_In + "* ";
+
+  cout<<"GHS3DPRL command :\n  "<<run_GHS3DPRL.ToCString()<<endl;
+  fileskinmesh=path + "GHS3DPRL.mesh";
+  cout<<"  Write input file for tetra_hpc.exe "<<fileskinmesh<<"...";
+  GHS3DPRL_Out = path + casenamemed;
+  removeFile( GHS3DPRL_Outxml ); //only the master xml file
+  //Ok=writeGHS3DPRLFiles(GHS3DPRL_In, meshDS, aSmdsToGHS3DPRLIdMap, aGHS3DPRLIdToNodeMap);
+  bool toCreateGroups = false;
+  theMesh.ExportGMF(fileskinmesh.ToCString(), meshDS, toCreateGroups );
+  cout<<" ...done\n";
+  //else {
+  //   cout<<" ...NOT done\n";
+  //   pluginerror = pluginerror + "problem writing input tepal files " + GHS3DPRL_In + ".mesh";
+
+  //Ecriture dans un fichier MED ?v2.? meme si not Ok
+  //create empty file -> avoid warning message
+  //med_idt fid=MEDouvrir((const char *)fileskinmed.ToCString(),MED_CREATION);
+  //med_err ret=MEDfermer(fid);
+  //fileskinmed=fileskinmed + "cp /home/wambeke/empty.med "+ path + "GHS3DPRL_skin.med";
+  //system( fileskinmed.ToCString() );
+  fileskinmed=path + "GHS3DPRL_skin.med";
+  cout<<"  Write file "<<fileskinmed<<"...";
+  theMesh.ExportMED(fileskinmed.ToCString(),"SKIN_INITIAL",true,1);
+  cout<<" ...done\n\n";
+
+
+  //sometimes it is better to wait flushing files on slow filesystem...
+  system( "sleep 3" );
+  //launch tetrahpc2med which launch mg-tetra_hpc.py which launch mg-tetra_hpc(_mpi?).exe
+  system( run_GHS3DPRL.ToCString() );
+  system( "sleep 3" );
+
+  if (_Background) {
+    pluginerror = pluginerror + "backgrounding... plugin is not waiting for output files "+ casenamemed + "_*.med";
+    cout<<pluginerror<<endl;
+    error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
+    return false; //but it is not a problem but if true my message is overwritten
+    //return true; //but it is not a problem,
+  }
+
+  // read a result, GHS3DPRL_Out is the name of master file (previous xml format)
+  FILE * aResultFile = fopen( GHS3DPRL_Outxml.ToCString(), "r" );
+  if (aResultFile){
+    //Ok = readResult( aResultFile, meshDS, theShape, aGHS3DPRLIdToNodeMap, GHS3DPRL_Out, _nodeRefNumber );
+    Ok = true;
+    Ok = false; //but it is not a problem but if true my message is overwritten
+    fclose(aResultFile);
+    cout<<"GHS3DPRL OK output master file "<<casenamemed<<".xml exist !\n\n";
+    pluginerror = pluginerror + "new tetraedra not in memory, but stored in files "+ casenamemed + "_*.med";
+    cout<<pluginerror<<endl;
+    error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
+    if (!_KeepFiles) system( run_nokeep_files.ToCString() );
+  }
+  else{
+    Ok = false; //it is a problem AND my message is NOT overwritten
+    pluginerror = pluginerror + "output master file " + casenamemed + ".xml do not exist";
+    cout<<pluginerror<<endl;
+    error(COMPERR_ALGO_FAILED, pluginerror.ToCString() );
+    cout<<"GHS3DPRL KO output files "<<GHS3DPRL_Out<<" do not exist ! see intermediates files keeped:\n";
+    TCollection_AsciiString run_list_files("ls -alt ");
+    run_list_files +=  GHS3DPRL_Out + "* " + GHS3DPRL_In + "* " + path + "tetrahpc.log";
+    system( run_list_files.ToCString() );
+    cout<<endl;
+  }
+  _countSubMesh=0;
+
+
+  return Ok;
 }
 
 
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 bool GHS3DPRLPlugin_GHS3DPRL::Evaluate(SMESH_Mesh& aMesh,
index f1d112522c602af08fd3f87b1fe2237dc370a9a3..5742b5eedd4877e94b81c58aef5977c3320a0a24 100755 (executable)
@@ -69,6 +69,7 @@ private:
   float       _Gradation;
   float       _MinSize;
   float       _MaxSize;
+  std::string _AdvOptions;
 };
 
 #endif
index d436fb3f920936281f1d353d6e5903958f2d5239..736de1fe14bfda82e2278ae5f0cf48cf3d45adc7 100755 (executable)
@@ -152,8 +152,14 @@ void GHS3DPRLPlugin_Hypothesis::SetMaxSize(float theVal) {
   }
 }
 
-
-
+void GHS3DPRLPlugin_Hypothesis::SetAdvancedOption(const char* theOptAndVals )
+{
+  if ( _AdvOptions != theOptAndVals )
+  {
+    _AdvOptions = theOptAndVals;
+    NotifySubMeshesHypothesisModification();
+  }
+}
 
 
 
@@ -176,6 +182,7 @@ std::ostream& GHS3DPRLPlugin_Hypothesis::SaveTo(std::ostream& save)
   save<<"KeepFiles="<<(int) _KeepFiles<<";";
   save<<"Background="<<(int) _Background<<";";
   save<<"Multithread="<<(int) _Multithread<<";";
+  save<<" " << _AdvOptions.size() << " " << _AdvOptions;
   return save;
 }
 
@@ -207,16 +214,23 @@ std::istream& GHS3DPRLPlugin_Hypothesis::LoadFrom(std::istream& load)
      str4 = str2.substr(eqpos+1);
      pos = found + 1;
 
-     if (str3=="MEDName") _MEDName = str4.c_str();
-     if (str3=="NbPart") _NbPart = atoi(str4.c_str());
-     if (str3=="KeepFiles") _KeepFiles = (bool) atoi(str4.c_str());
-     //if (str3=="ToMeshHoles") _ToMeshHoles = (bool) atoi(str4.c_str());
-     if (str3=="Gradation") _Gradation = (float) atof(str4.c_str());
-     if (str3=="MinSize") _MinSize = (float) atof(str4.c_str());
-     if (str3=="MaxSize") _MaxSize = (float) atof(str4.c_str());
-     if (str3=="Background") _Background = (bool) atoi(str4.c_str());
+     if (str3=="MEDName")     _MEDName     = str4.c_str();
+     if (str3=="NbPart")      _NbPart      = atoi(str4.c_str());
+     if (str3=="KeepFiles")   _KeepFiles   = (bool) atoi(str4.c_str());
+     if (str3=="Gradation")   _Gradation   = atof(str4.c_str());
+     if (str3=="MinSize")     _MinSize     = atof(str4.c_str());
+     if (str3=="MaxSize")     _MaxSize     = atof(str4.c_str());
+     if (str3=="Background")  _Background  = (bool) atoi(str4.c_str());
      if (str3=="Multithread") _Multithread = (bool) atoi(str4.c_str());
    }
+
+   len = 0;
+   isOK = static_cast<bool>(load >> len >> std::ws);
+   if ( isOK && len > 0 )
+   {
+     _AdvOptions.resize( len );
+     load.get( &_AdvOptions[0], len + 1);
+   }
    return load;
 }
 
@@ -250,7 +264,7 @@ std::istream& operator >>(std::istream& load, GHS3DPRLPlugin_Hypothesis& hyp)
  */
 //================================================================================
 bool GHS3DPRLPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh*   theMesh,
-                                                   const TopoDS_Shape& theShape)
+                                                    const TopoDS_Shape& theShape)
 {
   return false;
 }
index 877bf70d284a551acfab94de98ef947e676384c6..c0cacbe106b6cd7b13a8a4fbfdb6ca5f08040c7c 100755 (executable)
@@ -66,6 +66,8 @@ public:
   void                  SetMaxSize(float theVal);
   float                 GetMaxSize() const { return _MaxSize; }
 
+  void                  SetAdvancedOption(const char* theOptAndVals );
+  std::string           GetAdvancedOption() const { return _AdvOptions; }
 
   // the parameters default values
 
@@ -81,8 +83,6 @@ public:
   // Persistence
   virtual std::ostream& SaveTo(std::ostream& save);
   virtual std::istream& LoadFrom(std::istream& load);
-  friend std::ostream&  operator <<(std::ostream& save, GHS3DPRLPlugin_Hypothesis& hyp);
-  friend std::istream&  operator >>(std::istream& load, GHS3DPRLPlugin_Hypothesis& hyp);
 
   /*!
    * \brief Does nothing
@@ -98,19 +98,19 @@ public:
   virtual bool          SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
 
 private:
-  int          _countSubMesh;
-  int          _countTotal;
-  int          _nodeRefNumber;
-
-  std::string  _MEDName;     // generic path/name of med files
-  int          _NbPart;      // number of partitions
-  bool         _KeepFiles;   // keep intermediates tepal files or not
-  bool         _Background;  // mg-tetra_hpc in background
-  bool         _Multithread;  // launch mg-tetra_hpc multithread version, else mpi version
-//  bool         _ToMergeSubdomains;
-  float         _Gradation;
-  float         _MinSize;
-  float         _MaxSize;
+  int         _countSubMesh;
+  int         _countTotal;
+  int         _nodeRefNumber;
+
+  std::string _MEDName;     // generic path/name of med files
+  int         _NbPart;      // number of partitions
+  bool        _KeepFiles;   // keep intermediates tepal files or not
+  bool        _Background;  // mg-tetra_hpc in background
+  bool        _Multithread; // launch mg-tetra_hpc multithread version, else mpi version
+  float       _Gradation;
+  float       _MinSize;
+  float       _MaxSize;
+  std::string _AdvOptions;
   };
 
 #endif
index 5378d6ea001e047b9a35a1acdc32328a668f5e66..68cb74b00d10cf903e90ca173751b3ea248d3a09 100755 (executable)
@@ -228,6 +228,20 @@ CORBA::Float GHS3DPRLPlugin_Hypothesis_i::GetMaxSize()
   return this->GetImpl()->GetMaxSize();
 }
 
+void GHS3DPRLPlugin_Hypothesis_i::SetAdvancedOption(const char* theOptAndVals )
+{
+  if ( theOptAndVals && GetImpl()->GetAdvancedOption() != theOptAndVals )
+  {
+    GetImpl()->SetAdvancedOption( theOptAndVals );
+    SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << theOptAndVals << "' )";
+  }
+}
+
+char* GHS3DPRLPlugin_Hypothesis_i::GetAdvancedOption()
+{
+  return CORBA::string_dup( GetImpl()->GetAdvancedOption().c_str() );
+}
+
 //=============================================================================
 /*!
  *  GHS3DPRLPlugin_Hypothesis_i::GetImpl
index ab8d88835da9cb133c3f75a511ed2d1e7dd60702..c10e711c13a3a34427c8a3715fbfbc5f5529761b 100755 (executable)
@@ -77,6 +77,9 @@ class GHS3DPRLPLUGIN_EXPORT GHS3DPRLPlugin_Hypothesis_i:
   void SetMaxSize(CORBA::Float theVal);
   CORBA::Float GetMaxSize();
 
+  void SetAdvancedOption(const char* theOptAndVals );
+  char* GetAdvancedOption();
+
   // Get implementation
   ::GHS3DPRLPlugin_Hypothesis* GetImpl();
 
index e308e12e3431552dd45efc722113f454c71cf295..cdd0250f4369eb1c0d2ff3d07b29e7ea939dcf74 100644 (file)
@@ -49,7 +49,7 @@ SET(_link_LIBRARIES
   ${KERNEL_SALOMELocalTrace}
   ${GEOM_GEOM}
   ${SMESH_SMESH}
-  ${SMESH_GeomSelectionTools}
+  ${SMESH_PluginUtils}
   ${SMESH_StdMeshersGUI}
   ${SMESH_SMESHFiltersSelection}
   ${GUI_suit}
index a573172e3f7f82c410eed0ef0b4713df1414ba44..28d533b2bddf8fb0813eadd4f772d441af078186 100755 (executable)
@@ -26,6 +26,7 @@
 
 #include <SMESHGUI_Utils.h>
 #include <SMESHGUI_HypothesesUtils.h>
+#include <SMESH_AdvOptionsWdg.h>
 
 #include CORBA_SERVER_HEADER(GHS3DPRLPlugin_Algorithm)
 
 #include <QtxIntSpinBox.h>
 #include <QtxDoubleSpinBox.h>
 
+#include <QCheckBox>
 #include <QFrame>
+#include <QGridLayout>
 #include <QGroupBox>
 #include <QLabel>
 #include <QLineEdit>
-#include <QCheckBox>
+#include <QTabWidget>
 #include <QVBoxLayout>
-#include <QGridLayout>
 
 GHS3DPRLPluginGUI_HypothesisCreator::GHS3DPRLPluginGUI_HypothesisCreator( const QString& theHypType )
 : SMESHGUI_GenericHypothesisCreator( theHypType ),
@@ -71,7 +73,14 @@ QFrame* GHS3DPRLPluginGUI_HypothesisCreator::buildFrame()
   lay->setMargin( 5 );
   lay->setSpacing( 0 );
 
-  QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr );
+  // tab
+  QTabWidget* tab = new QTabWidget( fr );
+  tab->setTabShape( QTabWidget::Rounded );
+  tab->setTabPosition( QTabWidget::North );
+  lay->addWidget( tab );
+
+  // basic parameters
+  QWidget* GroupC1 = new QWidget();
   lay->addWidget( GroupC1 );
 
   QGridLayout* l = new QGridLayout( GroupC1 );
@@ -155,6 +164,12 @@ QFrame* GHS3DPRLPluginGUI_HypothesisCreator::buildFrame()
 
   myIs3D = true;
 
+  myAdvTable = new SMESH_AdvOptionsWdg( fr );
+
+  // add tabs
+  tab->insertTab( 0, GroupC1, tr( "SMESH_ARGUMENTS" ));
+  tab->insertTab( 1, myAdvTable, tr( "SMESH_ADVANCED" ));
+
   return fr;
 }
 
@@ -174,6 +189,7 @@ void GHS3DPRLPluginGUI_HypothesisCreator::retrieveParams() const
   myGradation->setValue( data.myGradation );
   myMinSize->setValue( data.myMinSize );
   myMaxSize->setValue( data.myMaxSize );
+  myAdvTable->SetCustomOptions( data.myAdvOptions );
 }
 
 QString GHS3DPRLPluginGUI_HypothesisCreator::storeParams() const
@@ -203,17 +219,16 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DPRLHypothesis
     GHS3DPRLPlugin::GHS3DPRLPlugin_Hypothesis::_narrow( initParamsHypothesis() );
 
   HypothesisData* data = SMESH::GetHypothesisData( hypType() );
-  h_data.myName      = isCreation() && data ? hypName() : "";
-  h_data.myMEDName   = h->GetMEDName(); //"DOMAIN\0";
-  h_data.myNbPart    = h->GetNbPart();
-  h_data.myKeepFiles = h->GetKeepFiles();
-  h_data.myBackground = h->GetBackground();
+  h_data.myName        = isCreation() && data ? hypName() : "";
+  h_data.myMEDName     = SMESH::toQStr( h->GetMEDName() ); //"DOMAIN\0";
+  h_data.myNbPart      = h->GetNbPart();
+  h_data.myKeepFiles   = h->GetKeepFiles();
+  h_data.myBackground  = h->GetBackground();
   h_data.myMultithread = h->GetMultithread();
-  //h_data.myToMeshHoles = h->GetToMeshHoles();
-  //h_data.myToMergeSubdomains = h->GetToMergeSubdomains();
-  h_data.myGradation = h->GetGradation();
-  h_data.myMinSize = h->GetMinSize();
-  h_data.myMaxSize = h->GetMaxSize();
+  h_data.myGradation   = h->GetGradation();
+  h_data.myMinSize     = h->GetMinSize();
+  h_data.myMaxSize     = h->GetMaxSize();
+  h_data.myAdvOptions  = SMESH::toQStr( h->GetAdvancedOption() );
 
   return true;
 }
@@ -229,16 +244,15 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DPRLHypot
     if ( isCreation() )
       SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() );
 
-    h->SetMEDName( h_data.myMEDName.toLatin1().constData() );
-    h->SetNbPart( h_data.myNbPart );
-    h->SetKeepFiles( h_data.myKeepFiles );
-    h->SetBackground( h_data.myBackground );
-    h->SetMultithread( h_data.myMultithread );
-    //h->SetToMeshHoles( h_data.myToMeshHoles );
-    //h->SetToMergeSubdomains( h_data.myToMergeSubdomains );
-    h->SetGradation( h_data.myGradation );
-    h->SetMinSize( h_data.myMinSize );
-    h->SetMaxSize( h_data.myMaxSize );
+    h->SetMEDName       ( h_data.myMEDName.toLatin1().constData() );
+    h->SetNbPart        ( h_data.myNbPart );
+    h->SetKeepFiles     ( h_data.myKeepFiles );
+    h->SetBackground    ( h_data.myBackground );
+    h->SetMultithread   ( h_data.myMultithread );
+    h->SetGradation     ( h_data.myGradation );
+    h->SetMinSize       ( h_data.myMinSize );
+    h->SetMaxSize       ( h_data.myMaxSize );
+    h->SetAdvancedOption( h_data.myAdvOptions.toLatin1().constData() );
   }
   catch ( const SALOME::SALOME_Exception& ex )
   {
@@ -250,16 +264,15 @@ bool GHS3DPRLPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DPRLHypot
 
 bool GHS3DPRLPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DPRLHypothesisData& h_data ) const
 {
-  h_data.myName      = myName ? myName->text() : "";
-  h_data.myMEDName   = myMEDName->text().simplified().replace(' ', '_');
-  h_data.myNbPart    = myNbPart->value();
-  h_data.myKeepFiles = myKeepFiles->isChecked();
+  h_data.myName       = myName ? myName->text() : "";
+  h_data.myMEDName    = myMEDName->text().simplified().replace(' ', '_');
+  h_data.myNbPart     = myNbPart->value();
+  h_data.myKeepFiles  = myKeepFiles->isChecked();
   h_data.myBackground = myBackground->isChecked();
-  //h_data.myToMeshHoles = myToMeshHoles->isChecked();
-  //h_data.myToMergeSubdomains = myToMergeSubdomains->isChecked();
-  h_data.myGradation = myGradation->value();
-  h_data.myMinSize = myMinSize->value();
-  h_data.myMaxSize = myMaxSize->value();
+  h_data.myGradation  = myGradation->value();
+  h_data.myMinSize    = myMinSize->value();
+  h_data.myMaxSize    = myMaxSize->value();
+  h_data.myAdvOptions = myAdvTable->GetCustomOptions();
   return true;
 }
 
index 9ecef8a692c294d34fa06b7d69855244b8d20ed2..fb9fef7211373d121f92fa5d1ab23e961c974bdf 100755 (executable)
@@ -42,6 +42,7 @@ class QtxIntSpinBox;
 class QtxDoubleSpinBox;
 class QCheckBox;
 class QLineEdit;
+class SMESH_AdvOptionsWdg;
 
 typedef struct
 {
@@ -56,6 +57,7 @@ typedef struct
   float     myGradation;
   float     myMinSize;
   float     myMaxSize;
+  QString   myAdvOptions;
  } GHS3DPRLHypothesisData;
 
 /*!
@@ -87,18 +89,17 @@ private:
   bool            storeParamsToHypo( const GHS3DPRLHypothesisData& ) const;
 
 private:
- QLineEdit*        myName;
- QLineEdit*        myMEDName;
- QtxIntSpinBox*    myNbPart;
- QCheckBox*        myKeepFiles;
- QCheckBox*        myBackground;
- QCheckBox*        myMultithread;
- //QCheckBox*       myToMeshHoles;
- //QCheckBox*       myToMergeSubdomains;
- QtxDoubleSpinBox* myGradation;
- QtxDoubleSpinBox* myMinSize;
- QtxDoubleSpinBox* myMaxSize;
- bool              myIs3D;
+  QLineEdit*           myName;
+  QLineEdit*           myMEDName;
+  QtxIntSpinBox*       myNbPart;
+  QCheckBox*           myKeepFiles;
+  QCheckBox*           myBackground;
+  QCheckBox*           myMultithread;
+  QtxDoubleSpinBox*    myGradation;
+  QtxDoubleSpinBox*    myMinSize;
+  QtxDoubleSpinBox*    myMaxSize;
+  bool                 myIs3D;
+  SMESH_AdvOptionsWdg* myAdvTable;
 };
 
 #endif // GHS3DPRLPLUGINGUI_HypothesisCreator_H