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 "errorEstimate.H"
00028 #include "zeroGradientFvPatchField.H"
00029 #include "fixedValueFvPatchField.H"
00030
00031
00032
00033
00034
00035
00036 template<class Type>
00037 Foam::wordList Foam::errorEstimate<Type>::errorBCTypes() const
00038 {
00039
00040
00041 wordList ebct
00042 (
00043 psi_.boundaryField().size(),
00044 zeroGradientFvPatchField<Type>::typeName
00045 );
00046
00047 forAll (psi_.boundaryField(), patchI)
00048 {
00049 if (psi_.boundaryField()[patchI].fixesValue())
00050 {
00051 ebct[patchI] = fixedValueFvPatchField<Type>::typeName;
00052 }
00053 }
00054
00055 return ebct;
00056 }
00057
00058
00059
00060
00061
00062 template<class Type>
00063 Foam::errorEstimate<Type>::errorEstimate
00064 (
00065 const GeometricField<Type, fvPatchField, volMesh>& psi,
00066 const dimensionSet& ds,
00067 const Field<Type>& res,
00068 const scalarField& norm
00069 )
00070 :
00071 psi_(psi),
00072 dimensions_(ds),
00073 residual_(res),
00074 normFactor_(norm)
00075 {}
00076
00077
00078
00079 template<class Type>
00080 Foam::errorEstimate<Type>::errorEstimate(const Foam::errorEstimate<Type>& ee)
00081 :
00082 refCount(),
00083 psi_(ee.psi_),
00084 dimensions_(ee.dimensions_),
00085 residual_(ee.residual_),
00086 normFactor_(ee.normFactor_)
00087 {}
00088
00089
00090
00091
00092 template<class Type>
00093 Foam::errorEstimate<Type>::~errorEstimate()
00094 {}
00095
00096
00097
00098
00099 template<class Type>
00100 Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
00101 Foam::errorEstimate<Type>::residual() const
00102 {
00103 tmp<GeometricField<Type, fvPatchField, volMesh> > tres
00104 (
00105 new GeometricField<Type, fvPatchField, volMesh>
00106 (
00107 IOobject
00108 (
00109 "residual" + psi_.name(),
00110 psi_.mesh().time().timeName(),
00111 psi_.db(),
00112 IOobject::NO_READ,
00113 IOobject::NO_WRITE
00114 ),
00115 psi_.mesh(),
00116 psi_.dimensions()/dimTime,
00117 errorBCTypes()
00118 )
00119 );
00120
00121 GeometricField<Type, fvPatchField, volMesh>& res = tres();
00122
00123 res.internalField() = residual_;
00124 res.boundaryField() == pTraits<Type>::zero;
00125
00126 res.correctBoundaryConditions();
00127
00128 return tres;
00129 }
00130
00131
00132 template<class Type>
00133 Foam::tmp<Foam::volScalarField> Foam::errorEstimate<Type>::normFactor() const
00134 {
00135 tmp<volScalarField> tnormFactor
00136 (
00137 new volScalarField
00138 (
00139 IOobject
00140 (
00141 "normFactor" + psi_.name(),
00142 psi_.mesh().time().timeName(),
00143 psi_.db(),
00144 IOobject::NO_READ,
00145 IOobject::NO_WRITE
00146 ),
00147 psi_.mesh(),
00148 dimless/dimTime,
00149 errorBCTypes()
00150 )
00151 );
00152
00153 volScalarField& normFactor = tnormFactor();
00154
00155 normFactor.internalField() = normFactor_;
00156 normFactor.boundaryField() == pTraits<Type>::zero;
00157
00158 normFactor.correctBoundaryConditions();
00159
00160 return tnormFactor;
00161 }
00162
00163 template<class Type>
00164 Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
00165 Foam::errorEstimate<Type>::error() const
00166 {
00167 tmp<GeometricField<Type, fvPatchField, volMesh> > tresError
00168 (
00169 new GeometricField<Type, fvPatchField, volMesh>
00170 (
00171 IOobject
00172 (
00173 "resError" + psi_.name(),
00174 psi_.mesh().time().timeName(),
00175 psi_.db(),
00176 IOobject::NO_READ,
00177 IOobject::NO_WRITE
00178 ),
00179 psi_.mesh(),
00180 psi_.dimensions(),
00181 errorBCTypes()
00182 )
00183 );
00184
00185 GeometricField<Type, fvPatchField, volMesh>& resError = tresError();
00186
00187 resError.internalField() = residual_/normFactor_;
00188 resError.boundaryField() == pTraits<Type>::zero;
00189
00190 resError.correctBoundaryConditions();
00191
00192 return tresError;
00193 }
00194
00195
00196
00197 template<class Type>
00198 void Foam::errorEstimate<Type>::operator=(const Foam::errorEstimate<Type>& rhs)
00199 {
00200
00201 if (this == &rhs)
00202 {
00203 FatalErrorIn
00204 (
00205 "errorEstimate<Type>::operator=(const Foam::errorEstimate<Type>&)"
00206 ) << "Attempted assignment to self"
00207 << abort(FatalError);
00208 }
00209
00210 if (&psi_ != &(rhs.psi_))
00211 {
00212 FatalErrorIn
00213 (
00214 "errorEstimate<Type>::operator=(const errorEstimate<Type>&)"
00215 ) << "different fields"
00216 << abort(FatalError);
00217 }
00218
00219 residual_ = rhs.residual_;
00220 normFactor_ = rhs.normFactor_;
00221 }
00222
00223
00224 template<class Type>
00225 void Foam::errorEstimate<Type>::operator=(const tmp<errorEstimate<Type> >& teev)
00226 {
00227 operator=(teev());
00228 teev.clear();
00229 }
00230
00231
00232 template<class Type>
00233 void Foam::errorEstimate<Type>::negate()
00234 {
00235 residual_.negate();
00236 }
00237
00238
00239 template<class Type>
00240 void Foam::errorEstimate<Type>::operator+=(const errorEstimate<Type>& eev)
00241 {
00242 checkMethod(*this, eev, "+=");
00243
00244 dimensions_ += eev.dimensions_;
00245
00246 residual_ += eev.residual_;
00247 normFactor_ += eev.normFactor_;
00248 }
00249
00250
00251 template<class Type>
00252 void Foam::errorEstimate<Type>::operator+=
00253 (
00254 const tmp<errorEstimate<Type> >& teev
00255 )
00256 {
00257 operator+=(teev());
00258 teev.clear();
00259 }
00260
00261
00262 template<class Type>
00263 void Foam::errorEstimate<Type>::operator-=(const errorEstimate<Type>& eev)
00264 {
00265 checkMethod(*this, eev, "+=");
00266
00267 dimensions_ -= eev.dimensions_;
00268 residual_ -= eev.residual_;
00269 normFactor_ += eev.normFactor_;
00270 }
00271
00272
00273 template<class Type>
00274 void Foam::errorEstimate<Type>::operator-=(const tmp<errorEstimate<Type> >& teev)
00275 {
00276 operator-=(teev());
00277 teev.clear();
00278 }
00279
00280
00281 template<class Type>
00282 void Foam::errorEstimate<Type>::operator+=
00283 (
00284 const GeometricField<Type, fvPatchField, volMesh>& su
00285 )
00286 {
00287 checkMethod(*this, su, "+=");
00288 residual_ -= su.internalField();
00289 }
00290
00291
00292 template<class Type>
00293 void Foam::errorEstimate<Type>::operator+=
00294 (
00295 const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu
00296 )
00297 {
00298 operator+=(tsu());
00299 tsu.clear();
00300 }
00301
00302
00303 template<class Type>
00304 void Foam::errorEstimate<Type>::operator-=
00305 (
00306 const GeometricField<Type, fvPatchField, volMesh>& su
00307 )
00308 {
00309 checkMethod(*this, su, "-=");
00310 residual_ += su.internalField();
00311 }
00312
00313
00314 template<class Type>
00315 void Foam::errorEstimate<Type>::operator-=
00316 (
00317 const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu
00318 )
00319 {
00320 operator-=(tsu());
00321 tsu.clear();
00322 }
00323
00324
00325 template<class Type>
00326 void Foam::errorEstimate<Type>::operator+=
00327 (
00328 const dimensioned<Type>& su
00329 )
00330 {
00331 residual_ -= su;
00332 }
00333
00334
00335 template<class Type>
00336 void Foam::errorEstimate<Type>::operator-=
00337 (
00338 const dimensioned<Type>& su
00339 )
00340 {
00341 residual_ += su;
00342 }
00343
00344
00345 template<class Type>
00346 void Foam::errorEstimate<Type>::operator*=
00347 (
00348 const volScalarField& vsf
00349 )
00350 {
00351 dimensions_ *= vsf.dimensions();
00352 residual_ *= vsf.internalField();
00353 normFactor_ *= vsf.internalField();
00354 }
00355
00356
00357 template<class Type>
00358 void Foam::errorEstimate<Type>::operator*=
00359 (
00360 const tmp<volScalarField>& tvsf
00361 )
00362 {
00363 operator*=(tvsf());
00364 tvsf.clear();
00365 }
00366
00367
00368 template<class Type>
00369 void Foam::errorEstimate<Type>::operator*=
00370 (
00371 const dimensioned<scalar>& ds
00372 )
00373 {
00374 dimensions_ *= ds.dimensions();
00375 residual_ *= ds.value();
00376 normFactor_ *= ds.value();
00377 }
00378
00379
00380
00381
00382 template<class Type>
00383 void Foam::checkMethod
00384 (
00385 const errorEstimate<Type>& ee1,
00386 const errorEstimate<Type>& ee2,
00387 const char* op
00388 )
00389 {
00390 if (&ee1.psi() != &ee2.psi())
00391 {
00392 FatalErrorIn
00393 (
00394 "checkMethod(const errorEstimate<Type>&, "
00395 "const errorEstimate<Type>&)"
00396 ) << "incompatible fields for operation "
00397 << endl << " "
00398 << "[" << ee1.psi().name() << "] "
00399 << op
00400 << " [" << ee2.psi().name() << "]"
00401 << abort(FatalError);
00402 }
00403
00404 if (dimensionSet::debug && ee1.dimensions() != ee2.dimensions())
00405 {
00406 FatalErrorIn
00407 (
00408 "checkMethod(const errorEstimate<Type>&, "
00409 "const errorEstimate<Type>&)"
00410 ) << "incompatible dimensions for operation "
00411 << endl << " "
00412 << "[" << ee1.psi().name() << ee1.dimensions()/dimVolume << " ] "
00413 << op
00414 << " [" << ee2.psi().name() << ee2.dimensions()/dimVolume << " ]"
00415 << abort(FatalError);
00416 }
00417 }
00418
00419
00420 template<class Type>
00421 void Foam::checkMethod
00422 (
00423 const errorEstimate<Type>& ee,
00424 const GeometricField<Type, fvPatchField, volMesh>& vf,
00425 const char* op
00426 )
00427 {
00428 if (dimensionSet::debug && ee.dimensions()/dimVolume != vf.dimensions())
00429 {
00430 FatalErrorIn
00431 (
00432 "checkMethod(const errorEstimate<Type>&, "
00433 "const GeometricField<Type, fvPatchField, volMesh>&)"
00434 ) << "incompatible dimensions for operation "
00435 << endl << " "
00436 << "[" << ee.psi().name() << ee.dimensions()/dimVolume << " ] "
00437 << op
00438 << " [" << vf.name() << vf.dimensions() << " ]"
00439 << abort(FatalError);
00440 }
00441 }
00442
00443
00444 template<class Type>
00445 void Foam::checkMethod
00446 (
00447 const errorEstimate<Type>& ee,
00448 const dimensioned<Type>& dt,
00449 const char* op
00450 )
00451 {
00452 if (dimensionSet::debug && ee.dimensions()/dimVolume != dt.dimensions())
00453 {
00454 FatalErrorIn
00455 (
00456 "checkMethod(const errorEstimate<Type>&, const dimensioned<Type>&)"
00457 ) << "incompatible dimensions for operation "
00458 << endl << " "
00459 << "[" << ee.psi().name() << ee.dimensions()/dimVolume << " ] "
00460 << op
00461 << " [" << dt.name() << dt.dimensions() << " ]"
00462 << abort(FatalError);
00463 }
00464 }
00465
00466
00467
00468
00469 namespace Foam
00470 {
00471
00472 template<class Type>
00473 tmp<errorEstimate<Type> > operator+
00474 (
00475 const errorEstimate<Type>& A,
00476 const errorEstimate<Type>& B
00477 )
00478 {
00479 checkMethod(A, B, "+");
00480 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00481 tC() += B;
00482 return tC;
00483 }
00484
00485
00486 template<class Type>
00487 tmp<errorEstimate<Type> > operator+
00488 (
00489 const tmp<errorEstimate<Type> >& tA,
00490 const errorEstimate<Type>& B
00491 )
00492 {
00493 checkMethod(tA(), B, "+");
00494 tmp<errorEstimate<Type> > tC(tA.ptr());
00495 tC() += B;
00496 return tC;
00497 }
00498
00499
00500 template<class Type>
00501 tmp<errorEstimate<Type> > operator+
00502 (
00503 const errorEstimate<Type>& A,
00504 const tmp<errorEstimate<Type> >& tB
00505 )
00506 {
00507 checkMethod(A, tB(), "+");
00508 tmp<errorEstimate<Type> > tC(tB.ptr());
00509 tC() += A;
00510 return tC;
00511 }
00512
00513
00514 template<class Type>
00515 tmp<errorEstimate<Type> > operator+
00516 (
00517 const tmp<errorEstimate<Type> >& tA,
00518 const tmp<errorEstimate<Type> >& tB
00519 )
00520 {
00521 checkMethod(tA(), tB(), "+");
00522 tmp<errorEstimate<Type> > tC(tA.ptr());
00523 tC() += tB();
00524 tB.clear();
00525 return tC;
00526 }
00527
00528
00529 template<class Type>
00530 tmp<errorEstimate<Type> > operator-
00531 (
00532 const errorEstimate<Type>& A
00533 )
00534 {
00535 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00536 tC().negate();
00537 return tC;
00538 }
00539
00540
00541 template<class Type>
00542 tmp<errorEstimate<Type> > operator-
00543 (
00544 const tmp<errorEstimate<Type> >& tA
00545 )
00546 {
00547 tmp<errorEstimate<Type> > tC(tA.ptr());
00548 tC().negate();
00549 return tC;
00550 }
00551
00552
00553 template<class Type>
00554 tmp<errorEstimate<Type> > operator-
00555 (
00556 const errorEstimate<Type>& A,
00557 const errorEstimate<Type>& B
00558 )
00559 {
00560 checkMethod(A, B, "-");
00561 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00562 tC() -= B;
00563 return tC;
00564 }
00565
00566
00567 template<class Type>
00568 tmp<errorEstimate<Type> > operator-
00569 (
00570 const tmp<errorEstimate<Type> >& tA,
00571 const errorEstimate<Type>& B
00572 )
00573 {
00574 checkMethod(tA(), B, "-");
00575 tmp<errorEstimate<Type> > tC(tA.ptr());
00576 tC() -= B;
00577 return tC;
00578 }
00579
00580
00581 template<class Type>
00582 tmp<errorEstimate<Type> > operator-
00583 (
00584 const errorEstimate<Type>& A,
00585 const tmp<errorEstimate<Type> >& tB
00586 )
00587 {
00588 checkMethod(A, tB(), "-");
00589 tmp<errorEstimate<Type> > tC(tB.ptr());
00590 tC() -= A;
00591 tC().negate();
00592 return tC;
00593 }
00594
00595
00596 template<class Type>
00597 tmp<errorEstimate<Type> > operator-
00598 (
00599 const tmp<errorEstimate<Type> >& tA,
00600 const tmp<errorEstimate<Type> >& tB
00601 )
00602 {
00603 checkMethod(tA(), tB(), "-");
00604 tmp<errorEstimate<Type> > tC(tA.ptr());
00605 tC() -= tB();
00606 tB.clear();
00607 return tC;
00608 }
00609
00610
00611 template<class Type>
00612 tmp<errorEstimate<Type> > operator==
00613 (
00614 const errorEstimate<Type>& A,
00615 const errorEstimate<Type>& B
00616 )
00617 {
00618 checkMethod(A, B, "==");
00619 return (A - B);
00620 }
00621
00622
00623 template<class Type>
00624 tmp<errorEstimate<Type> > operator==
00625 (
00626 const tmp<errorEstimate<Type> >& tA,
00627 const errorEstimate<Type>& B
00628 )
00629 {
00630 checkMethod(tA(), B, "==");
00631 return (tA - B);
00632 }
00633
00634
00635 template<class Type>
00636 tmp<errorEstimate<Type> > operator==
00637 (
00638 const errorEstimate<Type>& A,
00639 const tmp<errorEstimate<Type> >& tB
00640 )
00641 {
00642 checkMethod(A, tB(), "==");
00643 return (A - tB);
00644 }
00645
00646
00647 template<class Type>
00648 tmp<errorEstimate<Type> > operator==
00649 (
00650 const tmp<errorEstimate<Type> >& tA,
00651 const tmp<errorEstimate<Type> >& tB
00652 )
00653 {
00654 checkMethod(tA(), tB(), "==");
00655 return (tA - tB);
00656 }
00657
00658
00659 template<class Type>
00660 tmp<errorEstimate<Type> > operator+
00661 (
00662 const errorEstimate<Type>& A,
00663 const GeometricField<Type, fvPatchField, volMesh>& su
00664 )
00665 {
00666 checkMethod(A, su, "+");
00667 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00668 tC().res() -= su.internalField();
00669 return tC;
00670 }
00671
00672 template<class Type>
00673 tmp<errorEstimate<Type> > operator+
00674 (
00675 const tmp<errorEstimate<Type> >& tA,
00676 const GeometricField<Type, fvPatchField, volMesh>& su
00677 )
00678 {
00679 checkMethod(tA(), su, "+");
00680 tmp<errorEstimate<Type> > tC(tA.ptr());
00681 tC().res() -= su.internalField();
00682 return tC;
00683 }
00684
00685 template<class Type>
00686 tmp<errorEstimate<Type> > operator+
00687 (
00688 const errorEstimate<Type>& A,
00689 const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu
00690 )
00691 {
00692 checkMethod(A, tsu(), "+");
00693 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00694 tC().res() -= tsu().internalField();
00695 tsu.clear();
00696 return tC;
00697 }
00698
00699
00700 template<class Type>
00701 tmp<errorEstimate<Type> > operator+
00702 (
00703 const tmp<errorEstimate<Type> >& tA,
00704 const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu
00705 )
00706 {
00707 checkMethod(tA(), tsu(), "+");
00708 tmp<errorEstimate<Type> > tC(tA.ptr());
00709 tC().res() -= tsu().internalField();
00710 tsu.clear();
00711 return tC;
00712 }
00713
00714 template<class Type>
00715 tmp<errorEstimate<Type> > operator+
00716 (
00717 const GeometricField<Type, fvPatchField, volMesh>& su,
00718 const errorEstimate<Type>& A
00719 )
00720 {
00721 checkMethod(A, su, "+");
00722 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00723 tC().res() -= su.internalField();
00724 return tC;
00725 }
00726
00727 template<class Type>
00728 tmp<errorEstimate<Type> > operator+
00729 (
00730 const GeometricField<Type, fvPatchField, volMesh>& su,
00731 const tmp<errorEstimate<Type> >& tA
00732 )
00733 {
00734 checkMethod(tA(), su, "+");
00735 tmp<errorEstimate<Type> > tC(tA.ptr());
00736 tC().res() -= su.internalField();
00737 return tC;
00738 }
00739
00740 template<class Type>
00741 tmp<errorEstimate<Type> > operator+
00742 (
00743 const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu,
00744 const errorEstimate<Type>& A
00745 )
00746 {
00747 checkMethod(A, tsu(), "+");
00748 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00749 tC().res() -= tsu().internalField();
00750 tsu.clear();
00751 return tC;
00752 }
00753
00754 template<class Type>
00755 tmp<errorEstimate<Type> > operator+
00756 (
00757 const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu,
00758 const tmp<errorEstimate<Type> >& tA
00759 )
00760 {
00761 checkMethod(tA(), tsu(), "+");
00762 tmp<errorEstimate<Type> > tC(tA.ptr());
00763 tC().res() -= tsu().internalField();
00764 tsu.clear();
00765 return tC;
00766 }
00767
00768
00769 template<class Type>
00770 tmp<errorEstimate<Type> > operator-
00771 (
00772 const errorEstimate<Type>& A,
00773 const GeometricField<Type, fvPatchField, volMesh>& su
00774 )
00775 {
00776 checkMethod(A, su, "-");
00777 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00778 tC().res() += su.internalField();
00779 return tC;
00780 }
00781
00782 template<class Type>
00783 tmp<errorEstimate<Type> > operator-
00784 (
00785 const tmp<errorEstimate<Type> >& tA,
00786 const GeometricField<Type, fvPatchField, volMesh>& su
00787 )
00788 {
00789 checkMethod(tA(), su, "-");
00790 tmp<errorEstimate<Type> > tC(tA.ptr());
00791 tC().res() += su.internalField();
00792 return tC;
00793 }
00794
00795 template<class Type>
00796 tmp<errorEstimate<Type> > operator-
00797 (
00798 const errorEstimate<Type>& A,
00799 const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu
00800 )
00801 {
00802 checkMethod(A, tsu(), "-");
00803 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00804 tC().res() += tsu().internalField();
00805 tsu.clear();
00806 return tC;
00807 }
00808
00809 template<class Type>
00810 tmp<errorEstimate<Type> > operator-
00811 (
00812 const tmp<errorEstimate<Type> >& tA,
00813 const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu
00814 )
00815 {
00816 checkMethod(tA(), tsu(), "-");
00817 tmp<errorEstimate<Type> > tC(tA.ptr());
00818 tC().res() += tsu().internalField();
00819 tsu.clear();
00820 return tC;
00821 }
00822
00823
00824 template<class Type>
00825 tmp<errorEstimate<Type> > operator-
00826 (
00827 const GeometricField<Type, fvPatchField, volMesh>& su,
00828 const errorEstimate<Type>& A
00829 )
00830 {
00831 checkMethod(A, su, "-");
00832 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00833 tC().negate();
00834 tC().res() -= su.internalField();
00835 return tC;
00836 }
00837
00838
00839 template<class Type>
00840 tmp<errorEstimate<Type> > operator-
00841 (
00842 const GeometricField<Type, fvPatchField, volMesh>& su,
00843 const tmp<errorEstimate<Type> >& tA
00844 )
00845 {
00846 checkMethod(tA(), su, "-");
00847 tmp<errorEstimate<Type> > tC(tA.ptr());
00848 tC().negate();
00849 tC().res() -= su.internalField();
00850 return tC;
00851 }
00852
00853 template<class Type>
00854 tmp<errorEstimate<Type> > operator-
00855 (
00856 const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu,
00857 const errorEstimate<Type>& A
00858 )
00859 {
00860 checkMethod(A, tsu(), "-");
00861 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00862 tC().negate();
00863 tC().res() -= tsu().internalField();
00864 tsu.clear();
00865 return tC;
00866 }
00867
00868
00869 template<class Type>
00870 tmp<errorEstimate<Type> > operator-
00871 (
00872 const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu,
00873 const tmp<errorEstimate<Type> >& tA
00874 )
00875 {
00876 checkMethod(tA(), tsu(), "-");
00877 tmp<errorEstimate<Type> > tC(tA.ptr());
00878 tC().negate();
00879 tC().res() -= tsu().internalField();
00880 tsu.clear();
00881 return tC;
00882 }
00883
00884
00885 template<class Type>
00886 tmp<errorEstimate<Type> > operator+
00887 (
00888 const errorEstimate<Type>& A,
00889 const dimensioned<Type>& su
00890 )
00891 {
00892 checkMethod(A, su, "+");
00893 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00894 tC().res() -= su.value();
00895 return tC;
00896 }
00897
00898
00899 template<class Type>
00900 tmp<errorEstimate<Type> > operator+
00901 (
00902 const tmp<errorEstimate<Type> >& tA,
00903 const dimensioned<Type>& su
00904 )
00905 {
00906 checkMethod(tA(), su, "+");
00907 tmp<errorEstimate<Type> > tC(tA.ptr());
00908 tC().res() -= su.value();
00909 return tC;
00910 }
00911
00912
00913 template<class Type>
00914 tmp<errorEstimate<Type> > operator+
00915 (
00916 const dimensioned<Type>& su,
00917 const errorEstimate<Type>& A
00918 )
00919 {
00920 checkMethod(A, su, "+");
00921 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00922 tC().res() -= su.value();
00923 return tC;
00924 }
00925
00926
00927 template<class Type>
00928 tmp<errorEstimate<Type> > operator+
00929 (
00930 const dimensioned<Type>& su,
00931 const tmp<errorEstimate<Type> >& tA
00932 )
00933 {
00934 checkMethod(tA(), su, "+");
00935 tmp<errorEstimate<Type> > tC(tA.ptr());
00936 tC().res() -= su.value();
00937 return tC;
00938 }
00939
00940
00941 template<class Type>
00942 tmp<errorEstimate<Type> > operator-
00943 (
00944 const errorEstimate<Type>& A,
00945 const dimensioned<Type>& su
00946 )
00947 {
00948 checkMethod(A, su, "-");
00949 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00950 tC().res() += su.value();
00951 return tC;
00952 }
00953
00954
00955 template<class Type>
00956 tmp<errorEstimate<Type> > operator-
00957 (
00958 const tmp<errorEstimate<Type> >& tA,
00959 const dimensioned<Type>& su
00960 )
00961 {
00962 checkMethod(tA(), su, "-");
00963 tmp<errorEstimate<Type> > tC(tA.ptr());
00964 tC().res() += su.value();
00965 return tC;
00966 }
00967
00968
00969 template<class Type>
00970 tmp<errorEstimate<Type> > operator-
00971 (
00972 const dimensioned<Type>& su,
00973 const errorEstimate<Type>& A
00974 )
00975 {
00976 checkMethod(A, su, "-");
00977 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
00978 tC().negate();
00979 tC().res() -= su.value();
00980 return tC;
00981 }
00982
00983
00984 template<class Type>
00985 tmp<errorEstimate<Type> > operator-
00986 (
00987 const dimensioned<Type>& su,
00988 const tmp<errorEstimate<Type> >& tA
00989 )
00990 {
00991 checkMethod(tA(), su, "-");
00992 tmp<errorEstimate<Type> > tC(tA.ptr());
00993 tC().negate();
00994 tC().res() -= su.value();
00995 return tC;
00996 }
00997
00998
00999 template<class Type>
01000 tmp<errorEstimate<Type> > operator==
01001 (
01002 const errorEstimate<Type>& A,
01003 const GeometricField<Type, fvPatchField, volMesh>& su
01004 )
01005 {
01006 checkMethod(A, su, "==");
01007 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
01008 tC().res() += su.internalField();
01009 return tC;
01010 }
01011
01012 template<class Type>
01013 tmp<errorEstimate<Type> > operator==
01014 (
01015 const tmp<errorEstimate<Type> >& tA,
01016 const GeometricField<Type, fvPatchField, volMesh>& su
01017 )
01018 {
01019 checkMethod(tA(), su, "==");
01020 tmp<errorEstimate<Type> > tC(tA.ptr());
01021 tC().res() += su.internalField();
01022 return tC;
01023 }
01024
01025 template<class Type>
01026 tmp<errorEstimate<Type> > operator==
01027 (
01028 const errorEstimate<Type>& A,
01029 const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu
01030 )
01031 {
01032 checkMethod(A, tsu(), "==");
01033 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
01034 tC().res() += tsu().internalField();
01035 tsu.clear();
01036 return tC;
01037 }
01038
01039 template<class Type>
01040 tmp<errorEstimate<Type> > operator==
01041 (
01042 const tmp<errorEstimate<Type> >& tA,
01043 const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu
01044 )
01045 {
01046 checkMethod(tA(), tsu(), "==");
01047 tmp<errorEstimate<Type> > tC(tA.ptr());
01048 tC().res() += tsu().internalField();
01049 tsu.clear();
01050 return tC;
01051 }
01052
01053
01054 template<class Type>
01055 tmp<errorEstimate<Type> > operator==
01056 (
01057 const errorEstimate<Type>& A,
01058 const dimensioned<Type>& su
01059 )
01060 {
01061 checkMethod(A, su, "==");
01062 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
01063 tC().res() += su.value();
01064 return tC;
01065 }
01066
01067
01068 template<class Type>
01069 tmp<errorEstimate<Type> > operator==
01070 (
01071 const tmp<errorEstimate<Type> >& tA,
01072 const dimensioned<Type>& su
01073 )
01074 {
01075 checkMethod(tA(), su, "==");
01076 tmp<errorEstimate<Type> > tC(tA.ptr());
01077 tC().res() += su.value();
01078 return tC;
01079 }
01080
01081
01082 template<class Type>
01083 tmp<errorEstimate<Type> > operator*
01084 (
01085 const volScalarField& vsf,
01086 const errorEstimate<Type>& A
01087 )
01088 {
01089 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
01090 tC() *= vsf;
01091 return tC;
01092 }
01093
01094 template<class Type>
01095 tmp<errorEstimate<Type> > operator*
01096 (
01097 const tmp<volScalarField>& tvsf,
01098 const errorEstimate<Type>& A
01099 )
01100 {
01101 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
01102 tC() *= tvsf;
01103 return tC;
01104 }
01105
01106 template<class Type>
01107 tmp<errorEstimate<Type> > operator*
01108 (
01109 const volScalarField& vsf,
01110 const tmp<errorEstimate<Type> >& tA
01111 )
01112 {
01113 tmp<errorEstimate<Type> > tC(tA.ptr());
01114 tC() *= vsf;
01115 return tC;
01116 }
01117
01118 template<class Type>
01119 tmp<errorEstimate<Type> > operator*
01120 (
01121 const tmp<volScalarField>& tvsf,
01122 const tmp<errorEstimate<Type> >& tA
01123 )
01124 {
01125 tmp<errorEstimate<Type> > tC(tA.ptr());
01126 tC() *= tvsf;
01127 return tC;
01128 }
01129
01130
01131 template<class Type>
01132 tmp<errorEstimate<Type> > operator*
01133 (
01134 const dimensioned<scalar>& ds,
01135 const errorEstimate<Type>& A
01136 )
01137 {
01138 tmp<errorEstimate<Type> > tC(new errorEstimate<Type>(A));
01139 tC() *= ds;
01140 return tC;
01141 }
01142
01143
01144 template<class Type>
01145 tmp<errorEstimate<Type> > operator*
01146 (
01147 const dimensioned<scalar>& ds,
01148 const tmp<errorEstimate<Type> >& tA
01149 )
01150 {
01151 tmp<errorEstimate<Type> > tC(tA.ptr());
01152 tC() *= ds;
01153 return tC;
01154 }
01155
01156
01157
01158
01159 }
01160
01161