From: mpa Date: Thu, 25 Jun 2015 14:11:32 +0000 (+0300) Subject: 0023103: [CEA 1487] To add parameters to the command line X-Git-Tag: V7_7_0a1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9505068ceaa446f76e771824a29c6160e0f34578;p=plugins%2Fhexoticplugin.git 0023103: [CEA 1487] To add parameters to the command line --- diff --git a/doc/salome/examples/hexoticdemo_vl.py b/doc/salome/examples/hexoticdemo_vl.py index 971060d..678db35 100644 --- a/doc/salome/examples/hexoticdemo_vl.py +++ b/doc/salome/examples/hexoticdemo_vl.py @@ -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 ) diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png index def5da7..6f5e126 100644 Binary files a/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc b/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc index 60d9624..a5897f3 100644 --- a/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc +++ b/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc @@ -51,6 +51,9 @@ Parameters by default).
  • sd 4 : meshes non-manifold geometries as such and generates subdomains accordingly.
  • + +
  • Options as text - allows to input in the command line any text for MG-Hexa, for example, advanced options. +
  • \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. diff --git a/idl/HexoticPlugin_Algorithm.idl b/idl/HexoticPlugin_Algorithm.idl index 8c3cd0a..a725f3e 100644 --- a/idl/HexoticPlugin_Algorithm.idl +++ b/idl/HexoticPlugin_Algorithm.idl @@ -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); diff --git a/src/GUI/HexoticPLUGIN_msg_en.ts b/src/GUI/HexoticPLUGIN_msg_en.ts index 716ca89..2caa662 100644 --- a/src/GUI/HexoticPLUGIN_msg_en.ts +++ b/src/GUI/HexoticPLUGIN_msg_en.ts @@ -91,6 +91,14 @@ Hexotic_SD_MODE_4 Non-manifold geometries + + Hexotic_ADVANCED + Advanced options + + + Hexotic_TEXT_OPTIONS + Options as text + Hexotic_ADD Add diff --git a/src/GUI/HexoticPLUGIN_msg_fr.ts b/src/GUI/HexoticPLUGIN_msg_fr.ts index 1d445fe..ec8a690 100755 --- a/src/GUI/HexoticPLUGIN_msg_fr.ts +++ b/src/GUI/HexoticPLUGIN_msg_fr.ts @@ -95,6 +95,14 @@ Hexotic_SD_MODE_4 Géométries "non-manifold" + + Hexotic_ADVANCED + Options avancées + + + Hexotic_TEXT_OPTIONS + Options comme texte + Hexotic_ADD Ajouter diff --git a/src/GUI/HexoticPLUGIN_msg_ja.ts b/src/GUI/HexoticPLUGIN_msg_ja.ts index 0717ae7..cda84f3 100644 --- a/src/GUI/HexoticPLUGIN_msg_ja.ts +++ b/src/GUI/HexoticPLUGIN_msg_ja.ts @@ -91,6 +91,14 @@ Hexotic_SD_MODE_4 ジオメトリ「マニホールド」 + + Hexotic_ADVANCED + Advanced options + + + Hexotic_TEXT_OPTIONS + Option as text + Hexotic_ADD 追加 diff --git a/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx b/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx index 99e1e32..2d3e8f6 100644 --- a/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx @@ -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(); diff --git a/src/GUI/HexoticPluginGUI_HypothesisCreator.h b/src/GUI/HexoticPluginGUI_HypothesisCreator.h index 01b3810..1b07ea6 100644 --- a/src/GUI/HexoticPluginGUI_HypothesisCreator.h +++ b/src/GUI/HexoticPluginGUI_HypothesisCreator.h @@ -55,6 +55,7 @@ typedef struct int myHexoticVerbosity; int myHexoticMaxMemory; int myHexoticSdMode; + QString myTextOptions; HexoticPlugin_Hypothesis::THexoticSizeMaps mySizeMaps; int myNbLayers; double myFirstLayerSize; diff --git a/src/GUI/HexoticPluginGUI_StdWidget_QTD.ui b/src/GUI/HexoticPluginGUI_StdWidget_QTD.ui index 9cfa5b9..e6c40b9 100644 --- a/src/GUI/HexoticPluginGUI_StdWidget_QTD.ui +++ b/src/GUI/HexoticPluginGUI_StdWidget_QTD.ui @@ -7,7 +7,7 @@ 0 0 561 - 581 + 908 @@ -200,6 +200,28 @@ + + + + Hexotic_ADVANCED + + + + 6 + + + + + Hexotic_TEXT_OPTIONS + + + + + + + + + diff --git a/src/HexoticPlugin/HexoticPLUGINBuilder.py b/src/HexoticPlugin/HexoticPLUGINBuilder.py index bd59371..7edd7d5 100644 --- a/src/HexoticPlugin/HexoticPLUGINBuilder.py +++ b/src/HexoticPlugin/HexoticPLUGINBuilder.py @@ -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; diff --git a/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx b/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx index a2047d1..568fae0 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx @@ -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(); } diff --git a/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx b/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx index da6a840..a378b53 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx +++ b/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx @@ -135,6 +135,7 @@ private: int _hexoticVerbosity; int _hexoticMaxMemory; int _hexoticSdMode; + std::string _textOptions; HexoticPlugin_Hypothesis::THexoticSizeMaps _sizeMaps; int _nbLayers; double _firstLayerSize; diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx index b2432b4..8444384 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx @@ -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(); diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis.hxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis.hxx index 788b8d7..a9009b8 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis.hxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis.hxx @@ -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 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; diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx index 3a32570..a02028d 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx @@ -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"); diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx index 154d777..8f4939d 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx @@ -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);