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
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef faMatrix_H
00038 #define faMatrix_H
00039
00040 #include "areaFields.H"
00041 #include "edgeFields.H"
00042 #include "lduMatrix.H"
00043 #include "tmp.H"
00044 #include "autoPtr.H"
00045 #include "dimensionedTypes.H"
00046 #include "className.H"
00047
00048
00049
00050 namespace Foam
00051 {
00052
00053
00054
00055 template<class Type>
00056 class faMatrix;
00057
00058 template<class Type>
00059 Ostream& operator<<(Ostream&, const faMatrix<Type>&);
00060
00061
00062
00063
00064
00065
00066 template<class Type>
00067 class faMatrix
00068 :
00069 public refCount,
00070 public lduMatrix
00071 {
00072
00073
00074
00075 GeometricField<Type, faPatchField, areaMesh>& psi_;
00076
00077
00078 dimensionSet dimensions_;
00079
00080
00081 Field<Type> source_;
00082
00083
00084
00085 FieldField<Field, Type> internalCoeffs_;
00086
00087
00088
00089 FieldField<Field, Type> boundaryCoeffs_;
00090
00091
00092
00093 mutable GeometricField<Type, faPatchField, edgeMesh>
00094 *faceFluxCorrectionPtr_;
00095
00096 direction solvingComponent;
00097
00098
00099
00100
00101
00102 template<class Type2>
00103 void addToInternalField
00104 (
00105 const unallocLabelList& addr,
00106 const Field<Type2>& pf,
00107 Field<Type2>& intf
00108 ) const;
00109
00110 template<class Type2>
00111 void addToInternalField
00112 (
00113 const unallocLabelList& addr,
00114 const tmp<Field<Type2> >& tpf,
00115 Field<Type2>& intf
00116 ) const;
00117
00118
00119 template<class Type2>
00120 void subtractFromInternalField
00121 (
00122 const unallocLabelList& addr,
00123 const Field<Type2>& pf,
00124 Field<Type2>& intf
00125 ) const;
00126
00127 template<class Type2>
00128 void subtractFromInternalField
00129 (
00130 const unallocLabelList& addr,
00131 const tmp<Field<Type2> >& tpf,
00132 Field<Type2>& intf
00133 ) const;
00134
00135
00136
00137
00138 void addBoundaryDiag
00139 (
00140 scalarField& diag,
00141 const direction cmpt
00142 ) const;
00143
00144 void addCmptAvBoundaryDiag(scalarField& diag) const;
00145
00146 void addBoundarySource(Field<Type>& source) const;
00147
00148 void addBoundarySource
00149 (
00150 scalarField& source,
00151 const direction cmpt
00152 ) const;
00153
00154
00155 public:
00156
00157 ClassName("faMatrix");
00158
00159
00160
00161
00162
00163 faMatrix
00164 (
00165 GeometricField<Type, faPatchField, areaMesh>&,
00166 const dimensionSet&
00167 );
00168
00169
00170 faMatrix(const faMatrix<Type>&);
00171
00172
00173 faMatrix(GeometricField<Type, faPatchField, areaMesh>&, Istream&);
00174
00175
00176
00177
00178 virtual ~faMatrix();
00179
00180
00181
00182
00183
00184
00185 const GeometricField<Type, faPatchField, areaMesh>& psi() const
00186 {
00187 return psi_;
00188 }
00189
00190 GeometricField<Type, faPatchField, areaMesh>& psi()
00191 {
00192 return psi_;
00193 }
00194
00195 const dimensionSet& dimensions() const
00196 {
00197 return dimensions_;
00198 }
00199
00200 Field<Type>& source()
00201 {
00202 return source_;
00203 }
00204
00205 const Field<Type>& source() const
00206 {
00207 return source_;
00208 }
00209
00210
00211
00212 FieldField<Field, Type>& internalCoeffs()
00213 {
00214 return internalCoeffs_;
00215 }
00216
00217
00218
00219 FieldField<Field, Type>& boundaryCoeffs()
00220 {
00221 return boundaryCoeffs_;
00222 }
00223
00224
00225
00226 typedef GeometricField<Type, faPatchField, edgeMesh>
00227 *edgeTypeFieldPtr;
00228
00229
00230 edgeTypeFieldPtr& faceFluxCorrectionPtr()
00231 {
00232 return faceFluxCorrectionPtr_;
00233 }
00234
00235
00236
00237 bool needReference();
00238
00239
00240
00241
00242
00243 void setReference
00244 (
00245 const label cell,
00246 const Type& value
00247 );
00248
00249
00250
00251 void setComponentReference
00252 (
00253 const label patchi,
00254 const label facei,
00255 const direction cmpt,
00256 const scalar value
00257 );
00258
00259
00260
00261
00262
00263 void relax(const scalar alpha);
00264
00265
00266
00267 void relax();
00268
00269
00270
00271 lduMatrix::solverPerformance solve(Istream&);
00272
00273
00274
00275 lduMatrix::solverPerformance solve();
00276
00277
00278 tmp<Field<Type> > residual() const;
00279
00280
00281 tmp<scalarField> D() const;
00282
00283
00284 tmp<areaScalarField> A() const;
00285
00286
00287 tmp<GeometricField<Type, faPatchField, areaMesh> > H() const;
00288
00289
00290 tmp<GeometricField<Type, faPatchField, edgeMesh> > flux() const;
00291
00292
00293
00294
00295 void operator=(const faMatrix<Type>&);
00296 void operator=(const tmp<faMatrix<Type> >&);
00297
00298 void negate();
00299
00300 void operator+=(const faMatrix<Type>&);
00301 void operator+=(const tmp<faMatrix<Type> >&);
00302
00303 void operator-=(const faMatrix<Type>&);
00304 void operator-=(const tmp<faMatrix<Type> >&);
00305
00306 void operator+=(const GeometricField<Type,faPatchField,areaMesh>&);
00307 void operator+=(const tmp<GeometricField<Type,faPatchField,areaMesh> >&);
00308
00309 void operator-=(const GeometricField<Type,faPatchField,areaMesh>&);
00310 void operator-=(const tmp<GeometricField<Type,faPatchField,areaMesh> >&);
00311
00312 void operator+=(const dimensioned<Type>&);
00313 void operator-=(const dimensioned<Type>&);
00314
00315 void operator*=(const areaScalarField&);
00316 void operator*=(const tmp<areaScalarField>&);
00317
00318 void operator*=(const dimensioned<scalar>&);
00319
00320 tmp<Field<Type> > operator&(const Field<Type>&) const;
00321 tmp<Field<Type> > operator&(const tmp<Field<Type> >&) const;
00322
00323
00324
00325
00326 friend Ostream& operator<< <Type>
00327 (
00328 Ostream&,
00329 const faMatrix<Type>&
00330 );
00331 };
00332
00333
00334
00335
00336 template<class Type>
00337 void checkMethod
00338 (
00339 const faMatrix<Type>&,
00340 const faMatrix<Type>&,
00341 const char*
00342 );
00343
00344 template<class Type>
00345 void checkMethod
00346 (
00347 const faMatrix<Type>&,
00348 const GeometricField<Type, faPatchField, areaMesh>&,
00349 const char*
00350 );
00351
00352 template<class Type>
00353 void checkMethod
00354 (
00355 const faMatrix<Type>&,
00356 const dimensioned<Type>&,
00357 const char*
00358 );
00359
00360
00361
00362
00363 template<class Type>
00364 lduMatrix::solverPerformance solve(faMatrix<Type>&, Istream&);
00365
00366
00367
00368
00369
00370 template<class Type>
00371 lduMatrix::solverPerformance solve(const tmp<faMatrix<Type> >&, Istream&);
00372
00373
00374
00375
00376 template<class Type>
00377 lduMatrix::solverPerformance solve(faMatrix<Type>&);
00378
00379
00380
00381
00382
00383 template<class Type>
00384 lduMatrix::solverPerformance solve(const tmp<faMatrix<Type> >&);
00385
00386
00387
00388
00389 template<class Type>
00390 tmp<faMatrix<Type> > operator-
00391 (
00392 const faMatrix<Type>&
00393 );
00394
00395 template<class Type>
00396 tmp<faMatrix<Type> > operator-
00397 (
00398 const tmp<faMatrix<Type> >&
00399 );
00400
00401 template<class Type>
00402 tmp<faMatrix<Type> > operator+
00403 (
00404 const faMatrix<Type>&,
00405 const faMatrix<Type>&
00406 );
00407
00408 template<class Type>
00409 tmp<faMatrix<Type> > operator+
00410 (
00411 const tmp<faMatrix<Type> >&,
00412 const faMatrix<Type>&
00413 );
00414
00415 template<class Type>
00416 tmp<faMatrix<Type> > operator+
00417 (
00418 const faMatrix<Type>&,
00419 const tmp<faMatrix<Type> >&
00420 );
00421
00422 template<class Type>
00423 tmp<faMatrix<Type> > operator+
00424 (
00425 const tmp<faMatrix<Type> >&,
00426 const tmp<faMatrix<Type> >&
00427 );
00428
00429 template<class Type>
00430 tmp<faMatrix<Type> > operator-
00431 (
00432 const faMatrix<Type>&,
00433 const faMatrix<Type>&
00434 );
00435
00436 template<class Type>
00437 tmp<faMatrix<Type> > operator-
00438 (
00439 const tmp<faMatrix<Type> >&,
00440 const faMatrix<Type>&
00441 );
00442
00443 template<class Type>
00444 tmp<faMatrix<Type> > operator-
00445 (
00446 const faMatrix<Type>&,
00447 const tmp<faMatrix<Type> >&
00448 );
00449
00450 template<class Type>
00451 tmp<faMatrix<Type> > operator-
00452 (
00453 const tmp<faMatrix<Type> >&,
00454 const tmp<faMatrix<Type> >&
00455 );
00456
00457 template<class Type>
00458 tmp<faMatrix<Type> > operator==
00459 (
00460 const faMatrix<Type>&,
00461 const faMatrix<Type>&
00462 );
00463
00464 template<class Type>
00465 tmp<faMatrix<Type> > operator==
00466 (
00467 const tmp<faMatrix<Type> >&,
00468 const faMatrix<Type>&
00469 );
00470
00471 template<class Type>
00472 tmp<faMatrix<Type> > operator==
00473 (
00474 const faMatrix<Type>&,
00475 const tmp<faMatrix<Type> >&
00476 );
00477
00478 template<class Type>
00479 tmp<faMatrix<Type> > operator==
00480 (
00481 const tmp<faMatrix<Type> >&,
00482 const tmp<faMatrix<Type> >&
00483 );
00484
00485 template<class Type>
00486 tmp<faMatrix<Type> > operator+
00487 (
00488 const faMatrix<Type>&,
00489 const GeometricField<Type, faPatchField, areaMesh>&
00490 );
00491
00492 template<class Type>
00493 tmp<faMatrix<Type> > operator+
00494 (
00495 const tmp<faMatrix<Type> >&,
00496 const GeometricField<Type, faPatchField, areaMesh>&
00497 );
00498
00499 template<class Type>
00500 tmp<faMatrix<Type> > operator+
00501 (
00502 const faMatrix<Type>&,
00503 const tmp<GeometricField<Type, faPatchField, areaMesh> >&
00504 );
00505
00506 template<class Type>
00507 tmp<faMatrix<Type> > operator+
00508 (
00509 const tmp<faMatrix<Type> >&,
00510 const tmp<GeometricField<Type, faPatchField, areaMesh> >&
00511 );
00512
00513 template<class Type>
00514 tmp<faMatrix<Type> > operator+
00515 (
00516 const GeometricField<Type, faPatchField, areaMesh>&,
00517 const faMatrix<Type>&
00518 );
00519
00520 template<class Type>
00521 tmp<faMatrix<Type> > operator+
00522 (
00523 const GeometricField<Type, faPatchField, areaMesh>&,
00524 const tmp<faMatrix<Type> >&
00525 );
00526
00527 template<class Type>
00528 tmp<faMatrix<Type> > operator+
00529 (
00530 const tmp<GeometricField<Type, faPatchField, areaMesh> >&,
00531 const faMatrix<Type>&
00532 );
00533
00534 template<class Type>
00535 tmp<faMatrix<Type> > operator+
00536 (
00537 const tmp<GeometricField<Type, faPatchField, areaMesh> >&,
00538 const tmp<faMatrix<Type> >&
00539 );
00540
00541 template<class Type>
00542 tmp<faMatrix<Type> > operator-
00543 (
00544 const faMatrix<Type>&,
00545 const GeometricField<Type, faPatchField, areaMesh>&
00546 );
00547
00548 template<class Type>
00549 tmp<faMatrix<Type> > operator-
00550 (
00551 const tmp<faMatrix<Type> >&,
00552 const GeometricField<Type, faPatchField, areaMesh>&
00553 );
00554
00555 template<class Type>
00556 tmp<faMatrix<Type> > operator-
00557 (
00558 const faMatrix<Type>&,
00559 const tmp<GeometricField<Type, faPatchField, areaMesh> >&
00560 );
00561
00562 template<class Type>
00563 tmp<faMatrix<Type> > operator-
00564 (
00565 const tmp<faMatrix<Type> >&,
00566 const tmp<GeometricField<Type, faPatchField, areaMesh> >&
00567 );
00568
00569 template<class Type>
00570 tmp<faMatrix<Type> > operator-
00571 (
00572 const GeometricField<Type, faPatchField, areaMesh>&,
00573 const faMatrix<Type>&
00574 );
00575
00576 template<class Type>
00577 tmp<faMatrix<Type> > operator-
00578 (
00579 const GeometricField<Type, faPatchField, areaMesh>&,
00580 const tmp<faMatrix<Type> >&
00581 );
00582
00583 template<class Type>
00584 tmp<faMatrix<Type> > operator-
00585 (
00586 const tmp<GeometricField<Type, faPatchField, areaMesh> >&,
00587 const faMatrix<Type>&
00588 );
00589
00590 template<class Type>
00591 tmp<faMatrix<Type> > operator-
00592 (
00593 const tmp<GeometricField<Type, faPatchField, areaMesh> >&,
00594 const tmp<faMatrix<Type> >&
00595 );
00596
00597 template<class Type>
00598 tmp<faMatrix<Type> > operator+
00599 (
00600 const tmp<faMatrix<Type> >&,
00601 const dimensioned<Type>&
00602 );
00603
00604 template<class Type>
00605 tmp<faMatrix<Type> > operator+
00606 (
00607 const dimensioned<Type>&,
00608 const tmp<faMatrix<Type> >&
00609 );
00610
00611 template<class Type>
00612 tmp<faMatrix<Type> > operator-
00613 (
00614 const tmp<faMatrix<Type> >&,
00615 const dimensioned<Type>&
00616 );
00617
00618 template<class Type>
00619 tmp<faMatrix<Type> > operator-
00620 (
00621 const dimensioned<Type>&,
00622 const tmp<faMatrix<Type> >&
00623 );
00624
00625 template<class Type>
00626 tmp<faMatrix<Type> > operator==
00627 (
00628 const faMatrix<Type>&,
00629 const GeometricField<Type, faPatchField, areaMesh>&
00630 );
00631
00632 template<class Type>
00633 tmp<faMatrix<Type> > operator==
00634 (
00635 const tmp<faMatrix<Type> >&,
00636 const GeometricField<Type, faPatchField, areaMesh>&
00637 );
00638
00639 template<class Type>
00640 tmp<faMatrix<Type> > operator==
00641 (
00642 const faMatrix<Type>&,
00643 const tmp<GeometricField<Type, faPatchField, areaMesh> >&
00644 );
00645
00646 template<class Type>
00647 tmp<faMatrix<Type> > operator==
00648 (
00649 const tmp<faMatrix<Type> >&,
00650 const tmp<GeometricField<Type, faPatchField, areaMesh> >&
00651 );
00652
00653 template<class Type>
00654 tmp<faMatrix<Type> > operator==
00655 (
00656 const faMatrix<Type>&,
00657 const dimensioned<Type>&
00658 );
00659
00660 template<class Type>
00661 tmp<faMatrix<Type> > operator==
00662 (
00663 const tmp<faMatrix<Type> >&,
00664 const dimensioned<Type>&
00665 );
00666
00667
00668 template<class Type>
00669 tmp<faMatrix<Type> > operator*
00670 (
00671 const areaScalarField&,
00672 const faMatrix<Type>&
00673 );
00674
00675 template<class Type>
00676 tmp<faMatrix<Type> > operator*
00677 (
00678 const areaScalarField&,
00679 const tmp<faMatrix<Type> >&
00680 );
00681
00682 template<class Type>
00683 tmp<faMatrix<Type> > operator*
00684 (
00685 const tmp<areaScalarField>&,
00686 const faMatrix<Type>&
00687 );
00688
00689 template<class Type>
00690 tmp<faMatrix<Type> > operator*
00691 (
00692 const tmp<areaScalarField>&,
00693 const tmp<faMatrix<Type> >&
00694 );
00695
00696
00697 template<class Type>
00698 tmp<faMatrix<Type> > operator*
00699 (
00700 const dimensioned<scalar>&,
00701 const faMatrix<Type>&
00702 );
00703
00704 template<class Type>
00705 tmp<faMatrix<Type> > operator*
00706 (
00707 const dimensioned<scalar>&,
00708 const tmp<faMatrix<Type> >&
00709 );
00710
00711
00712
00713
00714 }
00715
00716
00717
00718 #ifdef NoRepository
00719 # include "faMatrix.C"
00720 #endif
00721
00722
00723
00724 #endif
00725
00726