Salome HOME
#23999 EDF 22760 - integration of dev in SMESH (from branch 'gni/adaptation')
authoreap <eap@opencascade.com>
Sat, 20 Mar 2021 13:01:14 +0000 (16:01 +0300)
committereap <eap@opencascade.com>
Sat, 20 Mar 2021 13:01:14 +0000 (16:01 +0300)
16 files changed:
CMakeLists.txt
doc/salome/examples/shaper_smesh_groups_without_session.py [new file with mode: 0644]
doc/salome/examples/tests.set
doc/salome/gui/SMESH/conf.py.in
resources/CMakeLists.txt
src/SMESHClient/CMakeLists.txt
src/SMESHClient/SMESH_Client.cxx
src/SMESHGUI/CMakeLists.txt
src/SMESHGUI/SMESHGUI.cxx
src/SMESH_I/CMakeLists.txt
src/SMESH_I/SMESH_Component_Generator.cxx [new file with mode: 0644]
src/SMESH_I/SMESH_Component_Generator.hxx [new file with mode: 0644]
src/SMESH_I/SMESH_Gen_No_Session_i.cxx
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Gen_i.hxx
src/SMESH_SWIG/SMeshHelper.cxx

index 651fbb877756f3cbcce0fe4437cc7bfbb0de06e1..242782dc419e25991699cecc0753e2f3acacbf4e 100644 (file)
@@ -130,8 +130,12 @@ IF(SALOME_BUILD_TESTS)
 ENDIF()
 IF(SALOME_BUILD_DOC)
   FIND_PACKAGE(SalomeDoxygen)
-  SET(Sphinx_EXTENSIONS sphinxcontrib.napoleon)
   FIND_PACKAGE(SalomeSphinx)
+  INCLUDE(UseSphinx)
+  SPHINX_CHECK_EXTENSIONS(sphinx_rtd_theme)
+  IF(SPHINX_VERSION VERSION_LESS "1.3")
+    SPHINX_CHECK_EXTENSIONS(sphinxcontrib.napoleon)
+  ENDIF()
   SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
   SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC)
 ENDIF()
