Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
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
27Description
28 Macro functions for FieldField<Type> algebra.
29
30\*---------------------------------------------------------------------------*/
31
32// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33
34#define UNARY_FUNCTION(ReturnType, Type1, Func) \
35 \
36TEMPLATE \
37void Func \
38( \
39 FieldField<Field, ReturnType>& result, \
40 const FieldField<Field, Type1>& f1 \
41); \
42 \
43TEMPLATE \
44tmp<FieldField<Field, ReturnType>> Func \
45( \
46 const FieldField<Field, Type1>& f1 \
47); \
48 \
49TEMPLATE \
50tmp<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 \
60TEMPLATE \
61void OpFunc \
62( \
63 FieldField<Field, ReturnType>& result, \
64 const FieldField<Field, Type1>& f1 \
65); \
66 \
67TEMPLATE \
68tmp<FieldField<Field, ReturnType>> operator Op \
69( \
70 const FieldField<Field, Type1>& f1 \
71); \
72 \
73TEMPLATE \
74tmp<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 \
84TEMPLATE \
85void Func \
86( \
87 FieldField<Field, ReturnType>& result, \
88 const FieldField<Field, Type1>& f1, \
89 const FieldField<Field, Type2>& f2 \
90); \
91 \
92TEMPLATE \
93tmp<FieldField<Field, ReturnType>> Func \
94( \
95 const FieldField<Field, Type1>& f1, \
96 const FieldField<Field, Type2>& f2 \
97); \
98 \
99TEMPLATE \
100tmp<FieldField<Field, ReturnType>> Func \
101( \
102 const FieldField<Field, Type1>& f1, \
103 const tmp<FieldField<Field, Type2>>& tf2 \
104); \
105 \
106TEMPLATE \
107tmp<FieldField<Field, ReturnType>> Func \
108( \
109 const tmp<FieldField<Field, Type1>>& tf1, \
110 const FieldField<Field, Type2>& f2 \
111); \
112 \
113TEMPLATE \
114tmp<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 \
125TEMPLATE \
126void Func \
127( \
128 FieldField<Field, ReturnType>& result, \
129 const Type1& s1, \
130 const FieldField<Field, Type2>& f2 \
131); \
132 \
133TEMPLATE \
134tmp<FieldField<Field, ReturnType>> Func \
135( \
136 const Type1& s1, \
137 const FieldField<Field, Type1>& f2 \
138); \
139 \
140TEMPLATE \
141tmp<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 \
150TEMPLATE \
151void Func \
152( \
153 FieldField<Field, ReturnType>& result, \
154 const FieldField<Field, Type1>& f1, \
155 const Type2& s2 \
156); \
157 \
158TEMPLATE \
159tmp<FieldField<Field, ReturnType>> Func \
160( \
161 const FieldField<Field, Type1>& f1, \
162 const Type2& s2 \
163); \
164 \
165TEMPLATE \
166tmp<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 \
182TEMPLATE \
183void OpFunc \
184( \
185 FieldField<Field, ReturnType>& result, \
186 const FieldField<Field, Type1>& f1, \
187 const FieldField<Field, Type2>& f2 \
188); \
189 \
190TEMPLATE \
191tmp<FieldField<Field, ReturnType>> operator Op \
192( \
193 const FieldField<Field, Type1>& f1, \
194 const FieldField<Field, Type2>& f2 \
195); \
196 \
197TEMPLATE \
198tmp<FieldField<Field, ReturnType>> operator Op \
199( \
200 const FieldField<Field, Type1>& f1, \
201 const tmp<FieldField<Field, Type2>>& tf2 \
202); \
203 \
204TEMPLATE \
205tmp<FieldField<Field, ReturnType>> operator Op \
206( \
207 const tmp<FieldField<Field, Type1>>& tf1, \
208 const FieldField<Field, Type2>& f2 \
209); \
210 \
211TEMPLATE \
212tmp<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 \
223TEMPLATE \
224void OpFunc \
225( \
226 FieldField<Field, ReturnType>& result, \
227 const Type1& s1, \
228 const FieldField<Field, Type2>& f2 \
229); \
230 \
231TEMPLATE \
232tmp<FieldField<Field, ReturnType>> operator Op \
233( \
234 const Type1& s1, \
235 const FieldField<Field, Type2>& f2 \
236); \
237 \
238TEMPLATE \
239tmp<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 \
248TEMPLATE \
249void OpFunc \
250( \
251 FieldField<Field, ReturnType>& result, \
252 const FieldField<Field, Type1>& f1, \
253 const Type2& s2 \
254); \
255 \
256TEMPLATE \
257tmp<FieldField<Field, ReturnType>> operator Op \
258( \
259 const FieldField<Field, Type1>& f1, \
260 const Type2& s2 \
261); \
262 \
263TEMPLATE \
264tmp<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 \
280TEMPLATE \
281void 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 \
289TEMPLATE \
290tmp<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 \
297TEMPLATE \
298tmp<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 \
305TEMPLATE \
306tmp<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 \
313TEMPLATE \
314tmp<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 \
321TEMPLATE \
322tmp<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 \
329TEMPLATE \
330tmp<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 \
337TEMPLATE \
338tmp<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 \
345TEMPLATE \
346tmp<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 \
356TEMPLATE \
357void 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 \
365TEMPLATE \
366tmp<FieldField<Field, ReturnType>> Func \
367( \
368 const FieldField<Field, Type1>& f1, \
369 const FieldField<Field, Type2>& f2, \
370 const Type3& s3 \
371); \
372 \
373TEMPLATE \
374tmp<FieldField<Field, ReturnType>> Func \
375( \
376 const tmp<FieldField<Field, Type1>>& tf1, \
377 const FieldField<Field, Type2>& f2, \
378 const Type3& s3 \
379); \
380 \
381TEMPLATE \
382tmp<FieldField<Field, ReturnType>> Func \
383( \
384 const FieldField<Field, Type1>& f1, \
385 const tmp<FieldField<Field, Type2>>& tf2, \
386 const Type3& s3 \
387); \
388 \
389TEMPLATE \
390tmp<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// ************************************************************************* //