35 #define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc) \
40 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
41 const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
44 Foam::Func(res.primitiveFieldRef(), gf1.primitiveField()); \
45 Foam::Func(res.boundaryFieldRef(), gf1.boundaryField()); \
49 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
51 const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
54 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
56 GeometricField<ReturnType, PatchField, GeoMesh>::New \
58 #Func "(" + gf1.name() + ')', \
60 Dfunc(gf1.dimensions()) \
64 Foam::Func(tRes.ref(), gf1); \
70 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
72 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1 \
75 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
77 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
79 reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
82 #Func "(" + gf1.name() + ')', \
83 Dfunc(gf1.dimensions()) \
87 Foam::Func(tRes.ref(), gf1); \
97 #define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc) \
102 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
103 const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
106 Foam::OpFunc(res.primitiveFieldRef(), gf1.primitiveField()); \
107 Foam::OpFunc(res.boundaryFieldRef(), gf1.boundaryField()); \
111 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
113 const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
116 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
118 GeometricField<ReturnType, PatchField, GeoMesh>::New \
122 Dfunc(gf1.dimensions()) \
126 Foam::OpFunc(tRes.ref(), gf1); \
132 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
134 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1 \
137 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
139 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
141 reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
145 Dfunc(gf1.dimensions()) \
149 Foam::OpFunc(tRes.ref(), gf1); \
159 #define BINARY_FUNCTION(ReturnType, Type1, Type2, Func) \
164 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
165 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
166 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
171 res.primitiveFieldRef(), \
172 gf1.primitiveField(), \
173 gf2.primitiveField() \
177 res.boundaryFieldRef(), \
178 gf1.boundaryField(), \
179 gf2.boundaryField() \
184 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
186 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
187 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
190 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
192 GeometricField<ReturnType, PatchField, GeoMesh>::New \
194 #Func "(" + gf1.name() + ',' + gf2.name() + ')', \
196 Func(gf1.dimensions(), gf2.dimensions()) \
200 Foam::Func(tRes.ref(), gf1, gf2); \
206 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
208 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
209 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
212 const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
214 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
216 reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
219 #Func "(" + gf1.name() + ',' + gf2.name() + ')', \
220 Func(gf1.dimensions(), gf2.dimensions()) \
224 Foam::Func(tRes.ref(), gf1, gf2); \
232 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
234 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
235 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
238 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
240 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
242 reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
245 #Func "(" + gf1.name() + ',' + gf2.name() + ')', \
246 Func(gf1.dimensions(), gf2.dimensions()) \
250 Foam::Func(tRes.ref(), gf1, gf2); \
258 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
260 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
261 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
264 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
265 const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
267 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
269 reuseTmpTmpGeometricField \
270 <ReturnType, Type1, Type2, PatchField, GeoMesh>::New \
274 #Func "(" + gf1.name() + ',' + gf2.name() + ')', \
275 Func(gf1.dimensions(), gf2.dimensions()) \
279 Foam::Func(tRes.ref(), gf1, gf2); \
289 #define BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
294 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
295 const dimensioned<Type1>& dt1, \
296 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
299 Foam::Func(res.primitiveFieldRef(), dt1.value(), gf2.primitiveField()); \
300 Foam::Func(res.boundaryFieldRef(), dt1.value(), gf2.boundaryField()); \
304 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
306 const dimensioned<Type1>& dt1, \
307 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
310 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
312 GeometricField<ReturnType, PatchField, GeoMesh>::New \
314 #Func "(" + dt1.name() + ',' + gf2.name() + ')', \
316 Func(dt1.dimensions(), gf2.dimensions()) \
320 Foam::Func(tRes.ref(), dt1, gf2); \
326 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
329 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
332 return Func(dimensioned<Type1>(t1), gf2); \
337 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
339 const dimensioned<Type1>& dt1, \
340 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
343 const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
345 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
347 reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
350 #Func "(" + dt1.name() + gf2.name() + ',' + ')', \
351 Func(dt1.dimensions(), gf2.dimensions()) \
355 Foam::Func(tRes.ref(), dt1, gf2); \
363 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
366 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
369 return Func(dimensioned<Type1>(t1), tgf2); \
373 #define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func) \
378 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
379 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
380 const dimensioned<Type2>& dt2 \
383 Foam::Func(res.primitiveFieldRef(), gf1.primitiveField(), dt2.value()); \
384 Foam::Func(res.boundaryFieldRef(), gf1.boundaryField(), dt2.value()); \
388 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
390 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
391 const dimensioned<Type2>& dt2 \
394 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
396 GeometricField<ReturnType, PatchField, GeoMesh>::New \
398 #Func "(" + gf1.name() + ',' + dt2.name() + ')', \
400 Func(gf1.dimensions(), dt2.dimensions()) \
404 Foam::Func(tRes.ref(), gf1, dt2); \
410 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
412 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
416 return Func(gf1, dimensioned<Type2>(t2)); \
421 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
423 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
424 const dimensioned<Type2>& dt2 \
427 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
429 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
431 reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
434 #Func "(" + gf1.name() + ',' + dt2.name() + ')', \
435 Func(gf1.dimensions(), dt2.dimensions()) \
439 Foam::Func(tRes.ref(), gf1, dt2); \
447 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> Func \
449 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
453 return Func(tgf1, dimensioned<Type2>(t2)); \
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)
464 #define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
469 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
470 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
471 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
475 (res.primitiveFieldRef(), gf1.primitiveField(), gf2.primitiveField()); \
477 (res.boundaryFieldRef(), gf1.boundaryField(), gf2.boundaryField()); \
481 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
483 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
484 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
487 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
489 GeometricField<ReturnType, PatchField, GeoMesh>::New \
491 '(' + gf1.name() + OpName + gf2.name() + ')', \
493 gf1.dimensions() Op gf2.dimensions() \
497 Foam::OpFunc(tRes.ref(), gf1, gf2); \
503 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
505 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
506 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
509 const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
511 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
513 reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
516 '(' + gf1.name() + OpName + gf2.name() + ')', \
517 gf1.dimensions() Op gf2.dimensions() \
521 Foam::OpFunc(tRes.ref(), gf1, gf2); \
529 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
531 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
532 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
535 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
537 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
539 reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
542 '(' + gf1.name() + OpName + gf2.name() + ')', \
543 gf1.dimensions() Op gf2.dimensions() \
547 Foam::OpFunc(tRes.ref(), gf1, gf2); \
555 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
557 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
558 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
561 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
562 const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
564 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
566 reuseTmpTmpGeometricField \
567 <ReturnType, Type1, Type2, PatchField, GeoMesh>::New \
571 '(' + gf1.name() + OpName + gf2.name() + ')', \
572 gf1.dimensions() Op gf2.dimensions() \
576 Foam::OpFunc(tRes.ref(), gf1, gf2); \
587 #define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
592 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
593 const dimensioned<Type1>& dt1, \
594 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
597 Foam::OpFunc(res.primitiveFieldRef(), dt1.value(), gf2.primitiveField()); \
598 Foam::OpFunc(res.boundaryFieldRef(), dt1.value(), gf2.boundaryField()); \
602 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
604 const dimensioned<Type1>& dt1, \
605 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
608 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
610 GeometricField<ReturnType, PatchField, GeoMesh>::New \
612 '(' + dt1.name() + OpName + gf2.name() + ')', \
614 dt1.dimensions() Op gf2.dimensions() \
618 Foam::OpFunc(tRes.ref(), dt1, gf2); \
624 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
627 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
630 return dimensioned<Type1>(t1) Op gf2; \
635 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
637 const dimensioned<Type1>& dt1, \
638 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
641 const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
643 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
645 reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
648 '(' + dt1.name() + OpName + gf2.name() + ')', \
649 dt1.dimensions() Op gf2.dimensions() \
653 Foam::OpFunc(tRes.ref(), dt1, gf2); \
661 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
664 const tmp<GeometricField<Type2, PatchField, GeoMesh>>& tgf2 \
667 return dimensioned<Type1>(t1) Op tgf2; \
671 #define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
676 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
677 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
678 const dimensioned<Type2>& dt2 \
681 Foam::OpFunc(res.primitiveFieldRef(), gf1.primitiveField(), dt2.value()); \
682 Foam::OpFunc(res.boundaryFieldRef(), gf1.boundaryField(), dt2.value()); \
686 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
688 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
689 const dimensioned<Type2>& dt2 \
692 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
694 GeometricField<ReturnType, PatchField, GeoMesh>::New \
696 '(' + gf1.name() + OpName + dt2.name() + ')', \
698 gf1.dimensions() Op dt2.dimensions() \
702 Foam::OpFunc(tRes.ref(), gf1, dt2); \
708 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
710 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
714 return gf1 Op dimensioned<Type2>(t2); \
719 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
721 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
722 const dimensioned<Type2>& dt2 \
725 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
727 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> tRes \
729 reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
732 '(' + gf1.name() + OpName + dt2.name() + ')', \
733 gf1.dimensions() Op dt2.dimensions() \
737 Foam::OpFunc(tRes.ref(), gf1, dt2); \
745 tmp<GeometricField<ReturnType, PatchField, GeoMesh>> operator Op \
747 const tmp<GeometricField<Type1, PatchField, GeoMesh>>& tgf1, \
751 return tgf1 Op dimensioned<Type2>(t2); \
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)