Back to index

salome-med  6.5.0
ParaMEDMEMTest.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef _ParaMEDMEMTEST_HXX_
00021 #define _ParaMEDMEMTEST_HXX_
00022 
00023 #include <cppunit/extensions/HelperMacros.h>
00024 
00025 #include <set>
00026 #include <string>
00027 #include <iostream>
00028 #include "mpi.h"
00029 
00030 
00031 class ParaMEDMEMTest : public CppUnit::TestFixture
00032 {
00033   CPPUNIT_TEST_SUITE( ParaMEDMEMTest );
00034   CPPUNIT_TEST(testMPIProcessorGroup_constructor);
00035   CPPUNIT_TEST(testMPIProcessorGroup_boolean);
00036   CPPUNIT_TEST(testMPIProcessorGroup_rank);
00037   CPPUNIT_TEST(testBlockTopology_constructor);
00038   CPPUNIT_TEST(testBlockTopology_serialize);
00039   CPPUNIT_TEST(testInterpKernelDEC_1D);
00040   CPPUNIT_TEST(testInterpKernelDEC_2DCurve);
00041   CPPUNIT_TEST(testInterpKernelDEC_2D);
00042   CPPUNIT_TEST(testInterpKernelDEC2_2D);
00043   CPPUNIT_TEST(testInterpKernelDEC_2DP0P1);
00044   CPPUNIT_TEST(testInterpKernelDEC_3D);
00045   CPPUNIT_TEST(testInterpKernelDECNonOverlapp_2D_P0P0);
00046   CPPUNIT_TEST(testInterpKernelDECNonOverlapp_2D_P0P1P1P0);
00047   CPPUNIT_TEST(testInterpKernelDEC2DM1D_P0P0);
00048   CPPUNIT_TEST(testInterpKernelDECPartialProcs);
00049   CPPUNIT_TEST(testInterpKernelDEC3DSurfEmptyBBox);
00050   CPPUNIT_TEST(testOverlapDEC1);
00051 
00052   CPPUNIT_TEST(testSynchronousEqualInterpKernelWithoutInterpNativeDEC_2D);
00053   CPPUNIT_TEST(testSynchronousEqualInterpKernelWithoutInterpDEC_2D);
00054   CPPUNIT_TEST(testSynchronousEqualInterpKernelDEC_2D);
00055   CPPUNIT_TEST(testSynchronousFasterSourceInterpKernelDEC_2D);
00056   CPPUNIT_TEST(testSynchronousSlowerSourceInterpKernelDEC_2D);
00057   CPPUNIT_TEST(testSynchronousSlowSourceInterpKernelDEC_2D);
00058   CPPUNIT_TEST(testSynchronousFastSourceInterpKernelDEC_2D);
00059   CPPUNIT_TEST(testAsynchronousEqualInterpKernelDEC_2D);
00060   CPPUNIT_TEST(testAsynchronousFasterSourceInterpKernelDEC_2D);
00061   CPPUNIT_TEST(testAsynchronousSlowerSourceInterpKernelDEC_2D);
00062   CPPUNIT_TEST(testAsynchronousSlowSourceInterpKernelDEC_2D);
00063   CPPUNIT_TEST(testAsynchronousFastSourceInterpKernelDEC_2D);
00064 #ifdef MED_ENABLE_FVM
00065   //can be added again after FVM correction for 2D
00066   //  CPPUNIT_TEST(testNonCoincidentDEC_2D);
00067   CPPUNIT_TEST(testNonCoincidentDEC_3D); 
00068 #endif
00069   CPPUNIT_TEST(testStructuredCoincidentDEC);
00070   CPPUNIT_TEST(testStructuredCoincidentDEC);
00071   CPPUNIT_TEST(testICocoTrio1);
00072   CPPUNIT_TEST(testGauthier1);
00073   CPPUNIT_TEST(testGauthier2);
00074   CPPUNIT_TEST(testGauthier3);
00075   CPPUNIT_TEST(testFabienAPI1);
00076   CPPUNIT_TEST(testFabienAPI2);
00077   CPPUNIT_TEST(testMEDLoaderRead1);
00078   CPPUNIT_TEST(testMEDLoaderPolygonRead);
00079   CPPUNIT_TEST(testMEDLoaderPolyhedronRead);
00080   CPPUNIT_TEST_SUITE_END();
00081   
00082 
00083 public:
00084  
00085   ParaMEDMEMTest():CppUnit::TestFixture(){}
00086   ~ParaMEDMEMTest(){}  
00087   void setUp(){}
00088   void tearDown(){}
00089   void testMPIProcessorGroup_constructor();
00090   void testMPIProcessorGroup_boolean();
00091   void testMPIProcessorGroup_rank();
00092   void testBlockTopology_constructor();
00093   void testBlockTopology_serialize();
00094   void testInterpKernelDEC_1D();
00095   void testInterpKernelDEC_2DCurve();
00096   void testInterpKernelDEC_2D();
00097   void testInterpKernelDEC2_2D();
00098   void testInterpKernelDEC_2DP0P1();
00099   void testInterpKernelDEC_3D();
00100   void testInterpKernelDECNonOverlapp_2D_P0P0();
00101   void testInterpKernelDECNonOverlapp_2D_P0P1P1P0();
00102   void testInterpKernelDEC2DM1D_P0P0();
00103   void testInterpKernelDECPartialProcs();
00104   void testInterpKernelDEC3DSurfEmptyBBox();
00105   void testOverlapDEC1();
00106 #ifdef MED_ENABLE_FVM
00107   void testNonCoincidentDEC_2D();
00108   void testNonCoincidentDEC_3D();
00109 #endif
00110   void testStructuredCoincidentDEC();
00111   void testSynchronousEqualInterpKernelWithoutInterpNativeDEC_2D();
00112   void testSynchronousEqualInterpKernelWithoutInterpDEC_2D();
00113   void testSynchronousEqualInterpKernelDEC_2D();
00114   void testSynchronousFasterSourceInterpKernelDEC_2D();
00115   void testSynchronousSlowerSourceInterpKernelDEC_2D();
00116   void testSynchronousSlowSourceInterpKernelDEC_2D();
00117   void testSynchronousFastSourceInterpKernelDEC_2D();
00118 
00119   void testAsynchronousEqualInterpKernelDEC_2D();
00120   void testAsynchronousFasterSourceInterpKernelDEC_2D();
00121   void testAsynchronousSlowerSourceInterpKernelDEC_2D();
00122   void testAsynchronousSlowSourceInterpKernelDEC_2D();
00123   void testAsynchronousFastSourceInterpKernelDEC_2D();
00124   //
00125   void testICocoTrio1();
00126   void testGauthier1();
00127   void testGauthier2();
00128   void testGauthier3();
00129   void testFabienAPI1();
00130   void testFabienAPI2();
00131   //
00132   void testMEDLoaderRead1();
00133   void testMEDLoaderPolygonRead();
00134   void testMEDLoaderPolyhedronRead();
00135   void testMEDLoaderWrite1();
00136   void testMEDLoaderPolygonWrite();
00137 
00138   std::string getResourceFile( const std::string& );
00139   std::string getTmpDirectory();
00140   std::string makeTmpFile( const std::string&, const std::string& = "" );
00141 
00142 private:
00143 #ifdef MED_ENABLE_FVM
00144   void testNonCoincidentDEC(const std::string& filename1, 
00145                             const std::string& meshname1, 
00146                             const std::string& filename2, 
00147                             const std::string& meshname2,
00148                             int nbprocsource, double epsilon);
00149 #endif
00150   void testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA, 
00151                                           double dtB, double tmaxB,
00152                                           bool WithPointToPoint, bool Asynchronous, bool WithInterp, const char *srcMeth, const char *targetMeth);
00153   void testInterpKernelDEC_2D_(const char *srcMeth, const char *targetMeth);
00154   void testInterpKernelDEC2_2D_(const char *srcMeth, const char *targetMeth);
00155   void testInterpKernelDEC_3D_(const char *srcMeth, const char *targetMeth);
00156 };
00157 
00158 // to automatically remove temporary files from disk
00159 class ParaMEDMEMTest_TmpFilesRemover
00160 {
00161 public:
00162   ParaMEDMEMTest_TmpFilesRemover() {}
00163   ~ParaMEDMEMTest_TmpFilesRemover();
00164   bool Register(const std::string theTmpFile);
00165 
00166 private:
00167   std::set<std::string> myTmpFiles;
00168 };
00169 
00173 template<class T>
00174 void ParaMEDMEMTest_DumpArray (std::ostream & stream, const T* array, const int length, const std::string text)
00175 {
00176   stream << text << ": {";
00177   if (length > 0) {
00178     stream << array[0];
00179     for (int i = 1; i < length; i++) {
00180       stream << ", " << array[i];
00181     }
00182   }
00183   stream << "}" << std::endl;
00184 }
00185 
00186 #endif