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
00033
00034
00035
00036
00037 #ifndef coordinateSystem_H
00038 #define coordinateSystem_H
00039
00040 #include "vector.H"
00041 #include "point.H"
00042 #include "tensor.H"
00043 #include "vectorField.H"
00044 #include "pointField.H"
00045 #include "tmp.H"
00046 #include "coordinateRotation.H"
00047 #include "objectRegistry.H"
00048
00049
00050
00051 namespace Foam
00052 {
00053
00054
00055
00056
00057
00058 class coordinateSystem
00059 {
00060
00061
00062
00063 mutable word name_;
00064
00065
00066 mutable point origin_;
00067
00068
00069 coordinateRotation R_;
00070
00071
00072 tensor Rtr_;
00073
00074 protected:
00075
00076
00077
00078
00079
00080 virtual vector localToGlobal(const vector&, bool translate) const;
00081
00082
00083
00084 virtual tmp<vectorField> localToGlobal
00085 (
00086 const vectorField&,
00087 bool translate
00088 ) const;
00089
00090
00091
00092 virtual vector globalToLocal(const vector&, bool translate) const;
00093
00094
00095
00096 virtual tmp<vectorField> globalToLocal
00097 (
00098 const vectorField&,
00099 bool translate
00100 ) const;
00101
00102 public:
00103
00104
00105 TypeName("coordinateSystem");
00106
00107
00108
00109
00110
00111 coordinateSystem();
00112
00113
00114 coordinateSystem
00115 (
00116 const word& name,
00117 const point& origin,
00118 const vector& axis,
00119 const vector& dir
00120 );
00121
00122
00123 coordinateSystem
00124 (
00125 const word& name,
00126 const point& origin,
00127 const coordinateRotation&
00128 );
00129
00130
00131 coordinateSystem(const dictionary&);
00132
00133
00134 coordinateSystem(const word& name, const dictionary&);
00135
00136
00137 coordinateSystem(Istream&);
00138
00139
00140 autoPtr<coordinateSystem> clone() const
00141 {
00142 return autoPtr<coordinateSystem>
00143 (
00144 new coordinateSystem
00145 (
00146 name(),
00147 origin(),
00148 rotation()
00149 )
00150 );
00151 }
00152
00153
00154
00155 declareRunTimeSelectionTable
00156 (
00157 autoPtr,
00158 coordinateSystem,
00159 origAxisDir,
00160 (
00161 const word& name,
00162 const point& origin,
00163 const vector& axis,
00164 const vector& dir
00165 ),
00166 (name, origin, axis, dir)
00167 );
00168
00169 declareRunTimeSelectionTable
00170 (
00171 autoPtr,
00172 coordinateSystem,
00173 origRotation,
00174 (
00175 const word& name,
00176 const point& origin,
00177 const coordinateRotation& cr
00178 ),
00179 (name, origin, cr)
00180 );
00181
00182 declareRunTimeSelectionTable
00183 (
00184 autoPtr,
00185 coordinateSystem,
00186 dictionary,
00187 (
00188 const word& name,
00189 const dictionary& dict
00190 ),
00191 (name, dict)
00192 );
00193
00194
00195
00196
00197
00198 static autoPtr<coordinateSystem> New
00199 (
00200 const word& coordType,
00201 const word& name,
00202 const point& origin,
00203 const vector& axis,
00204 const vector& dir
00205 );
00206
00207
00208 static autoPtr<coordinateSystem> New
00209 (
00210 const word& coordType,
00211 const word& name,
00212 const point& origin,
00213 const coordinateRotation& cr
00214 );
00215
00216
00217 static autoPtr<coordinateSystem> New
00218 (
00219 const word& name,
00220 const dictionary& dict
00221 );
00222
00223
00224 static autoPtr<coordinateSystem> New(Istream& is);
00225
00226
00227
00228 virtual ~coordinateSystem();
00229
00230
00231
00232
00233
00234
00235
00236 const word& name() const
00237 {
00238 return name_;
00239 }
00240
00241
00242 const point& origin() const
00243 {
00244 return origin_;
00245 }
00246
00247
00248 const coordinateRotation& rotation() const
00249 {
00250 return R_;
00251 }
00252
00253
00254 const tensor& R() const
00255 {
00256 return R_;
00257 }
00258
00259
00260 const vector& e1() const
00261 {
00262 return Rtr_.x();
00263 }
00264
00265
00266 const vector& e2() const
00267 {
00268 return Rtr_.y();
00269 }
00270
00271
00272 const vector& e3() const
00273 {
00274 return Rtr_.z();
00275 }
00276
00277
00278 const vector& axis() const
00279 {
00280 return Rtr_.z();
00281 }
00282
00283
00284 const vector& direction() const
00285 {
00286 return Rtr_.x();
00287 }
00288
00289
00290 virtual dictionary dict(bool ignoreType = false) const;
00291
00292
00293
00294
00295
00296 virtual void rename(const word& newName)
00297 {
00298 name_ = newName;
00299 }
00300
00301
00302 point& origin()
00303 {
00304 return origin_;
00305 }
00306
00307
00308
00309
00310 virtual void write(Ostream&) const;
00311
00312
00313 virtual void writeDict(Ostream&, bool subDict = true) const;
00314
00315
00316
00317
00318 point globalPosition(const point& local) const
00319 {
00320 return localToGlobal(local, true);
00321 }
00322
00323
00324 tmp<pointField> globalPosition(const pointField& local) const
00325 {
00326 return localToGlobal(local, true);
00327 }
00328
00329
00330 vector globalVector(const vector& local) const
00331 {
00332 return localToGlobal(local, false);
00333 }
00334
00335
00336 tmp<vectorField> globalVector(const vectorField& local) const
00337 {
00338 return localToGlobal(local, false);
00339 }
00340
00341
00342 point localPosition(const point& global) const
00343 {
00344 return globalToLocal(global, true);
00345 }
00346
00347
00348 tmp<pointField> localPosition(const pointField& global) const
00349 {
00350 return globalToLocal(global, true);
00351 }
00352
00353
00354 vector localVector(const vector& global) const
00355 {
00356 return globalToLocal(global, false);
00357 }
00358
00359
00360 tmp<vectorField> localVector(const vectorField& global) const
00361 {
00362 return globalToLocal(global, false);
00363 }
00364
00365
00366
00367
00368
00369 void operator=(const dictionary&);
00370
00371
00372
00373
00374 friend bool operator!=(const coordinateSystem&, const coordinateSystem&);
00375
00376
00377
00378 friend Ostream& operator<<(Ostream&, const coordinateSystem&);
00379 };
00380
00381
00382
00383
00384 }
00385
00386
00387
00388 #endif
00389
00390
Copyright © 2000-2007 OpenCFD Ltd