FaradayConstant.h

Go to the documentation of this file.
00001 
00008 /* Copyright (C) 2002 - 2009, Bernd Speiser */
00009 
00010 /* This file is part of PhysicalQuantities.
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 _FaradayConstant_h
00029 #define _FaradayConstant_h
00030 
00031 // Quantity includes
00032 #include "Quantity/UniqueConstant.h"
00033 #include "PhysicalQuantities/AmountOfSubstance.h"
00034 #include "PhysicalQuantities/ElectricCharge.h"
00035 
00036 namespace quantity {
00037   namespace faradayConstant {
00038 
00040 class Class;
00041 
00043 class Unit;
00044 
00045 /* the CoulombPerMole and prefixed variants */
00046 
00047 typedef LOKI_TYPELIST_2(electricCharge::Coulomb, 
00048                       electricCharge::MilliCoulomb) ElectricChargeList;
00049 
00051 typedef unit::ComposeElement<Unit, 
00052    ElectricChargeList, BSUtilities::Rational<1> > ElectricChargeElement;
00053 
00054 typedef LOKI_TYPELIST_2(amountOfSubstance::Mole, 
00055                    amountOfSubstance::MilliMole) AmountOfSubstanceList;
00056 
00058 typedef unit::ComposeElement<Unit, 
00059   AmountOfSubstanceList, BSUtilities::Rational<-1> > 
00060                                                AmountOfSubstanceElement;
00061 
00062 typedef 
00063   unit::ComposeBase<Unit, 
00064     LOKI_TYPELIST_2(ElectricChargeElement, AmountOfSubstanceElement)>
00065                                             FaradayConstantComposedUnit;
00066 
00067 typedef unit::Composed<FaradayConstantComposedUnit, 
00068   LOKI_TYPELIST_2(electricCharge::Coulomb, 
00069                               amountOfSubstance::Mole)> CoulombPerMole;
00070 typedef unit::Composed<FaradayConstantComposedUnit, 
00071   LOKI_TYPELIST_2(electricCharge::Coulomb, 
00072                     amountOfSubstance::MilliMole)> CoulombPerMilliMole;
00073 
00074 
00076 typedef LOKI_TYPELIST_2(CoulombPerMole, CoulombPerMilliMole) Units;
00077 
00078 /* FaradayConstant quantity */
00079 
00080 typedef Quantity<Class> Quantity;
00081 
00082 class DerivedFaradayConstant;
00083 
00084   } // end namespace faradayConstant
00085 
00087 
00089   template<typename ST>
00090     struct Standard<faradayConstant::FaradayConstantComposedUnit, ST>
00091     {
00092       static const ST ratio;
00093       static const bool exact;
00094     };
00095 
00097 template<typename ST> const ST Standard<faradayConstant::FaradayConstantComposedUnit, ST>::ratio 
00098                                                                                        = 1.0;
00099 
00101 template<typename ST> const bool Standard<faradayConstant::FaradayConstantComposedUnit, ST>::exact 
00102                                                                                        = true;
00103 
00105 template<>
00106   struct QuantityTraits<faradayConstant::Class>
00107   {
00108     typedef
00109       dimension::Dimension<BSUtilities::Rational<0>,
00110         BSUtilities::Rational<0>, BSUtilities::Rational<1>,
00111           BSUtilities::Rational<1>, BSUtilities::Rational<0>,
00112             BSUtilities::Rational<-1>, BSUtilities::Rational<0> > Dimension;
00113     typedef faradayConstant::Unit UnitType;
00114     typedef faradayConstant::Units UnitList;
00115     typedef faradayConstant::CoulombPerMole DefaultUnit;
00116 
00117     typedef faradayConstant::DerivedFaradayConstant DefaultDerivedQuantityType;
00118 
00119     static const std::string NameString;
00120     static const std::string SymbolString;
00121 
00122   };
00123 
00124 // the derived quantity traits template for coulomb per mole Faraday constant
00125 template<>
00126   struct DerivedQuantityTraits<faradayConstant::Class, faradayConstant::DerivedFaradayConstant>
00127   {
00128     static const bool OverwriteName = false;
00129     static const bool OverwriteSymbol = false;
00130 
00131     static const std::string NameString;
00132     static const std::string SymbolString;
00133 
00134   };
00135 
00136 
00138 typedef Loki::SingletonHolder<UniqueConstant
00139                          <faradayConstant::Quantity> > FaradayConstant;
00140 
00142 #define FARADAYCONSTANT FaradayConstant::Instance()
00143 
00144 } // end namespace quantity
00145 
00146 #endif /* _FaradayConstant_h */

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