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
00052
00053
00054 template<class particleType>
00055 class particle;
00056
00057 template<class particleType>
00058 Ostream& operator<<
00059 (
00060 Ostream&,
00061 const particle<particleType>&
00062 );
00063
00064
00065
00066
00067
00068
00069 template<class particleType>
00070 class particle
00071 :
00072 public IDLList<particleType>::link
00073 {
00074
00075
00076
00077 const Cloud<particleType>& cloud_;
00078
00079
00080 vector position_;
00081
00082
00083 label celli_;
00084
00085
00086 bool onBoundary_;
00087
00088
00089
00090
00091
00092
00093
00094 inline scalar lambda
00095 (
00096 const vector& from,
00097 const vector& to,
00098 const label facei,
00099 const scalar fraction
00100 );
00101
00102
00103
00104
00105 inline scalar lambda
00106 (
00107 const vector& from,
00108 const vector& to,
00109 const label facei
00110 );
00111
00112
00113 labelList findFaces
00114 (
00115 const vector& position
00116 );
00117
00118
00119 labelList findFaces
00120 (
00121 const vector& position,
00122 const label celli,
00123 const scalar fraction
00124 );
00125
00126 protected:
00127
00128
00129
00130 void prepareForParallelTransfer
00131 (
00132 const label patchi,
00133 const label facei
00134 );
00135
00136
00137
00138 void correctAfterParallelTransfer
00139 (
00140 const label patchi,
00141 const label facei
00142 );
00143
00144
00145 public:
00146
00147 friend class Cloud<particleType>;
00148
00149
00150
00151 TypeName("particle");
00152
00153
00154
00155
00156
00157 particle
00158 (
00159 const Cloud<particleType>&,
00160 const vector& position,
00161 const label celli
00162 );
00163
00164
00165 particle
00166 (
00167 const Cloud<particleType>&,
00168 Istream&
00169 );
00170
00171
00172
00173
00174 virtual ~particle()
00175 {}
00176
00177
00178
00179
00180
00181
00182
00183 inline bool inCell();
00184
00185
00186 inline bool inCell
00187 (
00188 const vector& position,
00189 const label celli,
00190 const scalar fraction
00191 );
00192
00193
00194 inline const vector& position() const;
00195
00196
00197 inline label cell() const;
00198
00199
00200 inline const Cloud<particleType>& cloud() const;
00201
00202
00203
00204
00205
00206 inline bool onBoundary() const;
00207
00208
00209 inline label patch(const label facei) const;
00210
00211
00212 inline label patchFace(const label patchi, const label facei) const;
00213
00214
00215
00216 virtual scalar wallImpactDistance(const vector& n) const;
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226 label track
00227 (
00228 const vector& endPosition,
00229 scalar& fraction,
00230 const bool softAlgorithm = false
00231 );
00232
00233
00234
00235
00236
00237
00238
00239
00240 label trackToFace
00241 (
00242 const vector& endPosition,
00243 scalar& fraction,
00244 const bool softAlgorithm = false
00245 );
00246
00247
00248
00249
00250
00251
00252 void transformPosition(const tensor& T);
00253
00254
00255
00256 virtual void transformProperties(const tensor& T);
00257
00258
00259
00260
00261 friend Ostream& operator<< <particleType>
00262 (
00263 Ostream&,
00264 const particle<particleType>&
00265 );
00266 };
00267
00268
00269
00270
00271 }
00272
00273
00274
00275 #include "particleI.H"
00276
00277 #define defineParticleTypeNameAndDebug(Type, DebugSwitch) \
00278 template<> \
00279 const Foam::word particle<Type>::typeName(#Type); \
00280 template<> \
00281 int particle<Type>::debug(Foam::debug::debugSwitch(#Type, DebugSwitch));
00282
00283
00284
00285 #ifdef NoRepository
00286 # include "particle.C"
00287 #endif
00288
00289
00290
00291 #endif
00292
00293