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