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 #ifndef GeometricField_H
00037 #define GeometricField_H
00038
00039 #include "regIOobject.H"
00040 #include "dimensionedTypes.H"
00041 #include "Field.H"
00042 #include "FieldField.H"
00043 #include "scalarField.H"
00044
00045
00046
00047 namespace Foam
00048 {
00049
00050 class dictionary;
00051
00052
00053
00054 template<class Type, template<class> class PatchField, class GeoMesh>
00055 class GeometricField;
00056
00057 template<class Type, template<class> class PatchField, class GeoMesh>
00058 Ostream& operator<<
00059 (
00060 Ostream&,
00061 const GeometricField<Type, PatchField, GeoMesh>&
00062 );
00063
00064 template<class Type, template<class> class PatchField, class GeoMesh>
00065 Ostream& operator<<
00066 (
00067 Ostream&,
00068 const tmp<GeometricField<Type, PatchField, GeoMesh> >&
00069 );
00070
00071
00072
00073
00074
00075
00076 template<class Type, template<class> class PatchField, class GeoMesh>
00077 class GeometricField
00078 :
00079 public regIOobject,
00080 public Field<Type>
00081 {
00082
00083
00084
00085 bool readIfPresent();
00086
00087
00088 bool readOldTimeIfPresent();
00089
00090
00091 public:
00092
00093
00094
00095 typedef typename GeoMesh::Mesh Mesh;
00096 typedef typename Mesh::BoundaryMesh BoundaryMesh;
00097
00098
00099 class GeometricBoundaryField
00100 :
00101 public FieldField<PatchField, Type>
00102 {
00103
00104
00105
00106 const BoundaryMesh& bmesh_;
00107
00108
00109 public:
00110
00111
00112
00113
00114 GeometricBoundaryField
00115 (
00116 const BoundaryMesh&,
00117 const Field<Type>&,
00118 const word&
00119 );
00120
00121
00122
00123 GeometricBoundaryField
00124 (
00125 const BoundaryMesh&,
00126 const Field<Type>&,
00127 const wordList&
00128 );
00129
00130
00131
00132 GeometricBoundaryField
00133 (
00134 const BoundaryMesh&,
00135 const Field<Type>&,
00136 const PtrList<PatchField<Type> >&
00137 );
00138
00139
00140 GeometricBoundaryField
00141 (
00142 const Field<Type>&,
00143 const GeometricBoundaryField&
00144 );
00145
00146
00147
00148
00149
00150
00151 GeometricBoundaryField
00152 (
00153 const GeometricBoundaryField&
00154 );
00155
00156
00157 GeometricBoundaryField
00158 (
00159 const BoundaryMesh&,
00160 const Field<Type>&,
00161 const dictionary&
00162 );
00163
00164
00165
00166
00167
00168 void updateCoeffs();
00169
00170
00171 void evaluate();
00172
00173
00174 wordList types() const;
00175
00176
00177
00178 GeometricBoundaryField boundaryInternalField() const;
00179
00180
00181 void writeEntry(const word& keyword, Ostream& os) const;
00182
00183
00184
00185
00186
00187 void operator=
00188 (
00189 const GeometricBoundaryField&
00190 );
00191
00192
00193 void operator=(const FieldField<PatchField, Type>&);
00194
00195
00196 void operator=(const Type&);
00197
00198
00199
00200
00201 void operator==
00202 (
00203 const GeometricBoundaryField&
00204 );
00205
00206
00207 void operator==(const FieldField<PatchField, Type>&);
00208
00209
00210 void operator==(const Type&);
00211 };
00212
00213
00214 private:
00215
00216
00217
00218
00219 const Mesh& mesh_;
00220
00221
00222 dimensionSet dimensions_;
00223
00224
00225
00226 mutable label timeIndex_;
00227
00228
00229 mutable GeometricField<Type, PatchField, GeoMesh>* field0Ptr_;
00230
00231
00232 mutable GeometricField<Type, PatchField, GeoMesh>* fieldPrevIterPtr_;
00233
00234
00235 GeometricBoundaryField boundaryField_;
00236
00237
00238
00239
00240 tmp<GeometricBoundaryField> readField();
00241
00242
00243 public:
00244
00245
00246 TypeName("GeometricField");
00247
00248
00249
00250
00251 typedef typename Field<Type>::cmptType cmptType;
00252
00253
00254
00255
00256
00257
00258
00259 GeometricField
00260 (
00261 const IOobject&,
00262 const Mesh&,
00263 const dimensionSet&,
00264 const word& patchFieldType=PatchField<Type>::calculatedType()
00265 );
00266
00267
00268
00269
00270 GeometricField
00271 (
00272 const IOobject&,
00273 const Mesh&,
00274 const dimensionSet&,
00275 const wordList& patchFieldTypes
00276 );
00277
00278
00279 GeometricField
00280 (
00281 const IOobject&,
00282 const Mesh&,
00283 const dimensioned<Type>&,
00284 const word& patchFieldType=PatchField<Type>::calculatedType()
00285 );
00286
00287
00288 GeometricField
00289 (
00290 const IOobject&,
00291 const Mesh&,
00292 const dimensioned<Type>&,
00293 const wordList& patchFieldTypes
00294 );
00295
00296
00297 GeometricField
00298 (
00299 const IOobject&,
00300 const Mesh&,
00301 const dimensionSet&,
00302 const Field<Type>&,
00303 const PtrList<PatchField<Type> >&
00304 );
00305
00306
00307 GeometricField
00308 (
00309 const IOobject&,
00310 const Mesh&
00311 );
00312
00313
00314 GeometricField
00315 (
00316 const GeometricField<Type, PatchField, GeoMesh>&
00317 );
00318
00319
00320 # ifdef ConstructFromTmp
00321 GeometricField
00322 (
00323 const tmp<GeometricField<Type, PatchField, GeoMesh> >&
00324 );
00325 # endif
00326
00327
00328 GeometricField
00329 (
00330 const IOobject&,
00331 const GeometricField<Type, PatchField, GeoMesh>&
00332 );
00333
00334
00335 GeometricField
00336 (
00337 const word& newName,
00338 const GeometricField<Type, PatchField, GeoMesh>&
00339 );
00340
00341
00342 # ifdef ConstructFromTmp
00343 GeometricField
00344 (
00345 const word& newName,
00346 const tmp<GeometricField<Type, PatchField, GeoMesh> >&
00347 );
00348 # endif
00349
00350
00351 GeometricField
00352 (
00353 const IOobject&,
00354 const GeometricField<Type, PatchField, GeoMesh>&,
00355 const word& patchFieldType
00356 );
00357
00358
00359 GeometricField
00360 (
00361 const IOobject&,
00362 const GeometricField<Type, PatchField, GeoMesh>&,
00363 const wordList& patchFieldTypes
00364 );
00365
00366
00367
00368
00369
00370
00371 static tmp<GeometricField<Type, PatchField, GeoMesh> > New
00372 (
00373 const IOobject&,
00374 const tmp<GeometricField<Type, PatchField, GeoMesh> >&,
00375 const dimensionSet&
00376 );
00377
00378
00379
00380
00381 virtual ~GeometricField();
00382
00383
00384
00385
00386
00387 inline const Mesh& mesh() const;
00388
00389
00390 inline dimensionSet& dimensions();
00391
00392
00393 inline const dimensionSet& dimensions() const;
00394
00395
00396 Field<Type>& internalField();
00397
00398
00399 inline const Field<Type>& internalField() const;
00400
00401
00402 GeometricBoundaryField& boundaryField();
00403
00404
00405 inline const GeometricBoundaryField& boundaryField() const;
00406
00407
00408 inline label timeIndex() const;
00409
00410
00411 void storeOldTimes() const;
00412
00413
00414 void storeOldTime() const;
00415
00416
00417 label nOldTimes() const;
00418
00419
00420 const GeometricField<Type, PatchField, GeoMesh>& oldTime() const;
00421
00422
00423
00424 GeometricField<Type, PatchField, GeoMesh>& oldTime();
00425
00426
00427 void storePrevIter() const;
00428
00429
00430 const GeometricField<Type, PatchField, GeoMesh>& prevIter() const;
00431
00432
00433 void correctBoundaryConditions();
00434
00435
00436 bool needReference() const;
00437
00438
00439 static GeometricField<Type, PatchField, GeoMesh>& null();
00440
00441
00442 tmp<GeometricField<cmptType, PatchField, GeoMesh> > component
00443 (
00444 const direction
00445 ) const;
00446
00447
00448 dimensioned<Type> average() const;
00449
00450
00451 dimensioned<Type> weightedAverage(const scalarField&) const;
00452
00453
00454 bool writeData(Ostream&) const;
00455
00456
00457 tmp<GeometricField<Type, PatchField, GeoMesh> > T() const;
00458
00459
00460
00461
00462
00463 void relax(const scalar alpha);
00464
00465
00466
00467 void relax();
00468
00469
00470
00471
00472 void negate();
00473
00474 void replace
00475 (
00476 const direction,
00477 const GeometricField<cmptType, PatchField, GeoMesh>&
00478 );
00479
00480 void max(const dimensioned<Type>&);
00481 void min(const dimensioned<Type>&);
00482
00483 void max
00484 (
00485 const GeometricField<Type, PatchField, GeoMesh>&,
00486 const dimensioned<Type>&
00487 );
00488
00489 void min
00490 (
00491 const GeometricField<Type, PatchField, GeoMesh>&,
00492 const dimensioned<Type>&
00493 );
00494
00495 void scale
00496 (
00497 const GeometricField<Type, PatchField, GeoMesh>&,
00498 const GeometricField<Type, PatchField, GeoMesh>&
00499 );
00500
00501 void scale
00502 (
00503 const GeometricField<Type, PatchField, GeoMesh>&,
00504 const dimensioned<Type>&
00505 );
00506
00507
00508
00509
00510 void operator=(const GeometricField<Type, PatchField, GeoMesh>&);
00511 void operator=(const tmp<GeometricField<Type, PatchField, GeoMesh> >&);
00512 void operator=(const dimensioned<Type>&);
00513
00514 void operator==(const tmp<GeometricField<Type, PatchField, GeoMesh> >&);
00515 void operator==(const dimensioned<Type>&);
00516
00517 void operator+=(const GeometricField<Type, PatchField, GeoMesh>&);
00518 void operator+=(const tmp<GeometricField<Type, PatchField, GeoMesh> >&);
00519
00520 void operator-=(const GeometricField<Type, PatchField, GeoMesh>&);
00521 void operator-=(const tmp<GeometricField<Type, PatchField, GeoMesh> >&);
00522
00523 void operator*=(const GeometricField<scalar, PatchField, GeoMesh>&);
00524 void operator*=(const tmp<GeometricField<scalar,PatchField,GeoMesh> >&);
00525
00526 void operator/=(const GeometricField<scalar, PatchField, GeoMesh>&);
00527 void operator/=(const tmp<GeometricField<scalar,PatchField,GeoMesh> >&);
00528
00529 void operator+=(const dimensioned<Type>&);
00530 void operator-=(const dimensioned<Type>&);
00531
00532 void operator*=(const dimensioned<scalar>&);
00533 void operator/=(const dimensioned<scalar>&);
00534
00535
00536
00537
00538 friend Ostream& operator<< <Type, PatchField, GeoMesh>
00539 (
00540 Ostream&,
00541 const GeometricField<Type, PatchField, GeoMesh>&
00542 );
00543
00544 friend Ostream& operator<< <Type, PatchField, GeoMesh>
00545 (
00546 Ostream&,
00547 const tmp<GeometricField<Type, PatchField, GeoMesh> >&
00548 );
00549 };
00550
00551
00552 template<class Type, template<class> class PatchField, class GeoMesh>
00553 Ostream& operator<<
00554 (
00555 Ostream&,
00556 const typename GeometricField<Type, PatchField, GeoMesh>::
00557 GeometricBoundaryField&
00558 );
00559
00560
00561
00562
00563 }
00564
00565
00566
00567 #include "GeometricFieldI.H"
00568
00569 #ifdef NoRepository
00570 # include "GeometricField.C"
00571 #endif
00572
00573 #include "GeometricFieldFunctions.H"
00574
00575
00576
00577 #endif
00578
00579