Object-oriented Scientific Computing Library: Version 0.910
convert_units_gnu.h
00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2008-2012, Andrew W. Steiner
00005   
00006   This file is part of O2scl.
00007   
00008   O2scl is free software; you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License as published by
00010   the Free Software Foundation; either version 3 of the License, or
00011   (at your option) any later version.
00012   
00013   O2scl is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016   GNU General Public License for more details.
00017   
00018   You should have received a copy of the GNU General Public License
00019   along with O2scl. If not, see <http://www.gnu.org/licenses/>.
00020 
00021   -------------------------------------------------------------------
00022 */
00023 #ifndef O2SCL_CONVERT_UNITS_GNU_H
00024 #define O2SCL_CONVERT_UNITS_GNU_H
00025 
00026 #include <cstdio>
00027 #include <cstdlib>
00028 #include <iostream>
00029 #include <fstream>
00030 #include <o2scl/err_hnd.h>
00031 #include <o2scl/misc.h>
00032 #include <o2scl/constants.h>
00033 #include <o2scl/convert_units.h>
00034 
00035 #ifndef DOXYGENP
00036 namespace o2scl {
00037 #endif
00038 
00039   /** \brief Convert units using a system call to GNU units
00040       
00041       Experimental.
00042   */
00043   class convert_units_gnu : public convert_units {
00044     
00045   public:
00046     
00047     convert_units_gnu() {
00048       prefix="units '";
00049       midfix="' '";
00050       suffix="'";
00051     }
00052     
00053     /// \name Strings to form \c units command
00054     //@{
00055     std::string prefix, midfix, suffix;
00056     //@}
00057 
00058     /** \brief Return the value \c val after converting using units \c
00059         from and \c to
00060     */
00061     virtual double convert(std::string from, std::string to, double val) {
00062 
00063       // Look in cache for conversion
00064       std::string both=from+","+to;
00065       miter m3=mcache.find(both);
00066       if (m3!=mcache.end()) {
00067         return val*m3->second.c;
00068       }
00069 
00070       // Look in cache for reverse conversion
00071       std::string both2=to+","+from;
00072       m3=mcache.find(both2);
00073       if (m3!=mcache.end()) {
00074         return val/m3->second.c;
00075       }
00076 
00077       // Look for combined conversions
00078       for(miter m=mcache.begin();m!=mcache.end();m++) {
00079         if (m->second.f==from) {
00080           std::string b=m->second.t+","+to;
00081           miter m2=mcache.find(b);
00082           if (m2!=mcache.end()) {
00083             if (verbose>0) {
00084               std::cout << "Using conversions: " << m->second.f << " , "
00085                         << m->second.t << std::endl;
00086               std::cout << " (1)          and: " << m2->second.f << " , "
00087                         << m2->second.t << std::endl;
00088             }
00089             return m->second.c*m2->second.c;
00090           }
00091           std::string b2=to+","+m->second.t;
00092           miter m4=mcache.find(b2);
00093           if (m4!=mcache.end()) {
00094             if (verbose>0) {
00095               std::cout << "Using conversions: " << m->second.f << " , "
00096                         << m->second.t << std::endl;
00097               std::cout << " (2)          and: " << m4->second.f << " , "
00098                         << m4->second.t << std::endl;
00099             }
00100             return m->second.c/m4->second.c;
00101           }
00102         } else if (m->second.t==from) {
00103           std::string b=m->second.f+","+to;
00104           miter m2=mcache.find(b);
00105           if (m2!=mcache.end()) {
00106             if (verbose>0) {
00107               std::cout << "Using conversions: " << m->second.f << " , "
00108                         << m->second.t << std::endl;
00109               std::cout << " (3)          and: " << m2->second.f << " , "
00110                         << m2->second.t << std::endl;
00111             }
00112             return 1.0/m->second.c*m2->second.c;
00113           }
00114         } else if (m->second.f==to) {
00115           std::string b=m->second.t+","+from;
00116           miter m2=mcache.find(b);
00117           if (m2!=mcache.end()) {
00118             if (verbose>0) {
00119               std::cout << "Using conversions: " << m->second.f << " , "
00120                         << m->second.t << std::endl;
00121               std::cout << " (4)          and: " << m2->second.f << " , "
00122                         << m2->second.t << std::endl;
00123             }
00124             return 1.0/m->second.c/m2->second.c;
00125           }
00126           std::string b2=from+","+m->second.t;
00127           miter m4=mcache.find(b2);
00128           if (m4!=mcache.end()) {
00129             if (verbose>0) {
00130               std::cout << "Using conversions: " << m->second.f << " , "
00131                         << m->second.t << std::endl;
00132               std::cout << " (5)          and: " << m4->second.f << " , "
00133                         << m4->second.t << std::endl;
00134             }
00135             return 1.0/m->second.c*m4->second.c;
00136           }
00137         } else if (m->second.t==to) {
00138           std::string b=m->second.f+","+from;
00139           miter m2=mcache.find(b);
00140           if (m2!=mcache.end()) {
00141             if (verbose>0) {
00142               std::cout << "Using conversions: " << m->second.f << " , "
00143                         << m->second.t << std::endl;
00144               std::cout << " (6)          and: " << m2->second.f << " , "
00145                         << m2->second.t << std::endl;
00146             }
00147             return m->second.c/m2->second.c;
00148           }
00149         }
00150       }
00151       
00152       // Neither found, run the 'units' command
00153       std::string cmd=prefix+from+midfix+to+suffix;
00154       if (verbose>0) std::cout << "cmd: " << cmd << std::endl;
00155       FILE *ps_pipe=popen(cmd.c_str(),"r");
00156       
00157       if (!ps_pipe) {
00158         O2SCL_ERR("Pipe could not be opened in convert_units::convert().",
00159                   gsl_efailed);
00160         return 0.0;
00161       }
00162 
00163       char line1[80];
00164       int size=80;
00165 
00166       fgets(line1,80,ps_pipe);
00167       if (verbose>0) std::cout << "output: " << line1 << std::endl;
00168 
00169       // Read the output from the 'units' command and compute the 
00170       // conversion factor
00171       std::string s=line1, t1, t2;
00172       std::istringstream *ins=new std::istringstream(s);
00173       (*ins) >> t1 >> t2;
00174       delete ins;
00175       double conv=stod(t2);
00176       
00177       // Cleanup
00178       if (pclose(ps_pipe)!=0) {
00179         O2SCL_ERR("Pipe could not be closed in convert_units::convert().",
00180                   gsl_efailed);
00181         return 0.0;
00182       }
00183       
00184       // Add the newly computed conversion to the table
00185       unit_t ut;
00186       ut.f=from;
00187       ut.t=to;
00188       ut.c=conv;
00189       mcache.insert(make_pair(both,ut));
00190       
00191       return conv*val;
00192     }
00193 
00194     /** \brief Make a GNU \c units.dat file from the GSL constants
00195 
00196         If \c c_1 is true, then the second is defined in terms of
00197         meters so that the speed of light is unitless. If \c hbar_1 is
00198         true, then the kilogram is defined in terms of <tt>s/m^2</tt>
00199         so that \f$ \hbar \f$ is unitless.
00200 
00201         \note Not all of the GSL constants or the canonical GNU units 
00202         conversions are given here.
00203      */
00204     int make_units_dat(std::string fname,
00205                        bool c_1=false, bool hbar_1=false,
00206                        bool K_1=false) {
00207       
00208       std::ofstream fout(fname.c_str());
00209       fout.precision(14);
00210 
00211       fout << "################################################" 
00212                 << "##############" << std::endl;
00213       fout << "# Fundamental units" << std::endl;
00214       fout << "m\t!" << std::endl;
00215       fout << "meter\tm" << std::endl;
00216       if (c_1==false) {
00217         fout << "s\t!" << std::endl;
00218         fout << "second\ts" << std::endl;
00219       } else {
00220         fout << "s\t" << gsl_mks::speed_of_light << " m" << std::endl;
00221         fout << "second\ts" << std::endl;
00222       }
00223       if (hbar_1==false) {
00224         fout << "kg\t!" << std::endl;
00225         fout << "kilogram\tkg" << std::endl;
00226       } else {
00227         fout << "kg\t" << 1.0/gsl_mks::plancks_constant_hbar 
00228              << " s / m^2" << std::endl;
00229         fout << "kilogram\tkg" << std::endl;
00230       }
00231       fout << "A\t!" << std::endl;
00232       fout << "ampere\tA" << std::endl;
00233       fout << "amp\tA" << std::endl;
00234       fout << "cd\t!" << std::endl;
00235       fout << "candela\tcd" << std::endl;
00236       fout << "mol\t!" << std::endl;
00237       fout << "mole\tmol" << std::endl;
00238       if (K_1==false) {
00239         fout << "K\t!" << std::endl;
00240         fout << "kelvin\tK" << std::endl;
00241       } else {
00242         fout << "K\t" << gsl_mks::boltzmann << " kg m^2 / s^2" << std::endl;
00243         fout << "kelvin\tK" << std::endl;
00244       }
00245       fout << "radian\t!" << std::endl;
00246       fout << "sr\t!" << std::endl;
00247       fout << "steradian\tsr" << std::endl;
00248       fout << "US$\t!" << std::endl;
00249       fout << "bit\t!" << std::endl;
00250       fout << std::endl;
00251       
00252       fout << "################################################" 
00253                 << "##############" << std::endl;
00254       fout << "# SI and common prefixes" << std::endl;
00255       fout << "yotta-\t\t1e24" << std::endl;
00256       fout << "zetta-\t\t1e21" << std::endl;
00257       fout << "exa-\t\t1e18" << std::endl;
00258       fout << "peta-\t\t1e15" << std::endl;
00259       fout << "tera-\t\t1e12" << std::endl;
00260       fout << "giga-\t\t1e9" << std::endl;
00261       fout << "mega-\t\t1e6" << std::endl;
00262       fout << "myria-\t\t1e4" << std::endl;
00263       fout << "kilo-\t\t1e3" << std::endl;
00264       fout << "hecto-\t\t1e2" << std::endl;
00265       fout << "deca-\t\t1e1" << std::endl;
00266       fout << "deka-\t\tdeca" << std::endl;
00267       fout << "deci-\t\t1e-1" << std::endl;
00268       fout << "centi-\t\t1e-2" << std::endl;
00269       fout << "milli-\t\t1e-3" << std::endl;
00270       fout << "micro-\t\t1e-6" << std::endl;
00271       fout << "nano-\t\t1e-9" << std::endl;
00272       fout << "pico-\t\t1e-12" << std::endl;
00273       fout << "femto-\t\t1e-15" << std::endl;
00274       fout << "atto-\t\t1e-18" << std::endl;
00275       fout << "zepto-\t\t1e-21" << std::endl;
00276       fout << "yocto-\t\t1e-24" << std::endl;
00277       fout << "quarter-\t1|4" << std::endl;
00278       fout << "semi-\t\t0.5" << std::endl;
00279       fout << "demi-\t\t0.5" << std::endl;
00280       fout << "hemi-\t\t0.5" << std::endl;
00281       fout << "half-\t\t0.5" << std::endl;
00282       fout << "double-\t\t2" << std::endl;
00283       fout << "triple-\t\t3" << std::endl;
00284       fout << "treble-\t\t3" << std::endl;
00285       fout << std::endl;
00286 
00287       fout << "################################################" 
00288                 << "##############" << std::endl;
00289       fout << "# SI prefix abbreviations" << std::endl;
00290       fout << "Y-                      yotta" << std::endl;
00291       fout << "Z-                      zetta" << std::endl;
00292       fout << "E-                      exa" << std::endl;
00293       fout << "P-                      peta" << std::endl;
00294       fout << "T-                      tera" << std::endl;
00295       fout << "G-                      giga" << std::endl;
00296       fout << "M-                      mega" << std::endl;
00297       fout << "k-                      kilo" << std::endl;
00298       fout << "h-                      hecto" << std::endl;
00299       fout << "da-                     deka" << std::endl;
00300       fout << "d-                      deci" << std::endl;
00301       fout << "c-                      centi" << std::endl;
00302       fout << "m-                      milli" << std::endl;
00303       fout << "n-                      nano" << std::endl;
00304       fout << "p-                      pico" << std::endl;
00305       fout << "f-                      femto" << std::endl;
00306       fout << "a-                      atto" << std::endl;
00307       fout << "z-                      zepto" << std::endl;
00308       fout << "y-                      yocto" << std::endl;
00309       fout << std::endl;
00310 
00311       fout << "################################################" 
00312                 << "##############" << std::endl;
00313       fout << "# Basic numbers" << std::endl;
00314       fout << "one                     1" << std::endl;
00315       fout << "two                     2" << std::endl;
00316       fout << "double                  2" << std::endl;
00317       fout << "couple                  2" << std::endl;
00318       fout << "three                   3" << std::endl;
00319       fout << "triple                  3" << std::endl;
00320       fout << "four                    4" << std::endl;
00321       fout << "quadruple               4" << std::endl;
00322       fout << "five                    5" << std::endl;
00323       fout << "quintuple               5" << std::endl;
00324       fout << "six                     6" << std::endl;
00325       fout << "seven                   7" << std::endl;
00326       fout << "eight                   8" << std::endl;
00327       fout << "nine                    9" << std::endl;
00328       fout << "ten                     10" << std::endl;
00329       fout << "twenty                  20" << std::endl;
00330       fout << "thirty                  30" << std::endl;
00331       fout << "forty                   40" << std::endl;
00332       fout << "fifty                   50" << std::endl;
00333       fout << "sixty                   60" << std::endl;
00334       fout << "seventy                 70" << std::endl;
00335       fout << "eighty                  80" << std::endl;
00336       fout << "ninety                  90" << std::endl;
00337       fout << "hundred                 100" << std::endl;
00338       fout << "thousand                1000" << std::endl;
00339       fout << "million                 1e6" << std::endl;
00340       fout << "billion                 1e9" << std::endl;
00341       fout << "trillion                1e12" << std::endl;
00342       fout << "quadrillion             1e15" << std::endl;
00343       fout << "quintillion             1e18" << std::endl;
00344       fout << "sextillion              1e21" << std::endl;
00345       fout << "septillion              1e24" << std::endl;
00346       fout << "octillion               1e27" << std::endl;
00347       fout << "nonillion               1e30" << std::endl;
00348       fout << "noventillion            nonillion" << std::endl;
00349       fout << "decillion               1e33" << std::endl;
00350       fout << "undecillion             1e36" << std::endl;
00351       fout << "duodecillion            1e39" << std::endl;
00352       fout << "tredecillion            1e42" << std::endl;
00353       fout << "quattuordecillion       1e45" << std::endl;
00354       fout << "quindecillion           1e48" << std::endl;
00355       fout << "sexdecillion            1e51" << std::endl;
00356       fout << "septendecillion         1e54" << std::endl;
00357       fout << "octodecillion           1e57" << std::endl;
00358       fout << "novemdecillion          1e60" << std::endl;
00359       fout << "vigintillion            1e63" << std::endl;
00360       fout << "googol                  1e100" << std::endl;
00361       fout << "centillion              1e303" << std::endl;
00362       fout << std::endl;
00363 
00364       fout << "################################################" 
00365                 << "##############" << std::endl;
00366       fout << "# Basic SI units" << std::endl;
00367       fout << "newton                  kg m / s^2   " << std::endl;
00368       fout << "N                       newton" << std::endl;
00369       fout << "pascal                  N/m^2        " << std::endl;
00370       fout << "Pa                      pascal" << std::endl;
00371       fout << "joule                   N m          " << std::endl;
00372       fout << "J                       joule" << std::endl;
00373       fout << "watt                    J/s          " << std::endl;
00374       fout << "W                       watt" << std::endl;
00375       fout << "coulomb                 A s          " << std::endl;
00376       fout << "C                       coulomb" << std::endl;
00377       fout << "volt                    W/A          " << std::endl;
00378       fout << "V                       volt" << std::endl;
00379       fout << "ohm                     V/A          " << std::endl;
00380       fout << "siemens                 A/V          " << std::endl;
00381       fout << "S                       siemens" << std::endl;
00382       fout << "farad                   C/V          " << std::endl;
00383       fout << "F                       farad" << std::endl;
00384       fout << "weber                   V s          " << std::endl;
00385       fout << "Wb                      weber" << std::endl;
00386       fout << "henry                   Wb/A         " << std::endl;
00387       fout << "H                       henry" << std::endl;
00388       fout << "tesla                   Wb/m^2       " << std::endl;
00389       fout << "T                       tesla" << std::endl;
00390       fout << "hertz                   1/s           " << std::endl;
00391       fout << "Hz                      hertz" << std::endl;
00392       fout << "gram                    millikg       " << std::endl;
00393       fout << "g                       gram" << std::endl;
00394       fout << std::endl;
00395 
00396       fout << "################################################" 
00397                 << "##############" << std::endl;
00398       fout << "# Dimensional analysis units" << std::endl;
00399       fout << "LENGTH                  meter" << std::endl;
00400       fout << "AREA                    LENGTH^2" << std::endl;
00401       fout << "VOLUME                  LENGTH^3" << std::endl;
00402       fout << "MASS                    kilogram" << std::endl;
00403       fout << "CURRENT                 ampere" << std::endl;
00404       fout << "AMOUNT                  mole" << std::endl;
00405       fout << "ANGLE                   radian" << std::endl;
00406       fout << "SOLID_ANGLE             steradian" << std::endl;
00407       fout << "MONEY                   US$" << std::endl;
00408       fout << "FORCE                   newton" << std::endl;
00409       fout << "PRESSURE                FORCE / AREA" << std::endl;
00410       fout << "STRESS                  FORCE / AREA" << std::endl;
00411       fout << "CHARGE                  coulomb" << std::endl;
00412       fout << "CAPACITANCE             farad" << std::endl;
00413       fout << "RESISTANCE              ohm" << std::endl;
00414       fout << "CONDUCTANCE             siemens" << std::endl;
00415       fout << "INDUCTANCE              henry" << std::endl;
00416       fout << "FREQUENCY               hertz" << std::endl;
00417       fout << "VELOCITY                LENGTH / TIME" << std::endl;
00418       fout << "ACCELERATION            VELOCITY / TIME" << std::endl;
00419       fout << "DENSITY                 MASS / VOLUME" << std::endl;
00420       fout << "LINEAR_DENSITY          MASS / LENGTH" << std::endl;
00421       fout << "VISCOSITY               FORCE TIME / AREA" << std::endl;
00422       fout << "KINEMATIC_VISCOSITY     VISCOSITY / DENSITY" << std::endl;
00423       fout << std::endl;
00424       
00425       fout << "################################################" 
00426                 << "##############" << std::endl;
00427       fout << "# GSL constants" << std::endl;
00428       fout << "schwarzchild_radius\t\t" << gsl_mks::schwarzchild_radius
00429                 << " m" << std::endl;
00430       fout << "Rschwarz\t\tschwarzchild_radius" << std::endl;
00431       fout << "speed_of_light\t\t" << gsl_mks::speed_of_light
00432                 << " m / s" << std::endl;
00433       fout << "c\t\tspeed_of_light" << std::endl;
00434       fout << "gravitational_constant\t\t" 
00435                 << gsl_mks::gravitational_constant
00436                 << " m^3 / kg s^2" << std::endl;
00437       fout << "G\t\tgravitational_constant" << std::endl;
00438       fout << "plancks_constant_h\t\t" 
00439                 << gsl_mks::plancks_constant_h
00440                 << " kg m^2 / s" << std::endl;
00441       fout << "h\t\tplancks_constant_h" << std::endl;
00442       fout << "plancks_constant_hbar\t\t" 
00443                 << gsl_mks::plancks_constant_hbar
00444                 << " kg m^2 / s" << std::endl;
00445       fout << "hbar\t\tplancks_constant_hbar" << std::endl;
00446       fout << "astronomical_unit\t\t" << gsl_mks::astronomical_unit
00447                 << " m" << std::endl;
00448       fout << "au\t\tastronomical_unit" << std::endl;
00449       fout << "light_year\t\t" << gsl_mks::light_year
00450                 << " m" << std::endl;
00451       fout << "lyr\t\tlight_year" << std::endl;
00452       fout << "parsec\t\t" << gsl_mks::parsec
00453                 << " m" << std::endl;
00454       fout << "pc\t\tparsec" << std::endl;
00455       fout << "grav_accel\t\t" << gsl_mks::grav_accel
00456                 << " m / s^2" << std::endl;
00457       fout << "electron_volt\t\t" << gsl_mks::electron_volt
00458                 << " kg m^2 / s^2" << std::endl;
00459       fout << "eV\t\telectron_volt" << std::endl;
00460       fout << "mass_electron\t\t" << gsl_mks::mass_electron
00461                 << " kg" << std::endl;
00462       fout << "mass_muon\t\t" << gsl_mks::mass_muon
00463                 << " kg" << std::endl;
00464       fout << "mass_proton\t\t" << gsl_mks::mass_proton
00465                 << " kg" << std::endl;
00466       fout << "mass_neutron\t\t" << gsl_mks::mass_neutron
00467                 << " kg" << std::endl;
00468       fout << "rydberg\t\t" << gsl_mks::rydberg
00469                 << " kg m^2 / s^2" << std::endl;
00470       fout << "boltzmann\t\t" << gsl_mks::boltzmann
00471                 << " kg m^2 / K s^2" << std::endl;
00472       fout << "bohr_magneton\t\t" << gsl_mks::bohr_magneton
00473                 << " A m^2" << std::endl;
00474       fout << "nuclear_magneton\t\t" << gsl_mks::nuclear_magneton
00475                 << " A m^2" << std::endl;
00476       fout << "electron_magnetic_moment\t\t" 
00477                 << gsl_mks::electron_magnetic_moment
00478                 << " A m^2" << std::endl;
00479       fout << "proton_magnetic_moment\t\t" 
00480                 << gsl_mks::proton_magnetic_moment
00481                 << " A m^2" << std::endl;
00482       fout << "molar_gas\t\t" << gsl_mks::molar_gas
00483                 << " kg m^2 / K mol s^2" << std::endl;
00484       fout << "standard_gas_volume\t\t" << gsl_mks::standard_gas_volume
00485                 << " m^3 / mol" << std::endl;
00486       fout << "minute\t\t" << gsl_mks::minute
00487                 << " s" << std::endl;
00488       fout << "min\t\tminute" << std::endl;
00489       fout << "hour\t\t" << gsl_mks::hour
00490                 << " s" << std::endl;
00491       fout << "day\t\t" << gsl_mks::day
00492                 << " s" << std::endl;
00493       fout << "week\t\t" << gsl_mks::week
00494                 << " s" << std::endl;
00495       fout << "inch\t\t" << gsl_mks::inch
00496                 << " m" << std::endl;
00497       fout << "foot\t\t" << gsl_mks::foot
00498                 << " m" << std::endl;
00499       fout << "yard\t\t" << gsl_mks::yard
00500                 << " m" << std::endl;
00501       fout << "mile\t\t" << gsl_mks::mile
00502                 << " m" << std::endl;
00503       fout << "nautical_mile\t\t" << gsl_mks::nautical_mile
00504                 << " m" << std::endl;
00505       fout << "fathom\t\t" << gsl_mks::fathom
00506                 << " m" << std::endl;
00507       fout << "mil\t\t" << gsl_mks::mil
00508                 << " m" << std::endl;
00509       fout << "point\t\t" << gsl_mks::point
00510                 << " m" << std::endl;
00511       fout << "texpoint\t\t" << gsl_mks::texpoint
00512                 << " m" << std::endl;
00513       fout << "micron\t\t" << gsl_mks::micron
00514                 << " m" << std::endl;
00515       fout << "angstrom\t\t" << gsl_mks::angstrom
00516                 << " m" << std::endl;
00517       fout << "hectare\t\t" << gsl_mks::hectare
00518                 << " m^2" << std::endl;
00519       fout << "acre\t\t" << gsl_mks::acre
00520                 << " m^2" << std::endl;
00521       fout << "barn\t\t" << gsl_mks::barn
00522                 << " m^2" << std::endl;
00523       fout << "liter\t\t" << gsl_mks::liter
00524                 << " m^3" << std::endl;
00525       fout << "us_gallon\t\t" << gsl_mks::us_gallon
00526                 << " m^3" << std::endl;
00527       fout << "gallon\t\tus_gallon" << std::endl;
00528       fout << "quart\t\t" << gsl_mks::quart
00529                 << " m^3" << std::endl;
00530       fout << "pint\t\t" << gsl_mks::pint
00531                 << " m^3" << std::endl;
00532       fout << "cup\t\t" << gsl_mks::cup
00533                 << " m^3" << std::endl;
00534       fout << "fluid_ounce\t\t" << gsl_mks::fluid_ounce
00535                 << " m^3" << std::endl;
00536       fout << "tablespoon\t\t" << gsl_mks::tablespoon
00537                 << " m^3" << std::endl;
00538       fout << "teaspoon\t\t" << gsl_mks::teaspoon
00539                 << " m^3" << std::endl;
00540       fout << "canadian_gallon\t\t" << gsl_mks::canadian_gallon
00541                 << " m^3" << std::endl;
00542       fout << "uk_gallon\t\t" << gsl_mks::uk_gallon
00543                 << " m^3" << std::endl;
00544       fout << "miles_per_hour\t\t" << gsl_mks::miles_per_hour
00545                 << " m / s" << std::endl;
00546       fout << "mph\t\tmiles_per_hour" << std::endl;
00547       fout << "kilometers_per_hour\t\t" << gsl_mks::kilometers_per_hour
00548                 << " m / s" << std::endl;
00549       fout << "kph\t\tkilometers_per_hour" << std::endl;
00550       fout << "knot\t\t" << gsl_mks::knot
00551                 << " m / s" << std::endl;
00552       fout << "pound_mass\t\t" << gsl_mks::pound_mass
00553                 << " kg" << std::endl;
00554       fout << "ounce_mass\t\t" << gsl_mks::ounce_mass
00555                 << " kg" << std::endl;
00556       fout << "ton\t\t" << gsl_mks::ton
00557                 << " kg" << std::endl;
00558       fout << "metric_ton\t\t" << gsl_mks::metric_ton
00559                 << " kg" << std::endl;
00560       fout << "uk_ton\t\t" << gsl_mks::uk_ton
00561                 << " kg" << std::endl;
00562       fout << "troy_ounce\t\t" << gsl_mks::troy_ounce
00563                 << " kg" << std::endl;
00564       fout << "carat\t\t" << gsl_mks::carat
00565                 << " kg" << std::endl;
00566       fout << "unified_atomic_mass\t\t" << gsl_mks::unified_atomic_mass
00567                 << " kg" << std::endl;
00568       fout << "gram_force\t\t" << gsl_mks::gram_force
00569                 << " kg m / s^2" << std::endl;
00570       fout << "pound_force\t\t" << gsl_mks::pound_force
00571                 << " kg m / s^2" << std::endl;
00572       fout << "kilopound_force\t\t" << gsl_mks::kilopound_force
00573                 << " kg m / s^2" << std::endl;
00574       fout << "poundal\t\t" << gsl_mks::poundal
00575                 << " kg m / s^2" << std::endl;
00576       fout << "calorie\t\t" << gsl_mks::calorie
00577                 << " kg m^2 / s^2" << std::endl;
00578       fout << "btu\t\t" << gsl_mks::btu
00579                 << " kg m^2 / s^2" << std::endl;
00580       fout << "therm\t\t" << gsl_mks::therm
00581                 << " kg m^2 / s^2" << std::endl;
00582       fout << "horsepower\t\t" << gsl_mks::horsepower
00583                 << " kg m^2 / s^3" << std::endl;
00584       fout << "hp\t\thorsepower" << std::endl;
00585       fout << "bar\t\t" << gsl_mks::bar
00586                 << " kg / m s^2" << std::endl;
00587       fout << "std_atmosphere\t\t" << gsl_mks::std_atmosphere
00588                 << " kg / m s^2" << std::endl;
00589       fout << "torr\t\t" << gsl_mks::torr
00590                 << " kg / m s^2" << std::endl;
00591       fout << "meter_of_mercury\t\t" << gsl_mks::meter_of_mercury
00592                 << " kg / m s^2" << std::endl;
00593       fout << "inch_of_mercury\t\t" << gsl_mks::inch_of_mercury
00594                 << " kg / m s^2" << std::endl;
00595       fout << "inch_of_water\t\t" << gsl_mks::inch_of_water
00596                 << " kg / m s^2" << std::endl;
00597       fout << "psi\t\t" << gsl_mks::psi
00598                 << " kg / m s^2" << std::endl;
00599       fout << "poise\t\t" << gsl_mks::poise
00600                 << " kg / m s " << std::endl;
00601       fout << "stokes\t\t" << gsl_mks::stokes
00602                 << " m^2 / s" << std::endl;
00603       fout << "faraday\t\t" << gsl_mks::faraday
00604                 << " A s / mol" << std::endl;
00605       fout << "electron_charge\t\t" << gsl_mks::electron_charge
00606                 << " A s" << std::endl;
00607       fout << "gauss\t\t" << gsl_mks::gauss
00608                 << " kg / A s^2" << std::endl;
00609       fout << "stilb\t\t" << gsl_mks::stilb
00610                 << " cd / m^2" << std::endl;
00611       fout << "lumen\t\t" << gsl_mks::lumen
00612                 << " cd sr" << std::endl;
00613       fout << "lux\t\t" << gsl_mks::lux
00614                 << " cd sr / m^2" << std::endl;
00615       fout << "phot\t\t" << gsl_mks::phot
00616                 << " cd sr / m^2" << std::endl;
00617       fout << "footcandle\t\t" << gsl_mks::footcandle
00618                 << " cd sr / m^2" << std::endl;
00619       fout << "lambert\t\t" << gsl_mks::lambert
00620                 << " cd sr / m^2" << std::endl;
00621       fout << "footlambert\t\t" << gsl_mks::footlambert
00622                 << " cd sr / m^2" << std::endl;
00623       fout << "curie\t\t" << gsl_mks::curie
00624                 << " 1 / s" << std::endl;
00625       fout << "roentgen\t\t" << gsl_mks::roentgen
00626                 << " A s / kg" << std::endl;
00627       fout << "rad\t\t" << gsl_mks::rad
00628                 << " m^2 / s^2" << std::endl;
00629       fout << "solar_mass\t\t" << gsl_mks::solar_mass
00630                 << " kg" << std::endl;
00631       fout << "Msun\t\tsolar_mass" << std::endl;
00632       fout << "bohr_radius\t\t" << gsl_mks::bohr_radius
00633                 << " m" << std::endl;
00634       fout << "dyne\t\t" << gsl_mks::dyne
00635                 << " kg m / s^2" << std::endl;
00636       fout << "erg\t\t" << gsl_mks::erg
00637                 << " kg m^2 / s^2" << std::endl;
00638       fout << "stefan_boltzmann_constant\t\t" 
00639                 << gsl_mks::stefan_boltzmann_constant
00640                 << " kg / K^4 s^3" << std::endl;
00641       fout << "thomson_cross_section\t\t" 
00642                 << gsl_mks::thomson_cross_section
00643                 << " m^2" << std::endl;
00644       fout << "vacuum_permittivity\t\t" << gsl_mks::vacuum_permittivity
00645                 << " A^2 s^4 / kg m^3" << std::endl;
00646       fout << "vacuum_permeability\t\t" << gsl_mks::vacuum_permeability
00647                 << " kg m / A^2 s^2" << std::endl;
00648       fout.close();
00649       
00650       return 0;
00651     }
00652 
00653 
00654   };
00655   
00656 #ifndef DOXYGENP
00657 }
00658 #endif
00659 
00660 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.