Nektar++
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);
101  enum ReduceOperator pOp);
103  enum ReduceOperator pOp);
104  LIB_UTILITIES_EXPORT virtual void v_AllReduce(std::vector<unsigned int>& pData,
105  enum ReduceOperator pOp);
107  Array<OneD, NekDouble>& pRecvData);
108  LIB_UTILITIES_EXPORT virtual void v_AlltoAll(Array<OneD, int>& pSendData,
109  Array<OneD, int>& pRecvData);
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
virtual void v_SplitComm(int pRows, int pColumns)
Definition: CommSerial.cpp:278
virtual void v_SendRecvReplace(int pSendProc, int pRecvProc, Array< OneD, NekDouble > &pSendData)
Definition: CommSerial.cpp:167
ReduceOperator
Type of operation to perform in AllReduce.
Definition: Comm.h:65
virtual void v_Send(int pProc, Array< OneD, NekDouble > &pData)
Definition: CommSerial.cpp:97
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
virtual bool v_TreatAsRankZero(void)
Definition: CommSerial.cpp:80
virtual void v_Recv(int pProc, Array< OneD, NekDouble > &pData)
Definition: CommSerial.cpp:105
virtual void v_AlltoAllv(Array< OneD, NekDouble > &pSendData, Array< OneD, int > &pSendDataSizeMap, Array< OneD, int > &pSendDataOffsetMap, Array< OneD, NekDouble > &pRecvData, Array< OneD, int > &pRecvDataSizeMap, Array< OneD, int > &pRecvDataOffsetMap)
Definition: CommSerial.cpp:250
boost::shared_ptr< CommSerial > CommSerialSharedPtr
Pointer to a Communicator object.
Definition: CommSerial.h:49
virtual void v_AlltoAll(Array< OneD, NekDouble > &pSendData, Array< OneD, NekDouble > &pRecvData)
Definition: CommSerial.cpp:232
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53
A global linear system.
Definition: CommSerial.h:55
#define LIB_UTILITIES_EXPORT
static CommSharedPtr create(int narg, char *arg[])
Creates an instance of this class.
Definition: CommSerial.h:59
double NekDouble
Base communications class.
Definition: Comm.h:73
virtual void v_SendRecv(int pSendProc, Array< OneD, NekDouble > &pSendData, int pRecvProc, Array< OneD, NekDouble > &pRecvData)
Definition: CommSerial.cpp:145
CommSerial(int argc, char *argv[])
Definition: CommSerial.cpp:48
static std::string className
Name of class.
Definition: CommSerial.h:65
virtual void v_AllReduce(NekDouble &pData, enum ReduceOperator pOp)
Definition: CommSerial.cpp:187