// run hybrid mesher
// -----------------
- std::string cmd = HYBRIDPlugin_Hypothesis::CommandToRun( _hyp, theMesh );
+ std::string cmd = HYBRIDPlugin_Hypothesis::CommandToRun( _hyp );
if ( mgHybrid.IsExecutable() )
{
// run hybrid mesher
// -----------------
- std::string cmd = HYBRIDPlugin_Hypothesis::CommandToRun( _hyp, theMesh );
+ std::string cmd = HYBRIDPlugin_Hypothesis::CommandToRun( _hyp );
if ( mgHybrid.IsExecutable() )
{
*/
//================================================================================
-std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* hyp,
- SMESH_Mesh& mesh)
+std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* hyp)
{
SMESH_Comment cmd = GetExeName();
// check if any option is overridden by hyp->_option2value
bool p_h = ( hyp && hyp->HasOptionDefined("-h"));
bool p_v = ( hyp && hyp->HasOptionDefined("-v"));
- bool p_blsd = ( hyp && hyp->HasOptionDefined("--normal_direction "));
- bool p_hotfl = ( hyp && hyp->HasOptionDefined("--boundary_layer_global_initial_height "));
- bool p_nobl = ( hyp && hyp->HasOptionDefined("--number_of_boundary_layers "));
- bool p_blgp = ( hyp && hyp->HasOptionDefined("--boundary_layer_geometric_progression "));
- bool p_eg = ( hyp && hyp->HasOptionDefined("--element_generation "));
- bool p_cs = ( hyp && hyp->HasOptionDefined("--global_physical_size "));
+ bool p_blsd = ( hyp && hyp->HasOptionDefined("--normal_direction"));
+ bool p_hotfl = ( hyp && hyp->HasOptionDefined("--boundary_layer_global_initial_height"));
+ bool p_nobl = ( hyp && hyp->HasOptionDefined("--number_of_boundary_layers"));
+ bool p_blgp = ( hyp && hyp->HasOptionDefined("--boundary_layer_geometric_progression"));
+ bool p_eg = ( hyp && hyp->HasOptionDefined("--element_generation"));
+ bool p_cs = ( hyp && hyp->HasOptionDefined("--global_physical_size"));
bool nolayers = false;
bool layersOnAllWrap = hyp ? hyp->myLayersOnAllWrap : DefaultLayersOnAllWrap();
if (op_val == _option2value.end())
{
op_val = _customOption2value.find( optionName );
- if ( op_val != _customOption2value.end() && op_val->second != optionValue )
+ if ( op_val == _customOption2value.end() || op_val->second != optionValue )
NotifySubMeshesHypothesisModification();
_customOption2value[ optionName ] = optionValue;
return;
/*!
* \brief Return command to run hybrid mesher excluding file prefix (-f)
*/
- static std::string CommandToRun(const HYBRIDPlugin_Hypothesis* hyp, SMESH_Mesh& mesh);
+ static std::string CommandToRun(const HYBRIDPlugin_Hypothesis* hyp);
/*!
* \brief Return a unique file name
*/
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 ));
{
if ( !optionsAndValues ) return;
- SMESH::TPythonDump dump;
+ //SMESH::TPythonDump dump;
std::istringstream strm( optionsAndValues );
std::istream_iterator<std::string> sIt( strm ), sEnd;
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 << "' )";
+ }
}
}