From: ageay Date: Tue, 9 Mar 2010 09:32:02 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: V5_1_main_FINAL~165 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f74e9e0943dc6b9f211341c3da262d56b9ecb6b8;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx index 23c2799b4..4126442df 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx @@ -705,6 +705,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() double targetResults[3][2]={{34.,34.},{38.333333333333336,42.666666666666664},{47.,47.}}; double targetResults2[3][2]={{0.28333333333333344,0.56666666666666687},{1.8564102564102569,2.0128205128205132},{1.0846153846153845,0.36153846153846159}}; double targetResults3[3][2]={{3.7777777777777781,7.5555555555555562},{24.511111111111113,26.355555555555558},{14.1,4.7}}; + double targetResults4[3][2]={{8.5,17},{8.8461538461538431, 9.8461538461538449},{35.25,11.75}}; // int size; int rank; @@ -841,20 +842,16 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[0],res[0],1e-13); CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[1],res[1],1e-13); } - //test 4 - Conservative volumic reversed + //test 4 - RevIntegral ParaMEDMEM::InterpKernelDEC dec4(*source_group,*target_group); - parafield->getField()->setNature(ConservativeVolumic); + parafield->getField()->setNature(RevIntegral); if (source_group->containsMyRank()) { dec4.setMethod("P0"); dec4.attachLocalField(parafield); dec4.synchronize(); dec4.setForcedRenormalization(false); - dec4.recvData(); - const double *res=parafield->getField()->getArray()->getConstPointer(); - CPPUNIT_ASSERT_EQUAL(1,parafield->getField()->getNumberOfTuples()); - const double expected[]={37.8518518518519,43.5333333333333}; - CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[rank],res[0],1e-13); + dec4.sendData(); } else { @@ -862,15 +859,15 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() dec4.attachLocalField(parafield); dec4.synchronize(); dec4.setForcedRenormalization(false); - double *res=parafield->getField()->getArray()->getPointer(); - const double *toSet=targetResults[rank-nproc_source]; - res[0]=toSet[0]; - res[1]=toSet[1]; - dec4.sendData(); + dec4.recvData(); + const double *res=parafield->getField()->getArray()->getConstPointer(); + const double *expected=targetResults4[rank-nproc_source]; + CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[0],res[0],1e-13); + CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[1],res[1],1e-13); } - //test 5 - Integral reversed + //test 5 - Conservative volumic reversed ParaMEDMEM::InterpKernelDEC dec5(*source_group,*target_group); - parafield->getField()->setNature(Integral); + parafield->getField()->setNature(ConservativeVolumic); if (source_group->containsMyRank()) { dec5.setMethod("P0"); @@ -880,7 +877,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() dec5.recvData(); const double *res=parafield->getField()->getArray()->getConstPointer(); CPPUNIT_ASSERT_EQUAL(1,parafield->getField()->getNumberOfTuples()); - const double expected[]={0.794600591715977,1.35631163708087}; + const double expected[]={37.8518518518519,43.5333333333333}; CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[rank],res[0],1e-13); } else @@ -890,14 +887,14 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() dec5.synchronize(); dec5.setForcedRenormalization(false); double *res=parafield->getField()->getArray()->getPointer(); - const double *toSet=targetResults2[rank-nproc_source]; + const double *toSet=targetResults[rank-nproc_source]; res[0]=toSet[0]; res[1]=toSet[1]; dec5.sendData(); } - //test 6 - Integral with global constraint reversed + //test 6 - Integral reversed ParaMEDMEM::InterpKernelDEC dec6(*source_group,*target_group); - parafield->getField()->setNature(IntegralGlobConstraint); + parafield->getField()->setNature(Integral); if (source_group->containsMyRank()) { dec6.setMethod("P0"); @@ -907,7 +904,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() dec6.recvData(); const double *res=parafield->getField()->getArray()->getConstPointer(); CPPUNIT_ASSERT_EQUAL(1,parafield->getField()->getNumberOfTuples()); - const double expected[]={36.4592592592593,44.5407407407407}; + const double expected[]={0.794600591715977,1.35631163708087}; CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[rank],res[0],1e-13); } else @@ -917,11 +914,65 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() dec6.synchronize(); dec6.setForcedRenormalization(false); double *res=parafield->getField()->getArray()->getPointer(); - const double *toSet=targetResults3[rank-nproc_source]; + const double *toSet=targetResults2[rank-nproc_source]; res[0]=toSet[0]; res[1]=toSet[1]; dec6.sendData(); } + //test 7 - Integral with global constraint reversed + ParaMEDMEM::InterpKernelDEC dec7(*source_group,*target_group); + parafield->getField()->setNature(IntegralGlobConstraint); + if (source_group->containsMyRank()) + { + dec7.setMethod("P0"); + dec7.attachLocalField(parafield); + dec7.synchronize(); + dec7.setForcedRenormalization(false); + dec7.recvData(); + const double *res=parafield->getField()->getArray()->getConstPointer(); + CPPUNIT_ASSERT_EQUAL(1,parafield->getField()->getNumberOfTuples()); + const double expected[]={36.4592592592593,44.5407407407407}; + CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[rank],res[0],1e-13); + } + else + { + dec7.setMethod("P0"); + dec7.attachLocalField(parafield); + dec7.synchronize(); + dec7.setForcedRenormalization(false); + double *res=parafield->getField()->getArray()->getPointer(); + const double *toSet=targetResults3[rank-nproc_source]; + res[0]=toSet[0]; + res[1]=toSet[1]; + dec7.sendData(); + } + //test 8 - Integral with RevIntegral reversed + ParaMEDMEM::InterpKernelDEC dec8(*source_group,*target_group); + parafield->getField()->setNature(RevIntegral); + if (source_group->containsMyRank()) + { + dec8.setMethod("P0"); + dec8.attachLocalField(parafield); + dec8.synchronize(); + dec8.setForcedRenormalization(false); + dec8.recvData(); + const double *res=parafield->getField()->getArray()->getConstPointer(); + CPPUNIT_ASSERT_EQUAL(1,parafield->getField()->getNumberOfTuples()); + const double expected[]={0.81314102564102553,1.3428994082840233}; + CPPUNIT_ASSERT_DOUBLES_EQUAL(expected[rank],res[0],1e-13); + } + else + { + dec8.setMethod("P0"); + dec8.attachLocalField(parafield); + dec8.synchronize(); + dec8.setForcedRenormalization(false); + double *res=parafield->getField()->getArray()->getPointer(); + const double *toSet=targetResults4[rank-nproc_source]; + res[0]=toSet[0]; + res[1]=toSet[1]; + dec8.sendData(); + } // delete parafield; mesh->decrRef(); @@ -1334,6 +1385,43 @@ void ParaMEDMEMTest::testInterpKernelDEC2DM1D_P0P0() CPPUNIT_ASSERT_DOUBLES_EQUAL(45.,res[0],1e-12); dec3.sendData(); } + // + ParaMEDMEM::InterpKernelDEC dec4(*source_group,*target_group); + dec4.setMethod("P0"); + parafield->getField()->setNature(RevIntegral); + if(source_group->containsMyRank()) + { + double *vals=parafield->getField()->getArray()->getPointer(); + if(rank==0) + { vals[0]=7.; vals[1]=8.; } + else + { vals[0]=9.; vals[1]=10.; vals[2]=11.; } + dec4.attachLocalField(parafield); + dec4.synchronize(); + dec4.sendData(); + dec4.recvData(); + const double *res=parafield->getField()->getArray()->getConstPointer(); + if(rank==0) + { + CPPUNIT_ASSERT_DOUBLES_EQUAL(9.125,res[0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(9.125,res[1],1e-12); + } + else + { + CPPUNIT_ASSERT_DOUBLES_EQUAL(9.125,res[0],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(9.125,res[1],1e-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL(9.125,res[2],1e-12); + } + } + else + { + dec4.attachLocalField(parafield); + dec4.synchronize(); + dec4.recvData(); + const double *res=parafield->getField()->getArray()->getConstPointer(); + CPPUNIT_ASSERT_DOUBLES_EQUAL(9.125,res[0],1e-12); + dec4.sendData(); + } delete parafield; delete paramesh; mesh->decrRef();