#include "SALOME_Exception.idl"
#include "SALOME_GenericObj.idl"
+#include "SALOME_Notebook.idl"
module SMESH
{
typedef sequence<string> ListOfParameters;
- interface SMESH_Hypothesis : SALOME::GenericObj
+ interface SMESH_Hypothesis : SALOME::ParameterizedObject
{
/*!
*/
long GetId();
- /*!
- * Set list of parameters
- * \param theParameters is a string containing the notebook variables separated by ":" symbol,
- * used for Hypothesis creation
- */
- void SetParameters (in string theParameters);
-
- /*!
- * Return list of notebook variables used for Hypothesis creation separated by ":" symbol
- */
- string GetParameters();
-
- /*!
- * Return list of last notebook variables used for Hypothesis creation.
- */
- ListOfParameters GetLastParameters();
-
- /*!
- * Set list of parameters
- * \param theParameters is a string containing the last notebook variables separated by ":" symbol,
- * used for Hypothesis creation
- */
- void SetLastParameters(in string theParameters);
-
- /*!
- * Clear parameters list
- */
- void ClearParameters();
-
/*!
* Verify whether hypothesis supports given entity type
*/
#include "SALOME_Exception.idl"
#include "SALOME_GenericObj.idl"
+#include "SALOME_Notebook.idl"
#include "GEOM_Gen.idl"
#include "MED.idl"
interface SMESH_GroupOnGeom;
interface SMESH_subMesh;
interface SMESH_MeshEditor;
- interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
+ interface SMESH_Mesh : SALOME::ParameterizedObject, SMESH_IDSource
{
/*!
* Return true if there is a geometry to be meshed
/*! Gets information about imported MED file */
SALOME_MED::MedFileInfo GetMEDFileInfo();
-
- /*!
- * Sets list of notebook variables used for Mesh operations separated by ":" symbol
- * \param theParameters is a string containing the notebook variables
- */
- void SetParameters (in string theParameters);
-
- /*!
- * Returns list of notebook variables used for Mesh operations separated by ":" symbol
- */
- string GetParameters();
-
- /*!
- * Returns list of notebook variables used for last Mesh operation
- */
- string_array GetLastParameters();
};
interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
_type = PARAM_ALGO;
_shapeType = 0; // to be set by algo with TopAbs_Enum
_param_algo_dim = -1; // to be set by algo parameter
- _parameters = string();
}
//=============================================================================
*
*/
//=============================================================================
-void SMESH_Hypothesis::SetParameters(const char *theParameters)
+void SMESH_Hypothesis::SetParameters(const std::list<std::string>& theParameters)
{
- string aNewParameters(theParameters);
- if(aNewParameters.size()==0 && _parameters.size()==0)
- aNewParameters = " ";
- if(_parameters.size()>0)
- _parameters +="|";
- _parameters +=aNewParameters;
- SetLastParameters(theParameters);
+ _parameters = theParameters;
}
//=============================================================================
*
*/
//=============================================================================
-void SMESH_Hypothesis::ClearParameters()
+std::list<std::string> SMESH_Hypothesis::GetParameters() const
{
- _parameters = string();
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-char* SMESH_Hypothesis::GetParameters() const
-{
- return (char*)_parameters.c_str();
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-char* SMESH_Hypothesis::GetLastParameters() const
-{
- return (char*)_lastParameters.c_str();
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-void SMESH_Hypothesis::SetLastParameters(const char* theParameters)
-{
- _lastParameters = string(theParameters);
+ return _parameters;
}
#include "SMESHDS_Hypothesis.hxx"
+#include <list>
+
class SMESH_Gen;
class TopoDS_Shape;
class SMESH_Mesh;
virtual const char* GetLibName() const;
void SetLibName(const char* theLibName);
- void SetParameters(const char *theParameters);
- char* GetParameters() const;
+ void SetParameters(const std::list<std::string>& theParameters);
+ std::list<std::string> GetParameters() const;
- void SetLastParameters(const char* theParameters);
- char* GetLastParameters() const;
- void ClearParameters();
-
/*!
* \brief Initialize my parameter values by the mesh built on the geometry
* \param theMesh - the built mesh
private:
std::string _libName;
- std::string _parameters;
- std::string _lastParameters;
+ std::list<std::string> _parameters;
};
#endif
*/
SALOMEDS::SObject_ptr GetAlgoSO(const ::SMESH_Algo* algo);
- void UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters);
- char* GetParameters(CORBA::Object_ptr theObject);
- char* ParseParameters(const char* theParameters);
-
-
private:
// Create hypothesis of given type
SMESH::SMESH_Hypothesis_ptr createHypothesis( const char* theHypName,
}
return true;
}
-
-//=======================================================================
-//function : UpdateParameters
-//purpose :
-//=======================================================================
-void SMESH_Gen_i::UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters)
-{
-
- if(VARIABLE_DEBUG)
- cout<<"UpdateParameters : "<<theParameters<<endl;
- SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
- if(aStudy->_is_nil() || CORBA::is_nil(theObject))
- return;
-
- SALOMEDS::SObject_var aSObj = ObjectToSObject(aStudy,theObject);
- if(aSObj->_is_nil())
- return;
-
- SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-
- SALOMEDS::GenericAttribute_var aFindAttr;
- bool hasAttr = aSObj->FindAttribute(aFindAttr, "AttributeString");
- if(VARIABLE_DEBUG)
- cout<<"Find Attribute "<<hasAttr<<endl;
-
- SALOMEDS::GenericAttribute_var anAttr;
- anAttr = aStudyBuilder->FindOrCreateAttribute( aSObj, "AttributeString");
- SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr);
-
- CORBA::String_var oldparVar = aStringAttr->Value();
- CORBA::String_var inpparVar = ParseParameters(theParameters);
- TCollection_AsciiString aNewParams;
- TCollection_AsciiString aOldParameters(oldparVar.inout());
- TCollection_AsciiString anInputParams(inpparVar.inout());
- if(!hasAttr)
- aNewParams = anInputParams;
- else
- aNewParams = aOldParameters+"|"+anInputParams;
-
- if(VARIABLE_DEBUG)
- {
- cout<<"Input Parameters : "<<anInputParams<<endl;
- cout<<"Old Parameters : "<<aOldParameters<<endl;
- cout<<"New Parameters : "<<aNewParams<<endl;
- }
-
- aStringAttr->SetValue( aNewParams.ToCString() );
-}
-
-//=======================================================================
-//function : ParseParameters
-//purpose :
-//=======================================================================
-char* SMESH_Gen_i::ParseParameters(const char* theParameters)
-{
- /* ouv: temporarily disabled
- //const char* aParameters = theParameters;
-// const char* aParameters = CORBA::string_dup(theParameters);
- TCollection_AsciiString anInputParams;
- SALOMEDS::Study_var aStudy = GetCurrentStudy();
- if( !aStudy->_is_nil() ) {
-// SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(theParameters);
-// for(int j=0;j<aSections->length();j++) {
-// SALOMEDS::ListOfStrings aVars= aSections[j];
-// for(int i=0;i<aVars.length();i++ ) {
-// anInputParams += aStudy->IsVariable(aVars[i].in()) ?
-// TCollection_AsciiString(aVars[i].in()) : TCollection_AsciiString("");
-// if(i != aVars.length()-1)
-// anInputParams+=":";
-// }
-// if(j!=aSections->length()-1)
-// anInputParams+="|";
-// }
- TCollection_AsciiString paramStr( theParameters );
- static TCollection_AsciiString separators(":|");
- int beg = 0, end;
- char sep, *pParams = (char*)paramStr.ToCString();
- while ( beg < paramStr.Length() )
- {
- end = beg-1;
- while ( ++end < paramStr.Length() )
- if ( pParams[end] == ':' || pParams[end] == '|')
- break;
- if ( end < paramStr.Length())
- {
- sep = pParams[end];
- pParams[end] = '\0';
- }
- if ( aStudy->IsVariable( pParams+beg ))
- anInputParams += pParams+beg;
- if ( end < paramStr.Length() )
- anInputParams += sep;
- else
- break;
- beg = end + 1;
- }
- }
- return CORBA::string_dup(anInputParams.ToCString());
- */
- return NULL;
-}
-
-//=======================================================================
-//function : GetParameters
-//purpose :
-//=======================================================================
-char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject)
-{
- TCollection_AsciiString aResult;
-
- SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
- SALOMEDS::SObject_var aSObj = ObjectToSObject(aStudy,theObject);
-
- if(!aStudy->_is_nil() &&
- !CORBA::is_nil(theObject) &&
- !aSObj->_is_nil()){
-
- SALOMEDS::GenericAttribute_var anAttr;
- if ( aSObj->FindAttribute(anAttr, "AttributeString")) {
- aResult = TCollection_AsciiString(SALOMEDS::AttributeString::_narrow(anAttr)->Value());
- }
- }
-
- return CORBA::string_dup( aResult.ToCString() );
-}
*
*/
//=============================================================================
-void SMESH_Hypothesis_i::SetParameters(const char* theParameters)
+//void SMESH_Hypothesis_i::SetParameters(const char* theParameters)
+void SMESH_Hypothesis_i::SetParameters( SALOME::Notebook_ptr theNotebook, const SALOME::StringArray& theParameters )
{
+ /*
SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
char * aParameters = CORBA::string_dup(theParameters);
if(gen){
myBaseImpl->SetParameters(gen->ParseParameters(aParameters));
}
}
+ */
}
//=============================================================================
*
*/
//=============================================================================
-char* SMESH_Hypothesis_i::GetParameters()
+//char* SMESH_Hypothesis_i::GetParameters()
+SALOME::StringArray* SMESH_Hypothesis_i::GetParameters()
{
+ /*
SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
char* aResult;
if(IsPublished()) {
aResult = myBaseImpl->GetParameters();
}
return CORBA::string_dup(aResult);
-}
-
-//=============================================================================
-/*!
- * SMESH_Hypothesis_i::GetLastParameters()
- *
- */
-//=============================================================================
-SMESH::ListOfParameters* SMESH_Hypothesis_i::GetLastParameters()
-{
- SMESH::ListOfParameters_var aResult = new SMESH::ListOfParameters();
- /* ouv: temporarily disabled
- SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
- if(gen) {
- char *aParameters;
- if(IsPublished())
- aParameters = GetParameters();
- else
- aParameters = myBaseImpl->GetLastParameters();
-
- SALOMEDS::Study_ptr aStudy = gen->GetCurrentStudy();
- if(!aStudy->_is_nil()) {
- SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
- if(aSections->length() > 0) {
- SALOMEDS::ListOfStrings aVars = aSections[aSections->length()-1];
- aResult->length(aVars.length());
- for(int i = 0;i < aVars.length();i++)
- aResult[i] = CORBA::string_dup( aVars[i]);
- }
- }
- }
*/
- return aResult._retn();
-}
-
-//=============================================================================
-/*!
- * SMESH_Hypothesis_i::SetLastParameters()
- *
- */
-//=============================================================================
-void SMESH_Hypothesis_i::SetLastParameters(const char* theParameters)
-{
- if(!IsPublished()) {
- myBaseImpl->SetLastParameters(theParameters);
- }
-}
-//=============================================================================
-/*!
- * SMESH_Hypothesis_i::ClearParameters()
- *
- */
-//=============================================================================
-void SMESH_Hypothesis_i::ClearParameters()
-{
- if(!IsPublished()) {
- myBaseImpl->ClearParameters();
- }
+ return NULL;
}
//=============================================================================
// Get unique id of hypothesis
CORBA::Long GetId();
- // Set list of parameters separated by ":" symbol, used for Hypothesis creation
- void SetParameters (const char* theParameters);
+ // Set list of parameters, used for Hypothesis creation
+ virtual void SetParameters( SALOME::Notebook_ptr theNotebook, const SALOME::StringArray& theParameters );
- // Return list of notebook variables used for Hypothesis creation separated by ":" symbol
- char* GetParameters();
-
- //Return list of last notebook variables used for Hypothesis creation.
- SMESH::ListOfParameters* GetLastParameters();
-
- //Set last parameters for not published hypothesis
-
- void SetLastParameters(const char* theParameters);
-
- // Clear parameters list
- void ClearParameters();
+ // Return list of notebook variables used for Hypothesis creation
+ virtual SALOME::StringArray* GetParameters();
//Return true if hypothesis was published in study
bool IsPublished();
* \brief Sets list of notebook variables used for Mesh operations separated by ":" symbol
*/
//=============================================================================
-void SMESH_Mesh_i::SetParameters(const char* theParameters)
+void SMESH_Mesh_i::SetParameters( SALOME::Notebook_ptr theNotebook, const SALOME::StringArray& theParameters )
{
- SMESH_Gen_i::GetSMESHGen()->UpdateParameters(SMESH::SMESH_Mesh::_narrow(_this()),
- CORBA::string_dup(theParameters));
}
//=============================================================================
* \brief Returns list of notebook variables used for Mesh operations separated by ":" symbol
*/
//=============================================================================
-char* SMESH_Mesh_i::GetParameters()
+SALOME::StringArray* SMESH_Mesh_i::GetParameters()
{
- SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
- return CORBA::string_dup(gen->GetParameters(SMESH::SMESH_Mesh::_narrow(_this())));
-}
-
-//=============================================================================
-/*!
- * \brief Returns list of notebook variables used for last Mesh operation
- */
-//=============================================================================
-SMESH::string_array* SMESH_Mesh_i::GetLastParameters()
-{
- SMESH::string_array_var aResult = new SMESH::string_array();
- /* ouv: temporarily disabled
- SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
- if(gen) {
- char *aParameters = GetParameters();
- SALOMEDS::Study_ptr aStudy = gen->GetCurrentStudy();
- if(!aStudy->_is_nil()) {
- SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
- if(aSections->length() > 0) {
- SALOMEDS::ListOfStrings aVars = aSections[aSections->length()-1];
- aResult->length(aVars.length());
- for(int i = 0;i < aVars.length();i++)
- aResult[i] = CORBA::string_dup( aVars[i]);
- }
- }
- }
- */
- return aResult._retn();
+ return NULL;
}
//=============================================================================
virtual SALOME_MED::MedFileInfo* GetMEDFileInfo();
/*!
- * Sets list of notebook variables used for Mesh operations separated by ":" symbol
+ * Sets list of notebook variables used for Mesh operations
*/
- void SetParameters (const char* theParameters);
+ virtual void SetParameters( SALOME::Notebook_ptr theNotebook, const SALOME::StringArray& theParameters );
/*!
- * Returns list of notebook variables used for Mesh operations separated by ":" symbol
+ * Returns list of notebook variables used for Mesh operations
*/
- char* GetParameters();
-
- /*!
- * Returns list of notebook variables used for last Mesh operation
- */
- SMESH::string_array* GetLastParameters();
-
+ virtual SALOME::StringArray* GetParameters();
/*!
* Returns statistic of mesh elements