Salome HOME
9d9bf4859977d7218832a3c286ae25ad6c05f097
[modules/med.git] / src / MEDMEMCppTest / MEDMEMTest.hxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
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.
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 _MEDMEMTEST_HXX_
21 #define _MEDMEMTEST_HXX_
22
23 #include "MEDMEMCppTestExport.hxx"
24 #include "MEDMEMTest_Utils.hxx"
25
26 #include <cppunit/extensions/HelperMacros.h>
27 #include "MEDMEM_Field.hxx"
28
29 #include <set>
30 #include <string>
31 //#include <ostream>
32 #include <iostream>
33
34 namespace MEDMEM {
35   class MESH;
36 }
37
38 class MEDMEMCPPTEST_EXPORT MEDMEMTest : public CppUnit::TestFixture
39 {
40   CPPUNIT_TEST_SUITE( MEDMEMTest );
41   //0
42   CPPUNIT_TEST( testArray );
43   CPPUNIT_TEST( testArrayConvert );
44   //CPPUNIT_TEST( testArrayInterface /* not in spec */ );
45   CPPUNIT_TEST( testAsciiFieldDriver );
46   //CPPUNIT_TEST( testCellModel /* not in spec */ );
47   CPPUNIT_TEST( testConnectivity );
48   CPPUNIT_TEST( testCoordinate );
49   CPPUNIT_TEST( testDriverFactory );
50   //CPPUNIT_TEST( testDriversDef /* not in spec */ );
51   //10
52   //CPPUNIT_TEST( testDriverTools /* not in spec */ );
53   //CPPUNIT_TEST( testException /* not in spec */ );
54   CPPUNIT_TEST( testFamily );
55   CPPUNIT_TEST( testField );
56   CPPUNIT_TEST( testFieldConvert );
57   CPPUNIT_TEST( testFormulae );
58   CPPUNIT_TEST( testGaussLocalization );
59   CPPUNIT_TEST( testGibiMeshDriver );
60   //20
61   //CPPUNIT_TEST( testGrid );
62   CPPUNIT_TEST( testGroup );
63   CPPUNIT_TEST( testIndexCheckingPolicy );
64   CPPUNIT_TEST( testInit /* cxx */ );
65   //CPPUNIT_TEST( testInterlacingPolicy /* not in spec */ );
66   //CPPUNIT_TEST( testInterlacingTraits /* not in spec */ );
67   CPPUNIT_TEST( testMedFieldDriver );
68   CPPUNIT_TEST( testReadFieldOnNodesAndCells );
69   //CPPUNIT_TEST( testMedFieldDriver /* not in spec */ );
70   CPPUNIT_TEST( testMedFileBrowser );
71   //30
72   //CPPUNIT_TEST( testMEDMEMchampLire /* not in spec */ );
73   //CPPUNIT_TEST( testMEDMEMgaussEcr /* not in spec */ );
74   //CPPUNIT_TEST( testMEDMEMprofilEcr /* not in spec */ );
75   CPPUNIT_TEST( testMedMeshDriver );
76   //CPPUNIT_TEST( testMedMeshDriver /* not in spec */ );
77   CPPUNIT_TEST( testMedVersion );
78   //40
79   CPPUNIT_TEST( testMeshAndMeshing );
80   CPPUNIT_TEST( testModulusArray );
81   CPPUNIT_TEST( testnArray );
82   CPPUNIT_TEST( testPartialDescendingConnectivity );
83   CPPUNIT_TEST( testPointerOf );
84   CPPUNIT_TEST( testPorflowMeshDriver );
85   //CPPUNIT_TEST( testRCBase /* not in spec */ );
86   //CPPUNIT_TEST( testSetInterlacingType /* not in spec */ );
87   CPPUNIT_TEST( testSkyLineArray );
88   //50
89   CPPUNIT_TEST( testSTRING );
90   CPPUNIT_TEST( testSupport );
91   //CPPUNIT_TEST( testTags /* not in spec */ );
92   //CPPUNIT_TEST( testTopLevel );
93   //  CPPUNIT_TEST( testTypeMeshDriver );
94   CPPUNIT_TEST( testUnit );
95   CPPUNIT_TEST( testVtkFieldDriver );
96   CPPUNIT_TEST( testVtkMedDriver );
97   CPPUNIT_TEST( testVtkMeshDriver );
98   //CPPUNIT_TEST( testmedimport_src /* not in spec */ );
99   //60
100   CPPUNIT_TEST( testExtractor );
101   CPPUNIT_TEST( testMeshFuse );
102   CPPUNIT_TEST( testDesactivateFacesComputation ); // issue 0020411
103   CPPUNIT_TEST( testGetVolumeAbs );
104   CPPUNIT_TEST( test_remapper4 );
105   CPPUNIT_TEST( test_remapper5 );
106   CPPUNIT_TEST( test_remapper6 );
107   CPPUNIT_TEST( test_remapper7 );
108   CPPUNIT_TEST( test_remapper3DTo1D );
109   CPPUNIT_TEST( test_RemapperP0P0 );
110   CPPUNIT_TEST( test_RemapperP1P1 );
111   CPPUNIT_TEST( test_RemapperP1P0 );
112   CPPUNIT_TEST( test_RemapperP0P1 );
113   CPPUNIT_TEST( testGetGaussPointsCoordinates );
114   CPPUNIT_TEST_SUITE_END();
115
116 public:
117   void setUp();
118   void tearDown();
119
120   void testArray();
121   void testArrayConvert();
122   //void testArrayInterface() /* not in spec */;
123   void testAsciiFieldDriver();
124   //void testCellModel() /* not in spec */;
125   void testConnectivity();
126   void testCoordinate();
127   void testDriverFactory();
128   //void testDriversDef() /* not in spec */;
129   //10
130   //void testDriverTools() /* not in spec */;
131   void testException() /* not in spec */;
132   void testFamily();
133   void testField();
134   void testFieldConvert();
135   void testFormulae();
136   void testGaussLocalization();
137   void testGibiMeshDriver();
138   //20
139   void testGrid();
140   void testGroup();
141   void testIndexCheckingPolicy();
142   void testInit() /* cxx */;
143   //void testInterlacingPolicy() /* not in spec */;
144   //void testInterlacingTraits() /* not in spec */;
145   void testMedFieldDriver();
146   void testReadFieldOnNodesAndCells();
147   //void testMedFieldDriver /* not in spec */();
148   void testMedFileBrowser();
149   //30
150   //void testMEDMEMchampLire() /* not in spec */;
151   //void testMEDMEMgaussEcr() /* not in spec */;
152   //void testMEDMEMprofilEcr() /* not in spec */;
153   void testMedMeshDriver();
154   //void testMedMeshDriver() /* not in spec */;
155   void testMedVersion();
156   //40
157   void testMeshAndMeshing();
158   void testModulusArray();
159   void testnArray();
160   void testPartialDescendingConnectivity();
161   void testPointerOf();
162   void testPorflowMeshDriver();
163   //void testRCBase() /* not in spec */;
164   //void testSetInterlacingType /*  IMED_MESH_RDWR_DRIVER(driver), not in spec */();
165   void testSkyLineArray();
166   //50
167   void testSTRING();
168   void testSupport();
169   //void testTags() /* not in spec */;
170   void testTopLevel();
171   void testTypeMeshDriver();
172   void testUnit();
173   void testVtkFieldDriver();
174   void testVtkMedDriver();
175   void testVtkMeshDriver();
176   //void testmedimport_src() /* not in spec */;
177   //60
178   void testExtractor();
179   void testMeshFuse();
180   void testDesactivateFacesComputation(); // issue 0020411
181   void testGetVolumeAbs();
182   void test_RemapperP0P0();
183   void test_RemapperP1P1();
184   void test_RemapperP1P0();
185   void test_RemapperP0P1();
186   void test_remapper4();
187   void test_remapper5();
188   void test_remapper6();
189   void test_remapper7();
190   void test_remapper3DTo1D();
191   void testGetGaussPointsCoordinates();
192
193   //private:
194   void absField(MEDMEM::FIELD<double>&);
195  private:
196   double sumAll(const std::vector< std::map<int,double> >& matrix);
197 };
198
199 // to create a mesh with certain filling
200 MEDMEMCPPTEST_EXPORT MEDMEM::MESH * MEDMEMTest_createTestMesh();
201
202 // to automatically remove temporary files from disk
203 class MEDMEMCPPTEST_EXPORT MEDMEMTest_TmpFilesRemover
204 {
205 public:
206   MEDMEMTest_TmpFilesRemover() {}
207   ~MEDMEMTest_TmpFilesRemover();
208   bool Register(const std::string theTmpFile);
209
210 private:
211   std::set<std::string> myTmpFiles;
212 };
213
214 /*!
215  *  Tool to print array to stream.
216  */
217 template<class T>
218 void MEDMEMTest_DumpArray (std::ostream & stream, const T* array, const int length, const std::string text)
219 {
220   stream << text << ": {";
221   if (length > 0) {
222     stream << array[0];
223     for (int i = 1; i < length; i++) {
224       stream << ", " << array[i];
225     }
226   }
227   stream << "}" << std::endl;
228 }
229
230 #endif