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
00040
00041
00042 #ifndef fvPatchField_H
00043 #define fvPatchField_H
00044
00045 #include "fvPatch.H"
00046 #include "primitiveFields.H"
00047 #include "lduCoupledInterface.H"
00048
00049
00050
00051 namespace Foam
00052 {
00053
00054 class objectRegistry;
00055 class dictionary;
00056 class fvPatchFieldMapper;
00057 class lduMatrix;
00058
00059
00060
00061 template<class Type>
00062 class fvPatchField;
00063
00064 template<class Type>
00065 Ostream& operator<<(Ostream&, const fvPatchField<Type>&);
00066
00067
00068
00069
00070
00071
00072 template<class Type>
00073 class fvPatchField
00074 :
00075 virtual public lduCoupledInterface,
00076 public Field<Type>
00077 {
00078
00079
00080 const fvPatch& patch_;
00081 const Field<Type>& internalField_;
00082
00083
00084
00085 bool updated_;
00086
00087
00088
00089
00090 void checkPatch() const;
00091 void checkInternalField() const;
00092
00093
00094 public:
00095
00096 typedef fvPatch Patch;
00097
00098
00099
00100 TypeName("fvPatchField");
00101
00102
00103 static int disallowDefaultFvPatchField;
00104
00105
00106
00107
00108 declareRunTimeSelectionTable
00109 (
00110 tmp,
00111 fvPatchField,
00112 patch,
00113 (const fvPatch& p, const Field<Type>& iF),
00114 (p, iF)
00115 );
00116
00117 declareRunTimeSelectionTable
00118 (
00119 tmp,
00120 fvPatchField,
00121 patchMapper,
00122 (
00123 const fvPatchField<Type>& ptf,
00124 const fvPatch& p,
00125 const Field<Type>& iF,
00126 const fvPatchFieldMapper& m
00127 ),
00128 (dynamic_cast<const fvPatchFieldType&>(ptf), p, iF, m)
00129 );
00130
00131 declareRunTimeSelectionTable
00132 (
00133 tmp,
00134 fvPatchField,
00135 dictionary,
00136 (const fvPatch& p, const Field<Type>& iF, const dictionary& dict),
00137 (p, iF, dict)
00138 );
00139
00140
00141
00142
00143
00144 fvPatchField
00145 (
00146 const fvPatch&,
00147 const Field<Type>&
00148 );
00149
00150
00151 fvPatchField
00152 (
00153 const fvPatch&,
00154 const Field<Type>&,
00155 const Field<Type>&
00156 );
00157
00158
00159 fvPatchField
00160 (
00161 const fvPatch&,
00162 const Field<Type>&,
00163 const dictionary&
00164 );
00165
00166
00167 fvPatchField
00168 (
00169 const fvPatchField<Type>&,
00170 const fvPatch&,
00171 const Field<Type>&,
00172 const fvPatchFieldMapper&
00173 );
00174
00175
00176 fvPatchField(const fvPatchField<Type>&);
00177
00178
00179 virtual tmp<fvPatchField<Type> > clone() const
00180 {
00181 return tmp<fvPatchField<Type> >(new fvPatchField<Type>(*this));
00182 }
00183
00184
00185 fvPatchField(const fvPatchField<Type>&, const Field<Type>&);
00186
00187
00188 virtual tmp<fvPatchField<Type> > clone(const Field<Type>& iF) const
00189 {
00190 return tmp<fvPatchField<Type> >(new fvPatchField<Type>(*this, iF));
00191 }
00192
00193
00194
00195
00196
00197
00198
00199 static tmp<fvPatchField<Type> > New
00200 (
00201 const word&,
00202 const fvPatch&,
00203 const Field<Type>&
00204 );
00205
00206
00207
00208 static tmp<fvPatchField<Type> > New
00209 (
00210 const fvPatchField<Type>&,
00211 const fvPatch&,
00212 const Field<Type>&,
00213 const fvPatchFieldMapper&
00214 );
00215
00216
00217
00218 static tmp<fvPatchField<Type> > New
00219 (
00220 const fvPatch&,
00221 const Field<Type>&,
00222 const dictionary&
00223 );
00224
00225
00226
00227 template<class Type2>
00228 static tmp<fvPatchField<Type> > NewCalculatedType
00229 (
00230 const fvPatchField<Type2>&
00231 );
00232
00233
00234
00235
00236 virtual ~fvPatchField<Type>()
00237 {}
00238
00239
00240
00241
00242
00243
00244
00245 const objectRegistry& db() const;
00246
00247
00248 const fvPatch& patch() const
00249 {
00250 return patch_;
00251 }
00252
00253
00254 const Field<Type>& internalField() const
00255 {
00256 return internalField_;
00257 }
00258
00259
00260 static const word& calculatedType();
00261
00262
00263
00264
00265 virtual bool fixesValue() const
00266 {
00267 return false;
00268 }
00269
00270
00271 bool updated() const
00272 {
00273 return updated_;
00274 }
00275
00276
00277 bool isVolField() const;
00278
00279
00280
00281 void checkVolField() const;
00282
00283
00284 template<class GeometricField, class Type2>
00285 const fvPatchField<Type2>& patchField(const GeometricField&) const;
00286
00287
00288
00289
00290
00291
00292 template<class GeometricField, class Type2>
00293 const fvPatchField<Type2>& lookupPatchField
00294 (
00295 const word& name,
00296 const GeometricField* = NULL,
00297 const Type2* = NULL
00298 ) const;
00299
00300
00301
00302
00303
00304 virtual void autoMap
00305 (
00306 const fvPatchFieldMapper&
00307 );
00308
00309
00310 virtual void rmap
00311 (
00312 const fvPatchField<Type>&,
00313 const labelList&
00314 );
00315
00316
00317
00318
00319
00320 virtual tmp<Field<Type> > snGrad() const;
00321
00322
00323
00324 virtual void updateCoeffs()
00325 {
00326 updated_ = true;
00327 }
00328
00329
00330 template<class Type2>
00331 tmp<Field<Type2> > patchInternalField
00332 (
00333 const Field<Type2>&
00334 ) const;
00335
00336
00337 virtual tmp<Field<Type> > patchInternalField() const;
00338
00339
00340 virtual tmp<Field<Type> > patchNeighbourField
00341 (
00342 const Field<Type>& iField
00343 ) const;
00344
00345
00346
00347 virtual tmp<labelField> nbrColour
00348 (
00349 const labelField& iColour
00350 ) const;
00351
00352
00353
00354 virtual tmp<Field<Type> > patchNeighbourField() const;
00355
00356
00357 virtual void initEvaluate(const bool=false)
00358 {}
00359
00360
00361 virtual void evaluate();
00362
00363
00364
00365
00366 virtual tmp<Field<Type> > valueInternalCoeffs
00367 (
00368 const tmp<Field<scalar> >&
00369 ) const
00370 {
00371 notImplemented
00372 (
00373 type()
00374 + "::valueInternalCoeffs(const tmp<Field<scalar> >&)"
00375 );
00376 return *this;
00377 }
00378
00379
00380
00381 virtual tmp<Field<Type> > valueBoundaryCoeffs
00382 (
00383 const tmp<Field<scalar> >&
00384 ) const
00385 {
00386 notImplemented
00387 (
00388 type()
00389 + "::valueBoundaryCoeffs(const tmp<Field<scalar> >&)"
00390 );
00391 return *this;
00392 }
00393
00394
00395
00396 virtual tmp<Field<Type> > gradientInternalCoeffs() const
00397 {
00398 notImplemented(type() + "::gradientInternalCoeffs()");
00399 return *this;
00400 }
00401
00402
00403
00404 virtual tmp<Field<Type> > gradientBoundaryCoeffs() const
00405 {
00406 notImplemented(type() + "::gradientBoundaryCoeffs()");
00407 return *this;
00408 }
00409
00410
00411
00412 virtual void write(Ostream&) const;
00413
00414
00415
00416
00417
00418 void check(const fvPatchField<Type>&) const;
00419
00420
00421
00422
00423 virtual void operator=(const UList<Type>&);
00424
00425 virtual void operator=(const fvPatchField<Type>&);
00426 virtual void operator+=(const fvPatchField<Type>&);
00427 virtual void operator-=(const fvPatchField<Type>&);
00428 virtual void operator*=(const fvPatchField<scalar>&);
00429 virtual void operator/=(const fvPatchField<scalar>&);
00430
00431 virtual void operator+=(const Field<Type>&);
00432 virtual void operator-=(const Field<Type>&);
00433
00434 virtual void operator*=(const Field<scalar>&);
00435 virtual void operator/=(const Field<scalar>&);
00436
00437 virtual void operator=(const Type&);
00438 virtual void operator+=(const Type&);
00439 virtual void operator-=(const Type&);
00440 virtual void operator*=(const scalar);
00441 virtual void operator/=(const scalar);
00442
00443
00444
00445
00446 virtual void operator==(const fvPatchField<Type>&);
00447 virtual void operator==(const Field<Type>&);
00448 virtual void operator==(const Type&);
00449
00450
00451
00452
00453 friend Ostream& operator<< <Type>(Ostream&, const fvPatchField<Type>&);
00454 };
00455
00456
00457
00458
00459 }
00460
00461
00462
00463 #ifdef NoRepository
00464 # include "fvPatchField.C"
00465 # include "calculatedFvPatchField.H"
00466 #endif
00467
00468
00469 #define makePatchTypeFieldTypeName(type) \
00470 \
00471 defineNamedTemplateTypeNameAndDebug(type, 0);
00472
00473 #define makePatchFieldsTypeName(type) \
00474 \
00475 makePatchTypeFieldTypeName(type##FvPatchScalarField); \
00476 makePatchTypeFieldTypeName(type##FvPatchVectorField); \
00477 makePatchTypeFieldTypeName(type##FvPatchTensorField); \
00478 makePatchTypeFieldTypeName(type##FvPatchSphericalTensorField);
00479
00480
00481 #define makePatchTypeField(PatchTypeField, typePatchTypeField) \
00482 \
00483 defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); \
00484 \
00485 addToRunTimeSelectionTable \
00486 ( \
00487 PatchTypeField, typePatchTypeField, patch \
00488 ); \
00489 \
00490 addToRunTimeSelectionTable \
00491 ( \
00492 PatchTypeField, \
00493 typePatchTypeField, \
00494 patchMapper \
00495 ); \
00496 \
00497 addToRunTimeSelectionTable \
00498 ( \
00499 PatchTypeField, typePatchTypeField, dictionary \
00500 );
00501
00502
00503 #define makePatchFields(type) \
00504 \
00505 makePatchTypeField(fvPatchScalarField, type##FvPatchScalarField); \
00506 makePatchTypeField(fvPatchVectorField, type##FvPatchVectorField); \
00507 makePatchTypeField(fvPatchTensorField, type##FvPatchTensorField); \
00508 makePatchTypeField(fvPatchSphericalTensorField, type##FvPatchSphericalTensorField);
00509
00510
00511 #define makePatchTypeFieldTypedefs(type) \
00512 \
00513 typedef type##FvPatchField<scalar> type##FvPatchScalarField; \
00514 typedef type##FvPatchField<vector> type##FvPatchVectorField; \
00515 typedef type##FvPatchField<tensor> type##FvPatchTensorField; \
00516 typedef type##FvPatchField<sphericalTensor> type##FvPatchSphericalTensorField;
00517
00518
00519
00520
00521 #endif
00522
00523