1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Combination-Reduction operation for a parallel run.
31 The information from all nodes is collected on the master node,
32 combined using the given combination function and the result is
33 broadcast to all nodes
35 \*---------------------------------------------------------------------------*/
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 #define EqOp(opName, op) \
49 template<class T1, class T2> \
54 void operator()(T1& x, const T2& y) const \
65 void operator()(T& x, const T& y) const \
74 EqOp(multiplyEq, x *= y)
75 EqOp(divideEq, x /= y)
76 EqOp(eqMag, x = mag(y))
77 EqOp(plusEqMagSqr, x += magSqr(y))
78 EqOp(maxEq, x = max(x, y))
79 EqOp(minEq, x = min(x, y))
80 EqOp(andEq, x = (x && y))
81 EqOp(orEq, x = (x || y))
88 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 #define Op(opName, op) \
92 template<class T, class T1, class T2> \
97 T operator()(const T1& x, const T2& y) const \
103 template<class T1, class T2> \
108 T1 operator()(const T1& x, const T2& y) const \
119 T operator()(const T& x, const T& y) const \
131 Op(cmptMultiply, cmptMultiply(x, y))
132 Op(cmptDivide, cmptDivide(x, y))
133 Op(stabilise, stabilise(x, y))
136 Op(minMod, minMod(x, y))
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 } // End namespace Foam
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 // ************************************************************************* //