Salome HOME
OverlapDEC: bug fix. Bounding box adjustment was negative.
[tools/medcoupling.git] / src / ParaMEDMEMTest / ParaMEDMEMTest.hxx
1 // Copyright (C) 2007-2015  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 _ParaMEDMEMTEST_HXX_
21 #define _ParaMEDMEMTEST_HXX_
22
23 #include <cppunit/extensions/HelperMacros.h>
24
25 #include <set>
26 #include <string>
27 #include <iostream>
28 #include "mpi.h"
29
30
31 class ParaMEDMEMTest : public CppUnit::TestFixture
32 {
33   CPPUNIT_TEST_SUITE( ParaMEDMEMTest );
34   CPPUNIT_TEST(testMPIProcessorGroup_constructor);
35   CPPUNIT_TEST(testMPIProcessorGroup_boolean);
36   CPPUNIT_TEST(testMPIProcessorGroup_rank);
37   CPPUNIT_TEST(testBlockTopology_constructor);
38   CPPUNIT_TEST(testBlockTopology_serialize);
39   CPPUNIT_TEST(testInterpKernelDEC_1D);
40   CPPUNIT_TEST(testInterpKernelDEC_2DCurve);
41   CPPUNIT_TEST(testInterpKernelDEC_2D);
42   CPPUNIT_TEST(testInterpKernelDEC2_2D);
43   CPPUNIT_TEST(testInterpKernelDEC_2DP0P1);
44   CPPUNIT_TEST(testInterpKernelDEC_3D);
45   CPPUNIT_TEST(testInterpKernelDECNonOverlapp_2D_P0P0);
46   CPPUNIT_TEST(testInterpKernelDECNonOverlapp_2D_P0P1P1P0);
47   CPPUNIT_TEST(testInterpKernelDEC2DM1D_P0P0);
48   CPPUNIT_TEST(testInterpKernelDECPartialProcs);
49   CPPUNIT_TEST(testInterpKernelDEC3DSurfEmptyBBox);
50   CPPUNIT_TEST(testOverlapDEC1);
51   CPPUNIT_TEST(testOverlapDEC2);
52 //    CPPUNIT_TEST(testOverlapDEC_LMEC_seq);
53 //    CPPUNIT_TEST(testOverlapDEC_LMEC_para);
54 //
55   CPPUNIT_TEST(testSynchronousEqualInterpKernelWithoutInterpNativeDEC_2D);
56   CPPUNIT_TEST(testSynchronousEqualInterpKernelWithoutInterpDEC_2D);
57   CPPUNIT_TEST(testSynchronousEqualInterpKernelDEC_2D);
58   CPPUNIT_TEST(testSynchronousFasterSourceInterpKernelDEC_2D);
59   CPPUNIT_TEST(testSynchronousSlowerSourceInterpKernelDEC_2D);
60   CPPUNIT_TEST(testSynchronousSlowSourceInterpKernelDEC_2D);
61   CPPUNIT_TEST(testSynchronousFastSourceInterpKernelDEC_2D);
62   CPPUNIT_TEST(testAsynchronousEqualInterpKernelDEC_2D);
63   CPPUNIT_TEST(testAsynchronousFasterSourceInterpKernelDEC_2D);
64   CPPUNIT_TEST(testAsynchronousSlowerSourceInterpKernelDEC_2D);
65   CPPUNIT_TEST(testAsynchronousSlowSourceInterpKernelDEC_2D);
66   CPPUNIT_TEST(testAsynchronousFastSourceInterpKernelDEC_2D);
67 //#ifdef MED_ENABLE_FVM
68 //  //can be added again after FVM correction for 2D
69 //  //  CPPUNIT_TEST(testNonCoincidentDEC_2D);
70 //  CPPUNIT_TEST(testNonCoincidentDEC_3D);
71 //#endif
72   CPPUNIT_TEST(testStructuredCoincidentDEC);
73   CPPUNIT_TEST(testStructuredCoincidentDEC);
74   CPPUNIT_TEST(testICoco1);
75   CPPUNIT_TEST(testGauthier1);
76   CPPUNIT_TEST(testGauthier2);
77   CPPUNIT_TEST(testGauthier3);
78   CPPUNIT_TEST(testGauthier4);
79   CPPUNIT_TEST(testFabienAPI1);
80   CPPUNIT_TEST(testFabienAPI2);
81   CPPUNIT_TEST(testMEDLoaderRead1);
82   CPPUNIT_TEST(testMEDLoaderPolygonRead);
83   CPPUNIT_TEST(testMEDLoaderPolyhedronRead);
84   CPPUNIT_TEST_SUITE_END();
85   
86
87 public:
88  
89   ParaMEDMEMTest():CppUnit::TestFixture(){}
90   ~ParaMEDMEMTest(){}  
91   void setUp(){}
92   void tearDown(){}
93   void testMPIProcessorGroup_constructor();
94   void testMPIProcessorGroup_boolean();
95   void testMPIProcessorGroup_rank();
96   void testBlockTopology_constructor();
97   void testBlockTopology_serialize();
98   void testInterpKernelDEC_1D();
99   void testInterpKernelDEC_2DCurve();
100   void testInterpKernelDEC_2D();
101   void testInterpKernelDEC2_2D();
102   void testInterpKernelDEC_2DP0P1();
103   void testInterpKernelDEC_3D();
104   void testInterpKernelDECNonOverlapp_2D_P0P0();
105   void testInterpKernelDECNonOverlapp_2D_P0P1P1P0();
106   void testInterpKernelDEC2DM1D_P0P0();
107   void testInterpKernelDECPartialProcs();
108   void testInterpKernelDEC3DSurfEmptyBBox();
109   void testOverlapDEC1();
110   void testOverlapDEC2();
111   void testOverlapDEC_LMEC_seq();
112   void testOverlapDEC_LMEC_para();
113 #ifdef MED_ENABLE_FVM
114   void testNonCoincidentDEC_2D();
115   void testNonCoincidentDEC_3D();
116 #endif
117   void testStructuredCoincidentDEC();
118   void testSynchronousEqualInterpKernelWithoutInterpNativeDEC_2D();
119   void testSynchronousEqualInterpKernelWithoutInterpDEC_2D();
120   void testSynchronousEqualInterpKernelDEC_2D();
121   void testSynchronousFasterSourceInterpKernelDEC_2D();
122   void testSynchronousSlowerSourceInterpKernelDEC_2D();
123   void testSynchronousSlowSourceInterpKernelDEC_2D();
124   void testSynchronousFastSourceInterpKernelDEC_2D();
125
126   void testAsynchronousEqualInterpKernelDEC_2D();
127   void testAsynchronousFasterSourceInterpKernelDEC_2D();
128   void testAsynchronousSlowerSourceInterpKernelDEC_2D();
129   void testAsynchronousSlowSourceInterpKernelDEC_2D();
130   void testAsynchronousFastSourceInterpKernelDEC_2D();
131   //
132   void testICoco1();
133   void testGauthier1();
134   void testGauthier2();
135   void testGauthier3();
136   void testGauthier4();
137   void testFabienAPI1();
138   void testFabienAPI2();
139   //
140   void testMEDLoaderRead1();
141   void testMEDLoaderPolygonRead();
142   void testMEDLoaderPolyhedronRead();
143   void testMEDLoaderWrite1();
144   void testMEDLoaderPolygonWrite();
145
146   std::string getResourceFile( const std::string& );
147   std::string getTmpDirectory();
148   std::string makeTmpFile( const std::string&, const std::string& = "" );
149
150 private:
151 #ifdef MED_ENABLE_FVM
152   void testNonCoincidentDEC(const std::string& filename1, 
153                             const std::string& meshname1, 
154                             const std::string& filename2, 
155                             const std::string& meshname2,
156                             int nbprocsource, double epsilon);
157 #endif
158   void testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA, 
159                                           double dtB, double tmaxB,
160                                           bool WithPointToPoint, bool Asynchronous, bool WithInterp, const char *srcMeth, const char *targetMeth);
161   void testInterpKernelDEC_2D_(const char *srcMeth, const char *targetMeth);
162   void testInterpKernelDEC2_2D_(const char *srcMeth, const char *targetMeth);
163   void testInterpKernelDEC_3D_(const char *srcMeth, const char *targetMeth);
164
165 };
166
167 // to automatically remove temporary files from disk
168 class ParaMEDMEMTest_TmpFilesRemover
169 {
170 public:
171   ParaMEDMEMTest_TmpFilesRemover() {}
172   ~ParaMEDMEMTest_TmpFilesRemover();
173   bool Register(const std::string theTmpFile);
174
175 private:
176   std::set<std::string> myTmpFiles;
177 };
178
179 /*!
180  *  Tool to print array to stream.
181  */
182 template<class T>
183 void ParaMEDMEMTest_DumpArray (std::ostream & stream, const T* array, const int length, const std::string text)
184 {
185   stream << text << ": {";
186   if (length > 0) {
187     stream << array[0];
188     for (int i = 1; i < length; i++) {
189       stream << ", " << array[i];
190     }
191   }
192   stream << "}" << std::endl;
193 }
194
195 #endif