UPstreamRequest.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) 2023 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "UPstream.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 :
34  UPstream::Request(nullptr)
35 {}
36 
37 
38 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
39 
41 {
42  return false;
43 }
44 
45 
47 {}
48 
49 
50 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
51 
52 Foam::label Foam::UPstream::nRequests() noexcept { return 0; }
53 
54 void Foam::UPstream::resetRequests(const label n) {}
55 
57 
58 void Foam::UPstream::cancelRequest(const label i) {}
61 
62 void Foam::UPstream::removeRequests(const label pos, label len) {}
63 
66 
67 void Foam::UPstream::waitRequests(const label pos, label len) {}
68 void Foam::UPstream::waitRequests(UList<UPstream::Request>&) {}
69 
70 bool Foam::UPstream::waitAnyRequest(const label pos, label len)
71 {
72  return false;
73 }
74 
76 (
77  const label pos,
78  label len,
79  DynamicList<int>* indices
80 )
81 {
82  if (indices) indices->clear();
83  return false;
84 }
85 
87 (
88  UList<UPstream::Request>& requests,
90 )
91 {
92  if (indices) indices->clear();
93  return false;
94 }
95 
97 {
98  return -1;
99 }
101 void Foam::UPstream::waitRequest(const label i) {}
103 
104 bool Foam::UPstream::finishedRequest(const label i) { return true; }
105 bool Foam::UPstream::finishedRequest(UPstream::Request&) { return true; }
107 bool Foam::UPstream::finishedRequests(const label pos, label len)
108 {
109  return true;
110 }
111 
114 {
115  return true;
116 }
117 
118 
119 bool Foam::UPstream::finishedRequestPair(label& req0, label& req1)
120 {
121  req0 = -1;
122  req1 = -1;
123  return true;
124 }
125 
126 
127 void Foam::UPstream::waitRequestPair(label& req0, label& req1)
128 {
129  req0 = -1;
130  req1 = -1;
131 }
132 
133 
134 // ************************************************************************* //
static void removeRequests(const label pos, label len=-1)
Non-blocking comms: cancel/free outstanding requests (from position onwards) and remove from internal...
void reset() noexcept
Reset to default constructed value (MPI_REQUEST_NULL)
static label nRequests() noexcept
Number of outstanding requests (on the internal list of requests)
static void cancelRequest(const label i)
Non-blocking comms: cancel and free outstanding request. Corresponds to MPI_Cancel() + MPI_Request_fr...
static bool finishedRequest(const label i)
Non-blocking comms: has request i finished? Corresponds to MPI_Test()
static void freeRequest(UPstream::Request &req)
Non-blocking comms: free outstanding request. Corresponds to MPI_Request_free()
static void freeRequests(UList< UPstream::Request > &requests)
Non-blocking comms: free outstanding requests. Corresponds to MPI_Request_free()
bool good() const noexcept
True if not equal to MPI_REQUEST_NULL.
static void waitRequests()
Wait for all requests to finish.
Definition: UPstream.H:1538
static bool finishedRequestPair(label &req0, label &req1)
Non-blocking comms: have both requests finished? Corresponds to pair of MPI_Test() ...
dimensionedScalar pos(const dimensionedScalar &ds)
An opaque wrapper for MPI_Request with a vendor-independent representation independent of any <mpi...
Definition: UPstream.H:1573
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 bool waitAnyRequest(const label pos, label len=-1)
Wait until any request (from position onwards) has finished. Corresponds to MPI_Waitany() ...
const direction noexcept
Definition: Scalar.H:258
static void resetRequests(const label n)
Truncate outstanding requests to given length, which is expected to be in the range [0 to nRequests()...
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
Definition: DynamicListI.H:405
static void waitRequestPair(label &req0, label &req1)
Non-blocking comms: wait for both requests to finish. Corresponds to pair of MPI_Wait() ...
static void addRequest(UPstream::Request &req)
Transfer the (wrapped) MPI request to the internal global list.
Request() noexcept
Default construct as MPI_REQUEST_NULL.
static void cancelRequests(UList< UPstream::Request > &requests)
Non-blocking comms: cancel and free outstanding requests. Corresponds to MPI_Cancel() + MPI_Request_f...
label n
static void waitRequest(const label i)
Wait until request i has finished. Corresponds to MPI_Wait()
Inter-processor communications stream.
Definition: UPstream.H:60
static bool waitSomeRequests(const label pos, label len=-1, DynamicList< int > *indices=nullptr)
Wait until some requests (from position onwards) have finished. Corresponds to MPI_Waitsome() ...
static bool finishedRequests(const label pos, label len=-1)
Non-blocking comms: have all requests (from position onwards) finished? Corresponds to MPI_Testall() ...