X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FParaMEDMEMTest%2FParaMEDMEMTest_OverlapDEC.cxx;h=f6b14cf496b72f11bb4d509fb395a1532e9bd77a;hb=0b187729ac99d3e9e9bb9d2be8cb8600a783be6c;hp=187d3df3fbe64ce50c9ec02b331f6ce2996a22e8;hpb=c1e02b8b052ccfab23eb10a5b11857870e64c389;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx index 187d3df3f..f6b14cf49 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx @@ -311,128 +311,6 @@ void prepareData1(int rank, NatureOfField nature, } } -/*! 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 procs; - for (int i=0; igetArray()->getIJ(0,0),1e-12); - } - if(rank==1) - { - CPPUNIT_ASSERT_DOUBLES_EQUAL(8.5,mcfieldT->getArray()->getIJ(0,0),1e-12); - } - if(rank==2) - { - CPPUNIT_ASSERT_DOUBLES_EQUAL(10.5,mcfieldT->getArray()->getIJ(0,0),1e-12); - } - - mcfieldS->decrRef(); - mcfieldT->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 procs; - for (int i=0; igetArray()->getIJ(0,0),1e-12); - } - if(rank==1) - { - CPPUNIT_ASSERT_DOUBLES_EQUAL(8.5,mcfieldT->getArray()->getIJ(0,0),1e-12); - } - if(rank==2) - { - CPPUNIT_ASSERT_DOUBLES_EQUAL(10.5,mcfieldT->getArray()->getIJ(0,0),1e-12); - } - - mcfieldS->decrRef(); - mcfieldT->decrRef(); - - MPI_Barrier(MPI_COMM_WORLD); -} - void prepareData2_buildOneSquare(MEDCouplingUMesh* & meshS_0, MEDCouplingUMesh* & meshT_0) { const double coords[10] = {0.0,0.0, 0.0,1.0, 1.0,1.0, 1.0,0.0, 0.5,0.5}; @@ -457,7 +335,6 @@ void prepareData2_buildOneSquare(MEDCouplingUMesh* & meshS_0, MEDCouplingUMesh* meshT_0->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT+3); meshT_0->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT+6); meshT_0->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT+9); - } /** @@ -574,6 +451,113 @@ void prepareData2(int rank, ProcessorGroup * grp, NatureOfField nature, meshT_0->decrRef(); } +/*! Test case from the official doc of the OverlapDEC. + * WARNING: bounding boxes might be tweaked here to make the case more interesting (i.e. to avoid an all to all exchange + * between all procs). + */ +void testOverlapDEC_generic(int workSharingAlgo, double bbAdj) +{ + 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 == 0) +// { +// int i=1, j=0; +// while (i!=0) +// j=2; +// } + + if (size != 3) return ; + int nproc = 3; + std::set procs; + for (int i=0; igetArray()->getIJ(0,0),1e-12); + } + if(rank==1) + { + CPPUNIT_ASSERT_DOUBLES_EQUAL(8.5,mcfieldT->getArray()->getIJ(0,0),1e-12); + } + if(rank==2) + { + CPPUNIT_ASSERT_DOUBLES_EQUAL(10.5,mcfieldT->getArray()->getIJ(0,0),1e-12); + } + + mcfieldS->decrRef(); + mcfieldT->decrRef(); + + MPI_Barrier(MPI_COMM_WORLD); +} + +void ParaMEDMEMTest::testOverlapDEC1() +{ + /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * 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 :-) + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + testOverlapDEC_generic(0,-1.0e-12); +} + +void ParaMEDMEMTest::testOverlapDEC1_bis() +{ + // Same BB hack as above + testOverlapDEC_generic(1,-1.0e-12); +} + +void ParaMEDMEMTest::testOverlapDEC1_ter() +{ + // Same BB hack as above + testOverlapDEC_generic(2, -1.0e-12); +} + + +/*! + * 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() +{ + testOverlapDEC_generic(0,1.0e-12); +} + +void ParaMEDMEMTest::testOverlapDEC2_bis() +{ + testOverlapDEC_generic(1,1.0e-12); +} + +void ParaMEDMEMTest::testOverlapDEC2_ter() +{ + testOverlapDEC_generic(2,1.0e-12); +} + + /*! Test focused on the mapping of cell IDs. * (i.e. when only part of the source/target mesh is transmitted) */ @@ -716,6 +700,5 @@ void ParaMEDMEMTest::testOverlapDEC4() meshT->decrRef(); MPI_Barrier(MPI_COMM_WORLD); - }