C:/nobackup/private/physical_svn/trunk/include/physical/quantity.hpp

Go to the documentation of this file.
00001 
00002 /*=============================================================================
00003     physical quantities / units / constants
00004     Copyright (c) 2006, 2007 Martin Schulz
00005     http://physical.sourceforge.net
00006   
00007     This is private code by Martin Schulz.
00008   
00009     Use, modification and distribution is subject to the Boost Software
00010     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
00011     http://www.boost.org/LICENSE_1_0.txt)
00012 =============================================================================*/
00013 
00014 #ifndef PHYSICAL_QUANTITY
00015 #define PHYSICAL_QUANTITY
00016 
00017 #include "physical/fixedphysical.hpp"
00018 
00019 namespace physical {
00020 
00021 
00022 // preprocessor definitions used to define quantities, units and unitsymbols.
00023 // trailing number is the count of comma signs inside expression as seen by the preprocessor
00024 #define QUANTITY0(AAA)         namespace quantity_si_double { typedef AAA; };  namespace quantity_si_float { typedef AAA; };  
00025 #define QUANTITY1(AAA,BBB)     namespace quantity_si_double { typedef double real; typedef AAA,BBB; };  namespace quantity_si_float { typedef float real; typedef AAA,BBB; };  
00026 #define QUANTITY2(AAA,BBB,CCC) namespace quantity_si_double { typedef double real; typedef AAA,BBB,CCC; };  namespace quantity_si_float { typedef float real; typedef AAA,BBB,CCC; };  
00027 
00028 namespace quantity_si_double { typedef SI system; typedef double real; };  
00029 namespace quantity_si_float  { typedef SI system; typedef float real; };  
00030 
00031 
00032                 // some statically predefined physical quantities:
00033                 
00034                 // define the SI basic physical quantities (from NIST table 1)
00035                 QUANTITY2( FixedPhysicalBase<system, real, -1>::type                                    scalar );
00036                 QUANTITY2( FixedPhysicalBase<system, real, system::meter>::type                 length );
00037                 QUANTITY2( FixedPhysicalBase<system, real, system::kilogram>::type              mass );
00038                 QUANTITY2( FixedPhysicalBase<system, real, system::second>::type                time );
00039                 QUANTITY2( FixedPhysicalBase<system, real, system::ampere>::type                electric_current );
00040                 QUANTITY2( FixedPhysicalBase<system, real, system::kelvin>::type                temperature );
00041                 QUANTITY2( FixedPhysicalBase<system, real, system::mol>::type                   amount_of_substance );
00042                 QUANTITY2( FixedPhysicalBase<system, real, system::candela>::type               luminous_intensity );
00043 
00044                 // define some derived physical quantities: (from NIST table 2)
00045                 QUANTITY0( length                                                                                               distance );
00046                 QUANTITY1( FixedPhysicalProduct<length, length>::type                   area );
00047                 QUANTITY1( FixedPhysicalProduct<area, length>::type                             volume );
00048                 QUANTITY1( FixedPhysicalRatio<length, time>::type                               velocity );
00049                 QUANTITY0( velocity                                                                                             speed );
00050                 QUANTITY1( FixedPhysicalRatio<velocity, time>::type                             acceleration );
00051                 QUANTITY1( FixedPhysicalRatio<scalar, length>::type                             wave_number );
00052                 QUANTITY1( FixedPhysicalRatio<mass, volume>::type                               mass_density );
00053                 QUANTITY1( FixedPhysicalRatio<volume, mass>::type                               specific_volume );
00054                 QUANTITY1( FixedPhysicalRatio<electric_current, area>::type             current_density );
00055                 QUANTITY1( FixedPhysicalRatio<electric_current, length>::type   magnetic_field_strength );
00056                 QUANTITY1( FixedPhysicalRatio<amount_of_substance, volume>::type        amount_of_substance_concentration );
00057                 QUANTITY1( FixedPhysicalRatio<luminous_intensity, area>::type   luminance );
00058                 QUANTITY1( FixedPhysicalRatio<mass, mass>::type                                 mass_fraction );
00059 
00060 
00061                 // further derived physical quantities: (from NIST table 3)
00062                 QUANTITY1( FixedPhysicalRatio<length, length>::type                             plane_angle );
00063                 QUANTITY1( FixedPhysicalRatio<area, area>::type                                 solid_angle );
00064                 QUANTITY1( FixedPhysicalRatio<scalar, time>::type                               frequency );
00065                 QUANTITY1( FixedPhysicalProduct<mass, acceleration>::type               force );
00066                 QUANTITY1( FixedPhysicalRatio<force, area>::type                                pressure );
00067                 QUANTITY0( pressure                                                                                             stress );
00068                 QUANTITY1( FixedPhysicalProduct<force, length>::type                    energy );
00069                 QUANTITY0( energy                                                                                               work );
00070                 QUANTITY0( energy                                                                                               quantity_of_heat );
00071                 QUANTITY1( FixedPhysicalRatio<energy, time>::type                               power );
00072                 QUANTITY0( power                                                                                                radiant_flux );
00073                 QUANTITY1( FixedPhysicalProduct<electric_current, time>::type   electric_charge );
00074                 QUANTITY0( electric_charge                                                                              quantity_of_electricity );
00075                 QUANTITY1( FixedPhysicalRatio<power, electric_current>::type    electric_potential_difference );
00076                 QUANTITY0( electric_potential_difference                                                electromotive_force );
00077                 QUANTITY1( FixedPhysicalRatio<electric_charge, 
00078                         electric_potential_difference>::type                                            capacitance );
00079                 QUANTITY1( FixedPhysicalRatio<electric_potential_difference, 
00080                         electric_current>::type                                                                         electric_resistance );
00081                 QUANTITY1( FixedPhysicalRatio<electric_current, 
00082                         electric_potential_difference>::type                                            electric_conductance );
00083                 QUANTITY1( FixedPhysicalProduct<electric_potential_difference, 
00084                         time>::type                                                                                                     magnetic_flux );
00085                 QUANTITY1( FixedPhysicalRatio<magnetic_flux, area>::type                magnetic_flux_density );
00086                 QUANTITY1( FixedPhysicalRatio<magnetic_flux, 
00087                         electric_current>::type                                                                         inductance );
00088                 QUANTITY1( FixedPhysicalProduct<luminous_intensity, 
00089                         solid_angle>::type                                                                                      luminous_flux );
00090                 QUANTITY1( FixedPhysicalRatio<luminous_flux, area>::type                illuminance );
00091                 QUANTITY1( FixedPhysicalRatio<scalar, time>::type                               activity_of_a_radionuclide );
00092                 QUANTITY1( FixedPhysicalRatio<energy, mass>::type                               absorbed_dose );
00093                 QUANTITY0( absorbed_dose                                                                                specific_energy );
00094                 QUANTITY1( FixedPhysicalRatio<energy, mass>::type                               dose_equivalent );
00095                 QUANTITY1( FixedPhysicalRatio<amount_of_substance, time>::type  catalytic_activity );
00096 
00097 
00098                 // further derived quantities (from NIST table 4)
00099 
00100                 QUANTITY1( FixedPhysicalProduct<pressure, time>::type                   dynamic_viscosity );
00101                 QUANTITY1( FixedPhysicalProduct<force, length>::type                    moment_of_force );
00102                 QUANTITY1( FixedPhysicalRatio<force, length>::type                              surface_tension );
00103                 QUANTITY1( FixedPhysicalRatio<plane_angle, time>::type                  angular_velocity );
00104                 QUANTITY1( FixedPhysicalRatio<angular_velocity, time>::type             angular_acceleration );
00105                 QUANTITY1( FixedPhysicalRatio<power, area>::type                                heat_flux_density );
00106                 QUANTITY0( heat_flux_density                                                                    irradiance );
00107                 QUANTITY1( FixedPhysicalRatio<energy, temperature>::type                heat_capacity );
00108                 QUANTITY0( heat_capacity                                                                                entropy );
00109                 QUANTITY1( FixedPhysicalRatio<heat_capacity, mass>::type                specific_heat_capacity );
00110                 QUANTITY0( specific_heat_capacity                                                               specific_entropy );
00111                 QUANTITY1( FixedPhysicalRatio<energy, mass>::type                               specific_energy );
00112                 QUANTITY2( FixedPhysicalRatio<power, typename 
00113                         FixedPhysicalProduct<length, temperature>::type >::type         thermal_conductivity );
00114                 QUANTITY1( FixedPhysicalRatio<energy, volume>::type                             energy_density );
00115                 QUANTITY1( FixedPhysicalRatio<electric_potential_difference, 
00116                         length>::type                                                                                           electric_field_strength );
00117                 QUANTITY1( FixedPhysicalRatio<electric_charge, volume>::type    electric_charge_density );
00118                 QUANTITY1( FixedPhysicalRatio<electric_charge, area>::type              electric_flux_density );
00119                 QUANTITY1( FixedPhysicalRatio<capacitance, length>::type                permittivity );
00120                 QUANTITY1( FixedPhysicalRatio<inductance, length>::type                 permeability );
00121                 QUANTITY1( FixedPhysicalRatio<energy, amount_of_substance>::type        molar_energy );
00122                 QUANTITY1( FixedPhysicalRatio<molar_energy, temperature>::type  molar_entropy );
00123                 QUANTITY0( molar_entropy                                                                                molar_heat_capacity );
00124                 QUANTITY1( FixedPhysicalRatio<electric_charge, mass>::type              exposure ); // (x and gamma rays)
00125                 QUANTITY1( FixedPhysicalRatio<absorbed_dose, time>::type                absorbed_dose_rate );
00126                 QUANTITY1( FixedPhysicalRatio<power, solid_angle>::type                 radiant_intensity );
00127                 QUANTITY1( FixedPhysicalRatio<radiant_intensity, area>::type    radiance );
00128                 QUANTITY1( FixedPhysicalRatio<catalytic_activity, volume>::type catalytic_activity_concentration );
00129 
00130 #undef QUANTITY0
00131 #undef QUANTITY1
00132 #undef QUANTITY2
00133 
00134 
00135 }; // namespace physical
00136 
00137 #endif

Generated on Mon Apr 2 22:25:03 2007 for physical_svn by  doxygen 1.5.1-p1
hosted on SourceForge.net Logo