Back to index

salome-med  6.5.0
Public Member Functions | Private Member Functions
MPI2ParaMEDMEMTest Class Reference
Inheritance diagram for MPI2ParaMEDMEMTest:
Inheritance graph
[legend]
Collaboration diagram for MPI2ParaMEDMEMTest:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void testBasicMPI2_1 ()
void testBasicMPI2_1 ()

Private Member Functions

 CPPUNIT_TEST_SUITE (MPI2ParaMEDMEMTest)
 CPPUNIT_TEST (testBasicMPI2_1)
 CPPUNIT_TEST_SUITE_END ()
 CPPUNIT_TEST_SUITE (MPI2ParaMEDMEMTest)
 CPPUNIT_TEST (testBasicMPI2_1)
 CPPUNIT_TEST_SUITE_END ()

Detailed Description

Definition at line 35 of file ParaMEDMEMTestMPI2_1.cxx.


Member Function Documentation

Definition at line 46 of file ParaMEDMEMTestMPI2_1.cxx.

{
  int lsize, lrank, gsize, grank;
  MPI_Comm gcom;
  std::string service = "SERVICE";
  std::ostringstream meshfilename, meshname;
  ParaMEDMEM::ParaMESH *paramesh=0;
  ParaMEDMEM::MEDCouplingUMesh *mesh;
  ParaMEDMEM::ParaFIELD *parafield=0;
  ParaMEDMEM::CommInterface *interface;
  ParaMEDMEM::MPIProcessorGroup *source, *target;

  MPI_Comm_size( MPI_COMM_WORLD, &lsize );
  MPI_Comm_rank( MPI_COMM_WORLD, &lrank );
  if(lsize!=2)
    {
      CPPUNIT_ASSERT(false);
      return;
    }

  /* Connection to remote programm */
  MPI2Connector *mpio = new MPI2Connector;
  gcom = mpio->remoteMPI2Connect(service);
  MPI_Comm_size( gcom, &gsize );
  MPI_Comm_rank( gcom, &grank );
  if(gsize!=5)
    {
      CPPUNIT_ASSERT(false);
      return;
    }
  interface = new ParaMEDMEM::CommInterface;
  source = new ParaMEDMEM::MPIProcessorGroup(*interface,0,lsize-1,gcom);
  target = new ParaMEDMEM::MPIProcessorGroup(*interface,lsize,gsize-1,gcom);

  const double sourceCoordsAll[2][8]={{0.4,0.5,0.4,1.5,1.6,1.5,1.6,0.5},
                                      {0.3,-0.5,1.6,-0.5,1.6,-1.5,0.3,-1.5}};
  
  int conn4All[8]={0,1,2,3,4,5,6,7};
  
  std::ostringstream stream; stream << "sourcemesh2D proc " << grank;
  mesh=MEDCouplingUMesh::New(stream.str().c_str(),2);
  mesh->allocateCells(2);
  mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn4All);
  mesh->finishInsertingCells();
  DataArrayDouble *myCoords=DataArrayDouble::New();
  myCoords->alloc(4,2);
  const double *sourceCoords=sourceCoordsAll[grank];
  std::copy(sourceCoords,sourceCoords+8,myCoords->getPointer());
  mesh->setCoords(myCoords);
  myCoords->decrRef();
  paramesh=new ParaMESH(mesh,*source,"source mesh");
  ParaMEDMEM::ComponentTopology comptopo;
  parafield = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo);
  double *value=parafield->getField()->getArray()->getPointer();
  value[0]=34+13*((double)grank);

  ParaMEDMEM::InterpKernelDEC dec(*source,*target);
  parafield->getField()->setNature(ConservativeVolumic);


  dec.setMethod("P0");
  dec.attachLocalField(parafield);
  dec.synchronize();
  dec.setForcedRenormalization(false);
  dec.sendData();
  /* Deconnection of remote programm */
  mpio->remoteMPI2Disconnect(service);
  /* clean-up */
  delete mpio;
  delete parafield;
  mesh->decrRef();
  delete paramesh;
  delete source;
  delete target;
  delete interface;
}

Here is the call graph for this function:


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