Concentration.h

Go to the documentation of this file.
00001 
00007 /* Copyright (C) 2004 - 2009, Kai Ludwig, Bernd Speiser */
00008 /* This file is part of PhysicalQuantities.
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 _Concentration_h
00027 #define _Concentration_h
00028 
00029 // Quantity includes
00030 #include "Quantity/Variable.h"
00031 #include "Quantity/Constant.h"
00032 #include "Quantity/QuantityCluster.h"
00033 #include "PhysicalQuantities/AmountOfSubstance.h"
00034 #include "PhysicalQuantities/Volume.h"
00035 
00036 namespace quantity {
00037   namespace concentration {
00038 
00040 class Class;
00041 
00043 class Unit;
00044 
00045 /* MolePerLitre and prefixed variants */
00046 
00047 typedef LOKI_TYPELIST_2(amountOfSubstance::Mole, 
00048                    amountOfSubstance::MilliMole) AmountOfSubstanceList;
00049 
00051 typedef unit::ComposeElement<Unit, AmountOfSubstanceList, 
00052                     BSUtilities::Rational<1> > AmountOfSubstanceElement;
00053 
00054 typedef LOKI_TYPELIST_2(volume::Litre, volume::CubicCentiMetre) 
00055                                                              VolumeList;
00056 
00058 typedef unit::ComposeElement<Unit, VolumeList, 
00059                               BSUtilities::Rational<-1> > VolumeElement;
00060 
00061 typedef unit::ComposeBase<Unit, 
00062   LOKI_TYPELIST_2(AmountOfSubstanceElement, VolumeElement)> 
00063                                               ConcentrationComposedUnit;
00064 
00065 typedef unit::Composed<ConcentrationComposedUnit, 
00066   LOKI_TYPELIST_2(amountOfSubstance::Mole, volume::Litre)> MolePerLitre;
00067 
00068 typedef unit::Composed<ConcentrationComposedUnit, 
00069   LOKI_TYPELIST_2(amountOfSubstance::Mole, volume::CubicCentiMetre)> 
00070                                                  MolePerCubicCentiMetre;
00071 
00072 typedef unit::Composed<ConcentrationComposedUnit,
00073   LOKI_TYPELIST_2(amountOfSubstance::MilliMole, volume::Litre)> 
00074                                                       MilliMolePerLitre;
00075 
00076 typedef unit::Composed<ConcentrationComposedUnit, 
00077   LOKI_TYPELIST_2(amountOfSubstance::MilliMole, 
00078                                               volume::CubicCentiMetre)> 
00079                                             MilliMolePerCubicCentiMetre;
00080 
00082 typedef LOKI_TYPELIST_4(MolePerLitre, MolePerCubicCentiMetre, 
00083                   MilliMolePerLitre, MilliMolePerCubicCentiMetre) Units;
00084 
00085 /* Concentration quantity */
00086 
00087 typedef Quantity<Class> Quantity;
00088 
00089 class DerivedConcentration;
00090 
00091   } // end namespace concentration
00092 
00094 
00096   template<typename ST>
00097     struct Standard<concentration::ConcentrationComposedUnit, ST>
00098     {
00099       static const ST ratio;
00100       static const bool exact;
00101     };
00102 
00104 template<typename ST> const ST Standard<concentration::ConcentrationComposedUnit, ST>::ratio = 1.0;
00105 
00107 template<typename ST> const bool Standard<concentration::ConcentrationComposedUnit, ST>::exact = true;
00108 
00110 template<>
00111   struct QuantityTraits<concentration::Class>
00112   {
00113     typedef
00114       dimension::Dimension<BSUtilities::Rational<-3>,
00115         BSUtilities::Rational<0>, BSUtilities::Rational<0>,
00116           BSUtilities::Rational<0>, BSUtilities::Rational<0>,
00117             BSUtilities::Rational<1>, BSUtilities::Rational<0> > Dimension;
00118     typedef concentration::Unit UnitType;
00119     typedef concentration::Units UnitList;
00120     typedef concentration::MolePerLitre DefaultUnit;
00121 
00122     typedef concentration::DerivedConcentration DefaultDerivedQuantityType;
00123 
00124     static const std::string NameString;
00125     static const std::string SymbolString;
00126 
00127   };
00128 
00129 // the derived quantity traits template for MolePerLitre Concentration
00130 template<>
00131   struct DerivedQuantityTraits<concentration::Class, concentration::DerivedConcentration>
00132   {
00133     static const bool OverwriteName = false;
00134     static const bool OverwriteSymbol = false;
00135 
00136     static const std::string NameString;
00137     static const std::string SymbolString;
00138 
00139   };
00140 
00141 
00143 typedef Variable<concentration::Quantity> Concentration;
00144 
00146 typedef Constant<concentration::Quantity> ConcentrationConstant;
00147 
00149 typedef QuantityVector<Variable, concentration::Quantity> ConcentrationVector;
00150 
00151 }
00152 
00153 #endif /* _Concentration_h */

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