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