]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Padder smesh plugin in SSL mode
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 20 Dec 2021 16:30:35 +0000 (17:30 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 27 Dec 2021 11:58:04 +0000 (12:58 +0100)
src/SalomeSessionless/CMakeLists.txt
src/SalomeSessionless/MeshJobManager_SalomeSessionless.py [new file with mode: 0644]
src/Tools/padder/meshjob/impl/CMakeLists.txt
src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx
src/Tools/padder/meshjob/impl/MeshJobManager_i.hxx
src/Tools/padder/meshjob/impl/SMeshPadderHelper.cxx [new file with mode: 0644]
src/Tools/padder/meshjob/impl/SMeshPadderHelper.h [new file with mode: 0644]
src/Tools/padder/meshjob/impl/SMeshPadderHelper.i [new file with mode: 0644]
src/Tools/padder/spadderpy/__init__.py

index b21eaa20ead57d49775465424de69c938b8f03ae..dc1c5dc956fa8b443eb640bdef35458259ae36ca 100644 (file)
@@ -19,6 +19,7 @@
 
 SET(_bin_SCRIPTS
   SMESH_SalomeSessionless.py
+  MeshJobManager_SalomeSessionless.py
 )
 
 SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_PYTHON} DEF_PERMS)
diff --git a/src/SalomeSessionless/MeshJobManager_SalomeSessionless.py b/src/SalomeSessionless/MeshJobManager_SalomeSessionless.py
new file mode 100644 (file)
index 0000000..50f5d1f
--- /dev/null
@@ -0,0 +1,28 @@
+#  -*- coding: iso-8859-1 -*-
+# 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
+#
+
+def buildInstance(orb):
+    import SMeshPadderHelper
+    padder_ior = SMeshPadderHelper.BuildPadderMeshJobManagerInstance()
+    import MESHJOB
+    import CORBA
+    orb=CORBA.ORB_init([''])
+    padderInst = orb.string_to_object(padder_ior)
+    return padderInst, orb
index dedd03cb5a31734c8f422e254e1801ad81b86e4f..6e555a7a470002e03da9502fc092d3a2398a9161 100644 (file)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+include(${SWIG_USE_FILE})
+
 # --- options ---
