-/*! Test case from the official doc of the OverlapDEC.
- * WARNING: bounding boxes are tweaked here to make the case more interesting (i.e. to avoid an all to all exchange
- * between all procs).
- */
-void ParaMEDMEMTest::testOverlapDEC1()
-{
- int size, rank;
- MPI_Comm_size(MPI_COMM_WORLD,&size);
- MPI_Comm_rank(MPI_COMM_WORLD,&rank);
- // char hostname[256];
- // printf("(%d) PID %d on localhost ready for attach\n", rank, getpid());
- // fflush(stdout);
-
-// if (rank == 1)
-// {
-// int i=1, j=0;
-// while (i!=0)
-// j=2;
-// }
-
- if (size != 3) return ;
- int nproc = 3;
- std::set<int> procs;
- for (int i=0; i<nproc; i++)
- procs.insert(i);
-
- CommInterface interface;
- OverlapDEC dec(procs);
- ProcessorGroup * grp = dec.getGroup();
- MEDCouplingUMesh* meshS=0, *meshT=0;
- ParaMESH* parameshS=0, *parameshT=0;
- ParaFIELD* parafieldS=0, *parafieldT=0;
-
- MPI_Barrier(MPI_COMM_WORLD);
- prepareData1(rank, grp, ConservativeVolumic, meshS, meshT, parameshS, parameshT, parafieldS, parafieldT);
-
- /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- * HACK ON BOUNDING BOX TO MAKE THIS CASE SIMPLE AND USABLE IN DEBUG
- * Bounding boxes are slightly smaller than should be, thus localizing the work to be done
- * and avoiding every proc talking to everyone else.
- * Obviously this is NOT a good idea to do this in production code :-)
- * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- */
- dec.setBoundingBoxAdjustmentAbs(-1.0e-12);
-
- dec.attachSourceLocalField(parafieldS);
- dec.attachTargetLocalField(parafieldT);
- dec.synchronize();
- dec.sendRecvData(true);
- //
- MPI_Barrier(MPI_COMM_WORLD);
- if(rank==0)
- {
- CPPUNIT_ASSERT_DOUBLES_EQUAL(8.75,parafieldT->getField()->getArray()->getIJ(0,0),1e-12);
- }
- if(rank==1)
- {
- CPPUNIT_ASSERT_DOUBLES_EQUAL(8.5,parafieldT->getField()->getArray()->getIJ(0,0),1e-12);
- }
- if(rank==2)
- {
- CPPUNIT_ASSERT_DOUBLES_EQUAL(10.5,parafieldT->getField()->getArray()->getIJ(0,0),1e-12);
- }
-
- delete parafieldS;
- delete parafieldT;
- delete parameshS;
- delete parameshT;
- meshS->decrRef();
- meshT->decrRef();
-
- MPI_Barrier(MPI_COMM_WORLD);
-}
-
-/*!
- * Same as testOverlapDEC1() but with regular bounding boxes. If you're looking for a nice debug case,
- * testOverlapDEC1() is identical in terms of geometry and field values, and more appropriate.
- */
-void ParaMEDMEMTest::testOverlapDEC2()
-{
- int size, rank;
- MPI_Comm_size(MPI_COMM_WORLD,&size);
- MPI_Comm_rank(MPI_COMM_WORLD,&rank);
-
- if (size != 3) return ;
- int nproc = 3;
- std::set<int> procs;
- for (int i=0; i<nproc; i++)
- procs.insert(i);
-
-// if (rank == 0)
-// {
-// int i=1, j=0;
-// while (i!=0)
-// j=2;
-// }
-
-
- CommInterface interface;
- OverlapDEC dec(procs);
- ProcessorGroup * grp = dec.getGroup();
- MEDCouplingUMesh* meshS=0, *meshT=0;
- ParaMESH* parameshS=0, *parameshT=0;
- ParaFIELD* parafieldS=0, *parafieldT=0;
-
- MPI_Barrier(MPI_COMM_WORLD);
- prepareData1(rank, grp, ConservativeVolumic,meshS, meshT, parameshS, parameshT, parafieldS, parafieldT);
-
- /* Normal bounding boxes here: */
- dec.setBoundingBoxAdjustmentAbs(+1.0e-12);
-
- dec.attachSourceLocalField(parafieldS);
- dec.attachTargetLocalField(parafieldT);
- dec.synchronize();
- dec.sendRecvData(true);
- //
- if(rank==0)
- {
- CPPUNIT_ASSERT_DOUBLES_EQUAL(8.75,parafieldT->getField()->getArray()->getIJ(0,0),1e-12);
- }
- if(rank==1)
- {
- CPPUNIT_ASSERT_DOUBLES_EQUAL(8.5,parafieldT->getField()->getArray()->getIJ(0,0),1e-12);
- }
- if(rank==2)
- {
- CPPUNIT_ASSERT_DOUBLES_EQUAL(10.5,parafieldT->getField()->getArray()->getIJ(0,0),1e-12);
- }
- delete parafieldS;
- delete parafieldT;
- delete parameshS;
- delete parameshT;
- meshS->decrRef();
- meshT->decrRef();
-
- MPI_Barrier(MPI_COMM_WORLD);
-}
-