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(const wallPoint& w2, const scalar tol)
00140 const
00141 {
00142 scalar diff = mag(distSqr() - w2.distSqr());
00143
00144 if (diff < SMALL)
00145 {
00146 return true;
00147 }
00148 else
00149 {
00150 if ((distSqr() > SMALL) && ((diff/distSqr()) < tol))
00151 {
00152 return true;
00153 }
00154 else
00155 {
00156 return false;
00157 }
00158 }
00159 }
00160
00161
00162 inline void Foam::wallPoint::leaveDomain
00163 (
00164 const polyPatch&,
00165 const label,
00166 const point& faceCentre
00167 )
00168 {
00169 origin_ -= faceCentre;
00170 }
00171
00172
00173 inline void Foam::wallPoint::transform
00174 (
00175 const tensor& rotTensor
00176 )
00177 {
00178 origin_ = Foam::transform(rotTensor, origin_);
00179 }
00180
00181
00182
00183
00184 inline void Foam::wallPoint::enterDomain
00185 (
00186 const polyPatch&,
00187 const label,
00188 const point& faceCentre
00189 )
00190 {
00191
00192 origin_ += faceCentre;
00193 }
00194
00195
00196
00197 inline bool Foam::wallPoint::updateCell
00198 (
00199 const polyMesh& mesh,
00200 const label thisCellI,
00201 const label neighbourFaceI,
00202 const wallPoint& neighbourWallInfo,
00203 const scalar tol
00204 )
00205 {
00206 const vectorField& cellCentres = mesh.primitiveMesh::cellCentres();
00207
00208 return
00209 update
00210 (
00211 cellCentres[thisCellI],
00212 neighbourWallInfo,
00213 tol
00214 );
00215 }
00216
00217
00218
00219 inline bool Foam::wallPoint::updateFace
00220 (
00221 const polyMesh& mesh,
00222 const label thisFaceI,
00223 const label neighbourCellI,
00224 const wallPoint& neighbourWallInfo,
00225 const scalar tol
00226 )
00227 {
00228 const vectorField& faceCentres = mesh.faceCentres();
00229
00230 return
00231 update
00232 (
00233 faceCentres[thisFaceI],
00234 neighbourWallInfo,
00235 tol
00236 );
00237 }
00238
00239
00240 inline bool Foam::wallPoint::updateFace
00241 (
00242 const polyMesh& mesh,
00243 const label thisFaceI,
00244 const wallPoint& neighbourWallInfo,
00245 const scalar tol
00246 )
00247 {
00248 const vectorField& faceCentres = mesh.faceCentres();
00249
00250 return
00251 update
00252 (
00253 faceCentres[thisFaceI],
00254 neighbourWallInfo,
00255 tol
00256 );
00257 }
00258
00259
00260
00261
00262 inline bool Foam::wallPoint::operator==(const Foam::wallPoint& rhs) const
00263 {
00264 return origin() == rhs.origin();
00265 }
00266
00267
00268 inline bool Foam::wallPoint::operator!=(const Foam::wallPoint& rhs) const
00269 {
00270 return !(*this == rhs);
00271 }
00272
00273
00274