if ( isToSetParameter( GetMaxSize(), theValue, METH_SetMaxSize ))
{
this->GetImpl()->SetMaxSize(theValue);
- SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theValue << " )";
+ SMESH::TPythonDump() << _this() << ".SetMaxSize( " << SMESH::TVar(theValue) << " )";
}
}
if ( isToSetParameter( GetMinSize(), theValue, METH_SetMinSize ))
{
this->GetImpl()->SetMinSize(theValue);
- SMESH::TPythonDump() << _this() << ".SetMinSize( " << theValue << " )";
+ SMESH::TPythonDump() << _this() << ".SetMinSize( " << SMESH::TVar(theValue) << " )";
}
}
if ( isToSetParameter( GetGrowthRate(), theValue, METH_SetGrowthRate ))
{
this->GetImpl()->SetGrowthRate(theValue);
- SMESH::TPythonDump() << _this() << ".SetGrowthRate( " << theValue << " )";
+ SMESH::TPythonDump() << _this() << ".SetGrowthRate( " << SMESH::TVar(theValue) << " )";
}
}
if ( isToSetParameter( GetNbSegPerEdge(), theValue, METH_SetNbSegPerEdge ))
{
this->GetImpl()->SetNbSegPerEdge(theValue);
- SMESH::TPythonDump() << _this() << ".SetNbSegPerEdge( " << theValue << " )";
+ SMESH::TPythonDump() << _this() << ".SetNbSegPerEdge( " << SMESH::TVar(theValue) << " )";
}
}
if ( isToSetParameter( GetNbSegPerRadius(), theValue, METH_SetNbSegPerRadius ))
{
this->GetImpl()->SetNbSegPerRadius(theValue);
- SMESH::TPythonDump() << _this() << ".SetNbSegPerRadius( " << theValue << " )";
+ SMESH::TPythonDump() << _this() << ".SetNbSegPerRadius( " << SMESH::TVar(theValue) << " )";
}
}
{
return type == SMESH::DIM_3D;
}
+
+//================================================================================
+/*!
+ * \brief method intended to remove explicit treatment of Netgen hypotheses from SMESH_NoteBook
+ */
+//================================================================================
+
+int NETGENPlugin_Hypothesis_i::getParamIndex(const TCollection_AsciiString& method,
+ int nbVars) const
+{
+ if ( method == "SetMaxSize" ) return 0;
+ if ( method == "SetGrowthRate" ) return 1;
+ if ( method == "SetNbSegPerEdge" ) return 2;
+ if ( method == "SetNbSegPerRadius" ) return 3;
+ if ( method == "SetMinSize" ) return nbVars-1;
+
+ return SMESH_Hypothesis_i::getParamIndex( method, nbVars ); // return default value
+}
+
+//================================================================================
+/*!
+ * \brief Method used to convert variable parameters stored in an old study
+ * into myMethod2VarParams. It should return a method name for an index of
+ * variable parameters. Index is countered from zero
+ */
+//================================================================================
+
+std::string NETGENPlugin_Hypothesis_i::getMethodOfParameter(const int paramIndex,
+ int nbVars) const
+{
+ switch ( paramIndex ) {
+ case 0: return "SetMaxSize";
+ case 1: return nbVars == 2 ? "SetMinSize" : "SetGrowthRate";
+ case 2: return "SetNbSegPerEdge";
+ case 3: return "SetNbSegPerRadius";
+ case 4: return "SetMinSize";
+ }
+ return "";
+}
else
return ( mySetMethodFlags |= meth ); // == return true
}
+
+ public:
+ // method intended to remove explicit treatment of Netgen hypotheses from
+ // SMESH_NoteBook to assure backward compatibility after implemeneting
+ // issue 0021308: Remove hard-coded dependency of the external mesh plugins
+ virtual int getParamIndex(const TCollection_AsciiString& method, int nbVars) const;
+
+ // method used to convert variable parameters stored in an old study
+ // into myMethod2VarParams. It should return a method name for an index of
+ // variable parameters. Index is countered from zero
+ virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
};
#endif
#include <Utils_CorbaException.hxx>
#include <utilities.h>
+#include <TCollection_AsciiString.hxx>
+
using namespace std;
//=============================================================================
catch (SALOME_Exception& S_ex) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
}
- SMESH::TPythonDump() << _this() << ".SetNumberOfSegments( " << nb << " )";
+ SMESH::TPythonDump() << _this() << ".SetNumberOfSegments( " << SMESH::TVar(nb) << " )";
}
//=============================================================================
catch (SALOME_Exception& S_ex) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
}
- SMESH::TPythonDump() << _this() << ".SetLocalLength( " << segmentLength << " )";
+ SMESH::TPythonDump() << _this() << ".SetLocalLength( " << SMESH::TVar(segmentLength) << " )";
}
//================================================================================
MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::SetMaxElementArea");
ASSERT(myBaseImpl);
this->GetImpl()->SetMaxElementArea(area);
- SMESH::TPythonDump() << _this() << ".SetMaxElementArea( " << area << " )";
+ SMESH::TPythonDump() << _this() << ".SetMaxElementArea( " << SMESH::TVar(area) << " )";
}
* NETGENPlugin_SimpleHypothesis_2D_i::GetImpl
*/
//=============================================================================
-::NETGENPlugin_SimpleHypothesis_2D* NETGENPlugin_SimpleHypothesis_2D_i::GetImpl()
+::NETGENPlugin_SimpleHypothesis_2D* NETGENPlugin_SimpleHypothesis_2D_i::GetImpl() const
{
MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::GetImpl");
return (::NETGENPlugin_SimpleHypothesis_2D*)myBaseImpl;
{
return type == SMESH::DIM_2D;
}
+
+//================================================================================
+/*!
+ * \brief method intended to remove explicit treatment of Netgen hypotheses from SMESH_NoteBook
+ */
+//================================================================================
+
+int NETGENPlugin_SimpleHypothesis_2D_i::getParamIndex(const TCollection_AsciiString& method,
+ int nbVars) const
+{
+ if ( method == "SetLocalLength" ) return 0;
+ if ( method == "SetNumberOfSegments" ) return 0;
+ if ( method == "SetMaxElementArea" ) return 1;
+ if ( method == "LengthFromEdges" ) return 10; // just to go to the next state
+ if ( method == "SetMaxElementVolume" ) return 2;
+ if ( method == "LengthFromFaces" ) return 10; // just to go to the next state
+
+ return SMESH_Hypothesis_i::getParamIndex( method, nbVars ); // return default value
+}
+
+//================================================================================
+/*!
+ * \brief Method used to convert variable parameters stored in an old study
+ * into myMethod2VarParams. It should return a method name for an index of
+ * variable parameters. Index is countered from zero
+ */
+//================================================================================
+
+std::string NETGENPlugin_SimpleHypothesis_2D_i::getMethodOfParameter(const int paramIndex,
+ int nbVars) const
+{
+ switch ( paramIndex ) {
+ case 0: return GetImpl()->GetNumberOfSegments() ? "SetNumberOfSegments" : "SetLocalLength";
+ case 1: return "SetMaxElementArea";
+ case 2: return "SetMaxElementVolume";
+ }
+ return "";
+}
CORBA::Boolean GetAllowQuadrangles();
// Get implementation
- ::NETGENPlugin_SimpleHypothesis_2D* GetImpl();
+ ::NETGENPlugin_SimpleHypothesis_2D* GetImpl() const;
// Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
+
+ public:
+ // method intended to remove explicit treatment of Netgen hypotheses from
+ // SMESH_NoteBook to assure backward compatibility after implemeneting
+ // issue 0021308: Remove hard-coded dependency of the external mesh plugins
+ virtual int getParamIndex(const TCollection_AsciiString& method, int nbVars) const;
+
+ // method used to convert variable parameters stored in an old study
+ // into myMethod2VarParams. It should return a method name for an index of
+ // variable parameters. Index is countered from zero
+ virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
};
#endif
MESSAGE("NETGENPlugin_SimpleHypothesis_3D_i::SetMaxElementVolume");
ASSERT(myBaseImpl);
this->GetImpl()->SetMaxElementVolume(value);
- SMESH::TPythonDump() << _this() << ".SetMaxElementVolume( " << value << " )";
+ SMESH::TPythonDump() << _this() << ".SetMaxElementVolume( " << SMESH::TVar(value) << " )";
}