From 102c101f1ca964d4bf26215a6c573c8ba311dd29 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 7 Mar 2012 15:07:13 +0000 Subject: [PATCH] 0021308: Remove hard-coded dependency of the external mesh plugins from the SMESH module Use TVar structure to dump arguments that can be defined via notebook variables --- .../StdMeshers_Arithmetic1D_i.cxx | 15 ++++++++++-- .../StdMeshers_Arithmetic1D_i.hxx | 3 +++ .../StdMeshers_CartesianParameters3D_i.cxx | 2 +- .../StdMeshers_Deflection1D_i.cxx | 13 +++++++++- .../StdMeshers_Deflection1D_i.hxx | 5 ++-- .../StdMeshers_LayerDistribution2D_i.cxx | 3 --- .../StdMeshers_LayerDistribution2D_i.hxx | 1 - .../StdMeshers_LayerDistribution_i.cxx | 21 ++++++++++++---- .../StdMeshers_LayerDistribution_i.hxx | 6 +++-- src/StdMeshers_I/StdMeshers_LocalLength_i.cxx | 11 ++++++--- src/StdMeshers_I/StdMeshers_LocalLength_i.hxx | 4 +++- .../StdMeshers_MaxElementArea_i.cxx | 14 +++++++++-- .../StdMeshers_MaxElementArea_i.hxx | 4 +++- .../StdMeshers_MaxElementVolume_i.cxx | 13 ++++++++-- .../StdMeshers_MaxElementVolume_i.hxx | 4 +++- src/StdMeshers_I/StdMeshers_MaxLength_i.cxx | 13 +++++++++- src/StdMeshers_I/StdMeshers_MaxLength_i.hxx | 3 +++ .../StdMeshers_NumberOfLayers2D_i.cxx | 4 ---- .../StdMeshers_NumberOfLayers2D_i.hxx | 2 -- .../StdMeshers_NumberOfLayers_i.cxx | 13 ++++++++-- .../StdMeshers_NumberOfLayers_i.hxx | 5 ++-- .../StdMeshers_NumberOfSegments_i.cxx | 15 +++++++++--- .../StdMeshers_NumberOfSegments_i.hxx | 4 +++- ...StdMeshers_SegmentLengthAroundVertex_i.cxx | 13 ++++++++-- ...StdMeshers_SegmentLengthAroundVertex_i.hxx | 4 +++- .../StdMeshers_StartEndLength_i.cxx | 15 ++++++++++-- .../StdMeshers_StartEndLength_i.hxx | 4 +++- .../StdMeshers_ViscousLayers_i.cxx | 24 +++++++++++++++---- .../StdMeshers_ViscousLayers_i.hxx | 11 ++------- 29 files changed, 189 insertions(+), 60 deletions(-) diff --git a/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.cxx b/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.cxx index 290e62f74..2485217e6 100644 --- a/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.cxx @@ -24,7 +24,6 @@ // File : StdMeshers_Arithmetic1D_i.cxx // Author : Damien COQUERET, OCC // Module : SMESH -// $Header$ // #include "StdMeshers_Arithmetic1D_i.hxx" #include "SMESH_Gen_i.hxx" @@ -95,7 +94,8 @@ void StdMeshers_Arithmetic1D_i::SetLength(CORBA::Double theLength, // Update Python script SMESH::TPythonDump() - << _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " ) << theLength << " )"; + << _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " ) + << SMESH::TVar(theLength) << " )"; } //============================================================================= @@ -259,3 +259,14 @@ CORBA::Boolean StdMeshers_Arithmetic1D_i::IsDimSupported( SMESH::Dimension type return type == SMESH::DIM_1D; } +//================================================================================ +/*! + * \brief Return method name corresponding to index of variable parameter + */ +//================================================================================ + +std::string StdMeshers_Arithmetic1D_i::getMethodOfParameter(const int paramIndex, + int nbVars) const +{ + return paramIndex == 0 ? "SetStartLength" : "SetEndLength"; +} diff --git a/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.hxx b/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.hxx index c789ffd7a..45928d79c 100644 --- a/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.hxx @@ -82,6 +82,9 @@ public: // Verify whether hypothesis supports given entity type CORBA::Boolean IsDimSupported( SMESH::Dimension type ); + + protected: + virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; }; #endif diff --git a/src/StdMeshers_I/StdMeshers_CartesianParameters3D_i.cxx b/src/StdMeshers_I/StdMeshers_CartesianParameters3D_i.cxx index 06ebe87d4..fbba9a17f 100644 --- a/src/StdMeshers_I/StdMeshers_CartesianParameters3D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_CartesianParameters3D_i.cxx @@ -151,7 +151,7 @@ void StdMeshers_CartesianParameters3D_i::SetSizeThreshold(CORBA::Double threshol } // Update Python script - SMESH::TPythonDump() << _this() << ".SetSizeThreshold( " << threshold << " )"; + SMESH::TPythonDump() << _this() << ".SetSizeThreshold( " << SMESH::TVar(threshold) << " )"; } //============================================================================= diff --git a/src/StdMeshers_I/StdMeshers_Deflection1D_i.cxx b/src/StdMeshers_I/StdMeshers_Deflection1D_i.cxx index 91cb7a651..f01f2a167 100644 --- a/src/StdMeshers_I/StdMeshers_Deflection1D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_Deflection1D_i.cxx @@ -93,7 +93,7 @@ void StdMeshers_Deflection1D_i::SetDeflection( CORBA::Double theValue ) } // Update Python script - SMESH::TPythonDump() << _this() << ".SetDeflection( " << theValue << " )"; + SMESH::TPythonDump() << _this() << ".SetDeflection( " << SMESH::TVar(theValue) << " )"; } //============================================================================= @@ -139,3 +139,14 @@ CORBA::Boolean StdMeshers_Deflection1D_i::IsDimSupported( SMESH::Dimension type return type == SMESH::DIM_1D; } +//================================================================================ +/*! + * \brief Return method name corresponding to index of variable parameter + */ +//================================================================================ + +std::string StdMeshers_Deflection1D_i::getMethodOfParameter(const int paramIndex, + int /*nbVars*/) const +{ + return "SetDeflection"; +} diff --git a/src/StdMeshers_I/StdMeshers_Deflection1D_i.hxx b/src/StdMeshers_I/StdMeshers_Deflection1D_i.hxx index b1a185118..ad45de2a6 100644 --- a/src/StdMeshers_I/StdMeshers_Deflection1D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_Deflection1D_i.hxx @@ -25,7 +25,6 @@ // Moved here from SMESH_LocalLength_i.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #ifndef _SMESH_Deflection1D_I_HXX_ #define _SMESH_Deflection1D_I_HXX_ @@ -66,7 +65,9 @@ public: // Verify whether hypothesis supports given entity type CORBA::Boolean IsDimSupported( SMESH::Dimension type ); + + protected: + virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; }; #endif - diff --git a/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.cxx b/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.cxx index db93c33a2..2541fe94d 100644 --- a/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.cxx @@ -21,14 +21,11 @@ // File : StdMeshers_LayerDistribution2D_i.cxx // Author : Edward AGAPOV // Module : SMESH -// $Header$ // #include "StdMeshers_LayerDistribution2D_i.hxx" #include "utilities.h" -//using namespace std; - //============================================================================= /*! * StdMeshers_LayerDistribution2D_i::StdMeshers_LayerDistribution2D_i diff --git a/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.hxx b/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.hxx index 16f4d6c00..fc5c571e6 100644 --- a/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_LayerDistribution2D_i.hxx @@ -21,7 +21,6 @@ // File : StdMeshers_LayerDistribution2D_i.hxx // Author : Edward AGAPOV // Module : SMESH -// $Header$ // #ifndef _SMESH_LayerDistribution2D_I_HXX_ #define _SMESH_LayerDistribution2D_I_HXX_ diff --git a/src/StdMeshers_I/StdMeshers_LayerDistribution_i.cxx b/src/StdMeshers_I/StdMeshers_LayerDistribution_i.cxx index b30358a60..618575fe9 100644 --- a/src/StdMeshers_I/StdMeshers_LayerDistribution_i.cxx +++ b/src/StdMeshers_I/StdMeshers_LayerDistribution_i.cxx @@ -24,7 +24,6 @@ // File : StdMeshers_LayerDistribution_i.cxx // Author : Edward AGAPOV // Module : SMESH -// $Header$ // #include "StdMeshers_LayerDistribution_i.hxx" #include "SMESH_Gen_i.hxx" @@ -169,9 +168,9 @@ char* StdMeshers_LayerDistribution_i::SaveTo() else { os << hyp1D->GetName() << " " << hyp1D->GetLibName() << " " - << hyp1D_i->SaveTo(); + << hyp1D_i->SaveTo() << " "; } - //myBaseImpl->SaveTo( os ); + os << SMESH_Hypothesis_i::SaveTo(); // to have a mark of storage version ("VARS...") return CORBA::string_dup( os.str().c_str() ); } @@ -201,11 +200,14 @@ void StdMeshers_LayerDistribution_i::LoadFrom( const char* theStream ) gen->CreateHypothesis( typeName.c_str(), libName.c_str() ); SMESH_Hypothesis_i* hyp1D_i = SMESH::DownCast< SMESH_Hypothesis_i*>( hyp1D ); if ( hyp1D_i ) { - hyp1D_i->LoadFrom( & theStream[ is.tellg() ]); + hyp1D_i->LoadFrom( & theStream[ (streamoff) is.tellg()+1 ]); this->GetImpl()->SetLayerDistribution( hyp1D_i->GetImpl() ); myHyp = hyp1D; // as hyp1D is not published, its ID changes //SMESH::TPythonDump() << _this() << ".SetLayerDistribution( " << hyp1D << " )"; + + // restore a mark of storage version ("VARS...") + SMESH_Hypothesis_i::LoadFrom( & theStream[ (streamoff)is.tellg()+1 ]); } } catch (...) { @@ -214,3 +216,14 @@ void StdMeshers_LayerDistribution_i::LoadFrom( const char* theStream ) } } +//================================================================================ +/*! + * \brief Restore myMethod2VarParams by parameters stored in an old study + */ +//================================================================================ + +void StdMeshers_LayerDistribution_i::setOldParameters (const char* theParameters) +{ + if ( SMESH_Hypothesis_i* hyp1D_i = SMESH::DownCast< SMESH_Hypothesis_i*>( myHyp )) + hyp1D_i->setOldParameters( theParameters ); +} diff --git a/src/StdMeshers_I/StdMeshers_LayerDistribution_i.hxx b/src/StdMeshers_I/StdMeshers_LayerDistribution_i.hxx index f930c1e66..7f1b91603 100644 --- a/src/StdMeshers_I/StdMeshers_LayerDistribution_i.hxx +++ b/src/StdMeshers_I/StdMeshers_LayerDistribution_i.hxx @@ -24,7 +24,6 @@ // File : StdMeshers_LayerDistribution_i.hxx // Author : Edward AGAPOV // Module : SMESH -// $Header$ // #ifndef _SMESH_LayerDistribution_I_HXX_ #define _SMESH_LayerDistribution_I_HXX_ @@ -80,9 +79,12 @@ public: virtual char* SaveTo(); virtual void LoadFrom( const char* theStream ); +protected: + // restore myMethod2VarParams by parameters stored in an old study + virtual void setOldParameters (const char* theParameters); + private: SMESH::SMESH_Hypothesis_var myHyp; }; #endif - diff --git a/src/StdMeshers_I/StdMeshers_LocalLength_i.cxx b/src/StdMeshers_I/StdMeshers_LocalLength_i.cxx index 00feb20bd..a5fb518f4 100644 --- a/src/StdMeshers_I/StdMeshers_LocalLength_i.cxx +++ b/src/StdMeshers_I/StdMeshers_LocalLength_i.cxx @@ -25,7 +25,6 @@ // Moved here from SMESH_LocalLength_i.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #include "StdMeshers_LocalLength_i.hxx" #include "SMESH_Gen_i.hxx" @@ -93,7 +92,7 @@ void StdMeshers_LocalLength_i::SetLength( CORBA::Double theLength ) } // Update Python script - SMESH::TPythonDump() << _this() << ".SetLength( " << theLength << " )"; + SMESH::TPythonDump() << _this() << ".SetLength( " << SMESH::TVar(theLength) << " )"; } //============================================================================= @@ -117,7 +116,7 @@ void StdMeshers_LocalLength_i::SetPrecision( CORBA::Double thePrecision ) } // Update Python script - SMESH::TPythonDump() << _this() << ".SetPrecision( " << thePrecision << " )"; + SMESH::TPythonDump() << _this() << ".SetPrecision( " << SMESH::TVar(thePrecision) << " )"; } //============================================================================= @@ -174,3 +173,9 @@ CORBA::Boolean StdMeshers_LocalLength_i::IsDimSupported( SMESH::Dimension type ) { return type == SMESH::DIM_1D; } + +std::string StdMeshers_LocalLength_i::getMethodOfParameter(const int paramIndex, + int /*nbVars*/) const +{ + return paramIndex == 0 ? "SetLength" : "SetPrecision"; +} diff --git a/src/StdMeshers_I/StdMeshers_LocalLength_i.hxx b/src/StdMeshers_I/StdMeshers_LocalLength_i.hxx index 92c218ac1..00e565c31 100644 --- a/src/StdMeshers_I/StdMeshers_LocalLength_i.hxx +++ b/src/StdMeshers_I/StdMeshers_LocalLength_i.hxx @@ -25,7 +25,6 @@ // Moved here from SMESH_LocalLength_i.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #ifndef _SMESH_LOCALLENGTH_I_HXX_ #define _SMESH_LOCALLENGTH_I_HXX_ @@ -72,6 +71,9 @@ public: // Verify whether hypothesis supports given entity type CORBA::Boolean IsDimSupported( SMESH::Dimension type ); + + protected: + virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; }; #endif diff --git a/src/StdMeshers_I/StdMeshers_MaxElementArea_i.cxx b/src/StdMeshers_I/StdMeshers_MaxElementArea_i.cxx index b81a4b408..26f44c5cc 100644 --- a/src/StdMeshers_I/StdMeshers_MaxElementArea_i.cxx +++ b/src/StdMeshers_I/StdMeshers_MaxElementArea_i.cxx @@ -25,7 +25,6 @@ // Moved here from SMESH_MaxElementArea_i.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #include "StdMeshers_MaxElementArea_i.hxx" #include "SMESH_Gen_i.hxx" @@ -94,7 +93,7 @@ void StdMeshers_MaxElementArea_i::SetMaxElementArea( CORBA::Double theArea ) } // Update Python script - SMESH::TPythonDump() << _this() << ".SetMaxElementArea( " << theArea << " )"; + SMESH::TPythonDump() << _this() << ".SetMaxElementArea( " << SMESH::TVar(theArea) << " )"; } //============================================================================= @@ -140,3 +139,14 @@ CORBA::Boolean StdMeshers_MaxElementArea_i::IsDimSupported( SMESH::Dimension typ return type == SMESH::DIM_2D; } +//================================================================================ +/*! + * \brief Return method name corresponding to index of variable parameter + */ +//================================================================================ + +std::string StdMeshers_MaxElementArea_i::getMethodOfParameter(const int paramIndex, + int /*nbVars*/) const +{ + return "SetMaxElementArea"; +} diff --git a/src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx b/src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx index 5eeb9bbd5..071888494 100644 --- a/src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx +++ b/src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx @@ -25,7 +25,6 @@ // Moved here from SMESH_MaxElementArea_i.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #ifndef _SMESH_MAXELEMENTAREA_I_HXX_ #define _SMESH_MAXELEMENTAREA_I_HXX_ @@ -64,6 +63,9 @@ public: // Verify whether hypothesis supports given entity type CORBA::Boolean IsDimSupported( SMESH::Dimension type ); + + protected: + virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; }; #endif diff --git a/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.cxx b/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.cxx index fff72761f..5d447a355 100644 --- a/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.cxx +++ b/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.cxx @@ -25,7 +25,6 @@ // Moved here from SMESH_MaxElementVolume_i.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #include "StdMeshers_MaxElementVolume_i.hxx" #include "SMESH_Gen_i.hxx" @@ -94,7 +93,7 @@ void StdMeshers_MaxElementVolume_i::SetMaxElementVolume( CORBA::Double theVolume } // Update Python script - SMESH::TPythonDump() << _this() << ".SetMaxElementVolume( " << theVolume << " )"; + SMESH::TPythonDump() << _this() << ".SetMaxElementVolume( " << SMESH::TVar(theVolume) << " )"; } //============================================================================= @@ -140,3 +139,13 @@ CORBA::Boolean StdMeshers_MaxElementVolume_i::IsDimSupported( SMESH::Dimension t return type == SMESH::DIM_3D; } +//================================================================================ +/*! + * \brief Return method name corresponding to index of variable parameter + */ +//================================================================================ + +std::string StdMeshers_MaxElementVolume_i::getMethodOfParameter(const int, int) const +{ + return "SetMaxElementVolume"; +} diff --git a/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx b/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx index ffec42a8f..f4896a779 100644 --- a/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx +++ b/src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx @@ -25,7 +25,6 @@ // Moved here from SMESH_MaxElementVolume_i.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #ifndef _SMESH_MAXELEMENTVOLUME_I_HXX_ #define _SMESH_MAXELEMENTVOLUME_I_HXX_ @@ -64,6 +63,9 @@ public: // Verify whether hypothesis supports given entity type CORBA::Boolean IsDimSupported( SMESH::Dimension type ); + + protected: + virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; }; #endif diff --git a/src/StdMeshers_I/StdMeshers_MaxLength_i.cxx b/src/StdMeshers_I/StdMeshers_MaxLength_i.cxx index 1f1eee84f..f11df4fe4 100644 --- a/src/StdMeshers_I/StdMeshers_MaxLength_i.cxx +++ b/src/StdMeshers_I/StdMeshers_MaxLength_i.cxx @@ -84,7 +84,7 @@ void StdMeshers_MaxLength_i::SetLength( CORBA::Double theLength ) } // Update Python script - SMESH::TPythonDump() << _this() << ".SetLength( " << theLength << " )"; + SMESH::TPythonDump() << _this() << ".SetLength( " << SMESH::TVar(theLength) << " )"; } //============================================================================= @@ -201,3 +201,14 @@ CORBA::Boolean StdMeshers_MaxLength_i::IsDimSupported( SMESH::Dimension type ) { return type == SMESH::DIM_1D; } + +//================================================================================ +/*! + * \brief Return method name corresponding to index of variable parameter + */ +//================================================================================ + +std::string StdMeshers_MaxLength_i::getMethodOfParameter(const int, int) const +{ + return "SetLength"; +} diff --git a/src/StdMeshers_I/StdMeshers_MaxLength_i.hxx b/src/StdMeshers_I/StdMeshers_MaxLength_i.hxx index a046aeb28..cbc99b51a 100644 --- a/src/StdMeshers_I/StdMeshers_MaxLength_i.hxx +++ b/src/StdMeshers_I/StdMeshers_MaxLength_i.hxx @@ -77,6 +77,9 @@ public: // Verify whether hypothesis supports given entity type CORBA::Boolean IsDimSupported( SMESH::Dimension type ); + + protected: + virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; }; #endif diff --git a/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.cxx b/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.cxx index e33f6972a..fa7f8d566 100644 --- a/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.cxx +++ b/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.cxx @@ -21,14 +21,11 @@ // File : StdMeshers_NumberOfLayers2D_i.cxx // Author : Edward AGAPOV // Module : SMESH -// $Header$ // #include "StdMeshers_NumberOfLayers2D_i.hxx" #include "utilities.h" -//using namespace std; - //============================================================================= /*! * StdMeshers_NumberOfLayers2D_i::StdMeshers_NumberOfLayers2D_i @@ -89,4 +86,3 @@ CORBA::Boolean StdMeshers_NumberOfLayers2D_i::IsDimSupported( SMESH::Dimension t { return type == SMESH::DIM_2D; } - diff --git a/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.hxx b/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.hxx index 39e6bc944..759f7cf65 100644 --- a/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.hxx +++ b/src/StdMeshers_I/StdMeshers_NumberOfLayers2D_i.hxx @@ -21,7 +21,6 @@ // File : StdMeshers_NumberOfLayers2D_i.hxx // Author : Edward AGAPOV // Module : SMESH -// $Header$ // #ifndef _SMESH_NumberOfLayers2D_I_HXX_ #define _SMESH_NumberOfLayers2D_I_HXX_ @@ -57,4 +56,3 @@ public: }; #endif - diff --git a/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.cxx b/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.cxx index 8409af9e5..ecc6ffb3c 100644 --- a/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.cxx +++ b/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.cxx @@ -24,7 +24,6 @@ // File : StdMeshers_NumberOfLayers_i.cxx // Author : Edward AGAPOV // Module : SMESH -// $Header$ // #include "StdMeshers_NumberOfLayers_i.hxx" #include "SMESH_Gen_i.hxx" @@ -90,7 +89,7 @@ void StdMeshers_NumberOfLayers_i::SetNumberOfLayers(CORBA::Long numberOfLayers) THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM ); } // Update Python script - SMESH::TPythonDump() << _this() << ".SetNumberOfLayers( " << numberOfLayers << " )"; + SMESH::TPythonDump() << _this() << ".SetNumberOfLayers( " << SMESH::TVar(numberOfLayers) << " )"; } //============================================================================= @@ -134,3 +133,13 @@ CORBA::Boolean StdMeshers_NumberOfLayers_i::IsDimSupported( SMESH::Dimension typ return type == SMESH::DIM_3D; } +//================================================================================ +/*! + * \brief Return method name corresponding to index of variable parameter + */ +//================================================================================ + +std::string StdMeshers_NumberOfLayers_i::getMethodOfParameter(const int, int) const +{ + return "SetNumberOfLayers"; +} diff --git a/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.hxx b/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.hxx index 0178b9bc8..c301a916a 100644 --- a/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.hxx +++ b/src/StdMeshers_I/StdMeshers_NumberOfLayers_i.hxx @@ -24,7 +24,6 @@ // File : StdMeshers_NumberOfLayers_i.hxx // Author : Edward AGAPOV // Module : SMESH -// $Header$ // #ifndef _SMESH_NumberOfLayers_I_HXX_ #define _SMESH_NumberOfLayers_I_HXX_ @@ -69,7 +68,9 @@ public: // Verify whether hypothesis supports given entity type CORBA::Boolean IsDimSupported( SMESH::Dimension type ); + + protected: + virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; }; #endif - diff --git a/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.cxx b/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.cxx index 1dd31e46c..9e7aa6292 100644 --- a/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.cxx +++ b/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.cxx @@ -25,7 +25,6 @@ // Moved here from SMESH_NumberOfSegments_i.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #include "StdMeshers_NumberOfSegments_i.hxx" #include "SMESH_Gen_i.hxx" @@ -146,7 +145,7 @@ void StdMeshers_NumberOfSegments_i::SetNumberOfSegments( CORBA::Long theSegments } // Update Python script - SMESH::TPythonDump() << _this() << ".SetNumberOfSegments( " << theSegmentsNumber << " )"; + SMESH::TPythonDump() << _this() << ".SetNumberOfSegments( " << SMESH::TVar(theSegmentsNumber) << " )"; } //============================================================================= @@ -305,7 +304,7 @@ void StdMeshers_NumberOfSegments_i::SetScaleFactor( CORBA::Double theScaleFactor try { this->GetImpl()->SetScaleFactor( theScaleFactor ); // Update Python script - SMESH::TPythonDump() << _this() << ".SetScaleFactor( " << theScaleFactor << " )"; + SMESH::TPythonDump() << _this() << ".SetScaleFactor( " << SMESH::TVar(theScaleFactor) << " )"; } catch ( SALOME_Exception& S_ex ) { THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), @@ -490,3 +489,13 @@ CORBA::Boolean StdMeshers_NumberOfSegments_i::IsDimSupported( SMESH::Dimension t return type == SMESH::DIM_1D; } +//================================================================================ +/*! + * \brief Return method name corresponding to index of variable parameter + */ +//================================================================================ + +std::string StdMeshers_NumberOfSegments_i::getMethodOfParameter(const int paramIndex, int ) const +{ + return paramIndex == 0 ? "SetNumberOfSegments" : "SetScaleFactor"; +} diff --git a/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.hxx b/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.hxx index 87b7a7758..14876bf28 100644 --- a/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.hxx +++ b/src/StdMeshers_I/StdMeshers_NumberOfSegments_i.hxx @@ -25,7 +25,6 @@ // Moved here from SMESH_NumberOfSegments_i.hxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #ifndef _SMESH_NUMBEROFSEGMENTS_I_HXX_ #define _SMESH_NUMBEROFSEGMENTS_I_HXX_ @@ -117,6 +116,9 @@ public: //Get Object Entry char* GetObjectEntry(); + + protected: + virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; }; #endif diff --git a/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.cxx b/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.cxx index d4d2390de..d15385bfa 100644 --- a/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.cxx +++ b/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.cxx @@ -23,7 +23,6 @@ // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : StdMeshers_SegmentLengthAroundVertex_i.cxx // Module : SMESH -// $Header$ // #include "StdMeshers_SegmentLengthAroundVertex_i.hxx" #include "SMESH_Gen.hxx" @@ -91,7 +90,7 @@ void StdMeshers_SegmentLengthAroundVertex_i::SetLength( CORBA::Double theLength } // Update Python script - SMESH::TPythonDump() << _this() << ".SetLength( " << theLength << " )"; + SMESH::TPythonDump() << _this() << ".SetLength( " << SMESH::TVar(theLength) << " )"; } //============================================================================= @@ -138,3 +137,13 @@ CORBA::Boolean StdMeshers_SegmentLengthAroundVertex_i::IsDimSupported( SMESH::Di return type == SMESH::DIM_1D; } +//================================================================================ +/*! + * \brief Return method name corresponding to index of variable parameter + */ +//================================================================================ + +std::string StdMeshers_SegmentLengthAroundVertex_i::getMethodOfParameter(const int, int ) const +{ + return "SetLength"; +} diff --git a/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.hxx b/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.hxx index 42f98bb14..dd30be3fa 100644 --- a/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.hxx +++ b/src/StdMeshers_I/StdMeshers_SegmentLengthAroundVertex_i.hxx @@ -23,7 +23,6 @@ // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // File : StdMeshers_SegmentLengthAroundVertex_i.hxx // Module : SMESH -// $Header$ // #ifndef _SMESH_SegmentLengthAroundVertex_I_HXX_ #define _SMESH_SegmentLengthAroundVertex_I_HXX_ @@ -64,6 +63,9 @@ public: // Verify whether hypothesis supports given entity type CORBA::Boolean IsDimSupported( SMESH::Dimension type ); + + protected: + virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; }; #endif diff --git a/src/StdMeshers_I/StdMeshers_StartEndLength_i.cxx b/src/StdMeshers_I/StdMeshers_StartEndLength_i.cxx index 461d86b6c..1b9f0d8e8 100644 --- a/src/StdMeshers_I/StdMeshers_StartEndLength_i.cxx +++ b/src/StdMeshers_I/StdMeshers_StartEndLength_i.cxx @@ -25,7 +25,6 @@ // Moved here from SMESH_LocalLength_i.cxx // Author : Paul RASCLE, EDF // Module : SMESH -// $Header$ // #include "StdMeshers_StartEndLength_i.hxx" #include "SMESH_Gen_i.hxx" @@ -96,7 +95,8 @@ void StdMeshers_StartEndLength_i::SetLength(CORBA::Double theLength, // Update Python script SMESH::TPythonDump() << - _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " ) << theLength << " )"; + _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " ) << + SMESH::TVar(theLength) << " )"; } //============================================================================= @@ -257,3 +257,14 @@ CORBA::Boolean StdMeshers_StartEndLength_i::IsDimSupported( SMESH::Dimension typ return type == SMESH::DIM_1D; } +//================================================================================ +/*! + * \brief Return method name corresponding to index of variable parameter + */ +//================================================================================ + +std::string StdMeshers_StartEndLength_i::getMethodOfParameter(const int paramIndex, + int /*nbVars*/) const +{ + return paramIndex == 0 ? "SetStartLength" : "SetEndLength"; +} diff --git a/src/StdMeshers_I/StdMeshers_StartEndLength_i.hxx b/src/StdMeshers_I/StdMeshers_StartEndLength_i.hxx index c43a17628..bef2c5415 100644 --- a/src/StdMeshers_I/StdMeshers_StartEndLength_i.hxx +++ b/src/StdMeshers_I/StdMeshers_StartEndLength_i.hxx @@ -85,7 +85,9 @@ public: //Get Object Entry char* GetObjectEntry(); + + protected: + virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; }; #endif - diff --git a/src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx b/src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx index 44a37f6b9..18c7365e7 100644 --- a/src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx +++ b/src/StdMeshers_I/StdMeshers_ViscousLayers_i.cxx @@ -29,7 +29,6 @@ #include "SMESH_Gen.hxx" #include "SMESH_Gen_i.hxx" #include "SMESH_PythonDump.hxx" -//#include "StdMeshers_ObjRefUlils.hxx" #include "Utils_CorbaException.hxx" #include "utilities.h" @@ -118,7 +117,7 @@ throw ( SALOME::SALOME_Exception ) if ( thickness < 1e-100 ) THROW_SALOME_CORBA_EXCEPTION( "Invalid thickness", SALOME::BAD_PARAM ); GetImpl()->SetTotalThickness(thickness); - SMESH::TPythonDump() << _this() << ".SetTotalThickness( " << thickness << " )"; + SMESH::TPythonDump() << _this() << ".SetTotalThickness( " << SMESH::TVar(thickness) << " )"; } //================================================================================ @@ -145,7 +144,7 @@ throw ( SALOME::SALOME_Exception ) if ( nb < 1 ) THROW_SALOME_CORBA_EXCEPTION( "Invalid number of layers", SALOME::BAD_PARAM ); GetImpl()->SetNumberLayers( nb ); - SMESH::TPythonDump() << _this() << ".SetNumberLayers( " << nb << " )"; + SMESH::TPythonDump() << _this() << ".SetNumberLayers( " << SMESH::TVar(nb) << " )"; } //================================================================================ @@ -172,7 +171,7 @@ throw ( SALOME::SALOME_Exception ) if ( factor < 1 ) THROW_SALOME_CORBA_EXCEPTION( "Invalid stretch factor, it must be >= 1.0", SALOME::BAD_PARAM ); GetImpl()->SetStretchFactor(factor); - SMESH::TPythonDump() << _this() << ".SetStretchFactor( " << factor << " )"; + SMESH::TPythonDump() << _this() << ".SetStretchFactor( " << SMESH::TVar(factor) << " )"; } //================================================================================ @@ -213,3 +212,20 @@ CORBA::Boolean StdMeshers_ViscousLayers_i::IsDimSupported( SMESH::Dimension type return type == SMESH::DIM_3D; } +//================================================================================ +/*! + * \brief Return method name corresponding to index of variable parameter + */ +//================================================================================ + +std::string StdMeshers_ViscousLayers_i::getMethodOfParameter(const int paramIndex, int ) const +{ + // order of methods was defined by StdMeshersGUI_StdHypothesisCreator::storeParams() + switch ( paramIndex ) + { + case 0: return "SetTotalThickness"; + case 1: return "SetNumberLayers"; + case 2: return "SetStretchFactor"; + } + return ""; +} diff --git a/src/StdMeshers_I/StdMeshers_ViscousLayers_i.hxx b/src/StdMeshers_I/StdMeshers_ViscousLayers_i.hxx index 1713defba..99a3d14dc 100644 --- a/src/StdMeshers_I/StdMeshers_ViscousLayers_i.hxx +++ b/src/StdMeshers_I/StdMeshers_ViscousLayers_i.hxx @@ -67,15 +67,8 @@ class STDMESHERS_I_EXPORT StdMeshers_ViscousLayers_i: // Verify whether hypothesis supports given entity type CORBA::Boolean IsDimSupported( SMESH::Dimension type ); - // Redefined Persistence -// virtual char* SaveTo(); -// virtual void LoadFrom( const char* theStream ); -// virtual void UpdateAsMeshesRestored(); - - private: - //SMESH::string_array_var _groupEntries; - //std::vector< std::string > _groupIDs; + protected: + virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; }; #endif - -- 2.39.2