This commit is contained in:
Anthony Geay 2021-12-20 18:04:44 +01:00
parent f78cb36df7
commit 45f1540bdb
8 changed files with 181 additions and 1 deletions

View File

@ -19,6 +19,7 @@
SET(_bin_SCRIPTS SET(_bin_SCRIPTS
SMESH_SalomeSessionless.py SMESH_SalomeSessionless.py
MeshJobManager_SalomeSessionless.py
) )
SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_PYTHON} DEF_PERMS) 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 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
include(${SWIG_USE_FILE})
# --- options --- # --- options ---
# additional include directories
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${KERNEL_INCLUDE_DIRS} ${KERNEL_INCLUDE_DIRS}
${GEOM_INCLUDE_DIRS} ${GEOM_INCLUDE_DIRS}
${OpenCASCADE_INCLUDE_DIR} ${OpenCASCADE_INCLUDE_DIR}
@ -86,6 +88,28 @@ SET(SPADDERPluginTesterEngine_SOURCES
SPADDERPluginTester_i.cxx 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 --- # --- rules ---
ADD_LIBRARY(MeshJobManagerEngine ${MeshJobManagerEngine_SOURCES}) ADD_LIBRARY(MeshJobManagerEngine ${MeshJobManagerEngine_SOURCES})

View File

@ -83,6 +83,11 @@ static bool fexists(const char *filename)
return false; return false;
} }
Engines::EngineComponent_var RetrievePadderMeshJobManagerInstance()
{
}
// //
// ==================================================================== // ====================================================================
// Constructor/Destructor // Constructor/Destructor

View File

@ -43,6 +43,7 @@
#define MESHJOBMANAGERENGINE_EXPORT #define MESHJOBMANAGERENGINE_EXPORT
#endif #endif
Engines::EngineComponent_var RetrievePadderMeshJobManagerInstance();
class MESHJOBMANAGERENGINE_EXPORT MeshJobManager_i: public virtual POA_MESHJOB::MeshJobManager, class MESHJOBMANAGERENGINE_EXPORT MeshJobManager_i: public virtual POA_MESHJOB::MeshJobManager,
public Engines_Component_i public Engines_Component_i

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