1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Combination-Reduction operation for a parallel run.
30 The information from all nodes is collected on the master node,
31 combined using the given combination function and the result is
32 broadcast to all nodes
35 Format of this file has considerably changed to remove cpp pre-processor
36 definition in order to help Swig with parsing in. Implemented by
37 Alexey Petrov; merged by HJ, 14/Oct/2010
39 \*---------------------------------------------------------------------------*/
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 template<class T1, class T2>
51 { public: void operator()(T1& x, const T2& y) const { x = y; } };
55 { public: void operator()(T& x, const T& y) const { x = y; } };
57 template<class T1, class T2>
59 { public: void operator()(T1& x, const T2& y) const { x += y; } };
63 { public: void operator()(T& x, const T& y) const { x += y; } };
65 template<class T1, class T2>
67 { public: void operator()(T1& x, const T2& y) const { x -= y; } };
71 { public: void operator()(T& x, const T& y) const { x -= y; } };
73 template<class T1, class T2>
75 { public: void operator()(T1& x, const T2& y) const { x *= y; } };
79 { public: void operator()(T& x, const T& y) const { x *= y; } };
81 template<class T1, class T2>
83 { public: void operator()(T1& x, const T2& y) const { x /= y; } };
87 { public: void operator()(T& x, const T& y) const { x /= y; } };
89 template<class T1, class T2>
91 { public: void operator()(T1& x, const T2& y) const { x = mag(y); } };
95 { public: void operator()(T& x, const T& y) const { x = mag(y); } };
97 template<class T1, class T2>
99 { public: void operator()(T1& x, const T2& y) const { x += magSqr(y); } };
103 { public: void operator()(T& x, const T& y) const { x += magSqr(y); } };
105 template<class T1, class T2>
107 { public: void operator()(T1& x, const T2& y) const { x = max(x, y); } };
111 { public: void operator()(T& x, const T& y) const { x = max(x, y); } };
113 template<class T1, class T2>
115 { public: void operator()(T1& x, const T2& y) const { x = min(x, y); } };
119 { public: void operator()(T& x, const T& y) const { x = min(x, y); } };
121 template<class T1, class T2>
123 { public: void operator()(T1& x, const T2& y) const { x = (x && y); } };
127 { public: void operator()(T& x, const T& y) const { x = (x && y); } };
129 template<class T1, class T2>
131 { public: void operator()(T1& x, const T2& y) const { x = (x || y); } };
135 { public: void operator()(T& x, const T& y) const { x = (x || y); } };
137 template<class T1, class T2>
139 { public: void operator()(T1& x, const T2& y) const { x = -y; } };
143 { public: void operator()(T& x, const T& y) const { x = -y; } };
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 template<class T, class T1, class T2>
150 { public: T operator()(const T1& x, const T2& y) const { return x + y; } };
152 template<class T1, class T2>
154 { public: T1 operator()(const T1& x, const T2& y) const { return x + y; } };
158 { public: T operator()(const T& x, const T& y) const { return x + y; } };
160 template<class T, class T1, class T2>
162 { public: T operator()(const T1& x, const T2& y) const { return x + y; } };
164 template<class T1, class T2>
166 { public: T1 operator()(const T1& x, const T2& y) const { return x + y; } };
170 { public: T operator()(const T& x, const T& y) const { return x + y; } };
172 template<class T, class T1, class T2>
174 { public: T operator()(const T1& x, const T2& y) const { return x - y; } };
176 template<class T1, class T2>
178 { public: T1 operator()(const T1& x, const T2& y) const { return x - y; } };
182 { public: T operator()(const T& x, const T& y) const { return x - y; } };
184 template<class T, class T1, class T2>
186 { public: T operator()(const T1& x, const T2& y) const { return x * y; } };
188 template<class T1, class T2>
190 { public: T1 operator()(const T1& x, const T2& y) const { return x * y; } };
194 { public: T operator()(const T& x, const T& y) const { return x * y; } };
196 template<class T, class T1, class T2>
198 { public: T operator()(const T1& x, const T2& y) const { return x / y; } };
200 template<class T1, class T2>
202 { public: T1 operator()(const T1& x, const T2& y) const { return x / y; } };
206 { public: T operator()(const T& x, const T& y) const { return x / y; } };
208 template<class T, class T1, class T2>
209 class cmptMultiplyOp3
210 { public: T operator()(const T1& x, const T2& y) const { return cmptMultiply(x, y); } };
212 template<class T1, class T2>
213 class cmptMultiplyOp2
214 { public: T1 operator()(const T1& x, const T2& y) const { return cmptMultiply(x, y); } };
218 { public: T operator()(const T& x, const T& y) const { return cmptMultiply(x, y); } };
220 template<class T, class T1, class T2>
222 { public: T operator()(const T1& x, const T2& y) const { return cmptDivide(x, y); } };
224 template<class T1, class T2>
226 { public: T1 operator()(const T1& x, const T2& y) const { return cmptDivide(x, y); } };
230 { public: T operator()(const T& x, const T& y) const { return cmptDivide(x, y); } };
232 template<class T, class T1, class T2>
234 { public: T operator()(const T1& x, const T2& y) const { return stabilise(x, y); } };
236 template<class T1, class T2>
238 { public: T1 operator()(const T1& x, const T2& y) const { return stabilise(x, y); } };
242 { public: T operator()(const T& x, const T& y) const { return stabilise(x, y); } };
244 template<class T, class T1, class T2>
246 { public: T operator()(const T1& x, const T2& y) const { return max(x, y); } };
248 template<class T1, class T2>
250 { public: T1 operator()(const T1& x, const T2& y) const { return max(x, y); } };
254 { public: T operator()(const T& x, const T& y) const { return max(x, y); } };
256 template<class T, class T1, class T2>
258 { public: T operator()(const T1& x, const T2& y) const { return min(x, y); } };
260 template<class T1, class T2>
262 { public: T1 operator()(const T1& x, const T2& y) const { return min(x, y); } };
266 { public: T operator()(const T& x, const T& y) const { return min(x, y); } };
268 template<class T, class T1, class T2>
270 { public: T operator()(const T1& x, const T2& y) const { return minMod(x, y); } };
272 template<class T1, class T2>
274 { public: T1 operator()(const T1& x, const T2& y) const { return minMod(x, y); } };
278 { public: T operator()(const T& x, const T& y) const { return minMod(x, y); } };
280 template<class T, class T1, class T2>
282 { public: T operator()(const T1& x, const T2& y) const { return x && y; } };
284 template<class T1, class T2>
286 { public: T1 operator()(const T1& x, const T2& y) const { return x && y; } };
290 { public: T operator()(const T& x, const T& y) const { return x && y; } };
292 template<class T, class T1, class T2>
294 { public: T operator()(const T1& x, const T2& y) const { return x || y; } };
296 template<class T1, class T2>
298 { public: T1 operator()(const T1& x, const T2& y) const { return x || y; } };
302 { public: T operator()(const T& x, const T& y) const { return x || y; } };
304 template<class T, class T1, class T2>
306 { public: T operator()(const T1& x, const T2& y) const { return x == y; } };
308 template<class T1, class T2>
310 { public: T1 operator()(const T1& x, const T2& y) const { return x == y; } };
314 { public: T operator()(const T& x, const T& y) const { return x == y; } };
317 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
319 } // End namespace Foam
321 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
325 // ************************************************************************* //