mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-15 20:00:37 +05:00
WIP
This commit is contained in:
parent
907c315580
commit
92bc8fb9a5
@ -42,6 +42,7 @@ INCLUDE_DIRECTORIES(
|
|||||||
${PROJECT_SOURCE_DIR}/src/Controls
|
${PROJECT_SOURCE_DIR}/src/Controls
|
||||||
${PROJECT_SOURCE_DIR}/src/SMESHClient
|
${PROJECT_SOURCE_DIR}/src/SMESHClient
|
||||||
${PROJECT_SOURCE_DIR}/src/MEDWrapper
|
${PROJECT_SOURCE_DIR}/src/MEDWrapper
|
||||||
|
${PROJECT_SOURCE_DIR}/src/SMESH_I
|
||||||
${PROJECT_BINARY_DIR}
|
${PROJECT_BINARY_DIR}
|
||||||
${PROJECT_BINARY_DIR}/idl
|
${PROJECT_BINARY_DIR}/idl
|
||||||
)
|
)
|
||||||
@ -73,6 +74,7 @@ SET(_link_LIBRARIES
|
|||||||
SMDS
|
SMDS
|
||||||
SMESHControls
|
SMESHControls
|
||||||
SMESHObject
|
SMESHObject
|
||||||
|
SMESHEngine
|
||||||
)
|
)
|
||||||
|
|
||||||
# --- headers ---
|
# --- headers ---
|
||||||
|
@ -104,6 +104,7 @@
|
|||||||
#include "SMESH_ControlsDef.hxx"
|
#include "SMESH_ControlsDef.hxx"
|
||||||
#include "SMESH_ScalarBarActor.h"
|
#include "SMESH_ScalarBarActor.h"
|
||||||
#include "SMESH_TypeFilter.hxx"
|
#include "SMESH_TypeFilter.hxx"
|
||||||
|
#include "SMESH_Component_Generator.hxx"
|
||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <LightApp_DataOwner.h>
|
#include <LightApp_DataOwner.h>
|
||||||
@ -2155,13 +2156,20 @@ SMESH::SMESH_Gen_var SMESHGUI::myComponentSMESH = SMESH::SMESH_Gen::_nil();
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
SMESHGUI::SMESHGUI() :
|
SMESHGUI::SMESHGUI() : SalomeApp_Module( "SMESH" )
|
||||||
SalomeApp_Module( "SMESH" )
|
|
||||||
{
|
{
|
||||||
if ( CORBA::is_nil( myComponentSMESH ) )
|
if ( CORBA::is_nil( myComponentSMESH ) )
|
||||||
{
|
{
|
||||||
CORBA::Boolean anIsEmbeddedMode;
|
CORBA::Boolean anIsEmbeddedMode;
|
||||||
|
SALOME_NamingService_Abstract *ns = SalomeApp_Application::namingService();
|
||||||
|
if( dynamic_cast<SALOME_NamingService *>(ns) )
|
||||||
myComponentSMESH = SMESH_Client::GetSMESHGen(getApp()->orb(),anIsEmbeddedMode);
|
myComponentSMESH = SMESH_Client::GetSMESHGen(getApp()->orb(),anIsEmbeddedMode);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Engines::EngineComponent_var comp = RetrieveSMESHInstance();
|
||||||
|
myComponentSMESH = SMESH::SMESH_Gen::_narrow(comp);
|
||||||
|
}
|
||||||
|
|
||||||
//MESSAGE("-------------------------------> anIsEmbeddedMode=" << anIsEmbeddedMode);
|
//MESSAGE("-------------------------------> anIsEmbeddedMode=" << anIsEmbeddedMode);
|
||||||
|
|
||||||
// 0019923: EDF 765 SMESH : default values of hypothesis
|
// 0019923: EDF 765 SMESH : default values of hypothesis
|
||||||
|
@ -31,6 +31,7 @@ INCLUDE_DIRECTORIES(
|
|||||||
${PROJECT_SOURCE_DIR}/src/Controls
|
${PROJECT_SOURCE_DIR}/src/Controls
|
||||||
${PROJECT_SOURCE_DIR}/src/SMDS
|
${PROJECT_SOURCE_DIR}/src/SMDS
|
||||||
${PROJECT_SOURCE_DIR}/src/SMESHDS
|
${PROJECT_SOURCE_DIR}/src/SMESHDS
|
||||||
|
${PROJECT_SOURCE_DIR}/src/SMESH_I
|
||||||
${PROJECT_SOURCE_DIR}/src/MEDWrapper
|
${PROJECT_SOURCE_DIR}/src/MEDWrapper
|
||||||
${PROJECT_SOURCE_DIR}/src/Driver
|
${PROJECT_SOURCE_DIR}/src/Driver
|
||||||
${PROJECT_SOURCE_DIR}/src/DriverMED
|
${PROJECT_SOURCE_DIR}/src/DriverMED
|
||||||
@ -111,6 +112,7 @@ SET(SMESHEngine_HEADERS
|
|||||||
SMESH_PreMeshInfo.hxx
|
SMESH_PreMeshInfo.hxx
|
||||||
SMESH_MeshPartDS.hxx
|
SMESH_MeshPartDS.hxx
|
||||||
SMESH.hxx
|
SMESH.hxx
|
||||||
|
SMESH_Component_Generator.hxx
|
||||||
)
|
)
|
||||||
|
|
||||||
# --- sources ---
|
# --- sources ---
|
||||||
@ -138,6 +140,7 @@ SET(SMESHEngine_SOURCES
|
|||||||
SMESH_NoteBook.cxx
|
SMESH_NoteBook.cxx
|
||||||
SMESH_Measurements_i.cxx
|
SMESH_Measurements_i.cxx
|
||||||
SMESH_PreMeshInfo.cxx
|
SMESH_PreMeshInfo.cxx
|
||||||
|
SMESH_Component_Generator.cxx
|
||||||
)
|
)
|
||||||
|
|
||||||
# --- rules ---
|
# --- rules ---
|
||||||
|
55
src/SMESH_I/SMESH_Component_Generator.cxx
Normal file
55
src/SMESH_I/SMESH_Component_Generator.cxx
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
// 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;
|
||||||
|
}
|
28
src/SMESH_I/SMESH_Component_Generator.hxx
Normal file
28
src/SMESH_I/SMESH_Component_Generator.hxx
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// 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();
|
@ -19,32 +19,15 @@
|
|||||||
|
|
||||||
#include "SMeshHelper.h"
|
#include "SMeshHelper.h"
|
||||||
|
|
||||||
#include "SMESH_Gen_No_Session_i.hxx"
|
|
||||||
#include "SALOME_Container_i.hxx"
|
|
||||||
#include "SALOME_KernelServices.hxx"
|
#include "SALOME_KernelServices.hxx"
|
||||||
|
|
||||||
|
#include "SMESH_Component_Generator.hxx"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
std::string BuildSMESHInstanceInternal()
|
std::string BuildSMESHInstanceInternal()
|
||||||
{
|
{
|
||||||
CORBA::ORB_var orb;
|
Engines::EngineComponent_var zeRef = RetrieveSMESHInstance();
|
||||||
{ int argc(0); orb = CORBA::ORB_init(argc,nullptr); }
|
CORBA::String_var ior = KERNEL::getORB()->object_to_string(zeRef);
|
||||||
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());
|
return std::string(ior.in());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user