UPstreamReduce.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) 2022-2025 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 "Pstream.H"
29 #include "PstreamReduceOps.H"
30 
31 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
32 
33 // Special reductions for bool
34 
35 void Foam::UPstream::reduceAnd(bool& value, const int communicator)
36 {}
37 
38 void Foam::UPstream::reduceOr(bool& value, const int communicator)
39 {}
40 
41 
42 void Foam::reduce
43 (
44  bool& value,
46  const int tag,
47  const int communicator
48 )
49 {}
50 
51 void Foam::reduce
52 (
53  bool& value,
55  const int tag,
56  const int communicator
57 )
58 {}
59 
60 
61 // * * * * * * * * * * Protected Static Member Functions * * * * * * * * * * //
62 
64 (
65  void* values,
66  int count,
67  const UPstream::dataTypes dataTypeId,
68  const UPstream::opCodes opCodeId,
69  const int communicator,
71 )
72 {}
73 
74 
76 (
77  void* values,
78  int count,
79  const UPstream::dataTypes dataTypeId,
80  const UPstream::opCodes opCodeId,
81  const int communicator,
83 )
84 {}
85 
86 
87 // ************************************************************************* //
Inter-processor communication reduction functions.
static void mpi_reduce(void *values, int count, const UPstream::dataTypes dataTypeId, const UPstream::opCodes opCodeId, const int communicator, UPstream::Request *req=nullptr)
In-place reduction of values with result on rank 0.
void reduce(T &value, [[maybe_unused]] BinaryOp bop, [[maybe_unused]] const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce)
opCodes
Mapping of some MPI op codes.
Definition: UPstream.H:145
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Definition: HashOps.H:164
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of &#39;true&#39; entries.
Definition: BitOps.H:73
An opaque wrapper for MPI_Request with a vendor-independent representation without any <mpi...
Definition: UPstream.H:2599
static void reduceAnd(bool &value, const int communicator=worldComm)
Logical (and) reduction (MPI_AllReduce)
dataTypes
Mapping of some fundamental and aggregate types to MPI data types.
Definition: UPstream.H:103
Wrapper for internally indexed communicator label. Always invokes UPstream::allocateCommunicatorCompo...
Definition: UPstream.H:2237
static void mpi_allreduce(void *values, int count, const UPstream::dataTypes dataTypeId, const UPstream::opCodes opCodeId, const int communicator, UPstream::Request *req=nullptr)
In-place reduction of values with same result on all ranks.
static void reduceOr(bool &value, const int communicator=worldComm)
Logical (or) reduction (MPI_AllReduce)