UPstream.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2018 OpenFOAM Foundation
9  Copyright (C) 2016-2025 OpenCFD Ltd.
10  Copyright (C) 2026 Keysight Technologies
11 -------------------------------------------------------------------------------
12 License
13  This file is part of OpenFOAM.
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28 \*---------------------------------------------------------------------------*/
29 
30 #include "UPstream.H"
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
35 {}
36 
37 
39 {
41  << "The dummy Pstream library cannot be used in parallel mode"
42  << endl;
43 
44  return false;
45 }
46 
47 
48 bool Foam::UPstream::init(int& argc, char**& argv, const bool needsThread)
49 {
51  << "The dummy Pstream library cannot be used in parallel mode"
52  << endl
54 
55  return false;
56 }
57 
58 
59 bool Foam::UPstream::setSharedMemoryCommunicators()
60 {
61  return false;
62 }
63 
64 
65 void Foam::UPstream::shutdown(int errNo)
66 {}
67 
68 
69 void Foam::UPstream::exit(int errNo)
70 {
71  // No MPI - just exit
72  std::exit(errNo);
73 }
74 
75 
76 void Foam::UPstream::abort(int errNo)
77 {
78  // No MPI - just abort
79  std::abort();
80 }
81 
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 void Foam::UPstream::allocateCommunicatorComponents
86 (
87  const label parentIndex,
88  const label index
89 )
90 {}
91 
92 
93 void Foam::UPstream::dupCommunicatorComponents
94 (
95  const label parentIndex,
96  const label index
97 )
98 {}
99 
100 void Foam::UPstream::splitCommunicatorComponents
101 (
102  const label parentIndex,
103  const label index,
104  int colour,
105  const bool two_step
106 )
107 {}
108 
109 
110 void Foam::UPstream::freeCommunicatorComponents(const label index)
111 {}
113 
115 {}
116 
117 
119 (
120  const int toProc,
121  const int communicator,
122  const int tag
123 )
124 {}
125 
126 
128 (
129  const int fromProc,
130  const int communicator,
131  const int tag
132 )
133 {
134  return -1;
135 }
136 
137 
138 std::pair<int,int64_t>
140 (
141  const UPstream::commsTypes commsType,
142  const int fromProcNo,
143  const int tag,
144  const int communicator
145 )
146 {
147  return {-1, 0};
148 }
149 
150 
152 (
153  DynamicList<int64_t>& messageSizes,
154  const UList<int>& fromProcs,
155  const int tag,
156  const int communicator
157 )
158 {
159  messageSizes.clear();
160 }
161 
162 
163 // ************************************************************************* //
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
commsTypes
Communications types.
Definition: UPstream.H:81
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:652
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:518
static bool initNull()
Special purpose initialisation function.
Definition: UPstream.C:31
static void shutdown(int errNo=0)
Shutdown (finalize) MPI as required.
Definition: UPstream.C:58
static void send_done(const int toProcNo, const int communicator, const int tag=UPstream::msgType()+1970)
Impose a point-to-point synchronisation barrier by sending a zero-byte "done" message to given rank...
Definition: UPstream.C:112
static void barrier(const int communicator, UPstream::Request *req=nullptr)
Impose a synchronisation barrier (optionally non-blocking)
Definition: UPstream.C:107
static void exit(int errNo=1)
Shutdown (finalize) MPI as required and exit program with errNo.
Definition: UPstream.C:62
static bool init(int &argc, char **&argv, const bool needsThread)
Initialisation function called from main.
Definition: UPstream.C:41
An opaque wrapper for MPI_Request with a vendor-independent representation without any <mpi...
Definition: UPstream.H:3042
A HashTable similar to std::unordered_map.
Definition: HashTable.H:108
errorManip< error > abort(error &err)
Definition: errorManip.H:139
static void probeMessages(DynamicList< int64_t > &messageSizes, const UList< int > &fromProcs, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Probe incoming message sizes from specified ranks.
Definition: UPstream.C:145
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:105
static std::pair< int, int64_t > probeMessage(const UPstream::commsTypes commsType, const int fromProcNo, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
A standard or non-blocking probe for an incoming message.
Definition: UPstream.C:133
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
Definition: DynamicListI.H:451
Wrapper for internally indexed communicator label. Always invokes UPstream::allocateCommunicatorCompo...
Definition: UPstream.H:2667
static int wait_done(const int fromProcNo, const int communicator, const int tag=UPstream::msgType()+1970)
Impose a point-to-point synchronisation barrier by receiving a zero-byte "done" message from given ra...
Definition: UPstream.C:121
#define WarningInFunction
Report a warning using Foam::Warning.
static void abort(int errNo=1)
Call MPI_Abort with no other checks or cleanup.
Definition: UPstream.C:69
static void addValidParOptions(HashTable< string > &validParOptions)
Add the valid option this type of communications library adds/requires on the command line...
Definition: UPstream.C:27