wallPointI.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
00030
00031
00032
00033 inline bool Foam::wallPoint::update
00034 (
00035 const point& pt,
00036 const wallPoint& w2,
00037 const scalar tol
00038 )
00039 {
00040
00041
00042
00043
00044
00045
00046
00047 scalar dist2 = magSqr(pt - w2.origin());
00048
00049 if (!valid())
00050 {
00051
00052 distSqr_ = dist2;
00053 origin_ = w2.origin();
00054
00055 return true;
00056 }
00057
00058 scalar diff = distSqr_ - dist2;
00059
00060 if (diff < 0)
00061 {
00062
00063 return false;
00064 }
00065
00066 if ((diff < SMALL) || ((distSqr_ > SMALL) && (diff/distSqr_ < tol)))
00067 {
00068
00069 return false;
00070 }
00071 else
00072 {
00073
00074 distSqr_ = dist2;
00075 origin_ = w2.origin();
00076
00077 return true;
00078 }
00079 }
00080
00081
00082
00083
00084
00085 inline Foam::wallPoint::wallPoint()
00086 :
00087 origin_(greatPoint),
00088 distSqr_(GREAT)
00089 {}
00090
00091
00092
00093 inline Foam::wallPoint::wallPoint(const point& origin, const scalar distSqr)
00094 :
00095 origin_(origin), distSqr_(distSqr)
00096 {}
00097
00098
00099
00100 inline Foam::wallPoint::wallPoint(const wallPoint& wpt)
00101 :
00102 origin_(wpt.origin()), distSqr_(wpt.distSqr())
00103 {}
00104
00105
00106
00107
00108 inline const Foam::point& Foam::wallPoint::origin() const
00109 {
00110 return origin_;
00111 }
00112
00113
00114 inline Foam::point& Foam::wallPoint::origin()
00115 {
00116 return origin_;
00117 }
00118
00119
00120 inline Foam::scalar Foam::wallPoint::distSqr() const
00121 {
00122 return distSqr_;
00123 }
00124
00125
00126 inline Foam::scalar& Foam::wallPoint::distSqr()
00127 {
00128 return distSqr_;
00129 }
00130
00131
00132 inline bool Foam::wallPoint::valid() const
00133 {
00134 return origin_ != greatPoint;
00135 }
00136
00137
00138
00139 inline bool Foam::wallPoint::sameGeometry
00140 (
00141 const polyMesh&,
00142 const wallPoint& w2,
00143 const scalar tol
00144 )
00145 const
00146 {
00147 scalar diff = mag(distSqr() - w2.distSqr());
00148
00149 if (diff < SMALL)
00150 {
00151 return true;
00152 }
00153 else
00154 {
00155 if ((distSqr() > SMALL) && ((diff/distSqr()) < tol))
00156 {
00157 return true;
00158 }
00159 else
00160 {
00161 return false;
00162 }
00163 }
00164 }
00165
00166
00167 inline void Foam::wallPoint::leaveDomain
00168 (
00169 const polyMesh&,
00170 const polyPatch&,
00171 const label,
00172 const point& faceCentre
00173 )
00174 {
00175 origin_ -= faceCentre;
00176 }
00177
00178
00179 inline void Foam::wallPoint::transform
00180 (
00181 const polyMesh&,
00182 const tensor& rotTensor
00183 )
00184 {
00185 origin_ = Foam::transform(rotTensor, origin_);
00186 }
00187
00188
00189
00190
00191 inline void Foam::wallPoint::enterDomain
00192 (
00193 const polyMesh&,
00194 const polyPatch&,
00195 const label,
00196 const point& faceCentre
00197 )
00198 {
00199
00200 origin_ += faceCentre;
00201 }
00202
00203
00204
00205 inline bool Foam::wallPoint::updateCell
00206 (
00207 const polyMesh& mesh,
00208 const label thisCellI,
00209 const label neighbourFaceI,
00210 const wallPoint& neighbourWallInfo,
00211 const scalar tol
00212 )
00213 {
00214 return
00215 update
00216 (
00217 mesh.cellCentres()[thisCellI],
00218 neighbourWallInfo,
00219 tol
00220 );
00221 }
00222
00223
00224
00225 inline bool Foam::wallPoint::updateFace
00226 (
00227 const polyMesh& mesh,
00228 const label thisFaceI,
00229 const label neighbourCellI,
00230 const wallPoint& neighbourWallInfo,
00231 const scalar tol
00232 )
00233 {
00234 return
00235 update
00236 (
00237 mesh.faceCentres()[thisFaceI],
00238 neighbourWallInfo,
00239 tol
00240 );
00241 }
00242
00243
00244 inline bool Foam::wallPoint::updateFace
00245 (
00246 const polyMesh& mesh,
00247 const label thisFaceI,
00248 const wallPoint& neighbourWallInfo,
00249 const scalar tol
00250 )
00251 {
00252 return
00253 update
00254 (
00255 mesh.faceCentres()[thisFaceI],
00256 neighbourWallInfo,
00257 tol
00258 );
00259 }
00260
00261
00262
00263
00264 inline bool Foam::wallPoint::operator==(const Foam::wallPoint& rhs) const
00265 {
00266 return origin() == rhs.origin();
00267 }
00268
00269
00270 inline bool Foam::wallPoint::operator!=(const Foam::wallPoint& rhs) const
00271 {
00272 return !(*this == rhs);
00273 }
00274
00275
00276
Copyright © 2000-2009 OpenCFD Ltd