Force.h

Go to the documentation of this file.
00001 
00008 /* Copyright (C) 2002 - 2009, Bernd Speiser */
00009 
00010 /* This file is part of Quantities.
00011 
00012 PhysicalQuantities is free software; you can redistribute it and/or
00013 modify it under the terms of the GNU General Public License
00014 as published by the Free Software Foundation; either version 2
00015 of the License, or (at your option) any later version.
00016 
00017 PhysicalQuantities is distributed in the hope that it will be useful,
00018 but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 GNU General Public License for more details.
00021   
00022 You should have received a copy of the GNU General Public License
00023 along with this program; if not, write to the Free Software
00024 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00025 02111-1307, USA.
00026 */
00027 
00028 #ifndef _Force_h
00029 #define _Force_h
00030 
00031 // Quantity includes
00032 #include "Quantity/Variable.h"
00033 #include "Quantity/Constant.h"
00034 #include "Quantity/QuantityCluster.h"
00035 
00036 namespace quantity {
00037   namespace force {
00038 
00040 class Class;
00041 
00043 class Unit;
00044 
00045 /* declaration of Force units */
00046 class NewtonUnits;
00047 class DyneUnit;
00048 class KilogramForceUnit;
00049 class AtomicUnit;
00050 
00052 typedef unit::Prefixable<Unit, NewtonUnits> Newtons;
00053 
00055 typedef unit::Prefixed<Newtons> Newton;
00056 
00058 typedef unit::NonPrefixable<Unit, DyneUnit> Dyne;
00059 
00061 typedef unit::NonPrefixable<Unit, KilogramForceUnit> KilogramForce;
00062 
00064 typedef unit::NonPrefixable<Unit, AtomicUnit> Atomic;
00065 
00067 typedef Loki::TL::Append<Newtons::Units,
00068             LOKI_TYPELIST_3(Dyne, KilogramForce, Atomic)>::Result Units;
00069 
00070 /* declare some abbreviated time units */
00071 
00072 typedef Newton N;
00073 typedef Dyne dyn;
00074 
00075 /* Force Quantity */
00076 
00077 typedef Quantity<Class> Quantity;
00078 
00079 class DerivedForce;
00080 
00081   } // end namespace force
00082 
00084 
00086   template<typename ST>
00087     struct Standard<force::Newton, ST>
00088     {
00089       static const ST ratio;
00090       static const bool exact;
00091     };
00092 
00094 template<typename ST> const ST Standard<force::Newton, ST>::ratio = 1.0;
00095 
00097 template<typename ST> const bool Standard<force::Newton, ST>::exact = true;
00098 
00100 
00102   template<typename ST>
00103     struct Standard<force::Dyne, ST>
00104     {
00105       static const ST ratio;
00106       static const bool exact;
00107     };
00108 
00110 template<typename ST> const ST Standard<force::Dyne, ST>::ratio = 1.0e-5;
00111 
00113 template<typename ST> const bool Standard<force::Dyne, ST>::exact = true;
00114 
00116 
00118   template<typename ST>
00119     struct Standard<force::KilogramForce, ST>
00120     {
00121       static const ST ratio;
00122       static const bool exact;
00123     };
00124 
00126 template<typename ST> const ST Standard<force::KilogramForce, ST>::ratio = 9.80665;
00127 
00129 template<typename ST> const bool Standard<force::KilogramForce, ST>::exact = true;
00130 
00132 
00134   template<typename ST>
00135     struct Standard<force::Atomic, ST>
00136     {
00137       static const ST ratio;
00138       static const bool exact;
00139     };
00140 
00142 template<typename ST> const ST Standard<force::Atomic, ST>::ratio = 8.23873e-8;
00143 
00145 template<typename ST> const bool Standard<force::Atomic, ST>::exact = false;
00146 
00148 template<>
00149   struct QuantityTraits<force::Class>
00150   {
00151     typedef
00152       dimension::Dimension<BSUtilities::Rational<1>,
00153         BSUtilities::Rational<1>, BSUtilities::Rational<-2>,
00154           BSUtilities::Rational<0>, BSUtilities::Rational<0>,
00155             BSUtilities::Rational<0>, BSUtilities::Rational<0> > Dimension;
00156     typedef force::Unit UnitType;
00157     typedef force::Units UnitList;
00158     typedef force::Newton DefaultUnit;
00159 
00160     typedef force::DerivedForce DefaultDerivedQuantityType;
00161 
00162     static const std::string NameString;
00163     static const std::string SymbolString;
00164 
00165   };
00166 
00167 // the derived quantity traits template for Newton force
00168 template<>
00169   struct DerivedQuantityTraits<force::Class, force::DerivedForce>
00170   {
00171     static const bool OverwriteName = false;
00172     static const bool OverwriteSymbol = false;
00173 
00174     static const std::string NameString;
00175     static const std::string SymbolString;
00176 
00177   };
00178 
00180 typedef Variable<force::Quantity> Force;
00181 
00183 typedef Constant<force::Quantity> ForceConstant;
00184 
00186 typedef QuantityVector<Variable, force::Quantity> ForceVector;
00187 }
00188 
00189 #endif /* _Force_h */

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