Back to index

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

#include <MPIObject_i.hxx>

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

List of all members.

Public Member Functions

 MPIObject_i ()
 ~MPIObject_i ()
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

Private Attributes

std::map< std::string, MPI_Comm > _icom
std::map< std::string, bool_srv
std::map< std::string,
std::string > 
_port_name

Detailed Description

Definition at line 36 of file MPIObject_i.hxx.


Constructor & Destructor Documentation

Definition at line 33 of file MPIObject_i.cxx.

{
  MPI_Comm_size( MPI_COMM_WORLD, &_nbproc );
  MPI_Comm_rank( MPI_COMM_WORLD, &_numproc );
  _tior=NULL;
}

Definition at line 40 of file MPIObject_i.cxx.

{
  if(_tior) delete _tior;
}

Member Function Documentation

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

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:

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)

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]

Definition at line 62 of file MPIObject_i.hxx.

std::map<std::string, MPI_Comm> MPIObject_i::_icom [private]

Definition at line 65 of file MPIObject_i.hxx.

int MPIObject_i::_nbproc [protected]

Definition at line 49 of file MPIObject_i.hxx.

int MPIObject_i::_numproc [protected]

Definition at line 47 of file MPIObject_i.hxx.

std::map<std::string, std::string> MPIObject_i::_port_name [private]

Definition at line 67 of file MPIObject_i.hxx.

std::map<std::string, bool> MPIObject_i::_srv [private]

Definition at line 66 of file MPIObject_i.hxx.

Definition at line 51 of file MPIObject_i.hxx.


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