From fd6ece745c013178e78db978d9c2e196f37685eb Mon Sep 17 00:00:00 2001 From: rnv Date: Fri, 29 Dec 2017 15:54:43 +0300 Subject: [PATCH] Python 3 porting & Multi-study removing --- src/GMSHPlugin/GMSHPluginBuilder.py | 2 +- src/GMSHPlugin/GMSHPlugin_GMSH.cxx | 5 ++--- src/GMSHPlugin/GMSHPlugin_GMSH.hxx | 2 +- src/GMSHPlugin/GMSHPlugin_GMSH_2D.cxx | 5 ++--- src/GMSHPlugin/GMSHPlugin_GMSH_2D.hxx | 2 +- src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.cxx | 2 -- src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.hxx | 1 - src/GMSHPlugin/GMSHPlugin_GMSH_i.cxx | 2 -- src/GMSHPlugin/GMSHPlugin_GMSH_i.hxx | 1 - src/GMSHPlugin/GMSHPlugin_Hypothesis.cxx | 4 ++-- src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx | 2 +- src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.cxx | 5 ++--- src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.hxx | 2 +- src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.cxx | 4 +--- src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.hxx | 1 - src/GMSHPlugin/GMSHPlugin_Hypothesis_i.cxx | 2 -- src/GMSHPlugin/GMSHPlugin_Hypothesis_i.hxx | 1 - src/GMSHPlugin/GMSHPlugin_Mesher.cxx | 8 ++------ src/GMSHPlugin/GMSHPlugin_Mesher.hxx | 1 - src/GUI/GMSHPluginGUI_HypothesisCreator.cxx | 6 ++---- 20 files changed, 18 insertions(+), 40 deletions(-) diff --git a/src/GMSHPlugin/GMSHPluginBuilder.py b/src/GMSHPlugin/GMSHPluginBuilder.py index 1047504..117181e 100644 --- a/src/GMSHPlugin/GMSHPluginBuilder.py +++ b/src/GMSHPlugin/GMSHPluginBuilder.py @@ -45,7 +45,7 @@ class GMSH_Algorithm(Mesh_Algorithm): def __init__(self, mesh, geom=0): Mesh_Algorithm.__init__(self) - if noGMSHPlugin: print "Warning: GMSHPlugin module unavailable" + if noGMSHPlugin: print("Warning: GMSHPlugin module unavailable") self.Create(mesh, geom, self.algoType, "libGMSHEngine.so") self.params = None diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH.cxx b/src/GMSHPlugin/GMSHPlugin_GMSH.cxx index ecfa7f7..84c6ebb 100644 --- a/src/GMSHPlugin/GMSHPlugin_GMSH.cxx +++ b/src/GMSHPlugin/GMSHPlugin_GMSH.cxx @@ -37,9 +37,8 @@ using namespace std; */ //============================================================================= -GMSHPlugin_GMSH::GMSHPlugin_GMSH(int hypId, int studyId, - SMESH_Gen* gen) - : SMESH_3D_Algo(hypId, studyId, gen) +GMSHPlugin_GMSH::GMSHPlugin_GMSH(int hypId, SMESH_Gen* gen) + : SMESH_3D_Algo(hypId, gen) { MESSAGE("GMSHPlugin_GMSH::GMSHPlugin_GMSH"); _name = "GMSH"; diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH.hxx b/src/GMSHPlugin/GMSHPlugin_GMSH.hxx index 60b03b1..c9376cf 100644 --- a/src/GMSHPlugin/GMSHPlugin_GMSH.hxx +++ b/src/GMSHPlugin/GMSHPlugin_GMSH.hxx @@ -33,7 +33,7 @@ class GMSHPLUGIN_EXPORT GMSHPlugin_GMSH: public SMESH_3D_Algo { public: - GMSHPlugin_GMSH(int hypId, int studyId, SMESH_Gen* gen); + GMSHPlugin_GMSH(int hypId, SMESH_Gen* gen); virtual ~GMSHPlugin_GMSH(); virtual bool CheckHypothesis(SMESH_Mesh& aMesh, diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH_2D.cxx b/src/GMSHPlugin/GMSHPlugin_GMSH_2D.cxx index f155981..1c89ab1 100644 --- a/src/GMSHPlugin/GMSHPlugin_GMSH_2D.cxx +++ b/src/GMSHPlugin/GMSHPlugin_GMSH_2D.cxx @@ -37,9 +37,8 @@ using namespace std; */ //============================================================================= -GMSHPlugin_GMSH_2D::GMSHPlugin_GMSH_2D(int hypId, int studyId, - SMESH_Gen* gen) - : SMESH_2D_Algo(hypId, studyId, gen) +GMSHPlugin_GMSH_2D::GMSHPlugin_GMSH_2D(int hypId, SMESH_Gen* gen) + : SMESH_2D_Algo(hypId, gen) { MESSAGE("GMSHPlugin_GMSH_2D::GMSHPlugin_GMSH_2D"); _name = "GMSH_2D"; diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH_2D.hxx b/src/GMSHPlugin/GMSHPlugin_GMSH_2D.hxx index 5e99fa5..c4260e7 100644 --- a/src/GMSHPlugin/GMSHPlugin_GMSH_2D.hxx +++ b/src/GMSHPlugin/GMSHPlugin_GMSH_2D.hxx @@ -33,7 +33,7 @@ class GMSHPLUGIN_EXPORT GMSHPlugin_GMSH_2D: public SMESH_2D_Algo { public: - GMSHPlugin_GMSH_2D(int hypId, int studyId, SMESH_Gen* gen); + GMSHPlugin_GMSH_2D(int hypId, SMESH_Gen* gen); virtual ~GMSHPlugin_GMSH_2D(); virtual bool CheckHypothesis(SMESH_Mesh& aMesh, diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.cxx b/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.cxx index acba912..9ea8f6d 100644 --- a/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.cxx +++ b/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.cxx @@ -34,7 +34,6 @@ using namespace std; //============================================================================= GMSHPlugin_GMSH_2D_i::GMSHPlugin_GMSH_2D_i( PortableServer::POA_ptr thePOA, - int theStudyId, ::SMESH_Gen* theGenImpl ) : SALOME::GenericObj_i( thePOA ), SMESH_Hypothesis_i( thePOA ), @@ -43,7 +42,6 @@ GMSHPlugin_GMSH_2D_i::GMSHPlugin_GMSH_2D_i( PortableServer::POA_ptr thePOA, { MESSAGE( "GMSHPlugin_GMSH_2D_i::GMSHPlugin_GMSH_2D_i" ); myBaseImpl = new ::GMSHPlugin_GMSH_2D( theGenImpl->GetANewId(), - theStudyId, theGenImpl ); } diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.hxx b/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.hxx index 18adad7..e1efa65 100644 --- a/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.hxx +++ b/src/GMSHPlugin/GMSHPlugin_GMSH_2D_i.hxx @@ -38,7 +38,6 @@ class GMSHPLUGIN_EXPORT GMSHPlugin_GMSH_2D_i: public: // Constructor GMSHPlugin_GMSH_2D_i( PortableServer::POA_ptr thePOA, - int theStudyId, ::SMESH_Gen* theGenImpl ); // Destructor virtual ~GMSHPlugin_GMSH_2D_i(); diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH_i.cxx b/src/GMSHPlugin/GMSHPlugin_GMSH_i.cxx index 7978e1d..b4ccea5 100644 --- a/src/GMSHPlugin/GMSHPlugin_GMSH_i.cxx +++ b/src/GMSHPlugin/GMSHPlugin_GMSH_i.cxx @@ -34,7 +34,6 @@ using namespace std; //============================================================================= GMSHPlugin_GMSH_i::GMSHPlugin_GMSH_i( PortableServer::POA_ptr thePOA, - int theStudyId, ::SMESH_Gen* theGenImpl ) : SALOME::GenericObj_i( thePOA ), SMESH_Hypothesis_i( thePOA ), @@ -43,7 +42,6 @@ GMSHPlugin_GMSH_i::GMSHPlugin_GMSH_i( PortableServer::POA_ptr thePOA, { MESSAGE( "GMSHPlugin_GMSH_i::GMSHPlugin_GMSH_i" ); myBaseImpl = new ::GMSHPlugin_GMSH( theGenImpl->GetANewId(), - theStudyId, theGenImpl ); } diff --git a/src/GMSHPlugin/GMSHPlugin_GMSH_i.hxx b/src/GMSHPlugin/GMSHPlugin_GMSH_i.hxx index bd839dd..4cd133c 100644 --- a/src/GMSHPlugin/GMSHPlugin_GMSH_i.hxx +++ b/src/GMSHPlugin/GMSHPlugin_GMSH_i.hxx @@ -38,7 +38,6 @@ class GMSHPLUGIN_EXPORT GMSHPlugin_GMSH_i: public: // Constructor GMSHPlugin_GMSH_i( PortableServer::POA_ptr thePOA, - int theStudyId, ::SMESH_Gen* theGenImpl ); // Destructor virtual ~GMSHPlugin_GMSH_i(); diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis.cxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis.cxx index 2b414c9..c8a698e 100644 --- a/src/GMSHPlugin/GMSHPlugin_Hypothesis.cxx +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis.cxx @@ -27,9 +27,9 @@ using namespace std; -GMSHPlugin_Hypothesis::GMSHPlugin_Hypothesis (int hypId, int studyId, +GMSHPlugin_Hypothesis::GMSHPlugin_Hypothesis (int hypId, SMESH_Gen * gen) - : SMESH_Hypothesis(hypId, studyId, gen), + : SMESH_Hypothesis(hypId, gen), _algo2d (automatic), _algo3d (frontal3), _recomb2DAlgo (standard), diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx index dde0eb2..0fe8db8 100644 --- a/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis.hxx @@ -36,7 +36,7 @@ class GMSHPLUGIN_EXPORT GMSHPlugin_Hypothesis: public SMESH_Hypothesis { public: - GMSHPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen); + GMSHPlugin_Hypothesis(int hypId, SMESH_Gen * gen); enum Algo2D { diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.cxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.cxx index 72d265b..265811e 100644 --- a/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.cxx +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.cxx @@ -29,9 +29,8 @@ using namespace std; * */ //============================================================================= -GMSHPlugin_Hypothesis_2D::GMSHPlugin_Hypothesis_2D (int hypId, int studyId, - SMESH_Gen * gen) - : GMSHPlugin_Hypothesis(hypId, studyId, gen) +GMSHPlugin_Hypothesis_2D::GMSHPlugin_Hypothesis_2D (int hypId, SMESH_Gen * gen) + : GMSHPlugin_Hypothesis(hypId, gen) { _name = "GMSH_Parameters_2D"; diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.hxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.hxx index 2ea7f71..6f2d624 100644 --- a/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.hxx +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D.hxx @@ -33,7 +33,7 @@ class GMSHPLUGIN_EXPORT GMSHPlugin_Hypothesis_2D: public GMSHPlugin_Hypothesis { public: - GMSHPlugin_Hypothesis_2D(int hypId, int studyId, SMESH_Gen * gen); + GMSHPlugin_Hypothesis_2D(int hypId, SMESH_Gen * gen); }; diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.cxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.cxx index eb9e3eb..f1c7ea5 100644 --- a/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.cxx +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.cxx @@ -35,17 +35,15 @@ using namespace std; //============================================================================= GMSHPlugin_Hypothesis_2D_i:: GMSHPlugin_Hypothesis_2D_i (PortableServer::POA_ptr thePOA, - int theStudyId, ::SMESH_Gen* theGenImpl) : SALOME::GenericObj_i( thePOA ), SMESH_Hypothesis_i( thePOA ), - GMSHPlugin_Hypothesis_i( thePOA, theStudyId, theGenImpl ) + GMSHPlugin_Hypothesis_i( thePOA, theGenImpl ) { MESSAGE( "GMSHPlugin_Hypothesis_2D_i::GMSHPlugin_Hypothesis_2D_i" ); if (myBaseImpl) delete (::GMSHPlugin_Hypothesis*)myBaseImpl; myBaseImpl = new ::GMSHPlugin_Hypothesis_2D (theGenImpl->GetANewId(), - theStudyId, theGenImpl); } diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.hxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.hxx index a02c505..52c565e 100644 --- a/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.hxx +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis_2D_i.hxx @@ -39,7 +39,6 @@ class GMSHPLUGIN_EXPORT GMSHPlugin_Hypothesis_2D_i: public: // Constructor GMSHPlugin_Hypothesis_2D_i (PortableServer::POA_ptr thePOA, - int theStudyId, ::SMESH_Gen* theGenImpl); // Destructor virtual ~GMSHPlugin_Hypothesis_2D_i(); diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.cxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.cxx index 453074b..2fc0a5d 100644 --- a/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.cxx +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.cxx @@ -37,7 +37,6 @@ bool GMSHPlugin_Hypothesis_i::isToSetParameter(double curValue, GMSHPlugin_Hypothesis_i:: GMSHPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, - int theStudyId, ::SMESH_Gen* theGenImpl) : SALOME::GenericObj_i( thePOA ), SMESH_Hypothesis_i( thePOA ), @@ -45,7 +44,6 @@ GMSHPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, { MESSAGE( "GMSHPlugin_Hypothesis_i::GMSHPlugin_Hypothesis_i" ); myBaseImpl = new ::GMSHPlugin_Hypothesis (theGenImpl->GetANewId(), - theStudyId, theGenImpl); } diff --git a/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.hxx b/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.hxx index 98817aa..716ad95 100644 --- a/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.hxx +++ b/src/GMSHPlugin/GMSHPlugin_Hypothesis_i.hxx @@ -40,7 +40,6 @@ class GMSHPLUGIN_EXPORT GMSHPlugin_Hypothesis_i: public: // Constructor GMSHPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, - int theStudyId, ::SMESH_Gen* theGenImpl); // Destructor virtual ~GMSHPlugin_Hypothesis_i(); diff --git a/src/GMSHPlugin/GMSHPlugin_Mesher.cxx b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx index 6e2ccf1..b36bcaf 100644 --- a/src/GMSHPlugin/GMSHPlugin_Mesher.cxx +++ b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx @@ -94,7 +94,6 @@ void GMSHPlugin_Mesher::SetParameters(const GMSHPlugin_Hypothesis* hyp) _secondOrder = hyp->GetSecondOrder(); _useIncomplElem = hyp->GetUseIncomplElem(); _is2d = hyp->GetIs2d(); - _studyId = hyp->GetStudyId(); _compounds = hyp->GetCompoundOnEntries(); } else @@ -193,9 +192,6 @@ void GMSHPlugin_Mesher::CreateGmshCompounds() MESSAGE("GMSHPlugin_Mesher::CreateGmshCompounds"); SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen(); - CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager"); - SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject); - SALOMEDS::Study_var myStudy = aStudyMgr->GetStudyByID(_studyId); OCC_Internals* occgeo = _gModel->getOCCInternals(); @@ -203,13 +199,13 @@ void GMSHPlugin_Mesher::CreateGmshCompounds() { GEOM::GEOM_Object_var aGeomObj; TopoDS_Shape geomShape = TopoDS_Shape(); - SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( (*its).c_str() ); + SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( (*its).c_str() ); SALOMEDS::GenericAttribute_var anAttr; if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) { SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); CORBA::String_var aVal = anIOR->Value(); - CORBA::Object_var obj = myStudy->ConvertIORToObject(aVal); + CORBA::Object_var obj = SMESH_Gen_i::getStudyServant()->ConvertIORToObject(aVal); aGeomObj = GEOM::GEOM_Object::_narrow(obj); } if ( !aGeomObj->_is_nil() ) diff --git a/src/GMSHPlugin/GMSHPlugin_Mesher.hxx b/src/GMSHPlugin/GMSHPlugin_Mesher.hxx index 6da9164..ebbcae6 100644 --- a/src/GMSHPlugin/GMSHPlugin_Mesher.hxx +++ b/src/GMSHPlugin/GMSHPlugin_Mesher.hxx @@ -69,7 +69,6 @@ class GMSHPLUGIN_EXPORT GMSHPlugin_Mesher bool Evaluate(MapShapeNbElems& aResMap); private: - int _studyId; SMESH_Mesh* _mesh; const TopoDS_Shape& _shape; int _algo2d; diff --git a/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx b/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx index 03d8598..fded766 100644 --- a/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/GMSHPluginGUI_HypothesisCreator.cxx @@ -540,10 +540,8 @@ bool GMSHPluginGUI_HypothesisCreator::readParamsFromWidgets( GmshHypothesisData& GeomSelectionTools* GMSHPluginGUI_HypothesisCreator::getGeomSelectionTools() { - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - if (myGeomSelectionTools == NULL || myGeomSelectionTools->getMyStudy() != aStudy) { - delete myGeomSelectionTools; - myGeomSelectionTools = new GeomSelectionTools(aStudy); + if (myGeomSelectionTools == NULL) { + myGeomSelectionTools = new GeomSelectionTools(); } return myGeomSelectionTools; } -- 2.39.2