00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _Length_h
00028 #define _Length_h
00029
00030
00031 #include "Quantity/Variable.h"
00032 #include "Quantity/Constant.h"
00033 #include "Quantity/QuantityCluster.h"
00034
00035 namespace quantity {
00036 namespace length {
00037
00039 class Class;
00040
00042 class Unit;
00043
00044
00045 class MetreUnits;
00046 class BohrUnit;
00047 class AngstromUnit;
00048 class MicronUnit;
00049 class MilliMicronUnit;
00050 class XUnit;
00051 class FermiUnit;
00052 class InchUnit;
00053 class FootUnit;
00054 class YardUnit;
00055 class MileUnit;
00056 class NauticalMileUnit;
00057 class AstronomicalUnit;
00058 class ParsecUnit;
00059 class LightYearUnit;
00060 class LightSecondUnit;
00061
00063 typedef unit::Prefixable<Unit, MetreUnits> Metres;
00064
00066 typedef unit::Prefixed<Metres> Metre;
00067 typedef unit::Prefixed<Metres, unit::Deci> DeciMetre;
00068 typedef unit::Prefixed<Metres, unit::Centi> CentiMetre;
00069 typedef unit::Prefixed<Metres, unit::Milli> MilliMetre;
00070 typedef unit::Prefixed<Metres, unit::Micro> MicroMetre;
00071 typedef unit::Prefixed<Metres, unit::Nano> NanoMetre;
00072 typedef unit::Prefixed<Metres, unit::Pico> PicoMetre;
00073 typedef unit::Prefixed<Metres, unit::Kilo> KiloMetre;
00074
00076 typedef unit::NonPrefixable<Unit, BohrUnit> Bohr;
00077
00079 typedef unit::NonPrefixable<Unit, AngstromUnit> Angstrom;
00080
00082 typedef unit::NonPrefixable<Unit, MicronUnit> Micron;
00083
00085 typedef unit::NonPrefixable<Unit, MilliMicronUnit> MilliMicron;
00086
00088 typedef unit::NonPrefixable<Unit, XUnit> X;
00089
00091 typedef unit::NonPrefixable<Unit, FermiUnit> Fermi;
00092
00094 typedef unit::NonPrefixable<Unit, InchUnit> Inch;
00095
00097 typedef unit::NonPrefixable<Unit, FootUnit> Foot;
00098
00100 typedef unit::NonPrefixable<Unit, YardUnit> Yard;
00101
00103 typedef unit::NonPrefixable<Unit, MileUnit> Mile;
00104
00106 typedef unit::NonPrefixable<Unit, NauticalMileUnit> NauticalMile;
00107
00109 typedef unit::NonPrefixable<Unit, AstronomicalUnit> Astronomical;
00110
00112 typedef unit::NonPrefixable<Unit, ParsecUnit> Parsec;
00113
00115 typedef unit::NonPrefixable<Unit, LightYearUnit> LightYear;
00116
00118 typedef unit::NonPrefixable<Unit, LightSecondUnit> LightSecond;
00119
00121 typedef Loki::TL::Append<Metres::Units,
00122 LOKI_TYPELIST_15(Bohr, Angstrom, Micron, MilliMicron, X, Fermi, Inch,
00123 Foot, Yard, Mile, NauticalMile, Astronomical, Parsec,
00124 LightYear, LightSecond)>::Result Units;
00125
00126
00127
00128 typedef Metre m;
00129 typedef MilliMetre mm;
00130 typedef KiloMetre km;
00131 typedef CentiMetre cm;
00132
00133
00134
00135 typedef Quantity<Class> Quantity;
00136 typedef quantity::Quantity<Class, int> IntQuantity;
00137
00138 class DerivedLength;
00139
00140 }
00141
00143
00145 template<typename ST>
00146 struct Standard<length::Metres, ST>
00147 {
00148 static const ST ratio;
00149 static const bool exact;
00150 };
00151
00153 template<typename ST> const ST Standard<length::Metres, ST>::ratio = 1.0;
00154
00156 template<typename ST> const bool Standard<length::Metres, ST>::exact = true;
00157
00159
00161 template<typename ST>
00162 struct Standard<length::Bohr, ST>
00163 {
00164 static const ST ratio;
00165 static const bool exact;
00166 };
00167
00169 template<typename ST> const ST Standard<length::Bohr, ST>::ratio = 5.29177e-11;
00170
00172 template<typename ST> const bool Standard<length::Bohr, ST>::exact = false;
00173
00175
00177 template<typename ST>
00178 struct Standard<length::Angstrom, ST>
00179 {
00180 static const ST ratio;
00181 static const bool exact;
00182 };
00183
00185 template<typename ST> const ST Standard<length::Angstrom, ST>::ratio = 1.0e-10;
00186
00188 template<typename ST> const bool Standard<length::Angstrom, ST>::exact = true;
00189
00191
00193 template<typename ST>
00194 struct Standard<length::Micron, ST>
00195 {
00196 static const ST ratio;
00197 static const bool exact;
00198 };
00199
00201 template<typename ST> const ST Standard<length::Micron, ST>::ratio = 1.0e-6;
00202
00204 template<typename ST> const bool Standard<length::Micron, ST>::exact = true;
00205
00207
00209 template<typename ST>
00210 struct Standard<length::MilliMicron, ST>
00211 {
00212 static const ST ratio;
00213 static const bool exact;
00214 };
00215
00217 template<typename ST> const ST Standard<length::MilliMicron, ST>::ratio = 1.0e-9;
00218
00220 template<typename ST> const bool Standard<length::MilliMicron, ST>::exact = true;
00221
00223
00225 template<typename ST>
00226 struct Standard<length::X, ST>
00227 {
00228 static const ST ratio;
00229 static const bool exact;
00230 };
00231
00233 template<typename ST> const ST Standard<length::X, ST>::ratio = 1.002e-13;
00234
00236 template<typename ST> const bool Standard<length::X, ST>::exact = false;
00237
00239
00241 template<typename ST>
00242 struct Standard<length::Fermi, ST>
00243 {
00244 static const ST ratio;
00245 static const bool exact;
00246 };
00247
00249 template<typename ST> const ST Standard<length::Fermi, ST>::ratio = 1.0e-15;
00250
00252 template<typename ST> const bool Standard<length::Fermi, ST>::exact = true;
00253
00255
00257 template<typename ST>
00258 struct Standard<length::Inch, ST>
00259 {
00260 static const ST ratio;
00261 static const bool exact;
00262 };
00263
00265 template<typename ST> const ST Standard<length::Inch, ST>::ratio = 2.54e-2;
00266
00268 template<typename ST> const bool Standard<length::Inch, ST>::exact = true;
00269
00271
00273 template<typename ST>
00274 struct Standard<length::Foot, ST>
00275 {
00276 static const ST ratio;
00277 static const bool exact;
00278 };
00279
00281 template<typename ST> const ST Standard<length::Foot, ST>::ratio = 0.3048;
00282
00284 template<typename ST> const bool Standard<length::Foot, ST>::exact = true;
00285
00287
00289 template<typename ST>
00290 struct Standard<length::Yard, ST>
00291 {
00292 static const ST ratio;
00293 static const bool exact;
00294 };
00295
00297 template<typename ST> const ST Standard<length::Yard, ST>::ratio = 0.9144;
00298
00300 template<typename ST> const bool Standard<length::Yard, ST>::exact = true;
00301
00303
00305 template<typename ST>
00306 struct Standard<length::Mile, ST>
00307 {
00308 static const ST ratio;
00309 static const bool exact;
00310 };
00311
00313 template<typename ST> const ST Standard<length::Mile, ST>::ratio = 1609.344;
00314
00316 template<typename ST> const bool Standard<length::Mile, ST>::exact = true;
00317
00319
00321 template<typename ST>
00322 struct Standard<length::NauticalMile, ST>
00323 {
00324 static const ST ratio;
00325 static const bool exact;
00326 };
00327
00329 template<typename ST> const ST Standard<length::NauticalMile, ST>::ratio = 1852.;
00330
00332 template<typename ST> const bool Standard<length::NauticalMile, ST>::exact = true;
00333
00335
00337 template<typename ST>
00338 struct Standard<length::Astronomical, ST>
00339 {
00340 static const ST ratio;
00341 static const bool exact;
00342 };
00343
00345 template<typename ST> const ST Standard<length::Astronomical, ST>::ratio = 1.49600e11;
00346
00348 template<typename ST> const bool Standard<length::Astronomical, ST>::exact = true;
00349
00351
00353 template<typename ST>
00354 struct Standard<length::Parsec, ST>
00355 {
00356 static const ST ratio;
00357 static const bool exact;
00358 };
00359
00361 template<typename ST> const ST Standard<length::Parsec, ST>::ratio = 3.08568e16;
00362
00364 template<typename ST> const bool Standard<length::Parsec, ST>::exact = false;
00365
00367
00369 template<typename ST>
00370 struct Standard<length::LightYear, ST>
00371 {
00372 static const ST ratio;
00373 static const bool exact;
00374 };
00375
00377 template<typename ST> const ST Standard<length::LightYear, ST>::ratio = 9.460528e15;
00378
00380 template<typename ST> const bool Standard<length::LightYear, ST>::exact = false;
00381
00383
00385 template<typename ST>
00386 struct Standard<length::LightSecond, ST>
00387 {
00388 static const ST ratio;
00389 static const bool exact;
00390 };
00391
00393 template<typename ST> const ST Standard<length::LightSecond, ST>::ratio = 299792458.;
00394
00396 template<typename ST> const bool Standard<length::LightSecond, ST>::exact = true;
00397
00399 template<>
00400 struct QuantityTraits<length::Class>
00401 {
00402 typedef
00403 dimension::Dimension<BSUtilities::Rational<1>,
00404 BSUtilities::Rational<0>, BSUtilities::Rational<0>,
00405 BSUtilities::Rational<0>, BSUtilities::Rational<0>,
00406 BSUtilities::Rational<0>, BSUtilities::Rational<0> > Dimension;
00407 typedef length::Unit UnitType;
00408 typedef length::Units UnitList;
00409 typedef length::Metre DefaultUnit;
00410
00411 typedef length::DerivedLength DefaultDerivedQuantityType;
00412
00413 static const std::string NameString;
00414 static const std::string SymbolString;
00415
00416 };
00417
00418
00419 template<>
00420 struct DerivedQuantityTraits<length::Class, length::DerivedLength>
00421 {
00422 static const bool OverwriteName = false;
00423 static const bool OverwriteSymbol = false;
00424
00425 static const std::string NameString;
00426 static const std::string SymbolString;
00427
00428 };
00429
00431 typedef Variable<length::Quantity> Length;
00432
00434 typedef Variable<length::IntQuantity> IntLength;
00435
00437 typedef Constant<length::Quantity> LengthConstant;
00438
00440 typedef QuantityVector<Variable, length::Quantity> LengthVector;
00441
00442 }
00443
00444 #endif