]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
- Adding Load_ParallelComponent to LifeCycleCORBA
authorribes <ribes>
Fri, 13 Apr 2007 07:48:28 +0000 (07:48 +0000)
committerribes <ribes>
Fri, 13 Apr 2007 07:48:28 +0000 (07:48 +0000)
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx
src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i

index bdeddc58efab8b6ee28230dae812e721bc59ab23..7f6ad28ac0d06b4ea2c536e09f102f40134db7ae 100644 (file)
@@ -476,16 +476,47 @@ _LoadComponent(const Engines::MachineParameters& params,
   return myInstance._retn();
 }
 
+Engines::Component_ptr
+SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::MachineParameters& params,
+                                              const char *componentName,
+                                              int studyId)
+{
+  MESSAGE("Entering LoadParallelComponent");
+
+/*MESSAGE("Parameters : ");
+  MESSAGE("Container name : " << params.container_name);
+  MESSAGE("Number of component nodes : " << params.nb_component_nodes);
+  MESSAGE("Component Name : " << componentName);*/
+
+  MESSAGE("Building a list of machines");
+  Engines::MachineList_var listOfMachines = _ContManager->GetFittingResources(params, componentName);
+  if (listOfMachines->length() == 0)
+  {
+    INFOS("No matching machines founded !");
+    return Engines::Component::_nil();
+  }
 
+  MESSAGE("Starting Parallel Container");
+  Engines::Container_var cont = _ContManager->FindOrStartParallelContainer(params, listOfMachines);
+  if (CORBA::is_nil(cont)) {
+    INFOS("FindOrStartParallelContainer() returns a NULL container !");
+    return Engines::Component::_nil();
+  }
 
-
-
-
-
-
-
-
-
-
-
+  MESSAGE("Loading component library");
+  bool isLoadable = cont->load_component_Library(componentName);
+  if (!isLoadable) {
+    INFOS(componentName <<" library is not loadable !");
+    return Engines::Component::_nil();
+  }
+
+  MESSAGE("Creating component instance");
+  // @PARALLEL@ permits to identify that the component requested
+  // is a parallel component.
+  string name = string(componentName) + string("@PARALLEL@");
+  Engines::Component_var myInstance = cont->create_component_instance(name.c_str(), studyId);
+  if (CORBA::is_nil(myInstance))
+    INFOS("create_component_instance returns a NULL component !");
+  return myInstance._retn();
+}
 
index 5072ee4df80e609d7ed7a4e755f51cbd708e95e6..a8e0d5a883bc80078cca1c3097e695c57dcc302c 100644 (file)
@@ -39,7 +39,8 @@
 #include <Utils_SALOME_Exception.hxx>
 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
 #include CORBA_CLIENT_HEADER(SALOME_Component)
-
+#include <iostream>
+using namespace std;
 #ifdef WNT
 # if defined LIFECYCLECORBA_EXPORTS
 #  define LIFECYCLECORBA_EXPORT __declspec( dllexport )
@@ -85,6 +86,12 @@ public:
   FindOrLoad_Component(const char *containerName,
                       const char *componentName); // for compatibility
   
+  // Parallel extension
+  Engines::Component_ptr 
+    Load_ParallelComponent(const Engines::MachineParameters& params,
+                           const char *componentName,
+                           int studyId);
+
   bool isKnownComponentClass(const char *componentName);
 
   bool isMpiContainer(const Engines::MachineParameters& params)
index b017bb535e6d92487143ab50aaf2ec96c3c7c2e8..feaca2631c0683ebc91242c1bfbb6983ec10af4b 100644 (file)
@@ -163,6 +163,8 @@ struct omniORBpyAPI {
       param->nb_proc_per_node = 0;
       param->nb_node = 0;
       param->isMPI = false;
+      param->parallelLib = CORBA::string_dup("");
+      param->nb_component_nodes = 0;
       PyObject *key, *value;
       int pos = 0;
       while (PyDict_Next($input, &pos, &key, &value))
@@ -201,6 +203,14 @@ struct omniORBpyAPI {
            {
              param->isMPI = PyLong_AsLong(value);
            }
+         else if (strcmp(keystr,"parallelLib")==0)
+           {
+             param->parallelLib = CORBA::string_dup(PyString_AsString(value));
+           }
+         else if (strcmp(keystr,"nb_component_nodes")==0)
+           {
+             param->nb_component_nodes = PyLong_AsLong(value);
+           }
        }
       $1 = param;
     }