Ignore:
Timestamp:
Sep 26, 2005, 6:55:39 PM (19 years ago)
Author:
dkearney
Message:

fixed the python rpunits setup script so now it really finds PyRpUnits?.cc

added more conversions to RpUnitsStd?.[h,cc]

added static convert function to RpUnits.[h,cc] so now users can ask for a
conversion as without having to make an RpUnits Object. instead, the
user specifies the value to be converted (value with attached units) as well
as the units we should convert to and if they want units in the returned
string. if the units exist, the conversion is done, if not, the original
string should be returned.

also added the ability to load preset units into the dictionary.
use the static function RpUnits::addPresets(...) in c++ this is done
automatically in python (although, maybe it shouldn't be).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/RpUnitsStd.cc

    r20 r68  
    131131/****************************************
    132132 * METRIC TO NON-METRIC CONVERSIONS
     133 * LENGTH CONVERSIONS
     134 * http://www.nodc.noaa.gov/dsdt/ucg/
    133135 ****************************************/
    134136
     
    143145}
    144146
     147double meter2inch (double m)
     148{
     149        return (m*39.37008);
     150}
     151
     152double inch2meter (double in)
     153{
     154        return (in/39.37008);
     155}
     156
     157double meter2feet (double m)
     158{
     159        return (m*3.280840);
     160}
     161
     162double feet2meter (double ft)
     163{
     164        return (ft/3.280840);
     165}
     166
     167double meter2yard (double m)
     168{
     169        return (m*1.093613);
     170}
     171
     172double yard2meter (double yd)
     173{
     174        return (yd/1.093613);
     175}
     176
    145177/****************************************
    146178 * TEMPERATURE CONVERSIONS
     
    167199}
    168200
     201double rankine2kelvin (double R)
     202{
     203        return ((9.0/5.0)*R);
     204}
     205
     206double kelvin2rankine (double K)
     207{
     208        return ((5.0/9.0)*K);
     209}
     210
     211double fahrenheit2kelvin (double F)
     212{
     213        return ((F+459.67)*(5.0/9.0));
     214}
     215
     216double kelvin2fahrenheit (double K)
     217{
     218        return (((9.0/5.0)*K)-459.67);
     219}
     220
     221/****************************************
     222 * ENERGY CONVERSIONS
     223 ****************************************/
     224
     225double electronVolt2joule (double eV)
     226{
     227        return (eV*1.602177e-19);
     228}
     229
     230double joule2electronVolt (double J)
     231{
     232        return (J*1.602177e19);
     233}
    169234
    170235#ifdef __cplusplus
Note: See TracChangeset for help on using the changeset viewer.