-# additional include directories
 INCLUDE_DIRECTORIES(
+  ${CMAKE_CURRENT_SOURCE_DIR}
   ${KERNEL_INCLUDE_DIRS}
   ${GEOM_INCLUDE_DIRS}
   ${OpenCASCADE_INCLUDE_DIR}
@@ -86,6 +88,28 @@ SET(SPADDERPluginTesterEngine_SOURCES
   SPADDERPluginTester_i.cxx
 )
 
+# - swiggy pop
+
+SET(SMeshPadderHelper_HEADERS SMeshPadderHelper.h SMeshPadderHelper.i)
+SET(SMeshPadderHelper_SOURCES SMeshPadderHelper.cxx ${SMeshPadderHelper_HEADERS})
+SET_SOURCE_FILES_PROPERTIES(SMeshPadderHelper.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(SMeshPadderHelper.i PROPERTIES SWIG_FLAGS "-py3")
+SET_SOURCE_FILES_PROPERTIES(SMeshPadderHelper_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H")
+SET(_swig_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/SMeshPadderHelper.py )
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") 
+  SWIG_ADD_MODULE(SMeshPadderHelper python ${SMeshPadderHelper_SOURCES})
+ELSE()
+  SWIG_ADD_LIBRARY(SMeshPadderHelper LANGUAGE python SOURCES ${SMeshPadderHelper_SOURCES})
+ENDIF()
+SWIG_LINK_LIBRARIES(SMeshPadderHelper ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} MeshJobManagerEngine )
+SWIG_CHECK_GENERATION(SMeshPadderHelper)
+IF(WIN32)
+  SET_TARGET_PROPERTIES(_SMeshPadderHelper PROPERTIES DEBUG_OUTPUT_NAME _SMeshPadderHelper_d)
+ENDIF(WIN32)
+install(TARGETS _SMeshPadderHelper DESTINATION ${SALOME_INSTALL_LIBS})
+install(FILES ${SMeshPadderHelper_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
+SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}"  ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_SMeshPadderHelper_REAL_NAME}")
+
 # --- rules ---
 
 ADD_LIBRARY(MeshJobManagerEngine ${MeshJobManagerEngine_SOURCES})
index a8b0295a826386d957c25cdfb79ece1e48064cd6..10bae23e7129a6941484207fdad401f53505360b 100644 (file)
@@ -83,6 +83,11 @@ static bool fexists(const char *filename)
   return false;
 }
 
+Engines::EngineComponent_var RetrievePadderMeshJobManagerInstance()
+{
+
+}
+
 //
 // ====================================================================
 // Constructor/Destructor
@@ -92,8 +97,9 @@ MeshJobManager_i::MeshJobManager_i(CORBA::ORB_ptr orb,
                                    PortableServer::POA_ptr poa,
                                    PortableServer::ObjectId * contId,
                                    const char *instanceName,
-                                   const char *interfaceName)
-  : Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
+                                   const char *interfaceName,
+                                   bool checkNS, bool regist)
+  : Engines_Component_i(orb, poa, contId, instanceName, interfaceName, checkNS, regist)
 {
   LOG("Activating MESHJOB::MeshJobManager object");
   _thisObj = this ;
index e731371ff8a8a770b4ebdc9be1351598e5fbc48b..9c9968f10551ec9fe8022564767a642ed0cda84a 100644 (file)
@@ -43,6 +43,7 @@
  #define MESHJOBMANAGERENGINE_EXPORT
 #endif
 
+Engines::EngineComponent_var RetrievePadderMeshJobManagerInstance();
 
 class MESHJOBMANAGERENGINE_EXPORT MeshJobManager_i: public virtual POA_MESHJOB::MeshJobManager,
                                                     public Engines_Component_i
@@ -50,7 +51,7 @@ class MESHJOBMANAGERENGINE_EXPORT MeshJobManager_i: public virtual POA_MESHJOB::
 public:
   MeshJobManager_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa,
                    PortableServer::ObjectId * contId,
-                   const char *instanceName, const char *interfaceName);
+                   const char *instanceName, const char *interfaceName, bool checkNS = true, bool regist = true);
   ~MeshJobManager_i();
 
   bool           configure  (const char *configId,
diff --git a/src/Tools/padder/meshjob/impl/SMeshPadderHelper.cxx b/src/Tools/padder/meshjob/impl/SMeshPadderHelper.cxx
new file mode 100644 (file)
index 0000000..cc51e5a
--- /dev/null
@@ -0,0 +1,62 @@
+// 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 "SMeshPadderHelper.h"
+
+#include "MeshJobManager_i.hxx"
+#include "SALOME_Container_i.hxx"
+#include "SALOME_KernelServices.hxx"
+
+#include "SALOME_Fake_NamingService.hxx"
+
+static Engines::EngineComponent_var _unique_compo;
+
+Engines::EngineComponent_var BuildPadderMeshJobManagerInstance()
+{
+  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);
+    auto *cont(KERNEL::getContainerSA());
+    PortableServer::ObjectId *conId(cont->getCORBAId());
+    //
+    pman->activate();
+    //
+    MeshJobManager_i *servant = new MeshJobManager_i(orb, poa, conId, "MeshJobManager_inst_3", "MeshJobManager", false, false);
+    PortableServer::ObjectId *zeId = servant->getId();
+    CORBA::Object_var zeRef = poa->id_to_reference(*zeId);
+    _unique_compo = Engines::EngineComponent::_narrow(zeRef);
+  }
+  return _unique_compo;
+}
+
+std::string BuildPadderMeshJobManagerInstanceInternal()
+{
+  Engines::EngineComponent_var zeRef = BuildPadderMeshJobManagerInstance();
+  CORBA::String_var ior = KERNEL::getORB()->object_to_string(zeRef);
+  return std::string(ior.in());
+}
diff --git a/src/Tools/padder/meshjob/impl/SMeshPadderHelper.h b/src/Tools/padder/meshjob/impl/SMeshPadderHelper.h
new file mode 100644 (file)
index 0000000..afd7594
--- /dev/null
@@ -0,0 +1,25 @@
+// 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 <string>
+
+std::string BuildPadderMeshJobManagerInstanceInternal();
+
diff --git a/src/Tools/padder/meshjob/impl/SMeshPadderHelper.i b/src/Tools/padder/meshjob/impl/SMeshPadderHelper.i
new file mode 100644 (file)
index 0000000..db619fc
--- /dev/null
@@ -0,0 +1,34 @@
+// 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
+//
+
+%module SMeshPadderHelper
+
+%include "std_string.i"
+
+%{
+#include "SMeshPadderHelper.h"
+%}
+
+%inline
+{
+  std::string BuildPadderMeshJobManagerInstance()
+  {
+    return BuildPadderMeshJobManagerInstanceInternal();
+  }
+}
index 8a1128e9b79d795f363936c0ec73d91fc50fcd29..13ec28d170b7296378db3b89e7895834c84d5d1d 100644 (file)
@@ -94,7 +94,7 @@ def getSpadderCatalogFilename():
 def loadSpadderCatalog():
     import salome
     salome.salome_init()
-    obj = salome.naming_service.Resolve('Kernel/ModulCatalog')
+    obj = salome.naming_service.Resolve('/Kernel/ModulCatalog')
     import SALOME_ModuleCatalog
     catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
     if not catalog: