Use TVar structure to dump arguments that can be defined via notebook variables
// File : StdMeshers_Arithmetic1D_i.cxx
// Author : Damien COQUERET, OCC
// Module : SMESH
-// $Header$
//
#include "StdMeshers_Arithmetic1D_i.hxx"
#include "SMESH_Gen_i.hxx"
// Update Python script
SMESH::TPythonDump()
- << _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " ) << theLength << " )";
+ << _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " )
+ << SMESH::TVar(theLength) << " )";
}
//=============================================================================
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";
+}
// 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
}
// Update Python script
- SMESH::TPythonDump() << _this() << ".SetSizeThreshold( " << threshold << " )";
+ SMESH::TPythonDump() << _this() << ".SetSizeThreshold( " << SMESH::TVar(threshold) << " )";
}
//=============================================================================
}
// Update Python script
- SMESH::TPythonDump() << _this() << ".SetDeflection( " << theValue << " )";
+ SMESH::TPythonDump() << _this() << ".SetDeflection( " << SMESH::TVar(theValue) << " )";
}
//=============================================================================
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";
+}
// Moved here from SMESH_LocalLength_i.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
-// $Header$
//
#ifndef _SMESH_Deflection1D_I_HXX_
#define _SMESH_Deflection1D_I_HXX_
// 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
-
// 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
// File : StdMeshers_LayerDistribution2D_i.hxx
// Author : Edward AGAPOV
// Module : SMESH
-// $Header$
//
#ifndef _SMESH_LayerDistribution2D_I_HXX_
#define _SMESH_LayerDistribution2D_I_HXX_
// File : StdMeshers_LayerDistribution_i.cxx
// Author : Edward AGAPOV
// Module : SMESH
-// $Header$
//
#include "StdMeshers_LayerDistribution_i.hxx"
#include "SMESH_Gen_i.hxx"
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() );
}
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 (...) {
}
}
+//================================================================================
+/*!
+ * \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 );
+}
// File : StdMeshers_LayerDistribution_i.hxx
// Author : Edward AGAPOV
// Module : SMESH
-// $Header$
//
#ifndef _SMESH_LayerDistribution_I_HXX_
#define _SMESH_LayerDistribution_I_HXX_
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
-
// Moved here from SMESH_LocalLength_i.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
-// $Header$
//
#include "StdMeshers_LocalLength_i.hxx"
#include "SMESH_Gen_i.hxx"
}
// Update Python script
- SMESH::TPythonDump() << _this() << ".SetLength( " << theLength << " )";
+ SMESH::TPythonDump() << _this() << ".SetLength( " << SMESH::TVar(theLength) << " )";
}
//=============================================================================
}
// Update Python script
- SMESH::TPythonDump() << _this() << ".SetPrecision( " << thePrecision << " )";
+ SMESH::TPythonDump() << _this() << ".SetPrecision( " << SMESH::TVar(thePrecision) << " )";
}
//=============================================================================
{
return type == SMESH::DIM_1D;
}
+
+std::string StdMeshers_LocalLength_i::getMethodOfParameter(const int paramIndex,
+ int /*nbVars*/) const
+{
+ return paramIndex == 0 ? "SetLength" : "SetPrecision";
+}
// Moved here from SMESH_LocalLength_i.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
-// $Header$
//
#ifndef _SMESH_LOCALLENGTH_I_HXX_
#define _SMESH_LOCALLENGTH_I_HXX_
// 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
// Moved here from SMESH_MaxElementArea_i.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
-// $Header$
//
#include "StdMeshers_MaxElementArea_i.hxx"
#include "SMESH_Gen_i.hxx"
}
// Update Python script
- SMESH::TPythonDump() << _this() << ".SetMaxElementArea( " << theArea << " )";
+ SMESH::TPythonDump() << _this() << ".SetMaxElementArea( " << SMESH::TVar(theArea) << " )";
}
//=============================================================================
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";
+}
// Moved here from SMESH_MaxElementArea_i.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
-// $Header$
//
#ifndef _SMESH_MAXELEMENTAREA_I_HXX_
#define _SMESH_MAXELEMENTAREA_I_HXX_
// 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
// Moved here from SMESH_MaxElementVolume_i.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
-// $Header$
//
#include "StdMeshers_MaxElementVolume_i.hxx"
#include "SMESH_Gen_i.hxx"
}
// Update Python script
- SMESH::TPythonDump() << _this() << ".SetMaxElementVolume( " << theVolume << " )";
+ SMESH::TPythonDump() << _this() << ".SetMaxElementVolume( " << SMESH::TVar(theVolume) << " )";
}
//=============================================================================
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";
+}
// Moved here from SMESH_MaxElementVolume_i.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
-// $Header$
//
#ifndef _SMESH_MAXELEMENTVOLUME_I_HXX_
#define _SMESH_MAXELEMENTVOLUME_I_HXX_
// 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
}
// Update Python script
- SMESH::TPythonDump() << _this() << ".SetLength( " << theLength << " )";
+ SMESH::TPythonDump() << _this() << ".SetLength( " << SMESH::TVar(theLength) << " )";
}
//=============================================================================
{
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";
+}
// 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
// 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
{
return type == SMESH::DIM_2D;
}
-
// File : StdMeshers_NumberOfLayers2D_i.hxx
// Author : Edward AGAPOV
// Module : SMESH
-// $Header$
//
#ifndef _SMESH_NumberOfLayers2D_I_HXX_
#define _SMESH_NumberOfLayers2D_I_HXX_
};
#endif
-
// File : StdMeshers_NumberOfLayers_i.cxx
// Author : Edward AGAPOV
// Module : SMESH
-// $Header$
//
#include "StdMeshers_NumberOfLayers_i.hxx"
#include "SMESH_Gen_i.hxx"
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) << " )";
}
//=============================================================================
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";
+}
// File : StdMeshers_NumberOfLayers_i.hxx
// Author : Edward AGAPOV
// Module : SMESH
-// $Header$
//
#ifndef _SMESH_NumberOfLayers_I_HXX_
#define _SMESH_NumberOfLayers_I_HXX_
// 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
-
// Moved here from SMESH_NumberOfSegments_i.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
-// $Header$
//
#include "StdMeshers_NumberOfSegments_i.hxx"
#include "SMESH_Gen_i.hxx"
}
// Update Python script
- SMESH::TPythonDump() << _this() << ".SetNumberOfSegments( " << theSegmentsNumber << " )";
+ SMESH::TPythonDump() << _this() << ".SetNumberOfSegments( " << SMESH::TVar(theSegmentsNumber) << " )";
}
//=============================================================================
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(),
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";
+}
// Moved here from SMESH_NumberOfSegments_i.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
-// $Header$
//
#ifndef _SMESH_NUMBEROFSEGMENTS_I_HXX_
#define _SMESH_NUMBEROFSEGMENTS_I_HXX_
//Get Object Entry
char* GetObjectEntry();
+
+ protected:
+ virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
};
#endif
// 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"
}
// Update Python script
- SMESH::TPythonDump() << _this() << ".SetLength( " << theLength << " )";
+ SMESH::TPythonDump() << _this() << ".SetLength( " << SMESH::TVar(theLength) << " )";
}
//=============================================================================
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";
+}
// 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_
// 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
// Moved here from SMESH_LocalLength_i.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
-// $Header$
//
#include "StdMeshers_StartEndLength_i.hxx"
#include "SMESH_Gen_i.hxx"
// Update Python script
SMESH::TPythonDump() <<
- _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " ) << theLength << " )";
+ _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " ) <<
+ SMESH::TVar(theLength) << " )";
}
//=============================================================================
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";
+}
//Get Object Entry
char* GetObjectEntry();
+
+ protected:
+ virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
};
#endif
-
#include "SMESH_Gen.hxx"
#include "SMESH_Gen_i.hxx"
#include "SMESH_PythonDump.hxx"
-//#include "StdMeshers_ObjRefUlils.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
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) << " )";
}
//================================================================================
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) << " )";
}
//================================================================================
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) << " )";
}
//================================================================================
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 "";
+}
// 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
-