Salome HOME
Porting SALOME KERNEL to CMake
[modules/kernel.git] / src / TestMPIContainer / TestMPIComponentEngine.cxx
index 443f04cd09fe0271814429ab9a1c21f0238fb377..c868e6e0b37e9dadf2758da1cf18736fddb71beb 100644 (file)
@@ -1,23 +1,23 @@
-//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  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.
+// 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.
 //
-//  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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 //=============================================================================
 #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() ;
   }
 }