diff --git a/doc/salome/examples/shaper_smesh_groups_without_session.py b/doc/salome/examples/shaper_smesh_groups_without_session.py
new file mode 100644 (file)
index 0000000..592dc50
--- /dev/null
@@ -0,0 +1,88 @@
+
+"""
+Check that creating a mesh on a shaperstudy object does not raise orb not found in GetExistingSubObjects.
+It is called in SMESH GUI on Create mesh's Apply, in SMESHGUI_MeshOp::createSubMeshOnInternalEdges.
+We explicitly call GetExistingSubObjects here to be able to test it in python.
+"""
+
+import sys
+import salome
+
+salome.standalone()
+salome.salome_init()
+
+###
+### SHAPER component
+###
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+
+### Create Part
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+
+### Create Box
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+
+### Create Group
+Group_1 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]")])
+Group_1.setName("edge_ox")
+Group_1.result().setName("edge_ox")
+
+### Create Group
+Group_2 = model.addGroup(Part_1_doc, "Edges", [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]")])
+Group_2.setName("edge_oz")
+Group_2.result().setName("edge_oz")
+
+model.end()
+
+###
+### SHAPERSTUDY component
+###
+
+model.publishToShaperStudy()
+import SHAPERSTUDY
+Box_1_1, edge_ox, edge_oz = SHAPERSTUDY.shape(model.featureStringId(Box_1))
+
+###
+### SMESH component
+###
+
+import  SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+
+smesh = smeshBuilder.New()
+#smesh.SetEnablePublish( False ) # Set to False to avoid publish in study if not needed or in some particular situations:
+                                 # multiples meshes built in parallel, complex and numerous mesh edition (performance)
+
+Mesh_1 = smesh.Mesh(Box_1_1)
+
+Regular_1D = Mesh_1.Segment()
+Local_Length_1 = Regular_1D.LocalLength(5)
+
+MEFISTO_2D = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO)
+
+ok = Mesh_1.Compute()
+
+if not ok:
+  raise Exception("Error when computing Mesh_1")
+
+edge_ox_1 = Mesh_1.GroupOnGeom(edge_ox,'edge_ox',SMESH.EDGE)
+edge_oz_1 = Mesh_1.GroupOnGeom(edge_oz,'edge_oz',SMESH.EDGE)
+
+# check that ObjectToSObject works (called in GetExistingSubObjects)
+Box_1_1_sobj = salome.ObjectToSObject(Box_1_1)
+if not Box_1_1_sobj:
+  raise Exception("No SObject for Box_1_1")
+
+# check that GetExistingSubObjects works (called in SMESHGUI_MeshOp::createSubMeshOnInternalEdges)
+shaperBuilder = salome.lcc.FindOrLoadComponent("FactoryServer","SHAPERSTUDY")
+sOp = shaperBuilder.GetIShapesOperations()
+geomGroups = sOp.GetExistingSubObjects(Box_1_1, True)
+
+assert(len(geomGroups)==2)
+
+assert(Mesh_1.GetMesh().NbTriangles()>16)
index 5b7fb54df870f8583c17ac10ec25589ebe4a26ba..02ffd1e76d0c6ca64029c45a669f770ff7b926e6 100644 (file)
@@ -189,6 +189,7 @@ SET(GOOD_TESTS
 set(SESSION_FREE_TESTS
   basic_geom_smesh_without_session.py
   basic_shaper_smesh_without_session.py
+  shaper_smesh_groups_without_session.py
 )
 
 SET(EXAMPLES_TESTS ${BAD_TESTS} ${GOOD_TESTS} ${SESSION_FREE_TESTS} testme.py)
index 66efe32d3c7318abd5d6c5c736683895d4b1e8e6..be0975ff7cd9159d19b0519dbb70f7cf50a432f5 100644 (file)
@@ -11,6 +11,7 @@
 # All configuration values have a default; values that are commented out
 # serve to show the default.
 
+import importlib
 import sys, os
 import sphinx
 
@@ -25,17 +26,20 @@ import sphinx
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
 extensions = ['sphinx.ext.autodoc','sphinx.ext.autosummary']
-try:
-  import sphinxcontrib.napoleon
-  extensions += ['sphinxcontrib.napoleon']
-except:
-  pass
-try:
-  import sphinx_rtd_theme
-  extensions += ['sphinx_rtd_theme']
-  use_rtd_theme = True
-except:
-  use_rtd_theme = False
+# Optional extensions
+extra_extensions = ['sphinx_rtd_theme']
+if sphinx.version_info[:2] < (1,3):
+    extra_extensions += ['sphinxcontrib.napoleon']
+else:
+    extra_extensions += ['sphinx.ext.napoleon']
+for ext in extra_extensions:
+    try:
+        importlib.import_module(ext)
+        extensions.append(ext)
+        globals().update({'use_{}'.format(ext):True})
+    except:
+        globals().update({'use_{}'.format(ext):False})
+
 #add pdfbuilder to build a pdf with rst2pdf
 #extensions = ['rst2pdf.pdfbuilder']
 
@@ -111,7 +115,7 @@ pygments_style = 'sphinx'
 
 # The theme to use for HTML and HTML Help pages.  Major themes that come with
 # Sphinx are currently 'default' and 'sphinxdoc'.
-if use_rtd_theme:
+if use_sphinx_rtd_theme:
   html_theme = 'sphinx_rtd_theme'
 else:
   html_theme = 'default' if sphinx.version_info[:2] < (1,3) else 'classic'
index 1306b1319958edf6e2552732c42ffd708c01745e..3d9bae66761808c60a4c455a375b509d99430d67 100644 (file)
@@ -248,5 +248,6 @@ SET(SMESH_RESOURCES_FILES
 INSTALL(FILES ${SMESH_RESOURCES_FILES} DESTINATION ${SALOME_SMESH_INSTALL_RES_DATA})
 
 SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml INSTALL ${SALOME_SMESH_INSTALL_RES_DATA})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml RENAME SalomeAppSL.xml DESTINATION ${SALOME_SMESH_INSTALL_RES_DATA})
 SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/StdMeshers.xml.in ${CMAKE_CURRENT_BINARY_DIR}/StdMeshers.xml INSTALL ${SALOME_SMESH_INSTALL_RES_DATA})
 SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SMESHCatalog.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SMESHCatalog.xml INSTALL ${SALOME_SMESH_INSTALL_RES_DATA})
