]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Wed, 24 Feb 2010 12:54:19 +0000 (12:54 +0000)
committerageay <ageay>
Wed, 24 Feb 2010 12:54:19 +0000 (12:54 +0000)
src/ParaMEDMEMTest/ParaMEDMEMTest.hxx
src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx

index 1d4858ade8103d93a78463f0c46b4f9ccf04470f..698391cb541bd8e1b1eb0de06bc22d40f6824025 100644 (file)
@@ -42,6 +42,7 @@ class ParaMEDMEMTest : public CppUnit::TestFixture
   CPPUNIT_TEST(testInterpKernelDECNonOverlapp_2D_P0P0);
   CPPUNIT_TEST(testInterpKernelDECNonOverlapp_2D_P0P1P1P0);
   CPPUNIT_TEST(testInterpKernelDEC2DM1D_P0P0);
+  CPPUNIT_TEST(testInterpKernelDECPartialProcs);
 
   CPPUNIT_TEST(testSynchronousEqualInterpKernelWithoutInterpNativeDEC_2D);
   CPPUNIT_TEST(testSynchronousEqualInterpKernelWithoutInterpDEC_2D);
@@ -91,6 +92,7 @@ public:
   void testInterpKernelDECNonOverlapp_2D_P0P0();
   void testInterpKernelDECNonOverlapp_2D_P0P1P1P0();
   void testInterpKernelDEC2DM1D_P0P0();
+  void testInterpKernelDECPartialProcs();
 #ifdef MED_ENABLE_FVM
   void testNonCoincidentDEC_2D();
   void testNonCoincidentDEC_3D();
index 0680b02dcce851471ad0a53dd6732324e55d0b9d..23c2799b4394a9f0a2038e0a0ec42826d20e4f33 100644 (file)
@@ -1343,6 +1343,105 @@ void ParaMEDMEMTest::testInterpKernelDEC2DM1D_P0P0()
   MPI_Barrier(MPI_COMM_WORLD);
 }
 
+void ParaMEDMEMTest::testInterpKernelDECPartialProcs()
+{
+  int size;
+  int rank;
+  MPI_Comm_size(MPI_COMM_WORLD,&size);
+  MPI_Comm_rank(MPI_COMM_WORLD,&rank);
+  //
+  if(size!=3)
+    return ;
+  set<int> procs_source;
+  set<int> procs_target;
+  //
+  procs_source.insert(0);
+  procs_target.insert(1);
+  //
+  ParaMEDMEM::MEDCouplingUMesh *mesh=0;
+  ParaMEDMEM::ParaMESH *paramesh=0;
+  ParaMEDMEM::ParaFIELD *parafield=0;
+  //
+  ParaMEDMEM::CommInterface interface;
+  //
+  MPI_Barrier(MPI_COMM_WORLD);
+  double targetCoords[8]={ 0.,0., 1., 0., 0., 1., 1., 1. };
+  CommInterface comm;
+  int grpIds[2]={0,1};
+  MPI_Group grp,group_world;
+  comm.commGroup(MPI_COMM_WORLD,&group_world);
+  comm.groupIncl(group_world,2,grpIds,&grp);
+  MPI_Comm partialComm;
+  comm.commCreate(MPI_COMM_WORLD,grp,&partialComm);
+  //
+  ProcessorGroup* target_group=0;
+  ProcessorGroup* source_group=0;
+  //
+  ParaMEDMEM::InterpKernelDEC *dec=0;
+  if(rank==0 || rank==1)
+    {
+      target_group = new ParaMEDMEM::MPIProcessorGroup(interface,procs_target,partialComm);
+      source_group = new ParaMEDMEM::MPIProcessorGroup(interface,procs_source,partialComm);
+      if(source_group->containsMyRank())
+        {    
+          mesh=MEDCouplingUMesh::New();
+          mesh->setMeshDimension(2);
+          DataArrayDouble *myCoords=DataArrayDouble::New();
+          myCoords->alloc(4,2);
+          std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
+          mesh->setCoords(myCoords);
+          myCoords->decrRef();
+          int targetConn[4]={0,2,3,1};
+          mesh->allocateCells(1);
+          mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
+          mesh->finishInsertingCells();
+          ParaMEDMEM::ComponentTopology comptopo;
+          paramesh=new ParaMESH(mesh,*source_group,"source mesh");
+          parafield=new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo);
+          parafield->getField()->setNature(ConservativeVolumic);
+          double *vals=parafield->getField()->getArray()->getPointer();
+          vals[0]=7.;
+          dec=new ParaMEDMEM::InterpKernelDEC(*source_group,*target_group);
+          dec->attachLocalField(parafield);
+          dec->synchronize();
+          dec->sendData();
+          dec->recvData();
+        }
+      else
+        {
+          mesh=MEDCouplingUMesh::New();
+          mesh->setMeshDimension(2);
+          DataArrayDouble *myCoords=DataArrayDouble::New();
+          myCoords->alloc(4,2);
+          std::copy(targetCoords,targetCoords+8,myCoords->getPointer());
+          mesh->setCoords(myCoords);
+          myCoords->decrRef();
+          int targetConn[6]={0,2,1,2,3,1};
+          mesh->allocateCells(2);
+          mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn);
+          mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3);
+          mesh->finishInsertingCells();
+          ParaMEDMEM::ComponentTopology comptopo;
+          paramesh=new ParaMESH(mesh,*target_group,"target mesh");
+          parafield=new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo);
+          parafield->getField()->setNature(ConservativeVolumic);
+          dec=new ParaMEDMEM::InterpKernelDEC(*source_group,*target_group);
+          dec->attachLocalField(parafield);
+          dec->synchronize();
+          dec->recvData();
+          dec->sendData();
+        }
+    }
+  delete parafield;
+  delete paramesh;
+  if(mesh)
+    mesh->decrRef();
+  delete target_group;
+  delete source_group;
+  delete dec;
+  MPI_Barrier(MPI_COMM_WORLD);
+}
+
 /*!
  * Tests an asynchronous exchange between two codes
  * one sends data with dtA as an interval, the max time being tmaxA