Back to index

salome-kernel  6.5.0
Public Member Functions | Protected Member Functions | Protected Attributes
TestMPIComponentEngine Class Reference

#include <TestMPIComponentEngine.hxx>

Inheritance diagram for TestMPIComponentEngine:
Inheritance graph
[legend]
Collaboration diagram for TestMPIComponentEngine:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TestMPIComponentEngine ()
 TestMPIComponentEngine (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId *contId, const char *instanceName, const char *interfaceName, bool regist)
virtual ~TestMPIComponentEngine ()
void Coucou (CORBA::Long L)
void SPCoucou (CORBA::Long L)
Engines::IORTabtior ()
void tior (const Engines::IORTab &ior)

Protected Member Functions

void BCastIOR (CORBA::ORB_ptr orb, Engines::MPIObject_ptr pobj, bool amiCont)

Protected Attributes

int _numproc
int _nbproc
Engines::IORTab_tior
std::map< std::string, MPI_Comm > _gcom

Detailed Description

Definition at line 40 of file TestMPIComponentEngine.hxx.


Constructor & Destructor Documentation

Definition at line 48 of file TestMPIComponentEngine.cxx.

{
}
TestMPIComponentEngine::TestMPIComponentEngine ( CORBA::ORB_ptr  orb,
PortableServer::POA_ptr  poa,
PortableServer::ObjectId *  contId,
const char *  instanceName,
const char *  interfaceName,
bool  regist 
)

Definition at line 35 of file TestMPIComponentEngine.cxx.

                                                            :
  Engines_Component_i(orb, poa, contId, instanceName, interfaceName,true,regist)
{
  MESSAGE("activate object")
  _thisObj = this ;
  _id = _poa->reference_to_id(_thisObj->_this());
}

Definition at line 52 of file TestMPIComponentEngine.cxx.

{
}

Member Function Documentation

void MPIObject_i::BCastIOR ( CORBA::ORB_ptr  orb,
Engines::MPIObject_ptr  pobj,
bool  amiCont 
) [protected, inherited]

Definition at line 62 of file MPIObject_i.cxx.

{
  int err, ip, n;
  char *ior;
  MPI_Status status; /* status de reception de message MPI */
  std::ostringstream msg;

  if( _numproc == 0 )
    {

      //Allocation du tableau des IOR
      Engines::IORTab_var iort = new Engines::IORTab;
      iort->length(_nbproc);
      
      iort[0] = pobj;

      // Process 0 recupere les ior de l'object sur les autres process
      for(ip=1;ip<_nbproc;ip++)
        {
          err = MPI_Recv(&n,1,MPI_INT,ip,ip,MPI_COMM_WORLD,&status);
          if(err)
            {
              msg << "[" << _numproc << "] MPI_RECV error";
              throw SALOME_Exception(msg.str().c_str());
            }
          // Allocation de la chaine de longueur n
          ior = new char[n];
          err = MPI_Recv(ior,n,MPI_CHAR,ip,2*ip,MPI_COMM_WORLD,&status);
          if(err)
            {
              msg << "[" << _numproc << "] MPI_RECV error";
              throw SALOME_Exception(msg.str().c_str());
            }
          iort[ip] = orb->string_to_object(ior);
          delete [] ior;
          if(CORBA::is_nil(iort[ip]))
            {
              msg << "[" << ip << "] MPI Component not loaded";
              throw SALOME_Exception(msg.str().c_str());
            }
        }
      // On donne le tableau des ior a l'objet Corba du process 0
      if( amiCont )
        tior(*(iort._retn()));
      else
        pobj->tior(*(iort._retn()));
    }
  else
    {
      // Conversion IOR vers string
      ior = orb->object_to_string(pobj);
      n = strlen(ior) + 1;
      // On envoie l'IOR au process 0
      err = MPI_Send(&n,1,MPI_INT,0,_numproc,MPI_COMM_WORLD);
      if(err)
        {
          msg << "[" << _numproc << "] MPI_SEND error";
          throw SALOME_Exception(msg.str().c_str());
        }
      err = MPI_Send(ior,n,MPI_CHAR,0,2*_numproc,MPI_COMM_WORLD);
      if(err)
        {
          msg << "[" << _numproc << "] MPI_SEND error";
          throw SALOME_Exception(msg.str().c_str());
        }
      CORBA::string_free(ior);
    }
 
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TestMPIComponentEngine::Coucou ( CORBA::Long  L)

Definition at line 56 of file TestMPIComponentEngine.cxx.

{
  if(_numproc==0)
    for(int ip=1;ip<_nbproc;ip++)
      Engines::TestMPIComponent::_narrow((*_tior)[ip])->SPCoucou(L);
  SPCoucou(L);
}

Here is the call graph for this function:

void TestMPIComponentEngine::SPCoucou ( CORBA::Long  L)

Definition at line 64 of file TestMPIComponentEngine.cxx.

{
  BEGIN_OF("[" << _numproc << "] TestMPIComponentEngine::Coucou()");
  MESSAGE("[" << _numproc << "] TestMPIComponentEngine : L = " << L);
  END_OF("[" << _numproc << "] TestMPIComponentEngine::Coucou()");
  MPI_Barrier(MPI_COMM_WORLD);
}

Here is the caller graph for this function:

Definition at line 45 of file MPIObject_i.cxx.

{
  Engines::IORTab_var tior = new Engines::IORTab;
  tior->length(_tior->length());
  for(unsigned int ip=0;ip<tior->length();ip++)
    tior[ip] = (*_tior)[ip];
  return tior._retn(); 
};

Here is the caller graph for this function:

void MPIObject_i::tior ( const Engines::IORTab ior) [inherited]

Definition at line 54 of file MPIObject_i.cxx.

{
  _tior = new Engines::IORTab;
  _tior->length(ior.length());
  for(unsigned int ip=0;ip<ior.length();ip++)
    (*_tior)[ip] = ior[ip];
}

Member Data Documentation

std::map<std::string, MPI_Comm> MPIObject_i::_gcom [protected, inherited]

Definition at line 62 of file MPIObject_i.hxx.

int MPIObject_i::_nbproc [protected, inherited]

Definition at line 49 of file MPIObject_i.hxx.

int MPIObject_i::_numproc [protected, inherited]

Definition at line 47 of file MPIObject_i.hxx.

Engines::IORTab* MPIObject_i::_tior [protected, inherited]

Definition at line 51 of file MPIObject_i.hxx.


The documentation for this class was generated from the following files: