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