OpenFOAM
dev
The OpenFOAM Foundation
FieldFunctionsM.H
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration | Website: https://openfoam.org
5
\\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
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
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
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
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
Description
25
High performance macro functions for Field<Type> algebra. These expand
26
using either array element access (for vector machines) or pointer
27
dereferencing for scalar machines as appropriate.
28
29
\*---------------------------------------------------------------------------*/
30
31
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32
33
#define UNARY_FUNCTION(ReturnType, Type1, Func) \
34
\
35
TEMPLATE \
36
void Func(Field<ReturnType>& res, const UList<Type1>& f); \
37
TEMPLATE \
38
tmp<Field<ReturnType>> Func(const Field<Type1>& f); \
39
TEMPLATE \
40
tmp<Field<ReturnType>> Func(const SubField<Type1>& f); \
41
TEMPLATE \
42
tmp<Field<ReturnType>> Func(const tmp<Field<Type1>>& tf);
43
44
45
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc) \
48
\
49
TEMPLATE \
50
void OpFunc(Field<ReturnType>& res, const UList<Type1>& f); \
51
TEMPLATE \
52
tmp<Field<ReturnType>> operator Op(const Field<Type1>& f); \
53
TEMPLATE \
54
tmp<Field<ReturnType>> operator Op(const SubField<Type1>& f); \
55
TEMPLATE \
56
tmp<Field<ReturnType>> operator Op(const tmp<Field<Type1>>& tf);
57
58
59
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60
61
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func) \
62
\
63
TEMPLATE \
64
void Func \
65
( \
66
Field<ReturnType>& f, \
67
const UList<Type1>& f1, \
68
const UList<Type2>& f2 \
69
); \
70
\
71
TEMPLATE \
72
tmp<Field<ReturnType>> Func \
73
( \
74
const Field<Type1>& f1, \
75
const Field<Type2>& f2 \
76
); \
77
\
78
TEMPLATE \
79
tmp<Field<ReturnType>> Func \
80
( \
81
const Field<Type1>& f1, \
82
const SubField<Type2>& f2 \
83
); \
84
\
85
TEMPLATE \
86
tmp<Field<ReturnType>> Func \
87
( \
88
const SubField<Type1>& f1, \
89
const Field<Type2>& f2 \
90
); \
91
\
92
TEMPLATE \
93
tmp<Field<ReturnType>> Func \
94
( \
95
const SubField<Type1>& f1, \
96
const SubField<Type2>& f2 \
97
); \
98
\
99
TEMPLATE \
100
tmp<Field<ReturnType>> Func \
101
( \
102
const UList<Type1>& f1, \
103
const tmp<Field<Type2>>& tf2 \
104
); \
105
\
106
TEMPLATE \
107
tmp<Field<ReturnType>> Func \
108
( \
109
const UList<Type1>& f1, \
110
const tmp<Field<Type2>>& tf2 \
111
); \
112
\
113
TEMPLATE \
114
tmp<Field<ReturnType>> Func \
115
( \
116
const tmp<Field<Type1>>& tf1, \
117
const UList<Type2>& f2 \
118
); \
119
\
120
TEMPLATE \
121
tmp<Field<ReturnType>> Func \
122
( \
123
const tmp<Field<Type1>>& tf1, \
124
const UList<Type2>& f2 \
125
); \
126
\
127
TEMPLATE \
128
tmp<Field<ReturnType>> Func \
129
( \
130
const tmp<Field<Type1>>& tf1, \
131
const tmp<Field<Type2>>& tf2 \
132
);
133
134
135
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136
137
#define BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
138
\
139
TEMPLATE \
140
void Func \
141
( \
142
Field<ReturnType>& f, \
143
const Type1& s1, \
144
const UList<Type2>& f2 \
145
); \
146
\
147
TEMPLATE \
148
tmp<Field<ReturnType>> Func \
149
( \
150
const Type1& s1, \
151
const Field<Type2>& f2 \
152
); \
153
\
154
TEMPLATE \
155
tmp<Field<ReturnType>> Func \
156
( \
157
const Type1& s1, \
158
const SubField<Type2>& f2 \
159
); \
160
\
161
TEMPLATE \
162
tmp<Field<ReturnType>> Func \
163
( \
164
const Type1& s1, \
165
const tmp<Field<Type2>>& tf2 \
166
);
167
168
169
#define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func) \
170
\
171
TEMPLATE \
172
void Func \
173
( \
174
Field<ReturnType>& f, \
175
const UList<Type1>& f1, \
176
const Type2& s2 \
177
); \
178
\
179
TEMPLATE \
180
tmp<Field<ReturnType>> Func \
181
( \
182
const Field<Type1>& f1, \
183
const Type2& s2 \
184
); \
185
\
186
TEMPLATE \
187
tmp<Field<ReturnType>> Func \
188
( \
189
const SubField<Type1>& f1, \
190
const Type2& s2 \
191
); \
192
\
193
TEMPLATE \
194
tmp<Field<ReturnType>> Func \
195
( \
196
const tmp<Field<Type1>>& tf1, \
197
const Type2& s2 \
198
);
199
200
201
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func) \
202
BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
203
BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)
204
205
206
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207
208
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpFunc) \
209
\
210
TEMPLATE \
211
void OpFunc \
212
( \
213
Field<ReturnType>& f, \
214
const UList<Type1>& f1, \
215
const UList<Type2>& f2 \
216
); \
217
\
218
TEMPLATE \
219
tmp<Field<ReturnType>> operator Op \
220
( \
221
const Field<Type1>& f1, \
222
const Field<Type2>& f2 \
223
); \
224
\
225
TEMPLATE \
226
tmp<Field<ReturnType>> operator Op \
227
( \
228
const Field<Type1>& f1, \
229
const SubField<Type2>& f2 \
230
); \
231
\
232
TEMPLATE \
233
tmp<Field<ReturnType>> operator Op \
234
( \
235
const SubField<Type1>& f1, \
236
const Field<Type2>& f2 \
237
); \
238
\
239
TEMPLATE \
240
tmp<Field<ReturnType>> operator Op \
241
( \
242
const SubField<Type1>& f1, \
243
const SubField<Type2>& f2 \
244
); \
245
\
246
TEMPLATE \
247
tmp<Field<ReturnType>> operator Op \
248
( \
249
const Field<Type1>& f1, \
250
const tmp<Field<Type2>>& tf2 \
251
); \
252
\
253
TEMPLATE \
254
tmp<Field<ReturnType>> operator Op \
255
( \
256
const SubField<Type1>& f1, \
257
const tmp<Field<Type2>>& tf2 \
258
); \
259
\
260
TEMPLATE \
261
tmp<Field<ReturnType>> operator Op \
262
( \
263
const tmp<Field<Type1>>& tf1, \
264
const Field<Type2>& f2 \
265
); \
266
\
267
TEMPLATE \
268
tmp<Field<ReturnType>> operator Op \
269
( \
270
const tmp<Field<Type1>>& tf1, \
271
const SubField<Type2>& f2 \
272
); \
273
\
274
TEMPLATE \
275
tmp<Field<ReturnType>> operator Op \
276
( \
277
const tmp<Field<Type1>>& tf1, \
278
const tmp<Field<Type2>>& tf2 \
279
);
280
281
282
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283
284
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpFunc) \
285
\
286
TEMPLATE \
287
void OpFunc \
288
( \
289
Field<ReturnType>& f, \
290
const Type1& s1, \
291
const UList<Type2>& f2 \
292
); \
293
\
294
TEMPLATE \
295
tmp<Field<ReturnType>> operator Op \
296
( \
297
const Type1& s1, \
298
const Field<Type2>& f2 \
299
); \
300
\
301
TEMPLATE \
302
tmp<Field<ReturnType>> operator Op \
303
( \
304
const Type1& s1, \
305
const SubField<Type2>& f2 \
306
); \
307
\
308
TEMPLATE \
309
tmp<Field<ReturnType>> operator Op \
310
( \
311
const Type1& s1, \
312
const tmp<Field<Type2>>& tf2 \
313
);
314
315
316
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpFunc) \
317
\
318
TEMPLATE \
319
void OpFunc \
320
( \
321
Field<ReturnType>& f, \
322
const UList<Type1>& f1, \
323
const Type2& s2 \
324
); \
325
\
326
TEMPLATE \
327
tmp<Field<ReturnType>> operator Op \
328
( \
329
const Field<Type1>& f1, \
330
const Type2& s2 \
331
); \
332
\
333
TEMPLATE \
334
tmp<Field<ReturnType>> operator Op \
335
( \
336
const SubField<Type1>& f1, \
337
const Type2& s2 \
338
); \
339
\
340
TEMPLATE \
341
tmp<Field<ReturnType>> operator Op \
342
( \
343
const tmp<Field<Type1>>& tf1, \
344
const Type2& s2 \
345
);
346
347
348
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpFunc) \
349
BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpFunc) \
350
BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpFunc)
351
352
353
// ************************************************************************* //
src
OpenFOAM
fields
Field
FieldFunctionsM.H
Generated by
1.9.1