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