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
00038
00039 #ifndef dimensionSet_H
00040 #define dimensionSet_H
00041
00042 #include <OpenFOAM/scalar.H>
00043 #include <OpenFOAM/bool.H>
00044 #include <OpenFOAM/dimensionedScalarFwd.H>
00045 #include <OpenFOAM/className.H>
00046
00047
00048
00049 namespace Foam
00050 {
00051
00052
00053
00054 class dimensionSet;
00055
00056
00057
00058 dimensionSet max(const dimensionSet&, const dimensionSet&);
00059 dimensionSet min(const dimensionSet&, const dimensionSet&);
00060 dimensionSet cmptMultiply(const dimensionSet&, const dimensionSet&);
00061 dimensionSet cmptDivide(const dimensionSet&, const dimensionSet&);
00062
00063 dimensionSet pow(const dimensionSet&, const scalar);
00064 dimensionSet pow(const dimensionSet&, const dimensionedScalar&);
00065 dimensionSet pow(const dimensionedScalar&, const dimensionSet&);
00066
00067 dimensionSet sqr(const dimensionSet&);
00068 dimensionSet pow3(const dimensionSet&);
00069 dimensionSet pow4(const dimensionSet&);
00070 dimensionSet pow5(const dimensionSet&);
00071 dimensionSet pow6(const dimensionSet&);
00072
00073 dimensionSet sqrt(const dimensionSet&);
00074 dimensionSet magSqr(const dimensionSet&);
00075 dimensionSet mag(const dimensionSet&);
00076 dimensionSet sign(const dimensionSet&);
00077 dimensionSet pos(const dimensionSet&);
00078 dimensionSet neg(const dimensionSet&);
00079 dimensionSet inv(const dimensionSet&);
00080
00081
00082
00083 dimensionSet trans(const dimensionSet&);
00084
00085
00086 dimensionSet transform(const dimensionSet&);
00087
00088
00089
00090 dimensionSet operator-(const dimensionSet&);
00091 dimensionSet operator+(const dimensionSet&, const dimensionSet&);
00092 dimensionSet operator-(const dimensionSet&, const dimensionSet&);
00093 dimensionSet operator*(const dimensionSet&, const dimensionSet&);
00094 dimensionSet operator/(const dimensionSet&, const dimensionSet&);
00095 dimensionSet operator&(const dimensionSet&, const dimensionSet&);
00096 dimensionSet operator^(const dimensionSet&, const dimensionSet&);
00097 dimensionSet operator&&(const dimensionSet&, const dimensionSet&);
00098
00099
00100
00101 Istream& operator>>(Istream&, dimensionSet&);
00102 Ostream& operator<<(Ostream&, const dimensionSet&);
00103
00104
00105
00106
00107
00108
00109 class dimensionSet
00110 {
00111
00112 public:
00113
00114
00115
00116 enum
00117 {
00118 nDimensions = 7
00119 };
00120
00121
00122 enum dimensionType
00123 {
00124 MASS,
00125 LENGTH,
00126 TIME,
00127 TEMPERATURE,
00128 MOLES,
00129 CURRENT,
00130 LUMINOUS_INTENSITY
00131 };
00132
00133
00134
00135
00136 static const scalar smallExponent;
00137
00138
00139 private:
00140
00141
00142
00143
00144 scalar exponents_[nDimensions];
00145
00146
00147 public:
00148
00149
00150 ClassName("dimensionSet");
00151
00152
00153
00154
00155
00156
00157 dimensionSet
00158 (
00159 const scalar mass,
00160 const scalar length,
00161 const scalar time,
00162 const scalar temperature,
00163 const scalar moles,
00164 const scalar current,
00165 const scalar luminousIntensity
00166 );
00167
00168
00169
00170 dimensionSet
00171 (
00172 const scalar mass,
00173 const scalar length,
00174 const scalar time,
00175 const scalar temperature,
00176 const scalar moles
00177 );
00178
00179
00180 dimensionSet(Istream&);
00181
00182
00183
00184
00185 bool dimensionless() const;
00186 void reset(const dimensionSet&);
00187
00188
00189
00190
00191 scalar operator[](const dimensionType) const;
00192 scalar& operator[](const dimensionType);
00193 bool operator==(const dimensionSet&) const;
00194 bool operator!=(const dimensionSet&) const;
00195
00196 bool operator=(const dimensionSet&) const;
00197
00198 bool operator+=(const dimensionSet&) const;
00199 bool operator-=(const dimensionSet&) const;
00200 bool operator*=(const dimensionSet&);
00201 bool operator/=(const dimensionSet&);
00202
00203
00204
00205
00206 friend dimensionSet max(const dimensionSet&, const dimensionSet&);
00207 friend dimensionSet min(const dimensionSet&, const dimensionSet&);
00208 friend dimensionSet cmptMultiply
00209 (
00210 const dimensionSet&,
00211 const dimensionSet&
00212 );
00213 friend dimensionSet cmptDivide
00214 (
00215 const dimensionSet&,
00216 const dimensionSet&
00217 );
00218
00219 friend dimensionSet pow(const dimensionSet&, const scalar);
00220 friend dimensionSet pow(const dimensionSet&, const dimensionedScalar&);
00221 friend dimensionSet pow(const dimensionedScalar&, const dimensionSet&);
00222
00223 friend dimensionSet sqr(const dimensionSet&);
00224 friend dimensionSet pow3(const dimensionSet&);
00225 friend dimensionSet pow4(const dimensionSet&);
00226 friend dimensionSet pow5(const dimensionSet&);
00227 friend dimensionSet pow6(const dimensionSet&);
00228
00229 friend dimensionSet sqrt(const dimensionSet&);
00230 friend dimensionSet magSqr(const dimensionSet&);
00231 friend dimensionSet mag(const dimensionSet&);
00232 friend dimensionSet sign(const dimensionSet&);
00233 friend dimensionSet pos(const dimensionSet&);
00234 friend dimensionSet neg(const dimensionSet&);
00235 friend dimensionSet inv(const dimensionSet&);
00236
00237
00238
00239 friend dimensionSet trans(const dimensionSet&);
00240
00241
00242 friend dimensionSet transform(const dimensionSet&);
00243
00244
00245
00246
00247 friend dimensionSet operator-(const dimensionSet&);
00248
00249 friend dimensionSet operator+
00250 (
00251 const dimensionSet&,
00252 const dimensionSet&
00253 );
00254
00255 friend dimensionSet operator-
00256 (
00257 const dimensionSet&,
00258 const dimensionSet&
00259 );
00260
00261 friend dimensionSet operator*
00262 (
00263 const dimensionSet&,
00264 const dimensionSet&
00265 );
00266
00267 friend dimensionSet operator/
00268 (
00269 const dimensionSet&,
00270 const dimensionSet&
00271 );
00272
00273 friend dimensionSet operator&
00274 (
00275 const dimensionSet&,
00276 const dimensionSet&
00277 );
00278
00279 friend dimensionSet operator^
00280 (
00281 const dimensionSet&,
00282 const dimensionSet&
00283 );
00284
00285 friend dimensionSet operator&&
00286 (
00287 const dimensionSet&,
00288 const dimensionSet&
00289 );
00290
00291
00292
00293
00294 friend Istream& operator>>(Istream&, dimensionSet&);
00295 friend Ostream& operator<<(Ostream&, const dimensionSet&);
00296 };
00297
00298
00299
00300
00301 }
00302
00303
00304
00305 #include <OpenFOAM/dimensionSets.H>
00306
00307
00308
00309 #endif
00310
00311