]> SALOME platform Git repositories - plugins/hexoticplugin.git/commitdiff
Salome HOME
0023103: [CEA 1487] To add parameters to the command line
authormpa <mpa@opencascade.com>
Thu, 25 Jun 2015 14:11:32 +0000 (17:11 +0300)
committermpa <mpa@opencascade.com>
Thu, 25 Jun 2015 14:11:32 +0000 (17:11 +0300)
17 files changed:
doc/salome/examples/hexoticdemo_vl.py
doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png
doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc
idl/HexoticPlugin_Algorithm.idl
src/GUI/HexoticPLUGIN_msg_en.ts
src/GUI/HexoticPLUGIN_msg_fr.ts
src/GUI/HexoticPLUGIN_msg_ja.ts
src/GUI/HexoticPluginGUI_HypothesisCreator.cxx
src/GUI/HexoticPluginGUI_HypothesisCreator.h
src/GUI/HexoticPluginGUI_StdWidget_QTD.ui
src/HexoticPlugin/HexoticPLUGINBuilder.py
src/HexoticPlugin/HexoticPlugin_Hexotic.cxx
src/HexoticPlugin/HexoticPlugin_Hexotic.hxx
src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx
src/HexoticPlugin/HexoticPlugin_Hypothesis.hxx
src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx
src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx

index 971060d92d58623f05c95b4f4d3fb39364441c3f..678db35880e99a1d63f815fea3674f096283eb53 100644 (file)
@@ -42,7 +42,7 @@ MEFISTO_2D = Mesh_mghexa_vl.Triangle(algo=smeshBuilder.MEFISTO)
 
 MG_Hexa = Mesh_mghexa_vl.Hexahedron(algo=smeshBuilder.MG_Hexa)
 MG_Hexa_Parameters = MG_Hexa.Parameters()
-MG_Hexa.SetViscousLayers(5,5,3,MG_Hexa.Inward,[13,23])
+MG_Hexa.SetViscousLayers(5,5,3,smeshBuilder.Inward,[13,23])
 MG_Hexa_Parameters.SetMinSize( 2 )
 MG_Hexa_Parameters.SetMaxSize( 4 )
 MG_Hexa_Parameters.SetHexesMinLevel( 2 )
index def5da78da2cdff89c131719d8896f939af9b528..6f5e1263b3baffc0be090f40866ad7f635647405 100644 (file)
Binary files a/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png differ
index 60d962494b3aecb473fa542970ab986974bcea9b..a5897f3b10b86bc9bb8efffb754febaa701b4f75 100644 (file)
@@ -51,6 +51,9 @@ Parameters by default).</li>
 <li>sd 4 : meshes non-manifold geometries as such and generates subdomains accordingly.</li>
 </ul>
 </li>
+
+<li><b>Options as text</b> - allows to input in the command line any text for MG-Hexa, for example, advanced options.
+</li>
 </ul>
 
 \note If MG-CADSurf is used as 2D algo, and if a GMF file is defined as output file (using SetGMFFile(my2Dmesh.mesh)), then MG-Hexa will use this file as input.
index 8c3cd0ac439df3012eaef3978965b6c23b043a23..a725f3ea3bd3d37c4a8389933115292507b48d98 100644 (file)
@@ -91,6 +91,9 @@ module HexoticPlugin
 
     void SetHexoticMaxMemory(in long value);
     long GetHexoticMaxMemory();
+    
+    void SetTextOptions(in string option);
+    string GetTextOptions();
 
     void SetSizeMapEntry(in string entry, 
                          in double size);
index 716ca891417074db78b099dd38f8924d305049d7..2caa6625f77c5e10aea1e5da7944a605a77eb9cd 100644 (file)
         <source>Hexotic_SD_MODE_4</source>
         <translation>Non-manifold geometries</translation>
     </message>
+    <message>
+        <source>Hexotic_ADVANCED</source>
+        <translation>Advanced options</translation>
+    </message>
+    <message>
+        <source>Hexotic_TEXT_OPTIONS</source>
+        <translation>Options as text</translation>
+    </message>
     <message>
         <source>Hexotic_ADD</source>
         <translation>Add</translation>
