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
00082
00083 const Cloud<particleType>& cloud_;
00084
00085
00086 vector position_;
00087
00088
00089 label celli_;
00090
00091
00092 label facei_;
00093
00094
00095 scalar stepFraction_;
00096
00097
00098
00099
00100
00101
00102
00103 inline scalar lambda
00104 (
00105 const vector& from,
00106 const vector& to,
00107 const label facei,
00108 const scalar stepFraction
00109 );
00110
00111
00112
00113
00114 inline scalar lambda
00115 (
00116 const vector& from,
00117 const vector& to,
00118 const label facei
00119 );
00120
00121
00122 labelList findFaces
00123 (
00124 const vector& position
00125 );
00126
00127
00128 labelList findFaces
00129 (
00130 const vector& position,
00131 const label celli,
00132 const scalar stepFraction
00133 );
00134
00135
00136 protected:
00137
00138
00139 template<class TrackingData>
00140 void hitWedgePatch
00141 (
00142 const wedgePolyPatch&,
00143 TrackingData& td
00144 );
00145
00146
00147 template<class TrackingData>
00148 void hitSymmetryPatch
00149 (
00150 const symmetryPolyPatch&,
00151 TrackingData& td
00152 );
00153
00154
00155 template<class TrackingData>
00156 void hitCyclicPatch
00157 (
00158 const cyclicPolyPatch&,
00159 TrackingData& td
00160 );
00161
00162
00163 template<class TrackingData>
00164 void hitProcessorPatch
00165 (
00166 const processorPolyPatch&,
00167 TrackingData& td
00168 );
00169
00170
00171 template<class TrackingData>
00172 void hitWallPatch
00173 (
00174 const wallPolyPatch&,
00175 TrackingData& td
00176 );
00177
00178
00179 template<class TrackingData>
00180 void hitPatch
00181 (
00182 const polyPatch&,
00183 TrackingData& td
00184 );
00185
00186
00187
00188 void transformPosition(const tensor& T);
00189
00190
00191
00192 void transformProperties(const tensor& T);
00193
00194
00195
00196 void transformProperties(const vector& separation);
00197
00198
00199
00200 template<class TrackingData>
00201 void prepareForParallelTransfer(const label patchi, TrackingData& td);
00202
00203
00204
00205 template<class TrackingData>
00206 void correctAfterParallelTransfer(const label patchi, TrackingData& td);
00207
00208
00209 public:
00210
00211 friend class Cloud<particleType>;
00212
00213
00214
00215 TypeName("particle");
00216
00217
00218
00219
00220
00221 particle
00222 (
00223 const Cloud<particleType>&,
00224 const vector& position,
00225 const label celli
00226 );
00227
00228
00229 particle
00230 (
00231 const Cloud<particleType>&,
00232 Istream&,
00233 bool readFields = true
00234 );
00235
00236
00237 class iNew
00238 {
00239 const Cloud<particleType>& cloud_;
00240
00241 public:
00242
00243 iNew(const Cloud<particleType>& cloud)
00244 :
00245 cloud_(cloud)
00246 {}
00247
00248 autoPtr<particleType> operator()(Istream& is) const
00249 {
00250 return autoPtr<particleType>(new particleType(cloud_, is));
00251 }
00252 };
00253
00254
00255
00256
00257 virtual ~particle()
00258 {}
00259
00260
00261
00262
00263
00264
00265
00266 inline bool inCell();
00267
00268
00269 inline bool inCell
00270 (
00271 const vector& position,
00272 const label celli,
00273 const scalar stepFraction
00274 );
00275
00276
00277 inline const vector& position() const;
00278
00279
00280 inline label cell() const;
00281
00282
00283 inline label face() const;
00284
00285
00286 inline const Cloud<particleType>& cloud() const;
00287
00288
00289 inline bool softImpact() const;
00290
00291
00292
00293
00294
00295 inline bool onBoundary() const;
00296
00297
00298 inline label patch(const label facei) const;
00299
00300
00301 inline label patchFace(const label patchi, const label facei) const;
00302
00303
00304
00305 inline scalar wallImpactDistance(const vector& n) const;
00306
00307
00308 inline scalar& stepFraction();
00309
00310
00311 inline scalar stepFraction() const;
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323 template<class TrackingData>
00324 label track
00325 (
00326 const vector& endPosition,
00327 TrackingData& td
00328 );
00329
00330
00331 label track(const vector& endPosition);
00332
00333
00334
00335
00336
00337
00338
00339 template<class TrackingData>
00340 scalar trackToFace
00341 (
00342 const vector& endPosition,
00343 TrackingData& td
00344 );
00345
00346
00347 scalar trackToFace(const vector& endPosition);
00348
00349
00350
00351
00352 friend Ostream& operator<< <particleType>
00353 (
00354 Ostream&,
00355 const particle<particleType>&
00356 );
00357 };
00358
00359
00360
00361
00362 }
00363
00364
00365
00366 #include "particleI.H"
00367
00368 #define defineParticleTypeNameAndDebug(Type, DebugSwitch) \
00369 template<> \
00370 const Foam::word particle<Type>::typeName(#Type); \
00371 template<> \
00372 int particle<Type>::debug(Foam::debug::debugSwitch(#Type, DebugSwitch));
00373
00374
00375
00376 #ifdef NoRepository
00377 # include "particle.C"
00378 #endif
00379
00380
00381
00382 #endif
00383
00384
Copyright © 2000-2007 OpenCFD Ltd