PstreamCombineReduceOps.H
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-2013 OpenFOAM Foundation
9 Copyright (C) 2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27InClass
28 Foam
29
30Description
31 Combination-Reduction operation for a parallel run. The
32 information from all nodes is collected on the master node,
33 combined using the given combination function and the result is
34 broadcast to all nodes
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_PstreamCombineReduceOps_H
39#define Foam_PstreamCombineReduceOps_H
40
41#include "Pstream.H"
42#include "ops.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51template<class T, class CombineOp>
53(
54 const List<UPstream::commsStruct>& comms,
55 T& value,
56 const CombineOp& cop,
57 const int tag,
58 const label comm
59)
60{
61 Pstream::combineAllGather(comms, value, cop, tag, comm);
62}
63
64
65template<class T, class CombineOp>
67(
68 T& value,
69 const CombineOp& cop,
70 const int tag = UPstream::msgType(),
71 const label comm = UPstream::worldComm
72)
73{
74 Pstream::combineAllGather(value, cop, tag, comm);
75}
76
77
78// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79
80} // End namespace Foam
81
82// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
83
84#endif
85
86// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
static void combineAllGather(const List< commsStruct > &comms, T &value, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
static int & msgType() noexcept
Message tag of standard messages.
Definition: UPstream.H:556
static label worldComm
Default communicator (all processors)
Definition: UPstream.H:293
const volScalarField & T
Namespace for OpenFOAM.
void combineReduce(const List< UPstream::commsStruct > &comms, T &value, const CombineOp &cop, const int tag, const label comm)
Various functors for unary and binary operations. Can be used for parallel combine-reduce operations ...