index 1d445fe17dfa0e53d19768bea589b72cdcb84707..ec8a690619c4eb64b4faec9e71bd4e0358afbe5c 100755 (executable)
         <source>Hexotic_SD_MODE_4</source>
         <translation>Géométries &quot;non-manifold&quot;</translation>
     </message>
+    <message>
+        <source>Hexotic_ADVANCED</source>
+        <translation>Options avancées</translation>
+    </message>
+    <message>
+        <source>Hexotic_TEXT_OPTIONS</source>
+        <translation>Options comme texte</translation>
+    </message>
     <message>
         <source>Hexotic_ADD</source>
         <translation>Ajouter</translation>
index 0717ae76da07a8836afeaae6b769bfd074ad22f9..cda84f344d97c402747dac6d92217cec006ac94e 100644 (file)
       <source>Hexotic_SD_MODE_4</source>
       <translation>ジオメトリ「マニホールド」</translation>
     </message>
+    <message>
+        <source>Hexotic_ADVANCED</source>
+        <translation type="unfinished">Advanced options</translation>
+    </message>
+    <message>
+        <source>Hexotic_TEXT_OPTIONS</source>
+        <translation type="unfinished">Option as text</translation>
+    </message>
     <message>
       <source>Hexotic_ADD</source>
       <translation>追加</translation>
index 99e1e32bfe524ac6670e3497b498f5e38fc1d0c3..2d3e8f63302bb16c7aa9a9998aad659d41162a6e 100644 (file)
@@ -452,6 +452,8 @@ void HexoticPluginGUI_HypothesisCreator::retrieveParams() const
 
   myStdWidget->myHexoticSdMode->setCurrentIndex(data.myHexoticSdMode);
   
+  myStdWidget->myTextOptions->setText(data.myTextOptions);
+
   HexoticPlugin_Hypothesis::THexoticSizeMaps::const_iterator it = data.mySizeMaps.begin();
   for ( int row = 0; it != data.mySizeMaps.end(); it++, row++ )
   {
@@ -520,6 +522,7 @@ void HexoticPluginGUI_HypothesisCreator::printData( HexoticHypothesisData& data)
   valStr += tr("Hexotic_VERBOSITY") + " = " + QString::number( data.myHexoticVerbosity ) + "; ";
   valStr += tr("Hexotic_MAX_MEMORY") + " = " + QString::number( data.myHexoticMaxMemory ) + "; ";
   valStr += tr("Hexotic_SD_MODE") + " = " + QString::number( data.myHexoticSdMode ) + "; ";
+  valStr += tr("Hexotic_TEXT_OPTIONS") + " = " + data.myTextOptions + ";";
 
   std::cout << "Data: " << valStr.toStdString() << std::endl;
 }
@@ -543,6 +546,7 @@ QString HexoticPluginGUI_HypothesisCreator::storeParams() const
   valStr += tr("Hexotic_VERBOSITY") + " = " + QString::number( data.myHexoticVerbosity) + "; ";
   valStr += tr("Hexotic_MAX_MEMORY") + " = " + QString::number( data.myHexoticMaxMemory ) + "; ";
   valStr += tr("Hexotic_SD_MODE") + " = " + QString::number( data.myHexoticSdMode) + "; ";
+  valStr += tr("Hexotic_TEXT_OPTIONS") + " = " + data.myTextOptions + "; ";
 
   valStr += tr("Hexotic_NB_LAYERS") + " = " + QString::number(data.myNbLayers) + ";";
   valStr += tr("Hexotic_FIRST_LAYER_SIZE") + " = " + QString::number(data.myFirstLayerSize) + ";";
