OpenFOAM
5.0
The OpenFOAM Foundation
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
w
z
+
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
Enumerator
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
v
w
+
Enumerations
a
b
c
d
e
f
g
i
k
l
m
o
p
r
s
t
v
w
+
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Related Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
+
Files
File List
+
File Members
+
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Typedefs
b
c
d
f
g
k
l
m
p
r
s
t
v
w
+
Macros
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
src
OpenFOAM
fields
GeometricFields
GeometricField
GeometricFieldFunctionsM.C
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------* \
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | Copyright (C) 2011-2016 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
\*---------------------------------------------------------------------------*/
25
26
#include "
GeometricFieldReuseFunctions.H
"
27
28
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29
30
namespace
Foam
31
{
32
33
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34
35
#define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc) \
36
\
37
TEMPLATE \
38
void Func \
39
( \
40
GeometricField<ReturnType, PatchField, GeoMesh>& res, \
41
const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
42
) \
43
{ \
44
Foam::Func(res.primitiveFieldRef(), gf1.primitiveField()); \
45
Foam::Func(res.boundaryFieldRef(), gf1.boundaryField()); \
46
} \
47
\
48
TEMPLATE \
49
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
50
( \
51
const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
52
) \
53
{ \
54
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
55
( \
56
new GeometricField<ReturnType, PatchField, GeoMesh> \
57
( \
58
IOobject \
59
( \
60
#Func "(" + gf1.name() + ')', \
61
gf1.instance(), \
62
gf1.db(), \
63
IOobject::NO_READ, \
64
IOobject::NO_WRITE \
65
), \
66
gf1.mesh(), \
67
Dfunc(gf1.dimensions()) \
68
) \
69
); \
70
\
71
Foam::Func(tRes.ref(), gf1); \
72
\
73
return tRes; \
74
} \
75
\
76
TEMPLATE \
77
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
78
( \
79
const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1 \
80
) \
81
{ \
82
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
83
\
84
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
85
( \
86
reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
87
( \
88
tgf1, \
89
#Func "(" + gf1.name() + ')', \
90
Dfunc(gf1.dimensions()) \
91
) \
92
); \
93
\
94
Foam::Func(tRes.ref(), gf1); \
95
\
96
tgf1.clear(); \
97
\
98
return tRes; \
99
}
100
101
102
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103
104
#define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc) \
105
\
106
TEMPLATE \
107
void OpFunc \
108
( \
109
GeometricField<ReturnType, PatchField, GeoMesh>& res, \
110
const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
111
) \
112
{ \
113
Foam::OpFunc(res.primitiveFieldRef(), gf1.primitiveField()); \
114
Foam::OpFunc(res.boundaryFieldRef(), gf1.boundaryField()); \
115
} \
116
\
117
TEMPLATE \
118
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
119
( \
120
const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
121
) \
122
{ \
123
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
124
( \
125
new GeometricField<ReturnType, PatchField, GeoMesh> \
126
( \
127
IOobject \
128
( \
129
#Op + gf1.name(), \
130
gf1.instance(), \
131
gf1.db(), \
132
IOobject::NO_READ, \
133
IOobject::NO_WRITE \
134
), \
135
gf1.mesh(), \
136
Dfunc(gf1.dimensions()) \
137
) \
138
); \
139
\
140
Foam::OpFunc(tRes.ref(), gf1); \
141
\
142
return tRes; \
143
} \
144
\
145
TEMPLATE \
146
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
147
( \
148
const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1 \
149
) \
150
{ \
151
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
152
\
153
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
154
( \
155
reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
156
( \
157
tgf1, \
158
#Op + gf1.name(), \
159
Dfunc(gf1.dimensions()) \
160
) \
161
); \
162
\
163
Foam::OpFunc(tRes.ref(), gf1); \
164
\
165
tgf1.clear(); \
166
\
167
return tRes; \
168
}
169
170
171
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172
173
#define BINARY_FUNCTION(ReturnType, Type1, Type2, Func) \
174
\
175
TEMPLATE \
176
void Func \
177
( \
178
GeometricField<ReturnType, PatchField, GeoMesh>& res, \
179
const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
180
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
181
) \
182
{ \
183
Foam::Func \
184
( \
185
res.primitiveFieldRef(), \
186
gf1.primitiveField(), \
187
gf2.primitiveField() \
188
); \
189
Foam::Func \
190
( \
191
res.boundaryFieldRef(), \
192
gf1.boundaryField(), \
193
gf2.boundaryField() \
194
); \
195
} \
196
\
197
TEMPLATE \
198
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
199
( \
200
const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
201
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
202
) \
203
{ \
204
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
205
( \
206
new GeometricField<ReturnType, PatchField, GeoMesh> \
207
( \
208
IOobject \
209
( \
210
#Func "(" + gf1.name() + ',' + gf2.name() + ')', \
211
gf1.instance(), \
212
gf1.db(), \
213
IOobject::NO_READ, \
214
IOobject::NO_WRITE \
215
), \
216
gf1.mesh(), \
217
Func(gf1.dimensions(), gf2.dimensions()) \
218
) \
219
); \
220
\
221
Foam::Func(tRes.ref(), gf1, gf2); \
222
\
223
return tRes; \
224
} \
225
\
226
TEMPLATE \
227
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
228
( \
229
const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
230
const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
231
) \
232
{ \
233
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
234
\
235
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
236
( \
237
reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
238
( \
239
tgf2, \
240
#Func "(" + gf1.name() + ',' + gf2.name() + ')', \
241
Func(gf1.dimensions(), gf2.dimensions()) \
242
) \
243
); \
244
\
245
Foam::Func(tRes.ref(), gf1, gf2); \
246
\
247
tgf2.clear(); \
248
\
249
return tRes; \
250
} \
251
\
252
TEMPLATE \
253
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
254
( \
255
const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
256
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
257
) \
258
{ \
259
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
260
\
261
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
262
( \
263
reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
264
( \
265
tgf1, \
266
#Func "(" + gf1.name() + ',' + gf2.name() + ')', \
267
Func(gf1.dimensions(), gf2.dimensions()) \
268
) \
269
); \
270
\
271
Foam::Func(tRes.ref(), gf1, gf2); \
272
\
273
tgf1.clear(); \
274
\
275
return tRes; \
276
} \
277
\
278
TEMPLATE \
279
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
280
( \
281
const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
282
const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
283
) \
284
{ \
285
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
286
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
287
\
288
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
289
( \
290
reuseTmpTmpGeometricField \
291
<ReturnType, Type1, Type1, Type2, PatchField, GeoMesh> \
292
::New \
293
( \
294
tgf1, \
295
tgf2, \
296
#Func "(" + gf1.name() + ',' + gf2.name() + ')', \
297
Func(gf1.dimensions(), gf2.dimensions()) \
298
) \
299
); \
300
\
301
Foam::Func(tRes.ref(), gf1, gf2); \
302
\
303
tgf1.clear(); \
304
tgf2.clear(); \
305
\
306
return tRes; \
307
}
308
309
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
310
311
#define BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
312
\
313
TEMPLATE \
314
void Func \
315
( \
316
GeometricField<ReturnType, PatchField, GeoMesh>& res, \
317
const dimensioned<Type1>& dt1, \
318
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
319
) \
320
{ \
321
Foam::Func(res.primitiveFieldRef(), dt1.value(), gf2.primitiveField()); \
322
Foam::Func(res.boundaryFieldRef(), dt1.value(), gf2.boundaryField()); \
323
} \
324
\
325
TEMPLATE \
326
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
327
( \
328
const dimensioned<Type1>& dt1, \
329
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
330
) \
331
{ \
332
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
333
( \
334
new GeometricField<ReturnType, PatchField, GeoMesh> \
335
( \
336
IOobject \
337
( \
338
#Func "(" + dt1.name() + ',' + gf2.name() + ')', \
339
gf2.instance(), \
340
gf2.db(), \
341
IOobject::NO_READ, \
342
IOobject::NO_WRITE \
343
), \
344
gf2.mesh(), \
345
Func(dt1.dimensions(), gf2.dimensions()) \
346
) \
347
); \
348
\
349
Foam::Func(tRes.ref(), dt1, gf2); \
350
\
351
return tRes; \
352
} \
353
\
354
TEMPLATE \
355
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
356
( \
357
const Type1& t1, \
358
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
359
) \
360
{ \
361
return Func(dimensioned<Type1>(t1), gf2); \
362
} \
363
\
364
\
365
TEMPLATE \
366
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
367
( \
368
const dimensioned<Type1>& dt1, \
369
const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
370
) \
371
{ \
372
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
373
\
374
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
375
( \
376
reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
377
( \
378
tgf2, \
379
#Func "(" + dt1.name() + gf2.name() + ',' + ')', \
380
Func(dt1.dimensions(), gf2.dimensions()) \
381
) \
382
); \
383
\
384
Foam::Func(tRes.ref(), dt1, gf2); \
385
\
386
tgf2.clear(); \
387
\
388
return tRes; \
389
} \
390
\
391
TEMPLATE \
392
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
393
( \
394
const Type1& t1, \
395
const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
396
) \
397
{ \
398
return Func(dimensioned<Type1>(t1), tgf2); \
399
}
400
401
402
#define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func) \
403
\
404
TEMPLATE \
405
void Func \
406
( \
407
GeometricField<ReturnType, PatchField, GeoMesh>& res, \
408
const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
409
const dimensioned<Type2>& dt2 \
410
) \
411
{ \
412
Foam::Func(res.primitiveFieldRef(), gf1.primitiveField(), dt2.value()); \
413
Foam::Func(res.boundaryFieldRef(), gf1.boundaryField(), dt2.value()); \
414
} \
415
\
416
TEMPLATE \
417
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
418
( \
419
const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
420
const dimensioned<Type2>& dt2 \
421
) \
422
{ \
423
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
424
( \
425
new GeometricField<ReturnType, PatchField, GeoMesh> \
426
( \
427
IOobject \
428
( \
429
#Func "(" + gf1.name() + ',' + dt2.name() + ')', \
430
gf1.instance(), \
431
gf1.db(), \
432
IOobject::NO_READ, \
433
IOobject::NO_WRITE \
434
), \
435
gf1.mesh(), \
436
Func(gf1.dimensions(), dt2.dimensions()) \
437
) \
438
); \
439
\
440
Foam::Func(tRes.ref(), gf1, dt2); \
441
\
442
return tRes; \
443
} \
444
\
445
TEMPLATE \
446
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
447
( \
448
const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
449
const Type2& t2 \
450
) \
451
{ \
452
return Func(gf1, dimensioned<Type2>(t2)); \
453
} \
454
\
455
\
456
TEMPLATE \
457
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
458
( \
459
const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
460
const dimensioned<Type2>& dt2 \
461
) \
462
{ \
463
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
464
\
465
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
466
( \
467
reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
468
( \
469
tgf1, \
470
#Func "(" + gf1.name() + ',' + dt2.name() + ')', \
471
Func(gf1.dimensions(), dt2.dimensions()) \
472
) \
473
); \
474
\
475
Foam::Func(tRes.ref(), gf1, dt2); \
476
\
477
tgf1.clear(); \
478
\
479
return tRes; \
480
} \
481
\
482
TEMPLATE \
483
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
484
( \
485
const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
486
const Type2& t2 \
487
) \
488
{ \
489
return Func(tgf1, dimensioned<Type2>(t2)); \
490
}
491
492
493
#define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func) \
494
BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
495
BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)
496
497
498
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
499
500
#define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
501
\
502
TEMPLATE \
503
void OpFunc \
504
( \
505
GeometricField<ReturnType, PatchField, GeoMesh>& res, \
506
const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
507
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
508
) \
509
{ \
510
Foam::OpFunc \
511
(res.primitiveFieldRef(), gf1.primitiveField(), gf2.primitiveField()); \
512
Foam::OpFunc \
513
(res.boundaryFieldRef(), gf1.boundaryField(), gf2.boundaryField()); \
514
} \
515
\
516
TEMPLATE \
517
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
518
( \
519
const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
520
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
521
) \
522
{ \
523
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
524
( \
525
new GeometricField<ReturnType, PatchField, GeoMesh> \
526
( \
527
IOobject \
528
( \
529
'(' + gf1.name() + OpName + gf2.name() + ')', \
530
gf1.instance(), \
531
gf1.db(), \
532
IOobject::NO_READ, \
533
IOobject::NO_WRITE \
534
), \
535
gf1.mesh(), \
536
gf1.dimensions() Op gf2.dimensions() \
537
) \
538
); \
539
\
540
Foam::OpFunc(tRes.ref(), gf1, gf2); \
541
\
542
return tRes; \
543
} \
544
\
545
TEMPLATE \
546
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
547
( \
548
const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
549
const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
550
) \
551
{ \
552
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
553
\
554
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
555
( \
556
reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
557
( \
558
tgf2, \
559
'(' + gf1.name() + OpName + gf2.name() + ')', \
560
gf1.dimensions() Op gf2.dimensions() \
561
) \
562
); \
563
\
564
Foam::OpFunc(tRes.ref(), gf1, gf2); \
565
\
566
tgf2.clear(); \
567
\
568
return tRes; \
569
} \
570
\
571
TEMPLATE \
572
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
573
( \
574
const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
575
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
576
) \
577
{ \
578
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
579
\
580
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
581
( \
582
reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
583
( \
584
tgf1, \
585
'(' + gf1.name() + OpName + gf2.name() + ')', \
586
gf1.dimensions() Op gf2.dimensions() \
587
) \
588
); \
589
\
590
Foam::OpFunc(tRes.ref(), gf1, gf2); \
591
\
592
tgf1.clear(); \
593
\
594
return tRes; \
595
} \
596
\
597
TEMPLATE \
598
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
599
( \
600
const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
601
const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
602
) \
603
{ \
604
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
605
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
606
\
607
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
608
( \
609
reuseTmpTmpGeometricField \
610
<ReturnType, Type1, Type1, Type2, PatchField, GeoMesh>::New \
611
( \
612
tgf1, \
613
tgf2, \
614
'(' + gf1.name() + OpName + gf2.name() + ')', \
615
gf1.dimensions() Op gf2.dimensions() \
616
) \
617
); \
618
\
619
Foam::OpFunc(tRes.ref(), gf1, gf2); \
620
\
621
tgf1.clear(); \
622
tgf2.clear(); \
623
\
624
return tRes; \
625
}
626
627
628
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
629
630
#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
631
\
632
TEMPLATE \
633
void OpFunc \
634
( \
635
GeometricField<ReturnType, PatchField, GeoMesh>& res, \
636
const dimensioned<Type1>& dt1, \
637
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
638
) \
639
{ \
640
Foam::OpFunc(res.primitiveFieldRef(), dt1.value(), gf2.primitiveField()); \
641
Foam::OpFunc(res.boundaryFieldRef(), dt1.value(), gf2.boundaryField()); \
642
} \
643
\
644
TEMPLATE \
645
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
646
( \
647
const dimensioned<Type1>& dt1, \
648
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
649
) \
650
{ \
651
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
652
( \
653
new GeometricField<ReturnType, PatchField, GeoMesh> \
654
( \
655
IOobject \
656
( \
657
'(' + dt1.name() + OpName + gf2.name() + ')', \
658
gf2.instance(), \
659
gf2.db(), \
660
IOobject::NO_READ, \
661
IOobject::NO_WRITE \
662
), \
663
gf2.mesh(), \
664
dt1.dimensions() Op gf2.dimensions() \
665
) \
666
); \
667
\
668
Foam::OpFunc(tRes.ref(), dt1, gf2); \
669
\
670
return tRes; \
671
} \
672
\
673
TEMPLATE \
674
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
675
( \
676
const Type1& t1, \
677
const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
678
) \
679
{ \
680
return dimensioned<Type1>(t1) Op gf2; \
681
} \
682
\
683
\
684
TEMPLATE \
685
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
686
( \
687
const dimensioned<Type1>& dt1, \
688
const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
689
) \
690
{ \
691
const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
692
\
693
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
694
( \
695
reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
696
( \
697
tgf2, \
698
'(' + dt1.name() + OpName + gf2.name() + ')', \
699
dt1.dimensions() Op gf2.dimensions() \
700
) \
701
); \
702
\
703
Foam::OpFunc(tRes.ref(), dt1, gf2); \
704
\
705
tgf2.clear(); \
706
\
707
return tRes; \
708
} \
709
\
710
TEMPLATE \
711
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
712
( \
713
const Type1& t1, \
714
const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
715
) \
716
{ \
717
return dimensioned<Type1>(t1) Op tgf2; \
718
}
719
720
721
#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
722
\
723
TEMPLATE \
724
void OpFunc \
725
( \
726
GeometricField<ReturnType, PatchField, GeoMesh>& res, \
727
const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
728
const dimensioned<Type2>& dt2 \
729
) \
730
{ \
731
Foam::OpFunc(res.primitiveFieldRef(), gf1.primitiveField(), dt2.value()); \
732
Foam::OpFunc(res.boundaryFieldRef(), gf1.boundaryField(), dt2.value()); \
733
} \
734
\
735
TEMPLATE \
736
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
737
( \
738
const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
739
const dimensioned<Type2>& dt2 \
740
) \
741
{ \
742
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
743
( \
744
new GeometricField<ReturnType, PatchField, GeoMesh> \
745
( \
746
IOobject \
747
( \
748
'(' + gf1.name() + OpName + dt2.name() + ')', \
749
gf1.instance(), \
750
gf1.db(), \
751
IOobject::NO_READ, \
752
IOobject::NO_WRITE \
753
), \
754
gf1.mesh(), \
755
gf1.dimensions() Op dt2.dimensions() \
756
) \
757
); \
758
\
759
Foam::OpFunc(tRes.ref(), gf1, dt2); \
760
\
761
return tRes; \
762
} \
763
\
764
TEMPLATE \
765
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
766
( \
767
const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
768
const Type2& t2 \
769
) \
770
{ \
771
return gf1 Op dimensioned<Type2>(t2); \
772
} \
773
\
774
\
775
TEMPLATE \
776
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
777
( \
778
const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
779
const dimensioned<Type2>& dt2 \
780
) \
781
{ \
782
const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
783
\
784
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
785
( \
786
reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
787
( \
788
tgf1, \
789
'(' + gf1.name() + OpName + dt2.name() + ')', \
790
gf1.dimensions() Op dt2.dimensions() \
791
) \
792
); \
793
\
794
Foam::OpFunc(tRes.ref(), gf1, dt2); \
795
\
796
tgf1.clear(); \
797
\
798
return tRes; \
799
} \
800
\
801
TEMPLATE \
802
tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
803
( \
804
const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
805
const Type2& t2 \
806
) \
807
{ \
808
return tgf1 Op dimensioned<Type2>(t2); \
809
}
810
811
812
#define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
813
BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
814
BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
815
816
817
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
818
819
}
// End namespace Foam
820
821
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
GeometricFieldReuseFunctions.H
Foam
Namespace for OpenFOAM.
Definition:
combustionModel.C:30
Generated by
1.8.13