00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "GeometricFieldReuseFunctions.H"
00028
00029
00030
00031 namespace Foam
00032 {
00033
00034
00035
00036 #define UNARY_FUNCTION(ReturnType, Type1, Func, Dfunc) \
00037 \
00038 TEMPLATE \
00039 void Func \
00040 ( \
00041 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
00042 const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
00043 ) \
00044 { \
00045 Foam::Func(res.internalField(), gf1.internalField()); \
00046 Foam::Func(res.boundaryField(), gf1.boundaryField()); \
00047 } \
00048 \
00049 TEMPLATE \
00050 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00051 ( \
00052 const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
00053 ) \
00054 { \
00055 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00056 ( \
00057 new GeometricField<ReturnType, PatchField, GeoMesh> \
00058 ( \
00059 IOobject \
00060 ( \
00061 #Func "(" + gf1.name() + ')', \
00062 gf1.instance(), \
00063 gf1.db(), \
00064 IOobject::NO_READ, \
00065 IOobject::NO_WRITE \
00066 ), \
00067 gf1.mesh(), \
00068 Dfunc(gf1.dimensions()) \
00069 ) \
00070 ); \
00071 \
00072 Foam::Func(tRes(), gf1); \
00073 \
00074 return tRes; \
00075 } \
00076 \
00077 TEMPLATE \
00078 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00079 ( \
00080 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1 \
00081 ) \
00082 { \
00083 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
00084 \
00085 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00086 ( \
00087 reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
00088 ( \
00089 tgf1, \
00090 #Func "(" + gf1.name() + ')', \
00091 Dfunc(gf1.dimensions()) \
00092 ) \
00093 ); \
00094 \
00095 Foam::Func(tRes(), gf1); \
00096 \
00097 reuseTmpGeometricField \
00098 <ReturnType, Type1, PatchField, GeoMesh>::clear(tgf1); \
00099 \
00100 return tRes; \
00101 }
00102
00103
00104
00105
00106 #define UNARY_OPERATOR(ReturnType, Type1, Op, OpFunc, Dfunc) \
00107 \
00108 TEMPLATE \
00109 void OpFunc \
00110 ( \
00111 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
00112 const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
00113 ) \
00114 { \
00115 Foam::OpFunc(res.internalField(), gf1.internalField()); \
00116 Foam::OpFunc(res.boundaryField(), gf1.boundaryField()); \
00117 } \
00118 \
00119 TEMPLATE \
00120 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00121 ( \
00122 const GeometricField<Type1, PatchField, GeoMesh>& gf1 \
00123 ) \
00124 { \
00125 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00126 ( \
00127 new GeometricField<ReturnType, PatchField, GeoMesh> \
00128 ( \
00129 IOobject \
00130 ( \
00131 #Op + gf1.name(), \
00132 gf1.instance(), \
00133 gf1.db(), \
00134 IOobject::NO_READ, \
00135 IOobject::NO_WRITE \
00136 ), \
00137 gf1.mesh(), \
00138 Dfunc(gf1.dimensions()) \
00139 ) \
00140 ); \
00141 \
00142 Foam::OpFunc(tRes(), gf1); \
00143 \
00144 return tRes; \
00145 } \
00146 \
00147 TEMPLATE \
00148 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00149 ( \
00150 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1 \
00151 ) \
00152 { \
00153 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
00154 \
00155 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00156 ( \
00157 reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
00158 ( \
00159 tgf1, \
00160 #Op + gf1.name(), \
00161 Dfunc(gf1.dimensions()) \
00162 ) \
00163 ); \
00164 \
00165 Foam::OpFunc(tRes(), gf1); \
00166 \
00167 reuseTmpGeometricField \
00168 <ReturnType, Type1, PatchField, GeoMesh>::clear(tgf1); \
00169 \
00170 return tRes; \
00171 }
00172
00173
00174
00175
00176 #define BINARY_FUNCTION(ReturnType, Type1, Type2, Func) \
00177 \
00178 TEMPLATE \
00179 void Func \
00180 ( \
00181 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
00182 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
00183 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
00184 ) \
00185 { \
00186 Foam::Func(res.internalField(), gf1.internalField(), gf2.internalField());\
00187 Foam::Func(res.boundaryField(), gf1.boundaryField(), gf2.boundaryField());\
00188 } \
00189 \
00190 TEMPLATE \
00191 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00192 ( \
00193 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
00194 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
00195 ) \
00196 { \
00197 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00198 ( \
00199 new GeometricField<ReturnType, PatchField, GeoMesh> \
00200 ( \
00201 IOobject \
00202 ( \
00203 #Func "(" + gf1.name() + ',' + gf2.name() + ')', \
00204 gf1.instance(), \
00205 gf1.db(), \
00206 IOobject::NO_READ, \
00207 IOobject::NO_WRITE \
00208 ), \
00209 gf1.mesh(), \
00210 Func(gf1.dimensions(), gf2.dimensions()) \
00211 ) \
00212 ); \
00213 \
00214 Foam::Func(tRes(), gf1, gf2); \
00215 \
00216 return tRes; \
00217 } \
00218 \
00219 TEMPLATE \
00220 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00221 ( \
00222 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
00223 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tgf2 \
00224 ) \
00225 { \
00226 const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
00227 \
00228 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00229 ( \
00230 reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
00231 ( \
00232 tgf2, \
00233 #Func "(" + gf1.name() + ',' + gf2.name() + ')', \
00234 Func(gf1.dimensions(), gf2.dimensions()) \
00235 ) \
00236 ); \
00237 \
00238 Foam::Func(tRes(), gf1, gf2); \
00239 \
00240 reuseTmpGeometricField \
00241 <ReturnType, Type2, PatchField, GeoMesh>::clear(tgf2); \
00242 \
00243 return tRes; \
00244 } \
00245 \
00246 TEMPLATE \
00247 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00248 ( \
00249 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1, \
00250 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
00251 ) \
00252 { \
00253 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
00254 \
00255 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00256 ( \
00257 reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
00258 ( \
00259 tgf1, \
00260 #Func "(" + gf1.name() + ',' + gf2.name() + ')', \
00261 Func(gf1.dimensions(), gf2.dimensions()) \
00262 ) \
00263 ); \
00264 \
00265 Foam::Func(tRes(), gf1, gf2); \
00266 \
00267 reuseTmpGeometricField \
00268 <ReturnType, Type1, PatchField, GeoMesh>::clear(tgf1); \
00269 \
00270 return tRes; \
00271 } \
00272 \
00273 TEMPLATE \
00274 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00275 ( \
00276 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1, \
00277 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tgf2 \
00278 ) \
00279 { \
00280 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
00281 const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
00282 \
00283 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00284 ( \
00285 reuseTmpTmpGeometricField \
00286 <ReturnType, Type1, Type1, Type2, PatchField, GeoMesh> \
00287 ::New \
00288 ( \
00289 tgf1, \
00290 tgf2, \
00291 #Func "(" + gf1.name() + ',' + gf2.name() + ')', \
00292 Func(gf1.dimensions(), gf2.dimensions()) \
00293 ) \
00294 ); \
00295 \
00296 Foam::Func(tRes(), gf1, gf2); \
00297 \
00298 reuseTmpTmpGeometricField \
00299 <ReturnType, Type1, Type1, Type2, PatchField, GeoMesh> \
00300 ::clear(tgf1, tgf2); \
00301 \
00302 return tRes; \
00303 }
00304
00305
00306
00307 #define BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
00308 \
00309 TEMPLATE \
00310 void Func \
00311 ( \
00312 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
00313 const dimensioned<Type1>& dt1, \
00314 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
00315 ) \
00316 { \
00317 Foam::Func(res.internalField(), dt1.value(), gf2.internalField()); \
00318 Foam::Func(res.boundaryField(), dt1.value(), gf2.boundaryField()); \
00319 } \
00320 \
00321 TEMPLATE \
00322 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00323 ( \
00324 const dimensioned<Type1>& dt1, \
00325 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
00326 ) \
00327 { \
00328 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00329 ( \
00330 new GeometricField<ReturnType, PatchField, GeoMesh> \
00331 ( \
00332 IOobject \
00333 ( \
00334 #Func "(" + dt1.name() + ',' + gf2.name() + ')', \
00335 gf2.instance(), \
00336 gf2.db(), \
00337 IOobject::NO_READ, \
00338 IOobject::NO_WRITE \
00339 ), \
00340 gf2.mesh(), \
00341 Func(dt1.dimensions(), gf2.dimensions()) \
00342 ) \
00343 ); \
00344 \
00345 Foam::Func(tRes(), dt1, gf2); \
00346 \
00347 return tRes; \
00348 } \
00349 \
00350 TEMPLATE \
00351 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00352 ( \
00353 const Type1& t1, \
00354 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
00355 ) \
00356 { \
00357 return Func(dimensioned<Type1>(t1), gf2); \
00358 } \
00359 \
00360 \
00361 TEMPLATE \
00362 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00363 ( \
00364 const dimensioned<Type1>& dt1, \
00365 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tgf2 \
00366 ) \
00367 { \
00368 const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
00369 \
00370 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00371 ( \
00372 reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
00373 ( \
00374 tgf2, \
00375 #Func "(" + dt1.name() + gf2.name() + ',' + ')', \
00376 Func(dt1.dimensions(), gf2.dimensions()) \
00377 ) \
00378 ); \
00379 \
00380 Foam::Func(tRes(), dt1, gf2); \
00381 \
00382 reuseTmpGeometricField \
00383 <ReturnType, Type2, PatchField, GeoMesh>::clear(tgf2); \
00384 \
00385 return tRes; \
00386 } \
00387 \
00388 TEMPLATE \
00389 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00390 ( \
00391 const Type1& t1, \
00392 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tgf2 \
00393 ) \
00394 { \
00395 return Func(dimensioned<Type1>(t1), tgf2); \
00396 }
00397
00398
00399 #define BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func) \
00400 \
00401 TEMPLATE \
00402 void Func \
00403 ( \
00404 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
00405 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
00406 const dimensioned<Type2>& dt2 \
00407 ) \
00408 { \
00409 Foam::Func(res.internalField(), gf1.internalField(), dt2.value()); \
00410 Foam::Func(res.boundaryField(), gf1.boundaryField(), dt2.value()); \
00411 } \
00412 \
00413 TEMPLATE \
00414 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00415 ( \
00416 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
00417 const dimensioned<Type2>& dt2 \
00418 ) \
00419 { \
00420 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00421 ( \
00422 new GeometricField<ReturnType, PatchField, GeoMesh> \
00423 ( \
00424 IOobject \
00425 ( \
00426 #Func "(" + gf1.name() + ',' + dt2.name() + ')', \
00427 gf1.instance(), \
00428 gf1.db(), \
00429 IOobject::NO_READ, \
00430 IOobject::NO_WRITE \
00431 ), \
00432 gf1.mesh(), \
00433 Func(gf1.dimensions(), dt2.dimensions()) \
00434 ) \
00435 ); \
00436 \
00437 Foam::Func(tRes(), gf1, dt2); \
00438 \
00439 return tRes; \
00440 } \
00441 \
00442 TEMPLATE \
00443 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00444 ( \
00445 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
00446 const Type2& t2 \
00447 ) \
00448 { \
00449 return Func(gf1, dimensioned<Type2>(t2)); \
00450 } \
00451 \
00452 \
00453 TEMPLATE \
00454 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00455 ( \
00456 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1, \
00457 const dimensioned<Type2>& dt2 \
00458 ) \
00459 { \
00460 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
00461 \
00462 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00463 ( \
00464 reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
00465 ( \
00466 tgf1, \
00467 #Func "(" + gf1.name() + ',' + dt2.name() + ')', \
00468 Func(gf1.dimensions(), dt2.dimensions()) \
00469 ) \
00470 ); \
00471 \
00472 Foam::Func(tRes(), gf1, dt2); \
00473 \
00474 reuseTmpGeometricField \
00475 <ReturnType, Type1, PatchField, GeoMesh>::clear(tgf1); \
00476 \
00477 return tRes; \
00478 } \
00479 \
00480 TEMPLATE \
00481 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > Func \
00482 ( \
00483 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1, \
00484 const Type2& t2 \
00485 ) \
00486 { \
00487 return Func(tgf1, dimensioned<Type2>(t2)); \
00488 }
00489
00490
00491 #define BINARY_TYPE_FUNCTION(ReturnType, Type1, Type2, Func) \
00492 BINARY_TYPE_FUNCTION_SF(ReturnType, Type1, Type2, Func) \
00493 BINARY_TYPE_FUNCTION_FS(ReturnType, Type1, Type2, Func)
00494
00495
00496
00497
00498 #define BINARY_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
00499 \
00500 TEMPLATE \
00501 void OpFunc \
00502 ( \
00503 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
00504 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
00505 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
00506 ) \
00507 { \
00508 Foam::OpFunc \
00509 (res.internalField(), gf1.internalField(), gf2.internalField()); \
00510 Foam::OpFunc \
00511 (res.boundaryField(), gf1.boundaryField(), gf2.boundaryField()); \
00512 } \
00513 \
00514 TEMPLATE \
00515 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00516 ( \
00517 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
00518 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
00519 ) \
00520 { \
00521 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00522 ( \
00523 new GeometricField<ReturnType, PatchField, GeoMesh> \
00524 ( \
00525 IOobject \
00526 ( \
00527 '(' + gf1.name() + OpName + gf2.name() + ')', \
00528 gf1.instance(), \
00529 gf1.db(), \
00530 IOobject::NO_READ, \
00531 IOobject::NO_WRITE \
00532 ), \
00533 gf1.mesh(), \
00534 gf1.dimensions() Op gf2.dimensions() \
00535 ) \
00536 ); \
00537 \
00538 Foam::OpFunc(tRes(), gf1, gf2); \
00539 \
00540 return tRes; \
00541 } \
00542 \
00543 TEMPLATE \
00544 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00545 ( \
00546 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
00547 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tgf2 \
00548 ) \
00549 { \
00550 const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
00551 \
00552 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00553 ( \
00554 reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
00555 ( \
00556 tgf2, \
00557 '(' + gf1.name() + OpName + gf2.name() + ')', \
00558 gf1.dimensions() Op gf2.dimensions() \
00559 ) \
00560 ); \
00561 \
00562 Foam::OpFunc(tRes(), gf1, gf2); \
00563 \
00564 reuseTmpGeometricField \
00565 <ReturnType, Type2, PatchField, GeoMesh>::clear(tgf2); \
00566 \
00567 return tRes; \
00568 } \
00569 \
00570 TEMPLATE \
00571 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00572 ( \
00573 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1, \
00574 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
00575 ) \
00576 { \
00577 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
00578 \
00579 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00580 ( \
00581 reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
00582 ( \
00583 tgf1, \
00584 '(' + gf1.name() + OpName + gf2.name() + ')', \
00585 gf1.dimensions() Op gf2.dimensions() \
00586 ) \
00587 ); \
00588 \
00589 Foam::OpFunc(tRes(), gf1, gf2); \
00590 \
00591 reuseTmpGeometricField \
00592 <ReturnType, Type1, PatchField, GeoMesh>::clear(tgf1); \
00593 \
00594 return tRes; \
00595 } \
00596 \
00597 TEMPLATE \
00598 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00599 ( \
00600 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1, \
00601 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tgf2 \
00602 ) \
00603 { \
00604 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
00605 const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
00606 \
00607 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00608 ( \
00609 reuseTmpTmpGeometricField \
00610 <ReturnType, Type1, Type1, Type2, PatchField, GeoMesh>::New \
00611 ( \
00612 tgf1, \
00613 tgf2, \
00614 '(' + gf1.name() + OpName + gf2.name() + ')', \
00615 gf1.dimensions() Op gf2.dimensions() \
00616 ) \
00617 ); \
00618 \
00619 Foam::OpFunc(tRes(), gf1, gf2); \
00620 \
00621 reuseTmpTmpGeometricField \
00622 <ReturnType, Type1, Type1, Type2, PatchField, GeoMesh> \
00623 ::clear(tgf1, tgf2); \
00624 \
00625 return tRes; \
00626 }
00627
00628
00629
00630
00631 #define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
00632 \
00633 TEMPLATE \
00634 void OpFunc \
00635 ( \
00636 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
00637 const dimensioned<Type1>& dt1, \
00638 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
00639 ) \
00640 { \
00641 Foam::OpFunc(res.internalField(), dt1.value(), gf2.internalField()); \
00642 Foam::OpFunc(res.boundaryField(), dt1.value(), gf2.boundaryField()); \
00643 } \
00644 \
00645 TEMPLATE \
00646 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00647 ( \
00648 const dimensioned<Type1>& dt1, \
00649 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
00650 ) \
00651 { \
00652 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00653 ( \
00654 new GeometricField<ReturnType, PatchField, GeoMesh> \
00655 ( \
00656 IOobject \
00657 ( \
00658 '(' + dt1.name() + OpName + gf2.name() + ')', \
00659 gf2.instance(), \
00660 gf2.db(), \
00661 IOobject::NO_READ, \
00662 IOobject::NO_WRITE \
00663 ), \
00664 gf2.mesh(), \
00665 dt1.dimensions() Op gf2.dimensions() \
00666 ) \
00667 ); \
00668 \
00669 Foam::OpFunc(tRes(), dt1, gf2); \
00670 \
00671 return tRes; \
00672 } \
00673 \
00674 TEMPLATE \
00675 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00676 ( \
00677 const Type1& t1, \
00678 const GeometricField<Type2, PatchField, GeoMesh>& gf2 \
00679 ) \
00680 { \
00681 return dimensioned<Type1>(t1) Op gf2; \
00682 } \
00683 \
00684 \
00685 TEMPLATE \
00686 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00687 ( \
00688 const dimensioned<Type1>& dt1, \
00689 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tgf2 \
00690 ) \
00691 { \
00692 const GeometricField<Type2, PatchField, GeoMesh>& gf2 = tgf2(); \
00693 \
00694 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00695 ( \
00696 reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh>::New \
00697 ( \
00698 tgf2, \
00699 '(' + dt1.name() + OpName + gf2.name() + ')', \
00700 dt1.dimensions() Op gf2.dimensions() \
00701 ) \
00702 ); \
00703 \
00704 Foam::OpFunc(tRes(), dt1, gf2); \
00705 \
00706 reuseTmpGeometricField<ReturnType, Type2, PatchField, GeoMesh> \
00707 ::clear(tgf2); \
00708 \
00709 return tRes; \
00710 } \
00711 \
00712 TEMPLATE \
00713 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00714 ( \
00715 const Type1& t1, \
00716 const tmp<GeometricField<Type2, PatchField, GeoMesh> >& tgf2 \
00717 ) \
00718 { \
00719 return dimensioned<Type1>(t1) Op tgf2; \
00720 }
00721
00722
00723 #define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
00724 \
00725 TEMPLATE \
00726 void OpFunc \
00727 ( \
00728 GeometricField<ReturnType, PatchField, GeoMesh>& res, \
00729 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
00730 const dimensioned<Type2>& dt2 \
00731 ) \
00732 { \
00733 Foam::OpFunc(res.internalField(), gf1.internalField(), dt2.value()); \
00734 Foam::OpFunc(res.boundaryField(), gf1.boundaryField(), dt2.value()); \
00735 } \
00736 \
00737 TEMPLATE \
00738 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00739 ( \
00740 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
00741 const dimensioned<Type2>& dt2 \
00742 ) \
00743 { \
00744 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00745 ( \
00746 new GeometricField<ReturnType, PatchField, GeoMesh> \
00747 ( \
00748 IOobject \
00749 ( \
00750 '(' + gf1.name() + OpName + dt2.name() + ')', \
00751 gf1.instance(), \
00752 gf1.db(), \
00753 IOobject::NO_READ, \
00754 IOobject::NO_WRITE \
00755 ), \
00756 gf1.mesh(), \
00757 gf1.dimensions() Op dt2.dimensions() \
00758 ) \
00759 ); \
00760 \
00761 Foam::OpFunc(tRes(), gf1, dt2); \
00762 \
00763 return tRes; \
00764 } \
00765 \
00766 TEMPLATE \
00767 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00768 ( \
00769 const GeometricField<Type1, PatchField, GeoMesh>& gf1, \
00770 const Type2& t2 \
00771 ) \
00772 { \
00773 return gf1 Op dimensioned<Type2>(t2); \
00774 } \
00775 \
00776 \
00777 TEMPLATE \
00778 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00779 ( \
00780 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1, \
00781 const dimensioned<Type2>& dt2 \
00782 ) \
00783 { \
00784 const GeometricField<Type1, PatchField, GeoMesh>& gf1 = tgf1(); \
00785 \
00786 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > tRes \
00787 ( \
00788 reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh>::New \
00789 ( \
00790 tgf1, \
00791 '(' + gf1.name() + OpName + dt2.name() + ')', \
00792 gf1.dimensions() Op dt2.dimensions() \
00793 ) \
00794 ); \
00795 \
00796 Foam::OpFunc(tRes(), gf1, dt2); \
00797 \
00798 reuseTmpGeometricField<ReturnType, Type1, PatchField, GeoMesh> \
00799 ::clear(tgf1); \
00800 \
00801 return tRes; \
00802 } \
00803 \
00804 TEMPLATE \
00805 tmp<GeometricField<ReturnType, PatchField, GeoMesh> > operator Op \
00806 ( \
00807 const tmp<GeometricField<Type1, PatchField, GeoMesh> >& tgf1, \
00808 const Type2& t2 \
00809 ) \
00810 { \
00811 return tgf1 Op dimensioned<Type2>(t2); \
00812 }
00813
00814
00815 #define BINARY_TYPE_OPERATOR(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
00816 BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \
00817 BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc)
00818
00819
00820
00821
00822 }
00823
00824