@@ -573,6 +577,7 @@ bool HexoticPluginGUI_HypothesisCreator::readParamsFromHypo( HexoticHypothesisDa
   h_data.myHexoticVerbosity = h->GetHexoticVerbosity();
   h_data.myHexoticMaxMemory = h->GetHexoticMaxMemory();
   h_data.myHexoticSdMode = h->GetHexoticSdMode()-1;
+  h_data.myTextOptions = h->GetTextOptions();
   
   // Size maps
   HexoticPlugin::HexoticPluginSizeMapsList_var sizeMaps = h->GetSizeMaps();
@@ -624,6 +629,7 @@ bool HexoticPluginGUI_HypothesisCreator::storeParamsToHypo( const HexoticHypothe
     h->SetHexoticVerbosity( h_data.myHexoticVerbosity );
     h->SetHexoticMaxMemory( h_data.myHexoticMaxMemory );
     h->SetHexoticSdMode( h_data.myHexoticSdMode+1 );
+    h->SetTextOptions( h_data.myTextOptions.toLatin1().constData() );
     
     HexoticPlugin_Hypothesis::THexoticSizeMaps::const_iterator it;
     
@@ -679,6 +685,7 @@ bool HexoticPluginGUI_HypothesisCreator::readParamsFromWidgets( HexoticHypothesi
   h_data.myHexoticVerbosity = myStdWidget->myHexoticVerbosity->value();
   h_data.myHexoticMaxMemory = myStdWidget->myHexoticMaxMemory->value();
   h_data.myHexoticSdMode = myStdWidget->myHexoticSdMode->currentIndex();
+  h_data.myTextOptions = myStdWidget->myTextOptions->text();
 
   h_data.myMinSize = myStdWidget->myMinSize->text().isEmpty() ? 0.0 : myStdWidget->myMinSize->value();
   h_data.myMaxSize = myStdWidget->myMaxSize->text().isEmpty() ? 0.0 : myStdWidget->myMaxSize->value();
index 01b38104b09bc8e4f43777878d1ebc563ecc14fc..1b07ea6562e2c8cdad2b16ae103cb9b998b58d89 100644 (file)
@@ -55,6 +55,7 @@ typedef struct
   int      myHexoticVerbosity;
   int      myHexoticMaxMemory;
   int      myHexoticSdMode;
+  QString  myTextOptions;
   HexoticPlugin_Hypothesis::THexoticSizeMaps mySizeMaps;
   int      myNbLayers;
   double   myFirstLayerSize;
index 9cfa5b977bb4b6c5e7783b390cf0a7db34333832..e6c40b99a5a0fd51df713274432e37e787a9d49d 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>561</width>
-    <height>581</height>
+    <height>908</height>
    </rect>
   </property>
   <layout class="QGridLayout" name="gridLayout">
      </layout>
     </widget>
    </item>
+   <item row="9" column="0" colspan="4">
+    <widget class="QGroupBox" name="groupBoxAdvanced">
+     <property name="title">
+      <string>Hexotic_ADVANCED</string>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <property name="margin">
+       <number>6</number>
+      </property>
+      <item>
+       <widget class="QLabel" name="label_10">
+        <property name="text">
+         <string>Hexotic_TEXT_OPTIONS</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLineEdit" name="myTextOptions"/>
+      </item>
+     </layout>
+    </widget>
+   </item>
    <item row="1" column="2" colspan="2">
     <widget class="QCheckBox" name="myHexoticInvalidElements">
      <property name="text">
index bd59371a7d378723ea82c7ddd38b2ee57d87fa5b..7edd7d55bc400fd7e72d236f52a579b01ff76289 100644 (file)
@@ -41,6 +41,10 @@ except ImportError:
 MG_Hexa = "MG-Hexa"
 Hexotic = MG_Hexa
 
+## Direction of viscous layers for MG_Hexa algorithm
+Inward = True
+Outward = False
+
 #----------------------------
 # Algorithms
 #----------------------------
@@ -60,11 +64,6 @@ class Hexotic_Algorithm(Mesh_Algorithm):
     #  @internal
     docHelper  = "Creates hexahedron 3D algorithm for volumes"
 
-    ## Direction of viscous layers
-    #  @internal
-    Inward = True
-    Outward = False
-
     ## Private constructor.
     #  @param mesh parent mesh object algorithm is assigned to
     #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
index a2047d15f1fff3fd1a234e767785b9885d24aa15..568fae09d0ac3f2fbea9caf789552490e238bad1 100644 (file)
@@ -855,6 +855,7 @@ void HexoticPlugin_Hexotic::SetParameters(const HexoticPlugin_Hypothesis* hyp) {
     _hexoticVerbosity = hyp->GetHexoticVerbosity();
     _hexoticMaxMemory = hyp->GetHexoticMaxMemory();
     _hexoticSdMode = hyp->GetHexoticSdMode();
+    _textOptions = hyp->GetTextOptions();
     _sizeMaps = hyp->GetSizeMaps();
     _nbLayers = hyp->GetNbLayers();
     _firstLayerSize = hyp->GetFirstLayerSize();
@@ -879,6 +880,7 @@ void HexoticPlugin_Hexotic::SetParameters(const HexoticPlugin_Hypothesis* hyp) {
     _hexoticVerbosity = hyp->GetDefaultHexoticVerbosity();
     _hexoticMaxMemory = hyp->GetDefaultHexoticMaxMemory();
     _hexoticSdMode = hyp->GetDefaultHexoticSdMode();
+    _textOptions = hyp->GetDefaultTextOptions();
     _sizeMaps = hyp->GetDefaultHexoticSizeMaps();
     _nbLayers = hyp->GetDefaultNbLayers();
     _firstLayerSize = hyp->GetDefaultFirstLayerSize();
@@ -976,6 +978,7 @@ std::string HexoticPlugin_Hexotic::getHexoticCommand(const TCollection_AsciiStri
   cout << "    " << _name << " Number of threads = " << _hexoticNbProc << std::endl;
   cout << "    " << _name << " Working directory = \"" << _hexoticWorkingDirectory << "\"" << std::endl;
   cout << "    " << _name << " Sub. Dom mode = " << _hexoticSdMode << std::endl;
+  cout << "    " << _name << " Text options = \"" << _textOptions << "\"" << std::endl;
   cout << "    " << _name << " Number of layers = " << _nbLayers << std::endl;
   cout << "    " << _name << " Size of the first layer  = " << _firstLayerSize << std::endl;
   cout << "    " << _name << " Direction of the layers = " << ( _direction ? "Inward" : "Outward" ) << std::endl;
@@ -1023,7 +1026,7 @@ std::string HexoticPlugin_Hexotic::getHexoticCommand(const TCollection_AsciiStri
   TCollection_AsciiString comImptintedFaces = " --imprinted_surface_ids ";
 
   TCollection_AsciiString minLevel, maxLevel, minSize, maxSize, sharpAngle, mode, nbproc, verbosity, maxMemory,
-                          nbLayers, firstLayerSize, direction, growth, facesWithLayers, imprintedFaces;
+                          textOptions, nbLayers, firstLayerSize, direction, growth, facesWithLayers, imprintedFaces;
   minLevel = _hexesMinLevel;
   maxLevel = _hexesMaxLevel;
   minSize = _hexesMinSize;
@@ -1048,6 +1051,7 @@ std::string HexoticPlugin_Hexotic::getHexoticCommand(const TCollection_AsciiStri
   nbproc = _hexoticNbProc;
   verbosity = _hexoticVerbosity;
   maxMemory = _hexoticMaxMemory;
+  textOptions = (" " + _textOptions + " ").c_str();
   nbLayers = _nbLayers;
   firstLayerSize = _firstLayerSize;
   direction = _direction ? "1" : "-1";
@@ -1114,6 +1118,9 @@ std::string HexoticPlugin_Hexotic::getHexoticCommand(const TCollection_AsciiStri
   run_Hexotic += verb + verbosity;
   run_Hexotic += maxmem + maxMemory;
 
+  if (!_textOptions.empty())
+    run_Hexotic += textOptions;
+
   return run_Hexotic.ToCString();
 }
 
index da6a84096adb7bd5a246a01f5dc10addf9cd0019..a378b53d611c02afe2f4e432a51f5257caf54eb6 100644 (file)
@@ -135,6 +135,7 @@ private:
   int _hexoticVerbosity;
   int _hexoticMaxMemory;
   int _hexoticSdMode;
+  std::string _textOptions;
   HexoticPlugin_Hypothesis::THexoticSizeMaps _sizeMaps;
   int    _nbLayers;
   double _firstLayerSize;
index b2432b412a1891bd1c96da5722599184c97d60c4..8444384859ac4a6ab17e361620113bf0ca2362dc 100644 (file)
@@ -47,6 +47,7 @@ HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis (int hypId, int studyId,
     _hexoticSdMode(GetDefaultHexoticSdMode()),
     _hexoticVerbosity(GetDefaultHexoticVerbosity()),
     _hexoticMaxMemory(GetDefaultHexoticMaxMemory()),
+    _textOptions(GetDefaultTextOptions()),
     _sizeMaps(GetDefaultHexoticSizeMaps()),
     _nbLayers(GetDefaultNbLayers()),
     _firstLayerSize(GetDefaultFirstLayerSize()),
@@ -161,6 +162,14 @@ void HexoticPlugin_Hypothesis::SetHexoticMaxMemory(int theVal) {
   }
 }
 
+void HexoticPlugin_Hypothesis::SetTextOptions(const std::string& theOptions)
+{
+  if (_textOptions != theOptions ) {
+    _textOptions = theOptions;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
 bool HexoticPlugin_Hypothesis::AddSizeMap(std::string theEntry, double theSize) {
   THexoticSizeMaps::iterator it;
   it=_sizeMaps.find(theEntry);
@@ -269,6 +278,8 @@ std::ostream& HexoticPlugin_Hypothesis::SaveTo(std::ostream& save)
   save<<"hexoticSdMode="<<_hexoticSdMode<<";";
   save<<"hexoticVerbosity="<<_hexoticVerbosity<<";";
   save<<"hexoticMaxMemory="<<_hexoticMaxMemory<<";";
+  replace(_textOptions.begin(), _textOptions.end(), ' ', '*');
+  save<<"textOptions="<<_textOptions<<";";
   THexoticSizeMaps::iterator it = _sizeMaps.begin();
   if ( it != _sizeMaps.end() )
   {
@@ -345,6 +356,11 @@ std::istream& HexoticPlugin_Hypothesis::LoadFrom(std::istream& load)
       if (str3=="hexoticSdMode") _hexoticSdMode = atoi(str4.c_str());
       if (str3=="hexoticVerbosity") _hexoticVerbosity = atoi(str4.c_str());
       if (str3=="hexoticMaxMemory") _hexoticMaxMemory = atoi(str4.c_str());
+      if (str3=="textOptions")
+      {
+        replace(str4.begin(), str4.end(), '*', ' ');
+        _textOptions = str4;
+      }
       if (str3=="sizeMaps")
       {
         std::string sm_substr, sm_substr1, sm_substr2;
@@ -526,6 +542,11 @@ int HexoticPlugin_Hypothesis::GetDefaultHexoticMaxMemory()
   return 2048;
 }
 
+std::string HexoticPlugin_Hypothesis::GetDefaultTextOptions()
+{
+  return "";
+}
+
 HexoticPlugin_Hypothesis::THexoticSizeMaps HexoticPlugin_Hypothesis::GetDefaultHexoticSizeMaps()
 {
   return THexoticSizeMaps();
index 788b8d7bf337f64a267ba5db1ce05fa699eb75ac..a9009b8ace4cfca97b4bd8ec4662a3da73f1ded4 100644 (file)
@@ -91,6 +91,9 @@ public:
   void SetHexoticMaxMemory(int theVal);
   int GetHexoticMaxMemory() const { return _hexoticMaxMemory; }
   
+  void SetTextOptions(const std::string& theOptions);
+  std::string GetTextOptions() const { return _textOptions; }
+
   // Size Maps
   typedef std::map<std::string,double> THexoticSizeMaps;
   
@@ -132,6 +135,7 @@ public:
   static int GetDefaultHexoticSdMode();
   static int GetDefaultHexoticVerbosity();
   static int GetDefaultHexoticMaxMemory();
+  static std::string GetDefaultTextOptions();
   static THexoticSizeMaps GetDefaultHexoticSizeMaps();
   static int GetDefaultNbLayers();
   static double GetDefaultFirstLayerSize();
@@ -172,8 +176,9 @@ private:
   int    _hexoticSdMode;
   int    _hexoticVerbosity;
   int    _hexoticMaxMemory;
+  std::string _textOptions;
   THexoticSizeMaps _sizeMaps;
-  std::string _hexoticWorkingDirectory ;
+  std::string _hexoticWorkingDirectory;
   int    _nbLayers;
   double _firstLayerSize;
   bool   _direction;
index 3a325707c2c07e799271f80501481da1f7e71369..a02028dc95032405218a234580a22ecfa56de0b0 100644 (file)
@@ -76,6 +76,7 @@ HexoticPlugin_Hypothesis_i::~HexoticPlugin_Hypothesis_i()
  *  HexoticPlugin_Hypothesis_i::SetHexoticSdMode
  *  HexoticPlugin_Hypothesis_i::SetVerbosity
  *  HexoticPlugin_Hypothesis_i::SetHexoticMaxMemory
+ *  HexoticPlugin_Hypothesis_i::SetTextOptions
  *  HexoticPlugin_Hypothesis_i::SetNbLayers
  *  HexoticPlugin_Hypothesis_i::SetFirstLayerSize
  *  HexoticPlugin_Hypothesis_i::SetDirection
@@ -221,6 +222,16 @@ void HexoticPlugin_Hypothesis_i::SetHexoticMaxMemory (CORBA::Long theValue)
     SMESH::TPythonDump() << _this() << ".SetHexoticMaxMemory( " << theValue << " )";
 }
 
+void HexoticPlugin_Hypothesis_i::SetTextOptions(const char* theOptions)
+{
+  // MESSAGE("HexoticPlugin_Hypothesis_i::SetTextOptions");
+  ASSERT(myBaseImpl);
+  string oldValue(GetTextOptions());
+  this->GetImpl()->SetTextOptions(theOptions);
+  if (theOptions != oldValue)
+    SMESH::TPythonDump() << _this() << ".SetTextOptions( '" << theOptions << "' )";
+}
+
 HexoticPlugin::HexoticPluginSizeMapsList* HexoticPlugin_Hypothesis_i::GetSizeMaps ()
 {
   // Get the std::map < string entry, double size >
@@ -350,6 +361,7 @@ void HexoticPlugin_Hypothesis_i::SetImprintedFaces(const ::SMESH::long_array& th
  *  HexoticPlugin_Hypothesis_i::GetHexoticSdMode
  *  HexoticPlugin_Hypothesis_i::GetVerbosity
  *  HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory
+ *  HexoticPlugin_Hypothesis_i::GetTextOptions
  *  HexoticPlugin_Hypothesis_i::GetNbLayers
  *  HexoticPlugin_Hypothesis_i::GetFirstLayerSize
  *  HexoticPlugin_Hypothesis_i::GetDirection
@@ -442,6 +454,13 @@ CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory()
   return this->GetImpl()->GetHexoticMaxMemory();
 }
 
+char* HexoticPlugin_Hypothesis_i::GetTextOptions()
+{
+  // MESSAGE("HexoticPlugin_Hypothesis_i::GetTextOptions");
+  ASSERT(myBaseImpl);
+  return CORBA::string_dup( this->GetImpl()->GetTextOptions().c_str() );
+}
+
 CORBA::Long HexoticPlugin_Hypothesis_i::GetNbLayers()
 {
   // MESSAGE("HexoticPlugin_Hypothesis_i::GetNbLayers");
index 154d7775e38dcdcf54b78f5d1d428034accdf11c..8f4939dde1d91352b394d750b05d0faae9197181 100644 (file)
@@ -84,6 +84,9 @@ class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hypothesis_i:
   void SetHexoticMaxMemory(CORBA::Long theVal);
   CORBA::Long GetHexoticMaxMemory();
   
+  void SetTextOptions(const char* theOptions);
+  char* GetTextOptions();
+
   void SetSizeMapEntry(const char* theEntry, CORBA::Double theSize);
   void UnsetSizeMapEntry(const char* theEntry);