]> SALOME platform Git repositories - plugins/hybridplugin.git/blobdiff - src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis_i.cxx
Salome HOME
#17846 [CEA] SHA 90dbc5f1 and MG-Hybrid advanced parameters
[plugins/hybridplugin.git] / src / HYBRIDPlugin / HYBRIDPlugin_Hypothesis_i.cxx
index c1755cd25a621f50567a24523925a021bc8e822b..851bb461c967b9058e9fa973c4865fa3c6c1a700 100644 (file)
@@ -544,6 +544,9 @@ void HYBRIDPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const cha
     else if ( name == "boundary_layer_max_element_angle" )
       SetBoundaryLayersMaxElemAngle( GetImpl()->ToDbl( optionValue ));
 
+    else if ( name == "boundary_layer_height_relative_to_local_surface_size" )
+      SetHeightIsRelative( GetImpl()->ToBool( optionValue ));
+
     else if ( name == "gradation" )
       SetGradation( GetImpl()->ToDbl( optionValue ));
 
@@ -755,7 +758,7 @@ void HYBRIDPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
 {
   if ( !optionsAndValues ) return;
 
-  SMESH::TPythonDump dump;
+  //SMESH::TPythonDump dump;
 
   std::istringstream strm( optionsAndValues );
   std::istream_iterator<std::string> sIt( strm ), sEnd;
@@ -775,19 +778,30 @@ void HYBRIDPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
       AddOption( option.c_str(), "" );
     }
   }
-  dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
+  //dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
 }
 
 //=============================================================================
 
 void HYBRIDPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
 {
-  ASSERT(myBaseImpl);
+  if ( strncmp( "--", optionName, 2 ) == 0 )
+    optionName += 2;
+
   bool valueChanged = ( !this->GetImpl()->HasOptionDefined(optionName) ||
                         this->GetImpl()->GetOptionValue(optionName) != optionValue );
-  if (valueChanged) {
-    this->GetImpl()->SetOptionValue(optionName, optionValue);
-    SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
+  if ( valueChanged )
+  {
+    SetOptionValue(optionName, optionValue);
+
+    SMESH_Comment optVal("--");
+    optVal << optionName << " " << optionValue;
+    std::string cmd = ::HYBRIDPlugin_Hypothesis::CommandToRun( GetImpl() );
+    if ( cmd.find( optVal ) == std::string::npos )
+    {
+      this->GetImpl()->SetOptionValue(optionName, optionValue);
+      SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
+    }
   }
 }