Salome HOME
only default constructor is needed for MPIObject
authorsecher <secher>
Tue, 18 May 2010 14:36:51 +0000 (14:36 +0000)
committersecher <secher>
Tue, 18 May 2010 14:36:51 +0000 (14:36 +0000)
src/MPIContainer/MPIContainer_i.cxx
src/MPIContainer/MPIContainer_i.hxx
src/MPIContainer/MPIObject_i.cxx
src/MPIContainer/MPIObject_i.hxx
src/MPIContainer/SALOME_MPIContainer.cxx
src/TestMPIContainer/TestMPIComponentEngine.cxx
src/TestMPIContainer/TestMPIComponentEngine.hxx

index a4b8acdc4e7129db0f2dd3c797ddd045d3751dc1..e1ca6cc6b75939982e5d0cea5837b80c166211d3 100644 (file)
 #include "Container_init_python.hxx"
 
 // L'appel au registry SALOME ne se fait que pour le process 0
-Engines_MPIContainer_i::Engines_MPIContainer_i(int nbproc, int numproc,
-                                               CORBA::ORB_ptr orb, 
+Engines_MPIContainer_i::Engines_MPIContainer_i(CORBA::ORB_ptr orb, 
                                                PortableServer::POA_ptr poa,
                                                char * containerName,
                                                int argc, char *argv[]) 
-  : Engines_Container_i(orb,poa,containerName,argc,argv,false), MPIObject_i(nbproc,numproc)
+  : Engines_Container_i(orb,poa,containerName,argc,argv,false)
 {
 
   _id = _poa->activate_object(this);
@@ -54,7 +53,7 @@ Engines_MPIContainer_i::Engines_MPIContainer_i(int nbproc, int numproc,
   Engines::Container_var pCont = Engines::Container::_narrow(obj);
   _remove_ref();
 
-  if(numproc==0){
+  if(_numproc==0){
 
     _NS = new SALOME_NamingService();
     _NS->init_orb( CORBA::ORB::_duplicate(_orb) ) ;
@@ -71,8 +70,8 @@ Engines_MPIContainer_i::Engines_MPIContainer_i(int nbproc, int numproc,
   BCastIOR(_orb,pobj,true);
 }
 
-Engines_MPIContainer_i::Engines_MPIContainer_i(int nbproc, int numproc
-  : Engines_Container_i(), MPIObject_i(nbproc,numproc)
+Engines_MPIContainer_i::Engines_MPIContainer_i() 
+  : Engines_Container_i()
 {
 }
 
@@ -326,8 +325,7 @@ Engines_MPIContainer_i::createMPIInstance(std::string genericRegisterName,
   std::string factory_name = aGenRegisterName + std::string("Engine_factory");
 
   typedef  PortableServer::ObjectId * (*MPIFACTORY_FUNCTION)
-    (int,int,
-     CORBA::ORB_ptr,
+    (CORBA::ORB_ptr,
      PortableServer::POA_ptr, 
      PortableServer::ObjectId *, 
      const char *, 
@@ -365,8 +363,7 @@ Engines_MPIContainer_i::createMPIInstance(std::string genericRegisterName,
       // --- Instanciate required CORBA object
 
       PortableServer::ObjectId *id ; //not owner, do not delete (nore use var)
-      id = (MPIComponent_factory) ( _nbproc,_numproc,_orb, _poa, _id, instanceName.c_str(),
-                                 aGenRegisterName.c_str() ) ;
+      id = (MPIComponent_factory) ( _orb, _poa, _id, instanceName.c_str(), aGenRegisterName.c_str() ) ;
 
       // --- get reference & servant from id
 
@@ -468,14 +465,12 @@ Engines::Component_ptr Engines_MPIContainer_i::Lload_impl(
   MESSAGE("[" << _numproc << "] factory_name=" << factory_name) ;
 
   dlerror();
-  PortableServer::ObjectId * (*MPIComponent_factory) (int,int,
-                                                  CORBA::ORB_ptr,
+  PortableServer::ObjectId * (*MPIComponent_factory) (CORBA::ORB_ptr,
                                                   PortableServer::POA_ptr,
                                                   PortableServer::ObjectId *,
                                                   const char *,
                                                   const char *) =
-    (PortableServer::ObjectId * (*) (int,int,
-                                     CORBA::ORB_ptr,
+    (PortableServer::ObjectId * (*) (CORBA::ORB_ptr,
                                      PortableServer::POA_ptr, 
                                      PortableServer::ObjectId *, 
                                      const char *, 
@@ -494,7 +489,7 @@ Engines::Component_ptr Engines_MPIContainer_i::Lload_impl(
     // Instanciation du composant parallele
     MESSAGE("[" << _numproc << "] Try to load a parallel component");
     PortableServer::ObjectId * id = (MPIComponent_factory)
-      (_nbproc,_numproc,_orb, _poa, _id, instanceName.c_str(), _nameToRegister.c_str());
+      (_orb, _poa, _id, instanceName.c_str(), _nameToRegister.c_str());
     // get reference from id
     CORBA::Object_var o = _poa->id_to_reference(*id);
     pobj = Engines::MPIObject::_narrow(o) ;
index 6b5c6eefbfa0580b6b08b4ae5ef36dde68118c62..88b29e4d175ffd78b92969bcce250aeb872d0f40 100644 (file)
@@ -54,12 +54,11 @@ class Engines_MPIContainer_i : public POA_Engines::MPIContainer,
 
  public:
   // Constructor
-  Engines_MPIContainer_i( int nbproc, int numproc,
-                          CORBA::ORB_ptr orb,
+  Engines_MPIContainer_i( CORBA::ORB_ptr orb,
                           PortableServer::POA_ptr poa,
                           char * containerName,
                           int argc, char *argv[]);
-  Engines_MPIContainer_i(int nbproc, int numproc);
+  Engines_MPIContainer_i();
   // Destructor
   ~Engines_MPIContainer_i();
 
index fa590761297b1323aba7b4676acdf949083687a2..fd04587e1e411aa15d5d6d7d1ff6525c46c3c79d 100644 (file)
@@ -37,13 +37,6 @@ MPIObject_i::MPIObject_i()
   _tior=NULL;
 }
 
-MPIObject_i::MPIObject_i(int nbproc, int numproc)
-{
-  _nbproc = nbproc;
-  _numproc = numproc;
-  _tior=NULL;
-}
-
 MPIObject_i::~MPIObject_i()
 {
   if(_tior) delete _tior;
index 049021c6675093c0952c9d1636a2e37f3d4fafec..a0076892912cb1fed94d968da1d5c88907c74c2a 100644 (file)
@@ -36,7 +36,6 @@ class MPIObject_i: public virtual POA_Engines::MPIObject
 {
  public:
   MPIObject_i();
-  MPIObject_i(int nbproc, int numproc);
   ~MPIObject_i();
     
   Engines::IORTab* tior();
index c42a995fe9dc8604da54ad2d15aec5459b89ac5a..fa5d54a17b159d5e639d5759b955582f42c95bc0 100644 (file)
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
     }
 
     MESSAGE("[" << numproc << "] MPIContainer: load MPIContainer servant");
-    new Engines_MPIContainer_i(nbproc,numproc,orb,root_poa, containerName,argc,argv);
+    new Engines_MPIContainer_i(orb,root_poa, containerName,argc,argv);
 
     pman->activate();
 
index 443f04cd09fe0271814429ab9a1c21f0238fb377..0e7602056f2a6687931b13bc2dc4dd47559e2d3d 100644 (file)
 #include "utilities.h"
 #include "TestMPIComponentEngine.hxx"
 
-TestMPIComponentEngine::TestMPIComponentEngine(int nbproc, int numproc,
-                                               CORBA::ORB_ptr orb,
+TestMPIComponentEngine::TestMPIComponentEngine(CORBA::ORB_ptr orb,
                                                PortableServer::POA_ptr poa,
                                                PortableServer::ObjectId * contId, 
                                                const char *instanceName, 
                                                const char *interfaceName,
                                                bool regist) :
-  Engines_Component_i(orb, poa, contId, instanceName, interfaceName,true,regist), MPIObject_i(nbproc,numproc)
+  Engines_Component_i(orb, poa, contId, instanceName, interfaceName,true,regist)
 {
   MESSAGE("activate object")
   _thisObj = this ;
   _id = _poa->reference_to_id(_thisObj->_this());
 }
 
-TestMPIComponentEngine::TestMPIComponentEngine(): Engines_Component_i(), MPIObject_i()
+TestMPIComponentEngine::TestMPIComponentEngine()
 {
 }
 
@@ -73,24 +72,26 @@ void TestMPIComponentEngine::SPCoucou(CORBA::Long L)
 extern "C"
 {
   PortableServer::ObjectId * TestMPIComponentEngine_factory(
-                                 int nbproc, int numproc,
                                  CORBA::ORB_ptr orb,
                                  PortableServer::POA_ptr poa, 
                                  PortableServer::ObjectId * contId,
                                  const char *instanceName, 
                                  const char *interfaceName)
   {
+    int numproc;
     bool regist;
     TestMPIComponentEngine * myTestMPIComponent;
+
     MESSAGE("[" << numproc << "] PortableServer::ObjectId * TestMPIComponentEngine_factory()");
     SCRUTE(interfaceName);
+    MPI_Comm_rank( MPI_COMM_WORLD, &numproc );
     if(numproc==0)
       regist = true;
     else
       regist = false;
 
     myTestMPIComponent 
-      = new TestMPIComponentEngine(nbproc,numproc,orb, poa, contId, instanceName, interfaceName,regist);
+      = new TestMPIComponentEngine(orb, poa, contId, instanceName, interfaceName,regist);
     return myTestMPIComponent->getId() ;
   }
 }
index ea422bce389f365dded49a32bb97331248fc1b43..df161dffa61f34d9ca3377a4e8c5436cd9ee7dc6 100644 (file)
@@ -43,8 +43,7 @@ class TestMPIComponentEngine:
 {
 public:
   TestMPIComponentEngine();
-  TestMPIComponentEngine(int nbproc, int numproc,
-                         CORBA::ORB_ptr orb,
+  TestMPIComponentEngine(CORBA::ORB_ptr orb,
                          PortableServer::POA_ptr poa,
                          PortableServer::ObjectId * contId, 
                          const char *instanceName,