30 #define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc) \
33 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
35 const DimensionedField<Type1, GeoMesh>& df1 \
38 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
40 DimensionedField<ReturnType, GeoMesh>::New \
42 #Func "(" + df1.name() + ')', \
44 Dfunc(df1.dimensions()) \
48 Func(tRes.ref().primitiveFieldRef(), df1.primitiveField()); \
54 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
56 const tmp<DimensionedField<Type1, GeoMesh>>& tdf1 \
59 const DimensionedField<Type1, GeoMesh>& df1 = tdf1(); \
61 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
63 reuseTmpDimensionedField<ReturnType, Type1, GeoMesh>::New \
66 #Func "(" + df1.name() + ')', \
67 Dfunc(df1.dimensions()) \
71 Func(tRes.ref().primitiveFieldRef(), df1.primitiveField()); \
81 #define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc) \
84 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
86 const DimensionedField<Type1, GeoMesh>& df1 \
89 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
91 DimensionedField<ReturnType, GeoMesh>::New \
95 Dfunc(df1.dimensions()) \
99 Foam::OpFunc(tRes.ref().primitiveFieldRef(), df1.primitiveField()); \
105 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
107 const tmp<DimensionedField<Type1, GeoMesh>>& tdf1 \
110 const DimensionedField<Type1, GeoMesh>& df1 = tdf1(); \
112 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
114 reuseTmpDimensionedField<ReturnType, Type1, GeoMesh>::New \
118 Dfunc(df1.dimensions()) \
122 Foam::OpFunc(tRes.ref().primitiveFieldRef(), df1.primitiveField()); \
132 #define BINARY_FUNCTION(ReturnType, Type1, Type2, Func) \
135 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
137 const DimensionedField<Type1, GeoMesh>& df1, \
138 const DimensionedField<Type2, GeoMesh>& df2 \
141 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
143 DimensionedField<ReturnType, GeoMesh>::New \
145 #Func "(" + df1.name() + ',' + df2.name() + ')', \
147 Func(df1.dimensions(), df2.dimensions()) \
153 tRes.ref().primitiveFieldRef(), \
154 df1.primitiveField(), \
155 df2.primitiveField() \
162 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
164 const DimensionedField<Type1, GeoMesh>& df1, \
165 const tmp<DimensionedField<Type2, GeoMesh>>& tdf2 \
168 const DimensionedField<Type2, GeoMesh>& df2 = tdf2(); \
170 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
172 reuseTmpDimensionedField<ReturnType, Type2, GeoMesh>::New \
175 #Func "(" + df1.name() + ',' + df2.name() + ')', \
176 Func(df1.dimensions(), df2.dimensions()) \
182 tRes.ref().primitiveFieldRef(), \
183 df1.primitiveField(), \
184 df2.primitiveField() \
193 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
195 const tmp<DimensionedField<Type1, GeoMesh>>& tdf1, \
196 const DimensionedField<Type2, GeoMesh>& df2 \
199 const DimensionedField<Type1, GeoMesh>& df1 = tdf1(); \
201 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
203 reuseTmpDimensionedField<ReturnType, Type1, GeoMesh>::New \
206 #Func "(" + df1.name() + ',' + df2.name() + ')', \
207 Func(df1.dimensions(), df2.dimensions()) \
213 tRes.ref().primitiveFieldRef(), \
214 df1.primitiveField(), \
215 df2.primitiveField() \
224 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
226 const tmp<DimensionedField<Type1, GeoMesh>>& tdf1, \
227 const tmp<DimensionedField<Type2, GeoMesh>>& tdf2 \
230 const DimensionedField<Type1, GeoMesh>& df1 = tdf1(); \
231 const DimensionedField<Type2, GeoMesh>& df2 = tdf2(); \
233 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
235 reuseTmpTmpDimensionedField<ReturnType, Type1, Type2, GeoMesh>::New \
239 #Func "(" + df1.name() + ',' + df2.name() + ')', \
240 Func(df1.dimensions(), df2.dimensions()) \
246 tRes.ref().primitiveFieldRef(), \
247 df1.primitiveField(), \
248 df2.primitiveField() \
260 #define BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
263 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
265 const dimensioned<Type1>& dt1, \
266 const DimensionedField<Type2, GeoMesh>& df2 \
269 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
271 DimensionedField<ReturnType, GeoMesh>::New \
273 #Func "(" + dt1.name() + ',' + df2.name() + ')', \
275 Func(dt1.dimensions(), df2.dimensions()) \
279 Func(tRes.ref().primitiveFieldRef(), dt1.value(), df2.primitiveField()); \
285 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
288 const DimensionedField<Type2, GeoMesh>& df2 \
291 return Func(dimensioned<Type1>(t1), df2); \
296 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
298 const dimensioned<Type1>& dt1, \
299 const tmp<DimensionedField<Type2, GeoMesh>>& tdf2 \
302 const DimensionedField<Type2, GeoMesh>& df2 = tdf2(); \
304 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
306 reuseTmpDimensionedField<ReturnType, Type2, GeoMesh>::New \
309 #Func "(" + dt1.name() + ',' + df2.name() + ')', \
310 Func(dt1.dimensions(), df2.dimensions()) \
314 Func(tRes.ref().primitiveFieldRef(), dt1.value(), df2.primitiveField()); \
322 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
325 const tmp<DimensionedField<Type2, GeoMesh>>& tdf2 \
328 return Func(dimensioned<Type2>(t1), tdf2); \
332 #define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func) \
335 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
337 const DimensionedField<Type1, GeoMesh>& df1, \
338 const dimensioned<Type2>& dt2 \
341 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
343 DimensionedField<ReturnType, GeoMesh>::New \
345 #Func "(" + df1.name() + ',' + dt2.name() + ')', \
347 Func(df1.dimensions(), dt2.dimensions()) \
351 Func(tRes.ref().primitiveFieldRef(), df1.primitiveField(), dt2.value()); \
357 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
359 const DimensionedField<Type1, GeoMesh>& df1, \
363 return Func(df1, dimensioned<Type2>(t2)); \
368 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
370 const tmp<DimensionedField<Type1, GeoMesh>>& tdf1, \
371 const dimensioned<Type2>& dt2 \
374 const DimensionedField<Type1, GeoMesh>& df1 = tdf1(); \
376 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
378 reuseTmpDimensionedField<ReturnType, Type1, GeoMesh>::New \
381 #Func "(" + df1.name() + ',' + dt2.name() + ')', \
382 Func(df1.dimensions(), dt2.dimensions()) \
386 Func(tRes.ref().primitiveFieldRef(), df1.primitiveField(), dt2.value()); \
394 tmp<DimensionedField<ReturnType, GeoMesh>> Func \
396 const tmp<DimensionedField<Type1, GeoMesh>>& tdf1, \
400 return Func(tdf1, dimensioned<Type2>(t2)); \
404 #define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func) \
405 BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
406 BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)
411 #define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
414 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
416 const DimensionedField<Type1, GeoMesh>& df1, \
417 const DimensionedField<Type2, GeoMesh>& df2 \
420 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
422 DimensionedField<ReturnType, GeoMesh>::New \
424 '(' + df1.name() + OpName + df2.name() + ')', \
426 df1.dimensions() Op df2.dimensions() \
432 tRes.ref().primitiveFieldRef(), \
433 df1.primitiveField(), \
434 df2.primitiveField() \
441 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
443 const DimensionedField<Type1, GeoMesh>& df1, \
444 const tmp<DimensionedField<Type2, GeoMesh>>& tdf2 \
447 const DimensionedField<Type2, GeoMesh>& df2 = tdf2(); \
449 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
451 reuseTmpDimensionedField<ReturnType, Type2, GeoMesh>::New \
454 '(' + df1.name() + OpName + df2.name() + ')', \
455 df1.dimensions() Op df2.dimensions() \
461 tRes.ref().primitiveFieldRef(), \
462 df1.primitiveField(), \
463 df2.primitiveField() \
472 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
474 const tmp<DimensionedField<Type1, GeoMesh>>& tdf1, \
475 const DimensionedField<Type2, GeoMesh>& df2 \
478 const DimensionedField<Type1, GeoMesh>& df1 = tdf1(); \
480 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
482 reuseTmpDimensionedField<ReturnType, Type1, GeoMesh>::New \
485 '(' + df1.name() + OpName + df2.name() + ')', \
486 df1.dimensions() Op df2.dimensions() \
492 tRes.ref().primitiveFieldRef(), \
493 df1.primitiveField(), \
494 df2.primitiveField() \
503 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
505 const tmp<DimensionedField<Type1, GeoMesh>>& tdf1, \
506 const tmp<DimensionedField<Type2, GeoMesh>>& tdf2 \
509 const DimensionedField<Type1, GeoMesh>& df1 = tdf1(); \
510 const DimensionedField<Type2, GeoMesh>& df2 = tdf2(); \
512 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
514 reuseTmpTmpDimensionedField<ReturnType, Type1, Type2, GeoMesh>::New \
518 '(' + df1.name() + OpName + df2.name() + ')', \
519 df1.dimensions() Op df2.dimensions() \
525 tRes.ref().primitiveFieldRef(), \
526 df1.primitiveField(), \
527 df2.primitiveField() \
539 #define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
542 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
544 const dimensioned<Type1>& dt1, \
545 const DimensionedField<Type2, GeoMesh>& df2 \
548 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
550 DimensionedField<ReturnType, GeoMesh>::New \
552 '(' + dt1.name() + OpName + df2.name() + ')', \
554 dt1.dimensions() Op df2.dimensions() \
560 tRes.ref().primitiveFieldRef(), \
562 df2.primitiveField() \
569 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
572 const DimensionedField<Type2, GeoMesh>& df2 \
575 return dimensioned<Type1>(t1) Op df2; \
580 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
582 const dimensioned<Type1>& dt1, \
583 const tmp<DimensionedField<Type2, GeoMesh>>& tdf2 \
586 const DimensionedField<Type2, GeoMesh>& df2 = tdf2(); \
588 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
590 reuseTmpDimensionedField<ReturnType, Type2, GeoMesh>::New \
593 '(' + dt1.name() + OpName + df2.name() + ')', \
594 dt1.dimensions() Op df2.dimensions() \
600 tRes.ref().primitiveFieldRef(), \
602 tdf2().primitiveField() \
611 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
614 const tmp<DimensionedField<Type2, GeoMesh>>& tdf2 \
617 return dimensioned<Type1>(t1) Op tdf2; \
621 #define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
624 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
626 const DimensionedField<Type1, GeoMesh>& df1, \
627 const dimensioned<Type2>& dt2 \
630 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
632 DimensionedField<ReturnType, GeoMesh>::New \
634 '(' + df1.name() + OpName + dt2.name() + ')', \
636 df1.dimensions() Op dt2.dimensions() \
642 tRes.ref().primitiveFieldRef(), \
643 df1.primitiveField(), \
651 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
653 const DimensionedField<Type1, GeoMesh>& df1, \
657 return df1 Op dimensioned<Type2>(t2); \
662 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
664 const tmp<DimensionedField<Type1, GeoMesh>>& tdf1, \
665 const dimensioned<Type2>& dt2 \
668 const DimensionedField<Type1, GeoMesh>& df1 = tdf1(); \
670 tmp<DimensionedField<ReturnType, GeoMesh>> tRes \
672 reuseTmpDimensionedField<ReturnType, Type1, GeoMesh>::New \
675 '(' + df1.name() + OpName + dt2.name() + ')', \
676 df1.dimensions() Op dt2.dimensions() \
682 tRes.ref().primitiveFieldRef(), \
683 tdf1().primitiveField(), \
693 tmp<DimensionedField<ReturnType, GeoMesh>> operator Op \
695 const tmp<DimensionedField<Type1, GeoMesh>>& tdf1, \
699 return tdf1 Op dimensioned<Type2>(t2); \
702 #define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
703 BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
704 BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)