Acceleration.h

Go to the documentation of this file.
00001 
00007 /* Copyright (C) 2002 - 2009, Bernd Speiser */
00008 /* This file is part of Quantities.
00009 
00010 PhysicalQuantities is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 PhysicalQuantities is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019   
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00023 02111-1307, USA.
00024 */
00025 
00026 #ifndef _Acceleration_h
00027 #define _Acceleration_h
00028 
00029 // Quantity includes
00030 #include "Quantity/Variable.h"
00031 #include "Quantity/Constant.h"
00032 #include "Quantity/QuantityCluster.h"
00033 #include "PhysicalQuantities/Length.h"
00034 #include "PhysicalQuantities/Time.h"
00035 
00036 namespace quantity {
00037   namespace acceleration {
00038 
00040 class Class;
00041 
00043 class Unit;
00044 
00045 /* declaration of Acceleration units */
00046 class GalUnit;
00047 class StandardAccelerationOfFreeFallUnit;
00048 
00049 /* the MetrePerSquareSecond and prefixed variants */
00050 
00051 typedef LOKI_TYPELIST_3(length::Metre, length::CentiMetre,
00052                                         length::MilliMetre) LengthList;
00053 
00055 typedef unit::ComposeElement<Unit, LengthList, 
00056                                BSUtilities::Rational<1> > LengthElement;
00057 
00058 typedef LOKI_TYPELIST_3(time::Second, time::MilliSecond, 
00059                                            time::MicroSecond) TimeList;
00060 
00062 typedef unit::ComposeElement<Unit, TimeList, 
00063                                 BSUtilities::Rational<-2> > TimeElement;
00064 
00065 typedef 
00066   unit::ComposeBase<Unit, LOKI_TYPELIST_2(LengthElement, TimeElement)>
00067                                                AccelerationComposedUnit;
00068 
00069 typedef unit::Composed<AccelerationComposedUnit, 
00070      LOKI_TYPELIST_2(length::Metre, time::Second)> MetrePerSquareSecond;
00071 typedef unit::Composed<AccelerationComposedUnit, 
00072   LOKI_TYPELIST_2(length::CentiMetre, time::Second)> 
00073                                               CentiMetrePerSquareSecond;
00074 typedef unit::Composed<AccelerationComposedUnit, 
00075   LOKI_TYPELIST_2(length::Metre, time::MilliSecond)> 
00076                                               MetrePerSquareMilliSecond;
00077 
00078 /* declaration of other Acceleration units */
00080 typedef unit::NonPrefixable<Unit, GalUnit> Gal;
00081 
00083 typedef unit::NonPrefixable<Unit, 
00084      StandardAccelerationOfFreeFallUnit> StandardAccelerationOfFreeFall;
00085 
00087 typedef LOKI_TYPELIST_5(MetrePerSquareSecond, 
00088   CentiMetrePerSquareSecond, MetrePerSquareMilliSecond, Gal, 
00089                                   StandardAccelerationOfFreeFall) Units;
00090 
00091 /* Acceleration quantity */
00092 
00093 typedef Quantity<Class> Quantity;
00094 
00095 class DerivedAcceleration;
00096 
00097   } //end namespace acceleration
00098 
00100 
00102   template<typename ST>
00103     struct Standard<acceleration::AccelerationComposedUnit, ST>
00104     {
00105       static const ST ratio;
00106       static const bool exact;
00107     };
00108 
00110 template<typename ST> const ST Standard<acceleration::AccelerationComposedUnit, ST>::ratio = 1.0;
00111 
00113 template<typename ST> const bool Standard<acceleration::AccelerationComposedUnit, ST>::exact = true;
00114 
00116 
00118   template<typename ST>
00119     struct Standard<acceleration::Gal, ST>
00120     {
00121       static const ST ratio;
00122       static const bool exact;
00123     };
00124 
00126 template<typename ST> const ST Standard<acceleration::Gal, ST>::ratio = 1.0e-2;
00127 
00129 template<typename ST> const bool Standard<acceleration::Gal, ST>::exact = true;
00130 
00132 
00134   template<typename ST>
00135     struct Standard<acceleration::StandardAccelerationOfFreeFall, ST>
00136     {
00137       static const ST ratio;
00138       static const bool exact;
00139     };
00140 
00142 template<typename ST> const ST Standard<acceleration::StandardAccelerationOfFreeFall, ST>::ratio 
00143                                                                                       = 9.80665;
00144 
00146 template<typename ST> const bool Standard<acceleration::StandardAccelerationOfFreeFall, ST>::exact 
00147                                                                                          = true;
00148 
00150 template<>
00151   struct QuantityTraits<acceleration::Class>
00152   {
00153     typedef
00154       dimension::Dimension<BSUtilities::Rational<1>,
00155         BSUtilities::Rational<0>, BSUtilities::Rational<-2>,
00156           BSUtilities::Rational<0>, BSUtilities::Rational<0>,
00157             BSUtilities::Rational<0>, BSUtilities::Rational<0> > Dimension;
00158     typedef acceleration::Unit UnitType;
00159     typedef acceleration::Units UnitList;
00160     typedef acceleration::MetrePerSquareSecond DefaultUnit;
00161 
00162     typedef acceleration::DerivedAcceleration DefaultDerivedQuantityType;
00163 
00164     static const std::string NameString;
00165     static const std::string SymbolString;
00166 
00167   };
00168 
00169 // the derived quantity traits template for MetrePerSquareSecond Acceleration
00170 template<>
00171   struct DerivedQuantityTraits<acceleration::Class, acceleration::DerivedAcceleration>
00172   {
00173     static const bool OverwriteName = false;
00174     static const bool OverwriteSymbol = false;
00175 
00176     static const std::string NameString;
00177     static const std::string SymbolString;
00178 
00179   };
00180 
00181 
00183 typedef Variable<acceleration::Quantity> Acceleration;
00184 
00186 typedef Constant<acceleration::Quantity> AccelerationConstant;
00187 
00189 typedef QuantityVector<Variable, acceleration::Quantity> AccelerationVector;
00190 
00191 } // end namespace quantity
00192 
00193 #endif /* _Acceleration_h */

Generated on Mon Jul 27 15:55:44 2009 for Quantities by  doxygen 1.5.3