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