FieldFieldFunctionsM.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-2016 OpenFOAM Foundation
9  Copyright (C) 2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Description
28  Macro functions for FieldField<Type> algebra.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 #define UNARY_FUNCTION(ReturnType, Type1, Func) \
35  \
36 TEMPLATE \
37 void Func \
38 ( \
39  FieldField<Field, ReturnType>& result, \
40  const FieldField<Field, Type1>& f1 \
41 ); \
42  \
43 TEMPLATE \
44 tmp<FieldField<Field, ReturnType>> Func \
45 ( \
46  const FieldField<Field, Type1>& f1 \
47 ); \
48  \
49 TEMPLATE \
50 tmp<FieldField<Field, ReturnType>> Func \
51 ( \
52  const tmp<FieldField<Field, Type1>>& tf1 \
53 );
54 
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 #define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc) \
59  \
60 TEMPLATE \
61 void OpFunc \
62 ( \
63  FieldField<Field, ReturnType>& result, \
64  const FieldField<Field, Type1>& f1 \
65 ); \
66  \
67 TEMPLATE \
68 tmp<FieldField<Field, ReturnType>> operator Op \
69 ( \
70  const FieldField<Field, Type1>& f1 \
71 ); \
72  \
73 TEMPLATE \
74 tmp<FieldField<Field, ReturnType>> operator Op \
75 ( \
76  const tmp<FieldField<Field, Type1>>& tf1 \
77 );
78 
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 #define BINARY_FUNCTION(ReturnType, Type1, Type2, Func) \
83  \
84 TEMPLATE \
85 void Func \
86 ( \
87  FieldField<Field, ReturnType>& result, \
88  const FieldField<Field, Type1>& f1, \
89  const FieldField<Field, Type2>& f2 \
90 ); \
91  \
92 TEMPLATE \
93 tmp<FieldField<Field, ReturnType>> Func \
94 ( \
95  const FieldField<Field, Type1>& f1, \
96  const FieldField<Field, Type2>& f2 \
97 ); \
98  \
99 TEMPLATE \
100 tmp<FieldField<Field, ReturnType>> Func \
101 ( \
102  const FieldField<Field, Type1>& f1, \
103  const tmp<FieldField<Field, Type2>>& tf2 \
104 ); \
105  \
106 TEMPLATE \
107 tmp<FieldField<Field, ReturnType>> Func \
108 ( \
109  const tmp<FieldField<Field, Type1>>& tf1, \
110  const FieldField<Field, Type2>& f2 \
111 ); \
112  \
113 TEMPLATE \
114 tmp<FieldField<Field, ReturnType>> Func \
115 ( \
116  const tmp<FieldField<Field, Type1>>& tf1, \
117  const tmp<FieldField<Field, Type2>>& tf2 \
118 );
119 
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 #define BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
124  \
125 TEMPLATE \
126 void Func \
127 ( \
128  FieldField<Field, ReturnType>& result, \
129  const Type1& s1, \
130  const FieldField<Field, Type2>& f2 \
131 ); \
132  \
133 TEMPLATE \
134 tmp<FieldField<Field, ReturnType>> Func \
135 ( \
136  const Type1& s1, \
137  const FieldField<Field, Type1>& f2 \
138 ); \
139  \
140 TEMPLATE \
141 tmp<FieldField<Field, ReturnType>> Func \
142 ( \
143  const Type1& s1, \
144  const tmp<FieldField<Field, Type1>>& tf2 \
145 );
146 
147 
148 #define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func) \
149  \
150 TEMPLATE \
151 void Func \
152 ( \
153  FieldField<Field, ReturnType>& result, \
154  const FieldField<Field, Type1>& f1, \
155  const Type2& s2 \
156 ); \
157  \
158 TEMPLATE \
159 tmp<FieldField<Field, ReturnType>> Func \
160 ( \
161  const FieldField<Field, Type1>& f1, \
162  const Type2& s2 \
163 ); \
164  \
165 TEMPLATE \
166 tmp<FieldField<Field, ReturnType>> Func \
167 ( \
168  const tmp<FieldField<Field, Type1>>& tf1, \
169  const Type2& s2 \
170 );
171 
172 
173 #define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func) \
174  BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
175  BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpFunc) \
181  \
182 TEMPLATE \
183 void OpFunc \
184 ( \
185  FieldField<Field, ReturnType>& result, \
186  const FieldField<Field, Type1>& f1, \
187  const FieldField<Field, Type2>& f2 \
188 ); \
189  \
190 TEMPLATE \
191 tmp<FieldField<Field, ReturnType>> operator Op \
192 ( \
193  const FieldField<Field, Type1>& f1, \
194  const FieldField<Field, Type2>& f2 \
195 ); \
196  \
197 TEMPLATE \
198 tmp<FieldField<Field, ReturnType>> operator Op \
199 ( \
200  const FieldField<Field, Type1>& f1, \
201  const tmp<FieldField<Field, Type2>>& tf2 \
202 ); \
203  \
204 TEMPLATE \
205 tmp<FieldField<Field, ReturnType>> operator Op \
206 ( \
207  const tmp<FieldField<Field, Type1>>& tf1, \
208  const FieldField<Field, Type2>& f2 \
209 ); \
210  \
211 TEMPLATE \
212 tmp<FieldField<Field, ReturnType>> operator Op \
213 ( \
214  const tmp<FieldField<Field, Type1>>& tf1, \
215  const tmp<FieldField<Field, Type2>>& tf2 \
216 );
217 
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpFunc) \
222  \
223 TEMPLATE \
224 void OpFunc \
225 ( \
226  FieldField<Field, ReturnType>& result, \
227  const Type1& s1, \
228  const FieldField<Field, Type2>& f2 \
229 ); \
230  \
231 TEMPLATE \
232 tmp<FieldField<Field, ReturnType>> operator Op \
233 ( \
234  const Type1& s1, \
235  const FieldField<Field, Type2>& f2 \
236 ); \
237  \
238 TEMPLATE \
239 tmp<FieldField<Field, ReturnType>> operator Op \
240 ( \
241  const Type1& s1, \
242  const tmp<FieldField<Field, Type2>>& tf2 \
243 );
244 
245 
246 #define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpFunc) \
247  \
248 TEMPLATE \
249 void OpFunc \
250 ( \
251  FieldField<Field, ReturnType>& result, \
252  const FieldField<Field, Type1>& f1, \
253  const Type2& s2 \
254 ); \
255  \
256 TEMPLATE \
257 tmp<FieldField<Field, ReturnType>> operator Op \
258 ( \
259  const FieldField<Field, Type1>& f1, \
260  const Type2& s2 \
261 ); \
262  \
263 TEMPLATE \
264 tmp<FieldField<Field, ReturnType>> operator Op \
265 ( \
266  const tmp<FieldField<Field, Type1>>& tf1, \
267  const Type2& s2 \
268 );
269 
270 
271 #define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpFunc) \
272  BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpFunc) \
273  BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpFunc)
274 
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
278 #define TERNARY_FUNCTION(ReturnType, Type1, Type2, Type3, Func) \
279  \
280 TEMPLATE \
281 void Func \
282 ( \
283  FieldField<Field, ReturnType>& result, \
284  const FieldField<Field, Type1>& f1, \
285  const FieldField<Field, Type2>& f2, \
286  const FieldField<Field, Type3>& f3 \
287 ); \
288  \
289 TEMPLATE \
290 tmp<FieldField<Field, ReturnType>> Func \
291 ( \
292  const FieldField<Field, Type1>& f1, \
293  const FieldField<Field, Type2>& f2, \
294  const FieldField<Field, Type3>& f3 \
295 ); \
296  \
297 TEMPLATE \
298 tmp<FieldField<Field, ReturnType>> Func \
299 ( \
300  const tmp<FieldField<Field, Type1>>& tf1, \
301  const FieldField<Field, Type2>& f2, \
302  const FieldField<Field, Type3>& f3 \
303 ); \
304  \
305 TEMPLATE \
306 tmp<FieldField<Field, ReturnType>> Func \
307 ( \
308  const FieldField<Field, Type1>& f1, \
309  const tmp<FieldField<Field, Type2>>& tf2, \
310  const FieldField<Field, Type3>& f3 \
311 ); \
312  \
313 TEMPLATE \
314 tmp<FieldField<Field, ReturnType>> Func \
315 ( \
316  const FieldField<Field, Type1>& f1, \
317  const FieldField<Field, Type2>& f2, \
318  const tmp<FieldField<Field, Type3>>& tf3 \
319 ); \
320  \
321 TEMPLATE \
322 tmp<FieldField<Field, ReturnType>> Func \
323 ( \
324  const tmp<FieldField<Field, Type1>>& tf1, \
325  const tmp<FieldField<Field, Type2>>& tf2, \
326  const FieldField<Field, Type3>& f3 \
327 ); \
328  \
329 TEMPLATE \
330 tmp<FieldField<Field, ReturnType>> Func \
331 ( \
332  const tmp<FieldField<Field, Type1>>& tf1, \
333  const FieldField<Field, Type2>& f2, \
334  const tmp<FieldField<Field, Type3>>& tf3 \
335 ); \
336  \
337 TEMPLATE \
338 tmp<FieldField<Field, ReturnType>> Func \
339 ( \
340  const FieldField<Field, Type1>& f1, \
341  const tmp<FieldField<Field, Type2>>& tf2, \
342  const tmp<FieldField<Field, Type3>>& tf3 \
343 ); \
344  \
345 TEMPLATE \
346 tmp<FieldField<Field, ReturnType>> Func \
347 ( \
348  const tmp<FieldField<Field, Type1>>& tf1, \
349  const tmp<FieldField<Field, Type2>>& tf2, \
350  const tmp<FieldField<Field, Type3>>& tf3 \
351 );
352 
353 
354 #define TERNARY_TYPE_FUNCTION_FFS(ReturnType, Type1, Type2, Type3, Func) \
355  \
356 TEMPLATE \
357 void Func \
358 ( \
359  FieldField<Field, ReturnType>& result, \
360  const FieldField<Field, Type1>& f1, \
361  const FieldField<Field, Type2>& f2, \
362  const Type3& s3 \
363 ); \
364  \
365 TEMPLATE \
366 tmp<FieldField<Field, ReturnType>> Func \
367 ( \
368  const FieldField<Field, Type1>& f1, \
369  const FieldField<Field, Type2>& f2, \
370  const Type3& s3 \
371 ); \
372  \
373 TEMPLATE \
374 tmp<FieldField<Field, ReturnType>> Func \
375 ( \
376  const tmp<FieldField<Field, Type1>>& tf1, \
377  const FieldField<Field, Type2>& f2, \
378  const Type3& s3 \
379 ); \
380  \
381 TEMPLATE \
382 tmp<FieldField<Field, ReturnType>> Func \
383 ( \
384  const FieldField<Field, Type1>& f1, \
385  const tmp<FieldField<Field, Type2>>& tf2, \
386  const Type3& s3 \
387 ); \
388  \
389 TEMPLATE \
390 tmp<FieldField<Field, ReturnType>> Func \
391 ( \
392  const tmp<FieldField<Field, Type1>>& tf1, \
393  const tmp<FieldField<Field, Type2>>& tf2, \
394  const Type3& s3 \
395 );
396 
397 
398 // ************************************************************************* //