Back to index

salome-med  6.5.0
MEDMEMTest.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
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 _MEDMEMTEST_HXX_
00021 #define _MEDMEMTEST_HXX_
00022 
00023 #include "MEDMEMCppTestExport.hxx"
00024 #include "MEDMEMTest_Utils.hxx"
00025 
00026 #include <cppunit/extensions/HelperMacros.h>
00027 #include "MEDMEM_Field.hxx"
00028 
00029 #include <set>
00030 #include <string>
00031 //#include <ostream>
00032 #include <iostream>
00033 
00034 namespace MEDMEM {
00035   class MESH;
00036 }
00037 
00038 class MEDMEMCPPTEST_EXPORT MEDMEMTest : public CppUnit::TestFixture
00039 {
00040   CPPUNIT_TEST_SUITE( MEDMEMTest );
00041   //0
00042   CPPUNIT_TEST( testArray );
00043   CPPUNIT_TEST( testArrayConvert );
00044   //CPPUNIT_TEST( testArrayInterface /* not in spec */ );
00045   CPPUNIT_TEST( testAsciiFieldDriver );
00046   //CPPUNIT_TEST( testCellModel /* not in spec */ );
00047   CPPUNIT_TEST( testConnectivity );
00048   CPPUNIT_TEST( testCoordinate );
00049   CPPUNIT_TEST( testDriverFactory );
00050   //CPPUNIT_TEST( testDriversDef /* not in spec */ );
00051   //10
00052   //CPPUNIT_TEST( testDriverTools /* not in spec */ );
00053   //CPPUNIT_TEST( testException /* not in spec */ );
00054   CPPUNIT_TEST( testFamily );
00055   CPPUNIT_TEST( testField );
00056   CPPUNIT_TEST( testFieldConvert );
00057   CPPUNIT_TEST( testFormulae );
00058   CPPUNIT_TEST( testGaussLocalization );
00059   CPPUNIT_TEST( testGibiMeshDriver );
00060   //20
00061   //CPPUNIT_TEST( testGrid );
00062   CPPUNIT_TEST( testGroup );
00063   CPPUNIT_TEST( testIndexCheckingPolicy );
00064   CPPUNIT_TEST( testInit /* cxx */ );
00065   //CPPUNIT_TEST( testInterlacingPolicy /* not in spec */ );
00066   //CPPUNIT_TEST( testInterlacingTraits /* not in spec */ );
00067   CPPUNIT_TEST( testMedFieldDriver );
00068   CPPUNIT_TEST( testReadFieldOnNodesAndCells );
00069   //CPPUNIT_TEST( testMedFieldDriver /* not in spec */ );
00070   CPPUNIT_TEST( testMedFileBrowser );
00071   //30
00072   //CPPUNIT_TEST( testMEDMEMchampLire /* not in spec */ );
00073   //CPPUNIT_TEST( testMEDMEMgaussEcr /* not in spec */ );
00074   //CPPUNIT_TEST( testMEDMEMprofilEcr /* not in spec */ );
00075   CPPUNIT_TEST( testMedMeshDriver );
00076   //CPPUNIT_TEST( testMedMeshDriver /* not in spec */ );
00077   CPPUNIT_TEST( testMedVersion );
00078   //40
00079   CPPUNIT_TEST( testMeshAndMeshing );
00080   CPPUNIT_TEST( testModulusArray );
00081   CPPUNIT_TEST( testnArray );
00082   CPPUNIT_TEST( testPartialDescendingConnectivity );
00083   CPPUNIT_TEST( testPointerOf );
00084   CPPUNIT_TEST( testPorflowMeshDriver );
00085   //CPPUNIT_TEST( testRCBase /* not in spec */ );
00086   //CPPUNIT_TEST( testSetInterlacingType /* not in spec */ );
00087   CPPUNIT_TEST( testSkyLineArray );
00088   //50
00089   CPPUNIT_TEST( testSTRING );
00090   CPPUNIT_TEST( testSupport );
00091   //CPPUNIT_TEST( testTags /* not in spec */ );
00092   //CPPUNIT_TEST( testTopLevel );
00093   //  CPPUNIT_TEST( testTypeMeshDriver );
00094   CPPUNIT_TEST( testUnit );
00095   CPPUNIT_TEST( testVtkFieldDriver );
00096   CPPUNIT_TEST( testVtkMedDriver );
00097   CPPUNIT_TEST( testVtkMeshDriver );
00098   //CPPUNIT_TEST( testmedimport_src /* not in spec */ );
00099   //60
00100   CPPUNIT_TEST( testExtractor );
00101   CPPUNIT_TEST( testMeshFuse );
00102   CPPUNIT_TEST( testDesactivateFacesComputation ); // issue 0020411
00103   CPPUNIT_TEST( testGetVolumeAbs );
00104   CPPUNIT_TEST( test_remapper4 );
00105   CPPUNIT_TEST( test_remapper5 );
00106   CPPUNIT_TEST( test_remapper6 );
00107   CPPUNIT_TEST( test_remapper7 );
00108   CPPUNIT_TEST( test_remapper3DTo1D );
00109   CPPUNIT_TEST( test_RemapperP0P0 );
00110   CPPUNIT_TEST( test_RemapperP1P1 );
00111   CPPUNIT_TEST( test_RemapperP1P0 );
00112   CPPUNIT_TEST( test_RemapperP0P1 );
00113   CPPUNIT_TEST( testGetGaussPointsCoordinates );
00114   CPPUNIT_TEST_SUITE_END();
00115 
00116 public:
00117   void setUp();
00118   void tearDown();
00119 
00120   void testArray();
00121   void testArrayConvert();
00122   //void testArrayInterface() /* not in spec */;
00123   void testAsciiFieldDriver();
00124   //void testCellModel() /* not in spec */;
00125   void testConnectivity();
00126   void testCoordinate();
00127   void testDriverFactory();
00128   //void testDriversDef() /* not in spec */;
00129   //10
00130   //void testDriverTools() /* not in spec */;
00131   void testException() /* not in spec */;
00132   void testFamily();
00133   void testField();
00134   void testFieldConvert();
00135   void testFormulae();
00136   void testGaussLocalization();
00137   void testGibiMeshDriver();
00138   //20
00139   void testGrid();
00140   void testGroup();
00141   void testIndexCheckingPolicy();
00142   void testInit() /* cxx */;
00143   //void testInterlacingPolicy() /* not in spec */;
00144   //void testInterlacingTraits() /* not in spec */;
00145   void testMedFieldDriver();
00146   void testReadFieldOnNodesAndCells();
00147   //void testMedFieldDriver /* not in spec */();
00148   void testMedFileBrowser();
00149   //30
00150   //void testMEDMEMchampLire() /* not in spec */;
00151   //void testMEDMEMgaussEcr() /* not in spec */;
00152   //void testMEDMEMprofilEcr() /* not in spec */;
00153   void testMedMeshDriver();
00154   //void testMedMeshDriver() /* not in spec */;
00155   void testMedVersion();
00156   //40
00157   void testMeshAndMeshing();
00158   void testModulusArray();
00159   void testnArray();
00160   void testPartialDescendingConnectivity();
00161   void testPointerOf();
00162   void testPorflowMeshDriver();
00163   //void testRCBase() /* not in spec */;
00164   //void testSetInterlacingType /*  IMED_MESH_RDWR_DRIVER(driver), not in spec */();
00165   void testSkyLineArray();
00166   //50
00167   void testSTRING();
00168   void testSupport();
00169   //void testTags() /* not in spec */;
00170   void testTopLevel();
00171   void testTypeMeshDriver();
00172   void testUnit();
00173   void testVtkFieldDriver();
00174   void testVtkMedDriver();
00175   void testVtkMeshDriver();
00176   //void testmedimport_src() /* not in spec */;
00177   //60
00178   void testExtractor();
00179   void testMeshFuse();
00180   void testDesactivateFacesComputation(); // issue 0020411
00181   void testGetVolumeAbs();
00182   void test_RemapperP0P0();
00183   void test_RemapperP1P1();
00184   void test_RemapperP1P0();
00185   void test_RemapperP0P1();
00186   void test_remapper4();
00187   void test_remapper5();
00188   void test_remapper6();
00189   void test_remapper7();
00190   void test_remapper3DTo1D();
00191   void testGetGaussPointsCoordinates();
00192 
00193   //private:
00194   void absField(MEDMEM::FIELD<double>&);
00195  private:
00196   double sumAll(const std::vector< std::map<int,double> >& matrix);
00197 };
00198 
00199 // to create a mesh with certain filling
00200 MEDMEMCPPTEST_EXPORT MEDMEM::MESH * MEDMEMTest_createTestMesh();
00201 
00202 // to automatically remove temporary files from disk
00203 class MEDMEMCPPTEST_EXPORT MEDMEMTest_TmpFilesRemover
00204 {
00205 public:
00206   MEDMEMTest_TmpFilesRemover() {}
00207   ~MEDMEMTest_TmpFilesRemover();
00208   bool Register(const std::string theTmpFile);
00209 
00210 private:
00211   std::set<std::string> myTmpFiles;
00212 };
00213 
00217 template<class T>
00218 void MEDMEMTest_DumpArray (std::ostream & stream, const T* array, const int length, const std::string text)
00219 {
00220   stream << text << ": {";
00221   if (length > 0) {
00222     stream << array[0];
00223     for (int i = 1; i < length; i++) {
00224       stream << ", " << array[i];
00225     }
00226   }
00227   stream << "}" << std::endl;
00228 }
00229 
00230 #endif