From d60fe0cde471ced5d2a9b7d95bfb3812e521bf8c Mon Sep 17 00:00:00 2001 From: ageay Date: Tue, 25 Aug 2009 07:00:26 +0000 Subject: [PATCH] Add one test. --- src/ParaMEDMEM/Test/Makefile.am | 1 + src/ParaMEDMEM/Test/ParaMEDMEMTest.hxx | 2 + .../Test/ParaMEDMEMTest_Gauthier1.cxx | 298 ++++++++++++++++++ 3 files changed, 301 insertions(+) create mode 100644 src/ParaMEDMEM/Test/ParaMEDMEMTest_Gauthier1.cxx diff --git a/src/ParaMEDMEM/Test/Makefile.am b/src/ParaMEDMEM/Test/Makefile.am index 71a2e0132..ba5d75adc 100644 --- a/src/ParaMEDMEM/Test/Makefile.am +++ b/src/ParaMEDMEM/Test/Makefile.am @@ -37,6 +37,7 @@ dist_libParaMEDMEMTest_la_SOURCES = \ ParaMEDMEMTest_StructuredCoincidentDEC.cxx \ ParaMEDMEMTest_MEDLoader.cxx \ ParaMEDMEMTest_ICocoTrio.cxx \ + ParaMEDMEMTest_Gauthier1.cxx \ MPIAccessDECTest.cxx \ test_AllToAllDEC.cxx \ test_AllToAllvDEC.cxx \ diff --git a/src/ParaMEDMEM/Test/ParaMEDMEMTest.hxx b/src/ParaMEDMEM/Test/ParaMEDMEMTest.hxx index 4d94f7f86..9e33a62b6 100644 --- a/src/ParaMEDMEM/Test/ParaMEDMEMTest.hxx +++ b/src/ParaMEDMEM/Test/ParaMEDMEMTest.hxx @@ -61,6 +61,7 @@ class ParaMEDMEMTest : public CppUnit::TestFixture CPPUNIT_TEST(testStructuredCoincidentDEC); CPPUNIT_TEST(testStructuredCoincidentDEC); CPPUNIT_TEST(testICocoTrio1); + CPPUNIT_TEST(testGauthier1); CPPUNIT_TEST(testMEDLoaderRead1); CPPUNIT_TEST(testMEDLoaderPolygonRead); CPPUNIT_TEST(testMEDLoaderPolyhedronRead); @@ -105,6 +106,7 @@ public: void testAsynchronousFastSourceIntersectionDEC_2D(); // void testICocoTrio1(); + void testGauthier1(); // void testMEDLoaderRead1(); void testMEDLoaderPolygonRead(); diff --git a/src/ParaMEDMEM/Test/ParaMEDMEMTest_Gauthier1.cxx b/src/ParaMEDMEM/Test/ParaMEDMEMTest_Gauthier1.cxx new file mode 100644 index 000000000..b104583af --- /dev/null +++ b/src/ParaMEDMEM/Test/ParaMEDMEMTest_Gauthier1.cxx @@ -0,0 +1,298 @@ +#include "ParaMEDMEMTest.hxx" +#include + +#include +#include "CommInterface.hxx" +#include "ProcessorGroup.hxx" +#include "MPIProcessorGroup.hxx" +#include "DEC.hxx" +#include "IntersectionDEC.hxx" +#include +#include +#include "ICoCoTrioField.hxx" +#include +#include +#include + +using namespace std; +using namespace ParaMEDMEM; +using namespace ICoCo; + +void afficheGauthier1( const TrioField& field, const double *vals, int lgth) +{ + CPPUNIT_ASSERT_EQUAL(lgth,field._nb_elems); + for (int ele=0;ele emetteur_ids; + set recepteur_ids; + emetteur_ids.insert(0); + if(size!=4) + return; + recepteur_ids.insert(1); + if (size >2) + recepteur_ids.insert(2); + if (size >2) + emetteur_ids.insert(3); + if ((rank==0)||(rank==1)) + is_master=1; + + MPIProcessorGroup recepteur_group(comm,recepteur_ids); + MPIProcessorGroup emetteur_group(comm,emetteur_ids); + + + string cas; + if (recepteur_group.containsMyRank()) + { + cas="recepteur"; + //freopen("recpeteur.out","w",stdout); + //freopen("recepteur.err","w",stderr); + + } + else + { + cas="emetteur"; + // freopen("emetteur.out","w",stdout); + //freopen("emetteur.err","w",stderr); + } + double expected[8][4]={ + {1.,1.,1.,1.}, + {40., 40., 1., 1.}, + {1.,1.,1e200,1e200}, + {40.,1.,1e200,1e200}, + {1.,1.,1.,1.}, + {40.,1.,1.,1.}, + {1.,1.,1e200,1e200}, + {20.5,1.,1e200,1e200} + }; + + int expectedLgth[8]={4,4,2,2,4,4,2,2}; + + for (int send=0;send<2;send++) + for (int rec=0;rec<2;rec++) + { + IntersectionDEC dec_emetteur(emetteur_group, recepteur_group); + dec_emetteur.setOrientation(2); + TrioField champ_emetteur, champ_recepteur; + + if (send==0) + init_quadGauthier1(champ_emetteur,is_master); + else + init_triangleGauthier1(champ_emetteur,is_master); + if (rec==0) + init_triangleGauthier1(champ_recepteur,is_master); + else + init_quadGauthier1(champ_recepteur,is_master); + + if (cas=="emetteur") + { + champ_emetteur._field=new double[champ_emetteur._nb_elems]; + for (int ele=0;ele