index 1e67b66241d336bfb35cb960c904764ba7b2fa12..9e7a11e75a370fa03841483bdf7b8f38d94fefe3 100644 (file)
@@ -36,6 +36,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/SMESHDS
   ${PROJECT_SOURCE_DIR}/src/SMESH
   ${PROJECT_SOURCE_DIR}/src/SMESHUtils
+  ${PROJECT_SOURCE_DIR}/src/SMESH_I
   ${PROJECT_BINARY_DIR}/idl
 )
 
@@ -69,6 +70,7 @@ SET(_link_LIBRARIES
   SMESHimpl
   SMESHDS
   SMESHControls
+  SMESHEngine 
   MEDWrapper
 )
 
index 0c1b1aeabd9e365bac26bb24e5ba8f89825f2a2a..66d071a07614ca97a4f69e2d2a655bb1930979ea 100644 (file)
@@ -28,6 +28,7 @@
 #include "SMESHDS_Mesh.hxx"
 #include "SMESHDS_Script.hxx"
 #include "SMESH_Mesh.hxx"
+#include "SMESH_Component_Generator.hxx"
 
 #include "SALOME_NamingService.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
@@ -783,26 +784,35 @@ SMESH_Client::GetSMESHGen(CORBA::ORB_ptr theORB,
 {
   static SMESH::SMESH_Gen_var aMeshGen;
 
-  if(CORBA::is_nil(aMeshGen.in())){
+  if(CORBA::is_nil(aMeshGen.in()))
+  {
+    Engines::EngineComponent_var isCompoInSSLMode = GetSMESHInstanceHasThis();
+    if( CORBA::is_nil(isCompoInSSLMode) )
+    {
 #ifdef WIN32
-    long aClientPID = (long)_getpid();
+      long aClientPID = (long)_getpid();
 #else
-    long aClientPID =  (long)getpid();
+      long aClientPID =  (long)getpid();
 #endif
 
-    SALOME_NamingService aNamingService(theORB);
-    SALOME_LifeCycleCORBA aLifeCycleCORBA(&aNamingService);
-    Engines::EngineComponent_var aComponent = aLifeCycleCORBA.FindOrLoad_Component("FactoryServer","SMESH");
-    aMeshGen = SMESH::SMESH_Gen::_narrow(aComponent);
+      SALOME_NamingService aNamingService(theORB);
+      SALOME_LifeCycleCORBA aLifeCycleCORBA(&aNamingService);
+      Engines::EngineComponent_var aComponent = aLifeCycleCORBA.FindOrLoad_Component("FactoryServer","SMESH");
+      aMeshGen = SMESH::SMESH_Gen::_narrow(aComponent);
 
-    std::string aClientHostName = Kernel_Utils::GetHostname();
-    Engines::Container_var aServerContainer = aMeshGen->GetContainerRef();
-    CORBA::String_var aServerHostName = aServerContainer->getHostName();
-    CORBA::Long aServerPID = aServerContainer->getPID();
-    aMeshGen->SetEmbeddedMode((aClientPID == aServerPID) && (aClientHostName == aServerHostName.in()));
+      std::string aClientHostName = Kernel_Utils::GetHostname();
+      Engines::Container_var aServerContainer = aMeshGen->GetContainerRef();
+      CORBA::String_var aServerHostName = aServerContainer->getHostName();
+      CORBA::Long aServerPID = aServerContainer->getPID();
+      aMeshGen->SetEmbeddedMode((aClientPID == aServerPID) && (aClientHostName == aServerHostName.in()));
+    }
+    else
+    {
+      aMeshGen = SMESH::SMESH_Gen::_narrow(isCompoInSSLMode);
+    }
+    
   }
   theIsEmbeddedMode = aMeshGen->IsEmbeddedMode();
-
   return aMeshGen;
 }
 
index 237f63801af93a9f2685296bf3e33412b340e579..4f50dbc8e7d01bf44df59a10ee9cd9429e38e4e7 100644 (file)
@@ -42,6 +42,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/Controls
   ${PROJECT_SOURCE_DIR}/src/SMESHClient
   ${PROJECT_SOURCE_DIR}/src/MEDWrapper
+  ${PROJECT_SOURCE_DIR}/src/SMESH_I
   ${PROJECT_BINARY_DIR}
   ${PROJECT_BINARY_DIR}/idl
   ${MEDCOUPLING_INCLUDE_DIRS}
@@ -74,6 +75,7 @@ SET(_link_LIBRARIES
   SMDS
   SMESHControls
   SMESHObject
+  SMESHEngine
   ${MEDCoupling_medloader}
 )
 
index a16812234d7f1d945935710d26415e73b295ddfb..762c7cb341a911478a46e8f9db8087f81a298abd 100644 (file)
 #include "SMESH_ControlsDef.hxx"
 #include "SMESH_ScalarBarActor.h"
 #include "SMESH_TypeFilter.hxx"
+#include "SMESH_Component_Generator.hxx"
 
 // SALOME GUI includes
 #include <LightApp_DataOwner.h>
@@ -2156,13 +2157,20 @@ SMESH::SMESH_Gen_var SMESHGUI::myComponentSMESH = SMESH::SMESH_Gen::_nil();
  *
  */
 //=============================================================================
-SMESHGUI::SMESHGUI() :
-SalomeApp_Module( "SMESH" )
+SMESHGUI::SMESHGUI() : SalomeApp_Module( "SMESH" )
 {
   if ( CORBA::is_nil( myComponentSMESH ) )
   {
     CORBA::Boolean anIsEmbeddedMode;
-    myComponentSMESH = SMESH_Client::GetSMESHGen(getApp()->orb(),anIsEmbeddedMode);
+    SALOME_NamingService_Abstract *ns = SalomeApp_Application::namingService();
+    if( dynamic_cast<SALOME_NamingService *>(ns) )
+      myComponentSMESH = SMESH_Client::GetSMESHGen(getApp()->orb(),anIsEmbeddedMode);
+    else
+      {
+        Engines::EngineComponent_var comp = RetrieveSMESHInstance();
+        myComponentSMESH = SMESH::SMESH_Gen::_narrow(comp);
+      }
+    
     //MESSAGE("-------------------------------> anIsEmbeddedMode=" << anIsEmbeddedMode);
 
     //  0019923: EDF 765 SMESH : default values of hypothesis
index 9b2d937ffa304b216248e76c408e8238d0847abe..b9df761dd2f511c7492e19606d7c740c939a8b80 100644 (file)
@@ -31,16 +31,15 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/Controls
   ${PROJECT_SOURCE_DIR}/src/SMDS
   ${PROJECT_SOURCE_DIR}/src/SMESHDS
+  ${PROJECT_SOURCE_DIR}/src/SMESH_I
   ${PROJECT_SOURCE_DIR}/src/MEDWrapper
   ${PROJECT_SOURCE_DIR}/src/Driver
   ${PROJECT_SOURCE_DIR}/src/DriverMED
   ${PROJECT_SOURCE_DIR}/src/DriverCGNS
   ${PROJECT_SOURCE_DIR}/src/SMESH
   ${PROJECT_SOURCE_DIR}/src/SMESHUtils
-  #~${PROJECT_SOURCE_DIR}/src/ADAPT
   ${PROJECT_BINARY_DIR}
   ${PROJECT_BINARY_DIR}/idl
-  #~${PROJECT_BINARY_DIR}/ADAPT
   ${MEDCOUPLING_INCLUDE_DIRS}
 )
 
@@ -115,6 +114,7 @@ SET(SMESHEngine_HEADERS
   SMESH_PreMeshInfo.hxx
   SMESH_MeshPartDS.hxx
   SMESH.hxx
+  SMESH_Component_Generator.hxx
   MG_ADAPT_i.hxx
 )
 
@@ -143,6 +143,7 @@ SET(SMESHEngine_SOURCES
   SMESH_NoteBook.cxx
   SMESH_Measurements_i.cxx
   SMESH_PreMeshInfo.cxx
+  SMESH_Component_Generator.cxx
   MG_ADAPT_i.cxx
 )
 
diff --git a/src/SMESH_I/SMESH_Component_Generator.cxx b/src/SMESH_I/SMESH_Component_Generator.cxx
new file mode 100644 (file)
index 0000000..a1819c5
--- /dev/null
@@ -0,0 +1,60 @@
+// Copyright (C) 2021  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SMESH_Component_Generator.hxx"
+
+#include "SMESH_Gen_No_Session_i.hxx"
+#include "SALOME_Container_i.hxx"
+#include "SALOME_KernelServices.hxx"
+
+#include <cstring>
+
+static Engines::EngineComponent_var _unique_compo;
+
+Engines::EngineComponent_var RetrieveSMESHInstance()
+{
+  if (CORBA::is_nil(_unique_compo))
+  {
+    CORBA::ORB_var orb;
+    {
+      int argc(0);
+      orb = CORBA::ORB_init(argc, nullptr);
+    }
+    CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+    PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
+    PortableServer::POAManager_var pman = poa->the_POAManager();
+    CORBA::PolicyList policies;
+    policies.length(0);
+    Engines_Container_i *cont(KERNEL::getContainerSA());
+    PortableServer::ObjectId *conId(cont->getCORBAId());
+    //
+    pman->activate();
+    //
+    SMESH_Gen_No_Session_i *servant = new SMESH_Gen_No_Session_i(orb, poa, conId, "SMESH_inst_2", "SMESH");
+    PortableServer::ObjectId *zeId = servant->getId();
+    CORBA::Object_var zeRef = poa->id_to_reference(*zeId);
+    _unique_compo = Engines::EngineComponent::_narrow(zeRef);
+  }
+  return _unique_compo;
+}
+
+Engines::EngineComponent_var GetSMESHInstanceHasThis()
+{
+  return _unique_compo;
+}
diff --git a/src/SMESH_I/SMESH_Component_Generator.hxx b/src/SMESH_I/SMESH_Component_Generator.hxx
new file mode 100644 (file)
index 0000000..db796a5
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright (C) 2021  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#include "SMESH.hxx"
+
+#include "SALOMEconfig.h"
+
+#include CORBA_SERVER_HEADER(SMESH_Gen)
+
+SMESH_I_EXPORT Engines::EngineComponent_var RetrieveSMESHInstance();
+SMESH_I_EXPORT Engines::EngineComponent_var GetSMESHInstanceHasThis();
index 4bf1abf392e2a756a403eef5254e774dda94b2eb..db261e7d419f675da56607298d50e581b41830a0 100644 (file)
@@ -20,6 +20,7 @@
 #include "SMESH_Gen_No_Session_i.hxx"
 #include "SALOMEDS_Study_i.hxx"
 #include "SALOME_KernelServices.hxx"
+#include "SALOME_Fake_NamingService.hxx"
 #include "SALOME_ModuleCatalog_impl.hxx"
 
 SMESH_Gen_No_Session_i::SMESH_Gen_No_Session_i( CORBA::ORB_ptr orb,
@@ -28,7 +29,7 @@ SMESH_Gen_No_Session_i::SMESH_Gen_No_Session_i( CORBA::ORB_ptr orb,
                                                 const char*               instanceName,
                                                 const char*               interfaceName):SMESH_Gen_i(orb,poa,contId,instanceName,interfaceName,false)
 {
-
+  myNS = new SALOME_Fake_NamingService;
 }
 
 GEOM::GEOM_Gen_var SMESH_Gen_No_Session_i::GetGeomEngine( bool isShaper )
index 66f8570a3e32ba65299fd78a702c1b8e5ee42959..e89466cfbdc42868373a38f9e039a2d55e9b2525 100644 (file)
@@ -164,9 +164,9 @@ static int MYDEBUG = 0;
 GEOM::GEOM_Gen_var      SMESH_Gen_i::myGeomGen;
 CORBA::ORB_var          SMESH_Gen_i::myOrb;
 PortableServer::POA_var SMESH_Gen_i::myPoa;
-SALOME_NamingService*   SMESH_Gen_i::myNS  = NULL;
-SALOME_LifeCycleCORBA*  SMESH_Gen_i::myLCC = NULL;
-SMESH_Gen_i*            SMESH_Gen_i::mySMESHGen = NULL;
+SALOME_NamingService_Abstract*   SMESH_Gen_i::myNS  = nullptr;
+SALOME_LifeCycleCORBA*  SMESH_Gen_i::myLCC = nullptr;
+SMESH_Gen_i*            SMESH_Gen_i::mySMESHGen = nullptr;
 
 
 const int nbElemPerDiagonal = 10;
@@ -245,7 +245,7 @@ CORBA::Object_var SMESH_Gen_i::SObjectToObject( SALOMEDS::SObject_ptr theSObject
  */
 //=============================================================================
 
-SALOME_NamingService* SMESH_Gen_i::GetNS()
+SALOME_NamingService_Abstract* SMESH_Gen_i::GetNS()
 {
   if ( myNS == NULL ) {
     myNS = SINGLETON_<SALOME_NamingService>::Instance();
@@ -340,7 +340,7 @@ SMESH_Gen_i::SMESH_Gen_i( CORBA::ORB_ptr            orb,
   // SMESH_Gen_i::SetEmbeddedMode(), have wrong IsEmbeddedMode flag
   if(checkNS)
   {
-    if ( SALOME_NamingService* ns = GetNS() )
+    if ( SALOME_NamingService_Abstract* ns = GetNS() )
     {
       CORBA::Object_var obj = ns->Resolve( "/Kernel/Session" );
       SALOME::Session_var session = SALOME::Session::_narrow( obj ) ;
index 817abd07c790003944d31648f1abe2a9d151e496..d5c6be39962da6c95e1a27520a19dcec153d67d2 100644 (file)
@@ -104,7 +104,7 @@ public:
   // Get SMESH module's POA object
   static PortableServer::POA_var GetPOA() { return myPoa;}
   // Get Naming Service object
-  static SALOME_NamingService* GetNS();
+  static SALOME_NamingService_Abstract* GetNS();
   // Get SALOME_LifeCycleCORBA object
   static SALOME_LifeCycleCORBA* GetLCC();
   // Retrieve and get GEOM engine reference
@@ -650,10 +650,10 @@ private:
 
 protected:
   static GEOM::GEOM_Gen_var      myGeomGen;
+  static SALOME_NamingService_Abstract*   myNS;          // Naming Service
 private:
   static CORBA::ORB_var          myOrb;         // ORB reference
   static PortableServer::POA_var myPoa;         // POA reference
-  static SALOME_NamingService*   myNS;          // Naming Service
   static SALOME_LifeCycleCORBA*  myLCC;         // Life Cycle CORBA
   static SMESH_Gen_i*            mySMESHGen;    // Point to last created instance of the class
   ::SMESH_Gen                    myGen;         // SMESH_Gen local implementation
index 036ef29735dd00c80d7a3c763ec0dde17afa623e..ee2d54b05f57210512fe23eccb0696af91b19bcc 100644 (file)
 
 #include "SMeshHelper.h"
 
-#include "SMESH_Gen_No_Session_i.hxx"
-#include "SALOME_Container_i.hxx"
 #include "SALOME_KernelServices.hxx"
 
+#include "SMESH_Component_Generator.hxx"
+
 #include <cstring>
 
 std::string BuildSMESHInstanceInternal()
 {
-    CORBA::ORB_var orb;
-    { int argc(0); orb = CORBA::ORB_init(argc,nullptr); }
-    CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
-    PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
-    PortableServer::POAManager_var pman = poa->the_POAManager();
-    PortableServer::ObjectId_var conId;
-    //
-    {
-        char *argv[4] = {"Container","FactoryServer","SMESH",nullptr};
-        Engines_Container_i *cont = new Engines_Container_i(orb,poa,"FactoryServer",2,argv,false,false);
-        conId = poa->activate_object(cont);
-    }
-    //
-    pman->activate();
-    //
-    SMESH_Gen_No_Session_i *servant = new SMESH_Gen_No_Session_i(orb,poa,const_cast<PortableServer::ObjectId*>(&conId.in()),"SMESH_inst_2","SMESH");
-    PortableServer::ObjectId *zeId = servant->getId();
-    CORBA::Object_var zeRef = poa->id_to_reference(*zeId);
-    CORBA::String_var ior = orb->object_to_string(zeRef);
-    return std::string(ior.in());
+  Engines::EngineComponent_var zeRef = RetrieveSMESHInstance();
+  CORBA::String_var ior = KERNEL::getORB()->object_to_string(zeRef);
+  return std::string(ior.in());
 }