Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
10License
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
35void Foam::UPstream::reduceAnd(bool& value, const int communicator)
36{}
37
38void Foam::UPstream::reduceOr(bool& value, const int communicator)
39{}
40
41
42void Foam::reduce
43(
44 bool& value,
46 const int tag,
47 const int communicator
48)
49{}
50
51void 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
88(
89 void* values,
90 int count,
91 const UPstream::dataTypes dataTypeId,
92 const UPstream::opCodes opCodeId,
93 const int communicator,
94 const bool exclusive
95)
96{}
97
98
99// ************************************************************************* //
Inter-processor communication reduction functions.
An opaque wrapper for MPI_Request with a vendor-independent representation without any <mpi....
Definition UPstream.H:2919
Wrapper for internally indexed communicator label. Always invokes UPstream::allocateCommunicatorCompo...
Definition UPstream.H:2546
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.
opCodes
Mapping of some MPI op codes.
Definition UPstream.H:149
static void reduceAnd(bool &value, const int communicator=worldComm)
Logical (and) reduction (MPI_AllReduce).
static void reduceOr(bool &value, const int communicator=worldComm)
Logical (or) reduction (MPI_AllReduce).
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 mpi_scan_reduce(void *values, int count, const UPstream::dataTypes dataTypeId, const UPstream::opCodes opCodeId, const int communicator, const bool exclusive)
In-place scan/exscan reduction of values.
dataTypes
Mapping of some fundamental and aggregate types to MPI data types.
Definition UPstream.H:107
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).