Padder smesh plugin in SSL mode

This commit is contained in:
Anthony Geay 2021-12-20 17:30:35 +01:00
parent 5c094a96e9
commit 189a27b3b2
9 changed files with 186 additions and 5 deletions

View File

@ -19,6 +19,7 @@
SET(_bin_SCRIPTS
SMESH_SalomeSessionless.py
MeshJobManager_SalomeSessionless.py
)
SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_PYTHON} DEF_PERMS)

View File

@ -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

View File

@ -17,9 +17,11 @@
# 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})

View 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 ;

View 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,

View File

@ -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());
}

View File

@ -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();

View File

@ -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();
}
}

View 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: