]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/ParaMEDMEM/Test/MPIAccessDECTest.hxx
Salome HOME
Merge from BR_V5_DEV 16Feb09
[tools/medcoupling.git] / src / ParaMEDMEM / Test / MPIAccessDECTest.hxx
1 //  Copyright (C) 2007-2008  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.
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 #ifndef _MPIACCESSDECTEST_HXX_
20 #define _MPIACCESSDECTEST_HXX_
21
22 #include <cppunit/extensions/HelperMacros.h>
23
24 #include <set>
25 #include <string>
26 #include <iostream>
27 #include "mpi.h"
28
29
30 class MPIAccessDECTest : public CppUnit::TestFixture
31 {
32   CPPUNIT_TEST_SUITE( MPIAccessDECTest );
33   //  CPPUNIT_TEST( test_AllToAllDECSynchronousPointToPoint ) ;
34   CPPUNIT_TEST( test_AllToAllDECAsynchronousPointToPoint ) ;
35   //CPPUNIT_TEST( test_AllToAllvDECSynchronousPointToPoint ) ;
36   CPPUNIT_TEST( test_AllToAllvDECAsynchronousPointToPoint ) ;
37   //CPPUNIT_TEST( test_AllToAllTimeDECSynchronousPointToPoint ) ;
38   CPPUNIT_TEST( test_AllToAllTimeDECAsynchronousPointToPoint ) ;
39   CPPUNIT_TEST( test_AllToAllvTimeDECSynchronousNative ) ;
40   //CPPUNIT_TEST( test_AllToAllvTimeDECSynchronousPointToPoint ) ;
41   CPPUNIT_TEST( test_AllToAllvTimeDECAsynchronousPointToPoint ) ;
42   //CPPUNIT_TEST( test_AllToAllvTimeDoubleDECSynchronousPointToPoint ) ;
43   CPPUNIT_TEST( test_AllToAllvTimeDoubleDECAsynchronousPointToPoint ) ;
44   CPPUNIT_TEST_SUITE_END();
45   
46
47 public:
48  
49   MPIAccessDECTest():CppUnit::TestFixture(){}
50   ~MPIAccessDECTest(){}  
51   void setUp(){}
52   void tearDown(){}
53   void test_AllToAllDECSynchronousPointToPoint() ;
54   void test_AllToAllDECAsynchronousPointToPoint() ;
55   void test_AllToAllvDECSynchronousPointToPoint() ;
56   void test_AllToAllvDECAsynchronousPointToPoint() ;
57   void test_AllToAllTimeDECSynchronousPointToPoint() ;
58   void test_AllToAllTimeDECAsynchronousPointToPoint() ;
59   void test_AllToAllvTimeDECSynchronousNative() ;
60   void test_AllToAllvTimeDECSynchronousPointToPoint() ;
61   void test_AllToAllvTimeDECAsynchronousPointToPoint() ;
62   void test_AllToAllvTimeDoubleDECSynchronousPointToPoint() ;
63   void test_AllToAllvTimeDoubleDECAsynchronousPointToPoint() ;
64
65 private:
66   void test_AllToAllDEC( bool Asynchronous ) ;
67   void test_AllToAllvDEC( bool Asynchronous ) ;
68   void test_AllToAllTimeDEC( bool Asynchronous ) ;
69   void test_AllToAllvTimeDEC( bool Asynchronous , bool UseMPINative ) ;
70   void test_AllToAllvTimeDoubleDEC( bool Asynchronous ) ;
71   };
72
73 // to automatically remove temporary files from disk
74 class MPIAccessDECTest_TmpFilesRemover
75 {
76 public:
77   MPIAccessDECTest_TmpFilesRemover() {}
78   ~MPIAccessDECTest_TmpFilesRemover();
79   bool Register(const std::string theTmpFile);
80
81 private:
82   std::set<std::string> myTmpFiles;
83 };
84
85 /*!
86  *  Tool to print array to stream.
87  */
88 template<class T>
89 void MPIAccessDECTest_DumpArray (std::ostream & stream, const T* array, const int length, const std::string text)
90 {
91   stream << text << ": {";
92   if (length > 0) {
93     stream << array[0];
94     for (int i = 1; i < length; i++) {
95       stream << ", " << array[i];
96     }
97   }
98   stream << "}" << std::endl;
99 };
100
101 #endif