Salome HOME
f3721c7056d8ff0228ac8aa338d791fbef95dad7
[tools/medcoupling.git] / src / MEDPartitioner / Test / MEDPARTITIONERTest.hxx
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef __MEDPARTITIONERTEST_HXX__
21 #define __MEDPARTITIONERTEST_HXX__
22
23 #ifdef WIN32
24 # if defined MEDPARTITIONERTEST_EXPORTS || defined MEDPARTITIONERTest_EXPORTS
25 #  define MEDPARTITIONERTEST_EXPORT __declspec( dllexport )
26 # else
27 #  define MEDPARTITIONERTEST_EXPORT __declspec( dllimport )
28 # endif
29 #else
30 # define MEDPARTITIONERTEST_EXPORT
31 #endif
32
33
34 #include <cppunit/extensions/HelperMacros.h>
35
36 #include <set>
37 #include <string>
38 #include <iostream>
39
40 #include "MEDCouplingUMesh.hxx"
41 #include "MEDCouplingMappedExtrudedMesh.hxx"
42 #include "MEDCouplingFieldDouble.hxx"
43
44 class MEDPARTITIONERTEST_EXPORT MEDPARTITIONERTest : public CppUnit::TestFixture
45 {
46   CPPUNIT_TEST_SUITE( MEDPARTITIONERTest );
47   CPPUNIT_TEST( testMeshCollectionSingle );
48   CPPUNIT_TEST( testMeshCollectionXml );
49 #if defined(MED_ENABLE_METIS)
50   CPPUNIT_TEST( testMeshCollectionSinglePartitionMetis );
51   CPPUNIT_TEST( testMeshCollectionComplexPartitionMetis );
52   CPPUNIT_TEST( testMetisSmallSize );
53 #endif
54 #if defined(MED_ENABLE_SCOTCH)
55   CPPUNIT_TEST( testMeshCollectionSinglePartitionScotch );
56   CPPUNIT_TEST( testMeshCollectionComplexPartitionScotch );
57   CPPUNIT_TEST( testScotchSmallSize );
58 #endif
59
60 // [ABN] TO BE REVISED:
61
62 //#if defined(HAVE_MPI)
63 //#if defined(MED_ENABLE_PARMETIS)
64 //  //test with mpi on system
65 //  CPPUNIT_TEST( testMpirunSmallSize );
66 //  CPPUNIT_TEST( testMpirunMedianSize );
67 //  CPPUNIT_TEST( testMpirunHugeSize );
68 //#endif
69 //#endif
70
71   CPPUNIT_TEST( testCreateBoundaryFaces2D ); // imp 0021756
72
73   //CPPUNIT_TEST( deleteTestMeshes );
74   CPPUNIT_TEST_SUITE_END();
75
76 public:
77
78   //global use
79   int _ni;  //nb of hexa9
80   int _nj;
81   int _nk;
82   int _ntot;
83   std::string _file_name; //initial test mesh file med CUBE3D
84   std::string _file_name_with_faces; //initial test mesh file med CUBE3D plus a set of faces
85   std::string _file_name2; //initial test mesh file med CARRE3D
86   std::string _file_name_huge_xml;
87   int _nb_target_huge;
88   std::string _mesh_name; //initial test mesh file med
89   int _verbose;
90
91   //for utils
92   void setSize(int ni, int nj, int nk);
93   void setSmallSize();
94   void setMedianSize();
95   void setbigSize();
96   std::string getPartitionerExe() const;
97   std::string getPartitionerParaExe() const;
98   MEDCoupling::MEDCouplingUMesh * buildCUBE3DMesh();
99   MEDCoupling::MEDCouplingUMesh * buildFACE3DMesh();
100   MEDCoupling::MEDCouplingUMesh * buildCARRE3DMesh();
101   MEDCoupling::MEDCouplingFieldDouble * buildVecFieldOnCells(std::string myfileName);
102   MEDCoupling::MEDCouplingFieldDouble * buildVecFieldOnNodes();
103   void createTestMeshWithoutField();
104   void createTestMeshWithVecFieldOnCells();
105   void createTestMeshWithVecFieldOnNodes();
106   void verifyTestMeshWithVecFieldOnNodes();
107   void verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std::string MetisOrScotch);
108   void verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnCells(std::string MetisOrScotch);
109   void verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnGaussNe(std::string MetisOrScotch);
110   void verifyMedpartitionerOnSmallSizeForMesh();
111   void verifyMedpartitionerOnSmallSizeForFieldOnCells();
112   void verifyMedpartitionerOnSmallSizeForFieldOnGaussNe();
113   void createTestMeshes();
114   void createHugeTestMesh(int ni, int nj, int nk, int nbx, int nby, int nbz, int nbTarget);
115   void launchMetisOrScotchMedpartitionerOnTestMeshes(std::string MetisOrScotch);
116   void launchMedpartitionerOnTestMeshes();
117   void launchMedpartitionerOnHugeTestMeshes();
118   void deleteTestMeshes();
119
120   //for CPPUNIT_TEST
121   void setUp();
122   void tearDown();
123   void testMeshCollectionSingle();
124   void testMeshCollectionXml();
125 #if defined(MED_ENABLE_METIS)
126   void testMeshCollectionSinglePartitionMetis();
127   void testMeshCollectionComplexPartitionMetis();
128   void testMetisSmallSize();
129 #endif
130 #if defined(MED_ENABLE_SCOTCH)
131   void testMeshCollectionSinglePartitionScotch();
132   void testMeshCollectionComplexPartitionScotch();
133   void testScotchSmallSize();
134 #endif
135
136 #if defined(HAVE_MPI)
137   void testMpirunSmallSize();
138   void testMpirunMedianSize();
139   void testMpirunHugeSize();
140 #endif
141
142   void testCreateBoundaryFaces2D();
143 };
144
145 #endif