UPstream.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "UPstream.H"
27 #include "PstreamReduceOps.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
32 {}
33 
34 
35 bool Foam::UPstream::init(int& argc, char**& argv, const bool needsThread)
36 {
38  << "Trying to use the dummy Pstream library." << nl
39  << "This dummy library cannot be used in parallel mode"
41 
42  return false;
43 }
44 
45 
46 void Foam::UPstream::exit(int errnum)
47 {
49 }
50 
51 
53 {
55 }
56 
57 
58 void Foam::reduce(scalar&, const sumOp<scalar>&, const int, const label)
59 {}
60 
61 
62 void Foam::reduce(scalar&, const minOp<scalar>&, const int, const label)
63 {}
64 
65 
66 void Foam::reduce(vector2D&, const sumOp<vector2D>&, const int, const label)
67 {}
68 
69 
71 (
72  scalar&,
73  label&,
74  const int,
75  const label
76 )
77 {}
78 
79 
80 void Foam::reduce(scalar&, const sumOp<scalar>&, const int, const label, label&)
81 {}
82 
83 
85 (
86  const labelUList& sendData,
87  labelUList& recvData,
88  const label communicator
89 )
90 {
91  recvData.deepCopy(sendData);
92 }
93 
94 
96 (
97  const char* sendData,
98  int sendSize,
99 
100  char* recvData,
101  const UList<int>& recvSizes,
102  const UList<int>& recvOffsets,
103  const label communicator
104 )
105 {
106  memmove(recvData, sendData, sendSize);
107 }
108 
109 
111 (
112  const char* sendData,
113  const UList<int>& sendSizes,
114  const UList<int>& sendOffsets,
115 
116  char* recvData,
117  int recvSize,
118  const label communicator
119 )
120 {
121  memmove(recvData, sendData, recvSize);
122 }
123 
124 
125 void Foam::UPstream::allocatePstreamCommunicator
126 (
127  const label,
128  const label
129 )
130 {}
131 
132 
133 void Foam::UPstream::freePstreamCommunicator(const label)
134 {}
135 
136 
138 {
139  return 0;
140 }
141 
142 
144 {}
145 
146 
148 {}
149 
150 
152 {}
153 
154 
156 {
158  return false;
159 }
160 
161 
162 // ************************************************************************* //
Inter-processor communication reduction functions.
An STL-conforming hash table.
Definition: HashTable.H:127
void deepCopy(const UList< T > &)
Copy elements of the given UList.
Definition: UList.C:35
Helper class for allocating/freeing communicators.
Definition: UPstream.H:315
static bool init(int &argc, char **&argv, const bool needsThread)
Initialisation function called from main.
Definition: UPstream.C:35
static void allToAll(const labelUList &sendData, labelUList &recvData, const label communicator=0)
Exchange label with all processors (in the communicator).
Definition: UPstream.C:85
static label nRequests()
Get number of outstanding requests.
Definition: UPstream.C:137
static void gather(const char *sendData, int sendSize, char *recvData, const UList< int > &recvSizes, const UList< int > &recvOffsets, const label communicator=0)
Receive data from all processors on the master.
Definition: UPstream.C:96
static void addValidParOptions(HashTable< string > &validParOptions)
Add the valid option this type of communications library.
Definition: UPstream.C:31
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
Definition: UPstream.C:147
static void resetRequests(const label sz)
Truncate number of outstanding requests.
Definition: UPstream.C:143
static void scatter(const char *sendData, const UList< int > &sendSizes, const UList< int > &sendOffsets, char *recvData, int recvSize, const label communicator=0)
Send data to all processors from the root of the communicator.
Definition: UPstream.C:111
static void abort()
Abort program.
Definition: UPstream.C:52
static void exit(int errnum=1)
Exit program.
Definition: UPstream.C:46
static bool finishedRequest(const label i)
Non-blocking comms: has request i finished?
Definition: UPstream.C:155
static void waitRequest(const label i)
Wait until request i has finished.
Definition: UPstream.C:151
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:381
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
error FatalError
static const char nl
Definition: Ostream.H:266
void sumReduce(T &Value, label &Count, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)