pointDataI.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 #include "polyMesh.H"
00028 #include "transform.H"
00029 #include "wallPoint.H"
00030
00031
00032
00033
00034 inline bool Foam::pointData::update
00035 (
00036 const point& pt,
00037 const pointData& w2,
00038 const scalar tol
00039 )
00040 {
00041 scalar dist2 = magSqr(pt - w2.origin());
00042
00043 if (!valid())
00044 {
00045 distSqr_ = dist2;
00046 origin_ = w2.origin();
00047 s_ = w2.s();
00048 v_ = w2.v();
00049
00050 return true;
00051 }
00052
00053
00054
00055
00056
00057
00058
00059
00060 scalar diff = distSqr_ - dist2;
00061
00062 if (diff < 0)
00063 {
00064
00065 return false;
00066 }
00067
00068 if ((diff < SMALL) || ((distSqr_ > SMALL) && (diff/distSqr_ < tol)))
00069 {
00070
00071 return false;
00072 }
00073 else
00074 {
00075
00076 distSqr_ = dist2;
00077 origin_ = w2.origin();
00078 s_ = w2.s();
00079 v_ = w2.v();
00080
00081 return true;
00082 }
00083 }
00084
00085
00086
00087 inline bool Foam::pointData::update
00088 (
00089 const pointData& w2,
00090 const scalar tol
00091 )
00092 {
00093 if (!valid())
00094 {
00095
00096 distSqr_ = w2.distSqr();
00097 origin_ = w2.origin();
00098 s_ = w2.s();
00099 v_ = w2.v();
00100 return true;
00101 }
00102
00103
00104
00105
00106
00107
00108
00109
00110 scalar diff = distSqr_ - w2.distSqr();
00111
00112 if (diff < 0)
00113 {
00114
00115 return false;
00116 }
00117
00118 if ((diff < SMALL) || ((distSqr_ > SMALL) && (diff/distSqr_ < tol)))
00119 {
00120
00121 return false;
00122 }
00123 else
00124 {
00125
00126 distSqr_ = w2.distSqr();
00127 origin_ = w2.origin();
00128 s_ = w2.s();
00129 v_ = w2.v();
00130
00131 return true;
00132 }
00133 }
00134
00135
00136
00137
00138
00139 inline Foam::pointData::pointData()
00140 :
00141 origin_(wallPoint::greatPoint),
00142 distSqr_(GREAT),
00143 s_(GREAT),
00144 v_(wallPoint::greatPoint)
00145 {}
00146
00147
00148
00149 inline Foam::pointData::pointData
00150 (
00151 const point& origin,
00152 const scalar distSqr,
00153 const scalar s,
00154 const vector& v
00155 )
00156 :
00157 origin_(origin),
00158 distSqr_(distSqr),
00159 s_(s),
00160 v_(v)
00161 {}
00162
00163
00164
00165 inline Foam::pointData::pointData(const pointData& wpt)
00166 :
00167 origin_(wpt.origin()),
00168 distSqr_(wpt.distSqr()),
00169 s_(wpt.s()),
00170 v_(wpt.v())
00171 {}
00172
00173
00174
00175
00176 inline const Foam::point& Foam::pointData::origin() const
00177 {
00178 return origin_;
00179 }
00180
00181
00182 inline Foam::scalar Foam::pointData::distSqr() const
00183 {
00184 return distSqr_;
00185 }
00186
00187
00188 inline Foam::scalar Foam::pointData::s() const
00189 {
00190 return s_;
00191 }
00192
00193
00194 inline const Foam::vector& Foam::pointData::v() const
00195 {
00196 return v_;
00197 }
00198
00199
00200 inline bool Foam::pointData::valid() const
00201 {
00202 return origin_ != wallPoint::greatPoint;
00203 }
00204
00205
00206
00207 inline bool Foam::pointData::sameGeometry
00208 (
00209 const pointData& w2,
00210 const scalar tol
00211 ) const
00212 {
00213 scalar diff = Foam::mag(distSqr() - w2.distSqr());
00214
00215 if (diff < SMALL)
00216 {
00217 return true;
00218 }
00219 else
00220 {
00221 if ((distSqr() > SMALL) && ((diff/distSqr()) < tol))
00222 {
00223 return true;
00224 }
00225 else
00226 {
00227 return false;
00228 }
00229 }
00230 }
00231
00232
00233 inline void Foam::pointData::leaveDomain
00234 (
00235 const polyPatch& patch,
00236 const label patchPointI,
00237 const point& coord
00238 )
00239 {
00240 origin_ -= coord;
00241 }
00242
00243
00244 inline void Foam::pointData::transform(const tensor& rotTensor)
00245 {
00246 origin_ = Foam::transform(rotTensor, origin_);
00247 }
00248
00249
00250
00251
00252 inline void Foam::pointData::enterDomain
00253 (
00254 const polyPatch& patch,
00255 const label patchPointI,
00256 const point& coord
00257 )
00258 {
00259
00260 origin_ += coord;
00261 }
00262
00263
00264
00265 inline bool Foam::pointData::updatePoint
00266 (
00267 const polyMesh& mesh,
00268 const label pointI,
00269 const label edgeI,
00270 const pointData& edgeInfo,
00271 const scalar tol
00272 )
00273 {
00274 return
00275 update
00276 (
00277 mesh.points()[pointI],
00278 edgeInfo,
00279 tol
00280 );
00281 }
00282
00283
00284
00285 inline bool Foam::pointData::updatePoint
00286 (
00287 const polyMesh& mesh,
00288 const label pointI,
00289 const pointData& newPointInfo,
00290 const scalar tol
00291 )
00292 {
00293 return
00294 update
00295 (
00296 mesh.points()[pointI],
00297 newPointInfo,
00298 tol
00299 );
00300 }
00301
00302
00303
00304 inline bool Foam::pointData::updatePoint
00305 (
00306 const pointData& newPointInfo,
00307 const scalar tol
00308 )
00309 {
00310 return update(newPointInfo, tol);
00311 }
00312
00313
00314
00315 inline bool Foam::pointData::updateEdge
00316 (
00317 const polyMesh& mesh,
00318 const label edgeI,
00319 const label pointI,
00320 const pointData& pointInfo,
00321 const scalar tol
00322 )
00323 {
00324 const pointField& points = mesh.points();
00325
00326 const edge& e = mesh.edges()[edgeI];
00327
00328 const point edgeMid(0.5*(points[e[0]] + points[e[1]]));
00329
00330 return
00331 update
00332 (
00333 edgeMid,
00334 pointInfo,
00335 tol
00336 );
00337 }
00338
00339
00340
00341
00342 inline bool Foam::pointData::operator==(const pointData& rhs) const
00343 {
00344 return origin() == rhs.origin();
00345 }
00346
00347
00348 inline bool Foam::pointData::operator!=(const pointData& rhs) const
00349 {
00350 return !(*this == rhs);
00351 }
00352
00353
00354
Copyright © 2000-2009 OpenCFD Ltd