Particle.H
Go to the documentation of this file.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 #ifndef Particle_H
00033 #define Particle_H
00034
00035 #include "vector.H"
00036 #include "IDLList.H"
00037 #include "labelList.H"
00038 #include "pointField.H"
00039 #include "faceList.H"
00040 #include "typeInfo.H"
00041 #include "OFstream.H"
00042
00043
00044
00045 namespace Foam
00046 {
00047
00048 template<class Particle>
00049 class Cloud;
00050
00051 class wedgePolyPatch;
00052 class symmetryPolyPatch;
00053 class cyclicPolyPatch;
00054 class processorPolyPatch;
00055 class wallPolyPatch;
00056 class polyPatch;
00057
00058
00059
00060 template<class ParticleType>
00061 class Particle;
00062
00063 template<class ParticleType>
00064 Ostream& operator<<
00065 (
00066 Ostream&,
00067 const Particle<ParticleType>&
00068 );
00069
00070
00071
00072
00073
00074
00075 template<class ParticleType>
00076 class Particle
00077 :
00078 public IDLList<ParticleType>::link
00079 {
00080
00081 public:
00082
00083
00084 class trackData
00085 {
00086
00087
00088
00089
00090 Cloud<ParticleType>& cloud_;
00091
00092
00093 public:
00094
00095 bool switchProcessor;
00096 bool keepParticle;
00097
00098
00099
00100
00101 inline trackData(Cloud<ParticleType>& cloud);
00102
00103
00104
00105
00106
00107 inline Cloud<ParticleType>& cloud();
00108 };
00109
00110
00111 protected:
00112
00113
00114
00115
00116 const Cloud<ParticleType>& cloud_;
00117
00118
00119 vector position_;
00120
00121
00122 label celli_;
00123
00124
00125 label facei_;
00126
00127
00128 scalar stepFraction_;
00129
00130
00131 label origProc_;
00132
00133
00134 label origId_;
00135
00136
00137
00138
00139
00140
00141
00142 inline scalar lambda
00143 (
00144 const vector& from,
00145 const vector& to,
00146 const label facei,
00147 const scalar stepFraction
00148 ) const;
00149
00150
00151
00152
00153 inline scalar lambda
00154 (
00155 const vector& from,
00156 const vector& to,
00157 const label facei
00158 ) const;
00159
00160
00161 void findFaces
00162 (
00163 const vector& position,
00164 DynamicList<label>& faceList
00165 ) const;
00166
00167
00168 void findFaces
00169 (
00170 const vector& position,
00171 const label celli,
00172 const scalar stepFraction,
00173 DynamicList<label>& faceList
00174 ) const;
00175
00176
00177
00178
00179
00180
00181 template<class TrackData>
00182 bool hitPatch
00183 (
00184 const polyPatch&,
00185 TrackData& td,
00186 const label patchI
00187 );
00188
00189
00190 template<class TrackData>
00191 void hitWedgePatch
00192 (
00193 const wedgePolyPatch&,
00194 TrackData& td
00195 );
00196
00197
00198
00199 template<class TrackData>
00200 void hitSymmetryPatch
00201 (
00202 const symmetryPolyPatch&,
00203 TrackData& td
00204 );
00205
00206
00207 template<class TrackData>
00208 void hitCyclicPatch
00209 (
00210 const cyclicPolyPatch&,
00211 TrackData& td
00212 );
00213
00214
00215
00216 template<class TrackData>
00217 void hitProcessorPatch
00218 (
00219 const processorPolyPatch&,
00220 TrackData& td
00221 );
00222
00223
00224 template<class TrackData>
00225 void hitWallPatch
00226 (
00227 const wallPolyPatch&,
00228 TrackData& td
00229 );
00230
00231
00232
00233 template<class TrackData>
00234 void hitPatch
00235 (
00236 const polyPatch&,
00237 TrackData& td
00238 );
00239
00240
00241
00242
00243
00244
00245 virtual void transformPosition(const tensor& T);
00246
00247
00248
00249 virtual void transformProperties(const tensor& T);
00250
00251
00252
00253 virtual void transformProperties(const vector& separation);
00254
00255
00256
00257
00258
00259
00260 template<class TrackData>
00261 void prepareForParallelTransfer(const label patchi, TrackData& td);
00262
00263
00264
00265 template<class TrackData>
00266 void correctAfterParallelTransfer(const label patchi, TrackData& td);
00267
00268
00269 public:
00270
00271 friend class Cloud<ParticleType>;
00272
00273
00274
00275
00276
00277 TypeName("Particle");
00278
00279
00280 static string propHeader;
00281
00282
00283
00284
00285
00286 Particle
00287 (
00288 const Cloud<ParticleType>&,
00289 const vector& position,
00290 const label celli
00291 );
00292
00293
00294 Particle
00295 (
00296 const Cloud<ParticleType>&,
00297 Istream&,
00298 bool readFields = true
00299 );
00300
00301
00302 Particle(const Particle& p);
00303
00304
00305 autoPtr<ParticleType> clone() const
00306 {
00307 return autoPtr<Particle>(new Particle(*this));
00308 }
00309
00310
00311
00312
00313 class iNew
00314 {
00315
00316
00317
00318 const Cloud<ParticleType>& cloud_;
00319
00320
00321 public:
00322
00323 iNew(const Cloud<ParticleType>& cloud)
00324 :
00325 cloud_(cloud)
00326 {}
00327
00328 autoPtr<ParticleType> operator()(Istream& is) const
00329 {
00330 return autoPtr<ParticleType>
00331 (
00332 new ParticleType
00333 (
00334 cloud_,
00335 is,
00336 true
00337 )
00338 );
00339 }
00340 };
00341
00342
00343
00344 virtual ~Particle()
00345 {}
00346
00347
00348
00349
00350
00351
00352
00353 inline bool inCell() const;
00354
00355
00356 inline bool inCell
00357 (
00358 const vector& position,
00359 const label celli,
00360 const scalar stepFraction
00361 ) const;
00362
00363
00364 inline const vector& position() const;
00365
00366
00367 inline vector& position();
00368
00369
00370 inline label& cell();
00371
00372
00373 inline label cell() const;
00374
00375
00376 inline label face() const;
00377
00378
00379 inline const Cloud<ParticleType>& cloud() const;
00380
00381
00382 inline bool softImpact() const;
00383
00384
00385 inline scalar currentTime() const;
00386
00387
00388
00389
00390
00391 inline bool onBoundary() const;
00392
00393
00394 inline label patch(const label facei) const;
00395
00396
00397 inline label patchFace
00398 (
00399 const label patchi,
00400 const label facei
00401 ) const;
00402
00403
00404
00405 inline scalar wallImpactDistance(const vector& n) const;
00406
00407
00408 inline scalar& stepFraction();
00409
00410
00411 inline scalar stepFraction() const;
00412
00413
00414 inline label origProc() const;
00415
00416
00417 inline label origId() const;
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429 template<class TrackData>
00430 label track
00431 (
00432 const vector& endPosition,
00433 TrackData& td
00434 );
00435
00436
00437 label track(const vector& endPosition);
00438
00439
00440
00441
00442
00443
00444
00445 template<class TrackData>
00446 scalar trackToFace
00447 (
00448 const vector& endPosition,
00449 TrackData& td
00450 );
00451
00452
00453 scalar trackToFace(const vector& endPosition);
00454
00455
00456
00457 inline label faceInterpolation() const;
00458
00459
00460
00461
00462
00463 static void readFields(Cloud<ParticleType>& c);
00464
00465
00466 static void writeFields(const Cloud<ParticleType>& c);
00467
00468
00469 void write(Ostream& os, bool writeFields) const;
00470
00471
00472
00473 friend Ostream& operator<< <ParticleType>
00474 (
00475 Ostream&,
00476 const Particle<ParticleType>&
00477 );
00478 };
00479
00480
00481
00482
00483 }
00484
00485
00486
00487 #include "ParticleI.H"
00488
00489 #define defineParticleTypeNameAndDebug(Type, DebugSwitch) \
00490 template<> \
00491 const Foam::word Particle<Type>::typeName(#Type); \
00492 template<> \
00493 int Particle<Type>::debug(Foam::debug::debugSwitch(#Type, DebugSwitch));
00494
00495
00496
00497 #ifdef NoRepository
00498 # include "Particle.C"
00499 #endif
00500
00501
00502
00503 #endif
00504
00505
Copyright © 2000-2009 OpenCFD Ltd