ElectricPotential.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 _ElectricPotential_h
00027 #define _ElectricPotential_h
00028 
00029 // Quantity includes
00030 #include "Quantity/Variable.h"
00031 #include "Quantity/Constant.h"
00032 #include "Quantity/QuantityCluster.h"
00033 
00034 namespace quantity {
00035   namespace electricPotential {
00036 
00038 class Class;
00039 
00041 class Unit;
00042 
00043 /* declaration of ElectricPotential units */
00044 class VoltUnits;
00045 class GauUnit;
00046 class MeanInternationalVoltUnit;
00047 class USInternationalVoltUnit;
00048 class AtomicUnit;
00049 
00051 typedef unit::Prefixable<Unit, VoltUnits> Volts;
00052 
00054 typedef unit::Prefixed<Volts> Volt;
00055 
00057 typedef unit::Prefixed<Volts, unit::Milli> MilliVolt;
00058 
00060 typedef unit::Prefixed<Volts, unit::Micro> MicroVolt;
00061 
00063 typedef unit::Prefixed<Volts, unit::Kilo> KiloVolt;
00064 
00066 typedef unit::Prefixed<Volts, unit::Mega> MegaVolt;
00067 
00069 typedef unit::NonPrefixable<Unit, GauUnit> Gau;
00070 
00072 typedef unit::NonPrefixable<Unit, 
00073                        MeanInternationalVoltUnit> MeanInternationalVolt;
00074 
00076 typedef unit::NonPrefixable<Unit, 
00077                            USInternationalVoltUnit> USInternationalVolt;
00078 
00080 typedef unit::NonPrefixable<Unit, AtomicUnit> Atomic;
00081 
00083 typedef Loki::TL::Append<Volts::Units,
00084   LOKI_TYPELIST_4(Gau, MeanInternationalVolt, USInternationalVolt, 
00085                                                  Atomic)>::Result Units;
00086 
00087 /* declare some abbreviated electric potential units */
00088 
00089 typedef Volt V;
00090 typedef MilliVolt mV;
00091 typedef MicroVolt uV;
00092 
00093 /* ElectricPotential quantity */
00094 
00095 typedef Quantity<Class> Quantity;
00096 
00097 class DerivedElectricPotential;
00098 
00099   } // end namespace electricPotential
00100 
00102 
00104   template<typename ST>
00105     struct Standard<electricPotential::Volts, ST>
00106     {
00107       static const ST ratio;
00108       static const bool exact;
00109     };
00110 
00112 template<typename ST> const ST Standard<electricPotential::Volts, ST>::ratio = 1.0;
00113 
00115 template<typename ST> const bool Standard<electricPotential::Volts, ST>::exact = true;
00116 
00118 
00120   template<typename ST>
00121     struct Standard<electricPotential::Gau, ST>
00122     {
00123       static const ST ratio;
00124       static const bool exact;
00125     };
00126 
00128 template<typename ST> const ST Standard<electricPotential::Gau, ST>::ratio = 299.792458;
00129 
00131 template<typename ST> const bool Standard<electricPotential::Gau, ST>::exact = true;
00132 
00134 
00136   template<typename ST>
00137     struct Standard<electricPotential::MeanInternationalVolt, ST>
00138     {
00139       static const ST ratio;
00140       static const bool exact;
00141     };
00142 
00144 template<typename ST> const ST Standard<electricPotential::MeanInternationalVolt, ST>::ratio 
00145                                                                             = 1.00034;
00146 
00148 template<typename ST> const bool Standard<electricPotential::MeanInternationalVolt, ST>::exact 
00149                                                                             = true;
00150 
00152 
00154   template<typename ST>
00155     struct Standard<electricPotential::USInternationalVolt, ST>
00156     {
00157       static const ST ratio;
00158       static const bool exact;
00159     };
00160 
00162 template<typename ST> const ST Standard<electricPotential::USInternationalVolt, ST>::ratio 
00163                                                                             = 1.00033;
00164 
00166 template<typename ST> const bool Standard<electricPotential::USInternationalVolt, ST>::exact 
00167                                                                             = true;
00168 
00170 
00172   template<typename ST>
00173     struct Standard<electricPotential::Atomic, ST>
00174     {
00175       static const ST ratio;
00176       static const bool exact;
00177     };
00178 
00180 template<typename ST> const ST Standard<electricPotential::Atomic, ST>::ratio = 27.2114;
00181 
00183 template<typename ST> const bool Standard<electricPotential::Atomic, ST>::exact = false;
00184 
00186 template<>
00187   struct QuantityTraits<electricPotential::Class>
00188   {
00189     typedef
00190       dimension::Dimension<BSUtilities::Rational<2>,
00191         BSUtilities::Rational<1>, BSUtilities::Rational<-3>,
00192           BSUtilities::Rational<-1>, BSUtilities::Rational<0>,
00193             BSUtilities::Rational<0>, BSUtilities::Rational<0> > Dimension;
00194     typedef electricPotential::Unit UnitType;
00195     typedef electricPotential::Units UnitList;
00196     typedef electricPotential::Volt DefaultUnit;
00197 
00198     typedef electricPotential::DerivedElectricPotential DefaultDerivedQuantityType;
00199 
00200     static const std::string NameString;
00201     static const std::string SymbolString;
00202 
00203   };
00204 
00205 // the derived quantity traits template for Volt ElectricPotential
00206 template<>
00207   struct DerivedQuantityTraits<electricPotential::Class, electricPotential::DerivedElectricPotential>
00208   {
00209     static const bool OverwriteName = false;
00210     static const bool OverwriteSymbol = false;
00211 
00212     static const std::string NameString;
00213     static const std::string SymbolString;
00214 
00215   };
00216 
00217 
00219 typedef Variable<electricPotential::Quantity> ElectricPotential;
00220 
00222 typedef Constant<electricPotential::Quantity> ElectricPotentialConstant;
00223 
00225 typedef QuantityVector<Variable, electricPotential::Quantity> 
00226                                                 ElectricPotentialVector;
00227 }
00228 
00229 #endif /* _ElectricPotential_h */

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