GeometricFieldFunctionsM.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 \*---------------------------------------------------------------------------*/
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 #define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc) \
32  \
33 TEMPLATE \
34 void Func \
35 ( \
36  GeometricField<ReturnType, PatchField, GeoMesh>& result, \
37  const GeometricField<Type1, PatchField, GeoMesh>& f1 \
38 ); \
39  \
40 TEMPLATE \
41 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
42 ( \
43  const GeometricField<Type1, PatchField, GeoMesh>& f1 \
44 ); \
45  \
46 TEMPLATE \
47 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
48 ( \
49  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1 \
50 );
51 
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 #define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc) \
56  \
57 TEMPLATE \
58 void OpFunc \
59 ( \
60  GeometricField<ReturnType, PatchField, GeoMesh>& result, \
61  const GeometricField<Type1, PatchField, GeoMesh>& f1 \
62 ); \
63  \
64 TEMPLATE \
65 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
66 ( \
67  const GeometricField<Type1, PatchField, GeoMesh>& f1 \
68 ); \
69  \
70 TEMPLATE \
71 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
72 ( \
73  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1 \
74 );
75 
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 #define BINARY_FUNCTION(ReturnType, Type1, Type2, Func) \
80  \
81 TEMPLATE \
82 void Func \
83 ( \
84  GeometricField<ReturnType, PatchField, GeoMesh>& result, \
85  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
86  const GeometricField<Type2, PatchField, GeoMesh>& f2 \
87 ); \
88  \
89 TEMPLATE \
90 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
91 ( \
92  const GeometricField<Type1, PatchField, GeoMesh>& df1, \
93  const GeometricField<Type2, PatchField, GeoMesh>& df2 \
94 ); \
95  \
96 TEMPLATE \
97 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
98 ( \
99  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
100  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \
101 ); \
102  \
103 TEMPLATE \
104 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
105 ( \
106  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
107  const GeometricField<Type2, PatchField, GeoMesh>& f2 \
108 ); \
109  \
110 TEMPLATE \
111 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
112 ( \
113  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
114  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \
115 );
116 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 #define BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
121  \
122 TEMPLATE \
123 void Func \
124 ( \
125  GeometricField<ReturnType, PatchField, GeoMesh>& result, \
126  const dimensioned<Type1>& dt1, \
127  const GeometricField<Type2, PatchField, GeoMesh>& f2 \
128 ); \
129  \
130 TEMPLATE \
131 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
132 ( \
133  const dimensioned<Type1>& dt1, \
134  const GeometricField<Type2, PatchField, GeoMesh>& f2 \
135 ); \
136  \
137 TEMPLATE \
138 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
139 ( \
140  const Type1& s1, \
141  const GeometricField<Type2, PatchField, GeoMesh>& f2 \
142 ); \
143  \
144 TEMPLATE \
145 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
146 ( \
147  const dimensioned<Type1>& dt1, \
148  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \
149 ); \
150  \
151 TEMPLATE \
152 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
153 ( \
154  const Type1& s1, \
155  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \
156 );
157 
158 
159 #define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func) \
160  \
161 TEMPLATE \
162 void Func \
163 ( \
164  GeometricField<ReturnType, PatchField, GeoMesh>& result, \
165  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
166  const dimensioned<Type2>& dt2 \
167 ); \
168  \
169 TEMPLATE \
170 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
171 ( \
172  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
173  const dimensioned<Type2>& dt2 \
174 ); \
175  \
176 TEMPLATE \
177 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
178 ( \
179  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
180  const Type2& s2 \
181 ); \
182  \
183 TEMPLATE \
184 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
185 ( \
186  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
187  const dimensioned<Type2>& dt2 \
188 ); \
189  \
190 TEMPLATE \
191 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
192 ( \
193  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
194  const Type2& s2 \
195 );
196 
197 
198 #define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func) \
199  BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
200  BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
206  \
207 TEMPLATE \
208 void OpFunc \
209 ( \
210  GeometricField<ReturnType, PatchField, GeoMesh>& result, \
211  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
212  const GeometricField<Type2, PatchField, GeoMesh>& f2 \
213 ); \
214  \
215 TEMPLATE \
216 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
217 ( \
218  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
219  const GeometricField<Type2, PatchField, GeoMesh>& f2 \
220 ); \
221  \
222 TEMPLATE \
223 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
224 ( \
225  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
226  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \
227 ); \
228  \
229 TEMPLATE \
230 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
231 ( \
232  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
233  const GeometricField<Type2, PatchField, GeoMesh>& f2 \
234 ); \
235  \
236 TEMPLATE \
237 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
238 ( \
239  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
240  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \
241 );
242 
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 #define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
247  \
248 TEMPLATE \
249 void OpFunc \
250 ( \
251  GeometricField<ReturnType, PatchField, GeoMesh>& result, \
252  const dimensioned<Type1>& dt1, \
253  const GeometricField<Type2, PatchField, GeoMesh>& f2 \
254 ); \
255  \
256 TEMPLATE \
257 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
258 ( \
259  const dimensioned<Type1>& dt1, \
260  const GeometricField<Type2, PatchField, GeoMesh>& f2 \
261 ); \
262  \
263 TEMPLATE \
264 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
265 ( \
266  const Type1& s1, \
267  const GeometricField<Type2, PatchField, GeoMesh>& f2 \
268 ); \
269  \
270 TEMPLATE \
271 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
272 ( \
273  const dimensioned<Type1>& dt1, \
274  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \
275 ); \
276  \
277 TEMPLATE \
278 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
279 ( \
280  const Type1& s1, \
281  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2 \
282 );
283 
284 
285 #define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
286  \
287 TEMPLATE \
288 void OpFunc \
289 ( \
290  GeometricField<ReturnType, PatchField, GeoMesh>& result, \
291  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
292  const dimensioned<Type2>& dt2 \
293 ); \
294  \
295 TEMPLATE \
296 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
297 ( \
298  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
299  const dimensioned<Type2>& dt2 \
300 ); \
301  \
302 TEMPLATE \
303 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
304 ( \
305  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
306  const Type2& s2 \
307 ); \
308  \
309 TEMPLATE \
310 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
311 ( \
312  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
313  const dimensioned<Type2>& dt2 \
314 ); \
315  \
316 TEMPLATE \
317 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
318 ( \
319  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
320  const Type2& s2 \
321 );
322 
323 
324 #define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
325  BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
326  BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
327 
328 
329 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
330 
331 #define TERNARY_FUNCTION(ReturnType, Type1, Type2, Type3, Func) \
332  \
333 TEMPLATE \
334 void Func \
335 ( \
336  GeometricField<Type1, PatchField, GeoMesh>& result, \
337  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
338  const GeometricField<Type2, PatchField, GeoMesh>& f2, \
339  const GeometricField<Type3, PatchField, GeoMesh>& f3 \
340 ); \
341  \
342 TEMPLATE \
343 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
344 ( \
345  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
346  const GeometricField<Type2, PatchField, GeoMesh>& f2, \
347  const GeometricField<Type3, PatchField, GeoMesh>& f3 \
348 ); \
349  \
350 TEMPLATE \
351 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
352 ( \
353  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
354  const GeometricField<Type2, PatchField, GeoMesh>& f2, \
355  const GeometricField<Type3, PatchField, GeoMesh>& f3 \
356 ); \
357  \
358 TEMPLATE \
359 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
360 ( \
361  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
362  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2, \
363  const GeometricField<Type3, PatchField, GeoMesh>& f3 \
364 ); \
365  \
366 TEMPLATE \
367 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
368 ( \
369  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
370  const GeometricField<Type2, PatchField, GeoMesh>& f2, \
371  const tmp<GeometricField<Type3, PatchField, GeoMesh>>& tf3 \
372 ); \
373  \
374 TEMPLATE \
375 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
376 ( \
377  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
378  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2, \
379  const GeometricField<Type3, PatchField, GeoMesh>& f3 \
380 ); \
381  \
382 TEMPLATE \
383 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
384 ( \
385  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
386  const GeometricField<Type2, PatchField, GeoMesh>& f2, \
387  const tmp<GeometricField<Type3, PatchField, GeoMesh>>& tf3 \
388 ); \
389  \
390 TEMPLATE \
391 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
392 ( \
393  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
394  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2, \
395  const tmp<GeometricField<Type3, PatchField, GeoMesh>>& tf3 \
396 ); \
397  \
398 TEMPLATE \
399 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
400 ( \
401  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
402  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2, \
403  const tmp<GeometricField<Type3, PatchField, GeoMesh>>& tf3 \
404 );
405 
406 
407 #define TERNARY_TYPE_FUNCTION_FFS(ReturnType, Type1, Type2, Type3, Func) \
408  \
409 TEMPLATE \
410 void Func \
411 ( \
412  GeometricField<Type1, PatchField, GeoMesh>& result, \
413  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
414  const GeometricField<Type2, PatchField, GeoMesh>& f2, \
415  const dimensioned<Type3>& dt3 \
416 ); \
417  \
418 TEMPLATE \
419 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
420 ( \
421  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
422  const GeometricField<Type2, PatchField, GeoMesh>& f2, \
423  const dimensioned<Type3>& dt3 \
424 ); \
425  \
426 TEMPLATE \
427 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
428 ( \
429  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
430  const GeometricField<Type2, PatchField, GeoMesh>& f2, \
431  const Type3& s3 \
432 ); \
433  \
434 TEMPLATE \
435 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
436 ( \
437  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
438  const GeometricField<Type2, PatchField, GeoMesh>& f2, \
439  const dimensioned<Type3>& dt3 \
440 ); \
441  \
442 TEMPLATE \
443 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
444 ( \
445  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
446  const GeometricField<Type2, PatchField, GeoMesh>& f2, \
447  const Type3& s3 \
448 ); \
449  \
450 TEMPLATE \
451 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
452 ( \
453  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
454  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2, \
455  const dimensioned<Type3>& dt3 \
456 ); \
457  \
458 TEMPLATE \
459 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
460 ( \
461  const GeometricField<Type1, PatchField, GeoMesh>& f1, \
462  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2, \
463  const Type3& s3 \
464 ); \
465  \
466 TEMPLATE \
467 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
468 ( \
469  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
470  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2, \
471  const dimensioned<Type3>& dt3 \
472 ); \
473  \
474 TEMPLATE \
475 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
476 ( \
477  const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tf1, \
478  const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tf2, \
479  const Type3& s3 \
480 );
481 
482 
483 // ************************************************************************* //