Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CommSerial.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File CommSerial.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: CommSerial header
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 #ifndef NEKTAR_LIB_UTILITIES_COMMSERIAL_H
36 #define NEKTAR_LIB_UTILITIES_COMMSERIAL_H
37 
38 #include <string>
39 
43 
44 namespace Nektar
45 {
46  namespace LibUtilities
47  {
48  // Forward declarations
49  class CommSerial;
50 
51  /// Pointer to a Communicator object.
52  typedef boost::shared_ptr<CommSerial> CommSerialSharedPtr;
53 
54  /// A global linear system.
55  class CommSerial : public Comm
56  {
57  public:
58  /// Creates an instance of this class
59  LIB_UTILITIES_EXPORT static CommSharedPtr create(int narg, char* arg[])
60  {
62  }
63 
64  /// Name of class
65  LIB_UTILITIES_EXPORT static std::string className;
66 
67  LIB_UTILITIES_EXPORT CommSerial(int argc, char* argv[]);
69 
70  protected:
71  LIB_UTILITIES_EXPORT virtual void v_Finalise();
72  LIB_UTILITIES_EXPORT virtual int v_GetRank();
73  LIB_UTILITIES_EXPORT virtual bool v_TreatAsRankZero(void);
74 
75  LIB_UTILITIES_EXPORT virtual void v_Block();
76  LIB_UTILITIES_EXPORT virtual void v_Send(int pProc, Array<OneD, NekDouble>& pData);
77  LIB_UTILITIES_EXPORT virtual void v_Send(int pProc, Array<OneD, int>& pData);
78  LIB_UTILITIES_EXPORT virtual void v_Send(int pProc, std::vector<unsigned int>& pData);
79  LIB_UTILITIES_EXPORT virtual void v_Recv(int pProc, Array<OneD, NekDouble>& pData);
80  LIB_UTILITIES_EXPORT virtual void v_Recv(int pProc, Array<OneD, int>& pData);
81  LIB_UTILITIES_EXPORT virtual void v_Recv(int pProc, std::vector<unsigned int>& pData);
82  LIB_UTILITIES_EXPORT virtual void v_SendRecv(int pSendProc,
83  Array<OneD, NekDouble>& pSendData,
84  int pRecvProc,
85  Array<OneD, NekDouble>& pRecvData);
86  LIB_UTILITIES_EXPORT virtual void v_SendRecv(int pSendProc,
87  Array<OneD, int>& pSendData,
88  int pRecvProc,
89  Array<OneD, int>& pRecvData);
90  LIB_UTILITIES_EXPORT virtual void v_SendRecvReplace(int pSendProc,
91  int pRecvProc,
92  Array<OneD, NekDouble>& pSendData);
93  LIB_UTILITIES_EXPORT virtual void v_SendRecvReplace(int pSendProc,
94  int pRecvProc,
95  Array<OneD, int>& pSendData);
96  LIB_UTILITIES_EXPORT virtual void v_AllReduce(NekDouble& pData,
97  enum ReduceOperator pOp);
98  LIB_UTILITIES_EXPORT virtual void v_AllReduce(int& pData,
99  enum ReduceOperator pOp);
100  LIB_UTILITIES_EXPORT virtual void v_AllReduce(Array<OneD, NekDouble>& pData,
101  enum ReduceOperator pOp);
102  LIB_UTILITIES_EXPORT virtual void v_AllReduce(Array<OneD, int >& pData,
103  enum ReduceOperator pOp);
104  LIB_UTILITIES_EXPORT virtual void v_AllReduce(std::vector<unsigned int>& pData,
105  enum ReduceOperator pOp);
106  LIB_UTILITIES_EXPORT virtual void v_AlltoAll(Array<OneD, NekDouble>& pSendData,
107  Array<OneD, NekDouble>& pRecvData);
108  LIB_UTILITIES_EXPORT virtual void v_AlltoAll(Array<OneD, int>& pSendData,
109  Array<OneD, int>& pRecvData);
110  LIB_UTILITIES_EXPORT virtual void v_AlltoAllv(Array<OneD, NekDouble>& pSendData,
111  Array<OneD, int>& pSendDataSizeMap,
112  Array<OneD, int>& pSendDataOffsetMap,
113  Array<OneD, NekDouble>& pRecvData,
114  Array<OneD, int>& pRecvDataSizeMap,
115  Array<OneD, int>& pRecvDataOffsetMap);
116  LIB_UTILITIES_EXPORT virtual void v_AlltoAllv(Array<OneD, int>& pSendData,
117  Array<OneD, int>& pSendDataSizeMap,
118  Array<OneD, int>& pSendDataOffsetMap,
119  Array<OneD, int>& pRecvData,
120  Array<OneD, int>& pRecvDataSizeMap,
121  Array<OneD, int>& pRecvDataOffsetMap);
122  LIB_UTILITIES_EXPORT virtual void v_SplitComm(int pRows, int pColumns);
123 
124  };
125 
126  }
127 }
128 
129 #endif