Back to index

salome-med  6.5.0
MEDPARTITIONERTest.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 __MEDPARTITIONERTEST_HXX__
00021 #define __MEDPARTITIONERTEST_HXX__
00022 
00023 #ifdef WIN32
00024 # if defined MEDPARTITIONERTEST_EXPORTS || defined MEDPARTITIONERTest_EXPORTS
00025 #  define MEDPARTITIONERTEST_EXPORT __declspec( dllexport )
00026 # else
00027 #  define MEDPARTITIONERTEST_EXPORT __declspec( dllimport )
00028 # endif
00029 #else
00030 # define MEDPARTITIONERTEST_EXPORT
00031 #endif
00032 
00033 
00034 #include <cppunit/extensions/HelperMacros.h>
00035 
00036 #include <set>
00037 #include <string>
00038 #include <iostream>
00039 
00040 #include "MEDCouplingUMesh.hxx"
00041 #include "MEDCouplingExtrudedMesh.hxx"
00042 #include "MEDCouplingFieldDouble.hxx"
00043 
00044 class MEDPARTITIONERTEST_EXPORT MEDPARTITIONERTest : public CppUnit::TestFixture
00045 {
00046   CPPUNIT_TEST_SUITE( MEDPARTITIONERTest );
00047   CPPUNIT_TEST( testMeshCollectionSingle );
00048   CPPUNIT_TEST( testMeshCollectionXml );
00049 #if defined(MED_ENABLE_METIS)
00050   CPPUNIT_TEST( testMeshCollectionSinglePartitionMetis );
00051   CPPUNIT_TEST( testMeshCollectionComplexPartitionMetis );
00052   CPPUNIT_TEST( testMetisSmallSize );
00053 #endif
00054 #if defined(MED_ENABLE_SCOTCH)
00055   CPPUNIT_TEST( testMeshCollectionSinglePartitionScotch );
00056   CPPUNIT_TEST( testMeshCollectionComplexPartitionScotch );
00057   CPPUNIT_TEST( testScotchSmallSize );
00058 #endif
00059   
00060 #if defined(HAVE_MPI2)
00061 #if defined(MED_ENABLE_PARMETIS)
00062   //test with mpi on system
00063   CPPUNIT_TEST( testMpirunSmallSize );
00064   CPPUNIT_TEST( testMpirunMedianSize );
00065   CPPUNIT_TEST( testMpirunHugeSize );
00066 #endif
00067 #endif
00068 
00069   //CPPUNIT_TEST( deleteTestMeshes );
00070   CPPUNIT_TEST_SUITE_END();
00071 
00072 public:
00073 
00074   //global use
00075   int _ni;  //nb of hexa9
00076   int _nj;
00077   int _nk;
00078   int _ntot;
00079   std::string _file_name; //initial test mesh file med CUBE3D
00080   std::string _file_name_with_faces; //initial test mesh file med CUBE3D plus a set of faces
00081   std::string _file_name2; //initial test mesh file med CARRE3D
00082   std::string _file_name_huge_xml;
00083   int _nb_target_huge;
00084   std::string _mesh_name; //initial test mesh file med
00085   int _verbose;
00086   
00087   //for utils
00088   void setSize(int ni, int nj, int nk);
00089   void setSmallSize();
00090   void setMedianSize();
00091   void setbigSize();
00092   std::string getPartitionerExe() const;
00093   ParaMEDMEM::MEDCouplingUMesh * buildCUBE3DMesh();
00094   ParaMEDMEM::MEDCouplingUMesh * buildFACE3DMesh();
00095   ParaMEDMEM::MEDCouplingUMesh * buildCARRE3DMesh();
00096   ParaMEDMEM::MEDCouplingFieldDouble * buildVecFieldOnCells(std::string myfileName);
00097   ParaMEDMEM::MEDCouplingFieldDouble * buildVecFieldOnNodes();
00098   void createTestMeshWithoutField();
00099   void createTestMeshWithVecFieldOnCells();
00100   void createTestMeshWithVecFieldOnNodes();
00101   void verifyTestMeshWithVecFieldOnNodes();
00102   void verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std::string MetisOrScotch);
00103   void verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnCells(std::string MetisOrScotch);
00104   void verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnGaussNe(std::string MetisOrScotch);
00105   void verifyMedpartitionerOnSmallSizeForMesh();
00106   void verifyMedpartitionerOnSmallSizeForFieldOnCells();
00107   void verifyMedpartitionerOnSmallSizeForFieldOnGaussNe();
00108   void createTestMeshes();
00109   void createHugeTestMesh(int ni, int nj, int nk, int nbx, int nby, int nbz, int nbTarget);
00110   void launchMetisOrScotchMedpartitionerOnTestMeshes(std::string MetisOrScotch);
00111   void launchMedpartitionerOnTestMeshes();
00112   void launchMedpartitionerOnHugeTestMeshes();
00113   void deleteTestMeshes();
00114   
00115   //for CPPUNIT_TEST
00116   void setUp();
00117   void tearDown();
00118   void testMeshCollectionSingle();
00119   void testMeshCollectionXml();
00120 #if defined(MED_ENABLE_METIS)
00121   void testMeshCollectionSinglePartitionMetis();
00122   void testMeshCollectionComplexPartitionMetis();
00123   void testMetisSmallSize();
00124 #endif
00125 #if defined(MED_ENABLE_SCOTCH)
00126   void testMeshCollectionSinglePartitionScotch();
00127   void testMeshCollectionComplexPartitionScotch();
00128   void testScotchSmallSize();
00129 #endif
00130   
00131 #if defined(HAVE_MPI2)
00132   void testMpirunSmallSize();
00133   void testMpirunMedianSize();
00134   void testMpirunHugeSize();
00135 #endif
00136 };
00137 
00138 #endif