Changeset 709


Ignore:
Timestamp:
May 7, 2007 12:18:04 PM (17 years ago)
Author:
dkearney
Message:

added newton, amu as units.
clarified system names for hz, bq, mol

Location:
trunk/src/core
Files:
2 edited

Legend:

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

    r613 r709  
    23832383        retVal = RpUnitsPreset::addPresetPressure();
    23842384    }
     2385    else if (group.compare(RP_TYPE_CONC) == 0) {
     2386        retVal = RpUnitsPreset::addPresetConcentration();
     2387    }
     2388    else if (group.compare(RP_TYPE_FORCE) == 0) {
     2389        retVal = RpUnitsPreset::addPresetForce();
     2390    }
    23852391    else if (group.compare(RP_TYPE_MISC) == 0) {
    23862392        retVal = RpUnitsPreset::addPresetMisc();
     
    24142420    result += addPresetPressure();
    24152421    result += addPresetConcentration();
     2422    result += addPresetForce();
    24162423    result += addPresetMisc();
    24172424
     
    24732480                              !RPUNITS_CASE_INSENSITIVE);
    24742481    micro = RpUnits::define ( "u",  basis, type);
    2475     nano  = RpUnits::define ( "n",  basis, type);
     2482    nano  = RpUnits::define ( "n",  basis, type, !RPUNITS_METRIC,
     2483                              !RPUNITS_CASE_INSENSITIVE);
    24762484    pico  = RpUnits::define ( "p",  basis, type, !RPUNITS_METRIC,
    24772485                              !RPUNITS_CASE_INSENSITIVE);
     
    28232831/// Add concentration related units to the dictionary
    28242832/**
    2825  * http://www.ilpi.com/msds/ref/pressureunits.html
    28262833 *
    28272834 * Defines the following units:
     
    28482855
    28492856/**********************************************************************/
     2857// METHOD: addPresetForce()
     2858/// Add concentration related units to the dictionary
     2859/**
     2860 * http://en.wikipedia.org/wiki/Newton
     2861 *
     2862 * Defines the following units:
     2863 *   newton    (N)
     2864 *
     2865 * Return codes: 0 success, anything else is error
     2866 */
     2867
     2868int
     2869RpUnitsPreset::addPresetForce () {
     2870
     2871    RpUnits* newton = NULL;
     2872
     2873    newton = RpUnits::define("N",  NULL, RP_TYPE_FORCE, RPUNITS_METRIC);
     2874
     2875    return 0;
     2876}
     2877
     2878/**********************************************************************/
    28502879// METHOD: addPresetMisc()
    28512880/// Add Misc related units to the dictionary
     
    28642893    RpUnits* hertz     = NULL;
    28652894    RpUnits* becquerel = NULL;
     2895    RpUnits* amu       = NULL;
    28662896
    28672897    volt      = RpUnits::define("V",  NULL, RP_TYPE_EPOT, RPUNITS_METRIC);
    2868     mole      = RpUnits::define("mol",NULL, RP_TYPE_MISC, RPUNITS_METRIC);
    2869     hertz     = RpUnits::define("Hz", NULL, RP_TYPE_MISC, RPUNITS_METRIC);
    2870     becquerel = RpUnits::define("Bq", NULL, RP_TYPE_MISC, RPUNITS_METRIC);
     2898    mole      = RpUnits::define("mol",NULL, "quantity", RPUNITS_METRIC);
     2899    hertz     = RpUnits::define("Hz", NULL, "frequency", RPUNITS_METRIC);
     2900    becquerel = RpUnits::define("Bq", NULL, "radioactivity", RPUNITS_METRIC);
     2901    amu       = RpUnits::define("amu", NULL, "mass_unit", !RPUNITS_METRIC);
    28712902
    28722903    // RpUnits* percent   = RpUnits::define("%",  NULL, RP_TYPE_MISC);
     
    29112942        return &RpUnitsTypes::hintTypeConc;
    29122943    }
     2944    else if (type.compare(RP_TYPE_CONC) == 0) {
     2945        return &RpUnitsTypes::hintTypeForce;
     2946    }
    29132947    else if (type.compare(RP_TYPE_MISC) == 0) {
    29142948        return &RpUnitsTypes::hintTypeMisc;
     
    30573091
    30583092    if ( (unitObj->getType()).compare(RP_TYPE_CONC) == 0 ) {
     3093        retVal = true;
     3094    }
     3095
     3096    return retVal;
     3097}
     3098
     3099bool
     3100RpUnitsTypes::hintTypeForce   (   RpUnits* unitObj    ) {
     3101
     3102    bool retVal = false;
     3103
     3104    if ( (unitObj->getType()).compare(RP_TYPE_FORCE) == 0 ) {
    30593105        retVal = true;
    30603106    }
  • trunk/src/core/RpUnits.h

    r568 r709  
    4545#define RP_TYPE_PRESSURE    "pressure"
    4646#define RP_TYPE_CONC        "concentration"
     47#define RP_TYPE_FORCE       "force"
    4748#define RP_TYPE_MISC        "misc"
    4849
     
    8283        static int  addPresetPressure();
    8384        static int  addPresetConcentration();
     85        static int  addPresetForce();
    8486        static int  addPresetMisc();
    8587};
     
    103105        static bool hintTypePressure  ( RpUnits* unitObj );
    104106        static bool hintTypeConc      ( RpUnits* unitObj );
     107        static bool hintTypeForce     ( RpUnits* unitObj );
    105108        static bool hintTypeMisc      ( RpUnits* unitObj );
    106109
     
    499502        // populate the dictionary with a set of units specified by group
    500503        // if group equals........................then load................
    501         //                   "all"           load all available units
    502         //  RP_TYPE_ENERGY   "energy"        load units related to energy
    503         //  RP_TYPE_EPOT     "electric_potential" load units related to electric potential
    504         //  RP_TYPE_LENGTH   "length"        load units related to length
    505         //  RP_TYPE_TEMP     "temperature"   load units related to temperature
    506         //  RP_TYPE_TIME     "time"          load units related to time
    507         //  RP_TYPE_VOLUME   "volume"        load units related to volume
    508         //  RP_TYPE_ANGLE    "angle"         load units related to angles
    509         //  RP_TYPE_MASS     "mass"          load units related to mass
    510         //  RP_TYPE_PREFIX   "prefix"        load unit prefixes
    511         //  RP_TYPE_PRESSURE "pressure"      load units related to pressure
    512         //  RP_TYPE_CONC     "concentration" load units related to pressure
    513         //  RP_TYPE_MISC     "misc"          load units related to everything else
     504        //                    "all"           load all available units
     505        //  RP_TYPE_ENERGY    "energy"        load units related to energy
     506        //  RP_TYPE_EPOT      "electric_potential" load units related to electric potential
     507        //  RP_TYPE_LENGTH    "length"        load units related to length
     508        //  RP_TYPE_TEMP      "temperature"   load units related to temperature
     509        //  RP_TYPE_TIME      "time"          load units related to time
     510        //  RP_TYPE_VOLUME    "volume"        load units related to volume
     511        //  RP_TYPE_ANGLE     "angle"         load units related to angles
     512        //  RP_TYPE_MASS      "mass"          load units related to mass
     513        //  RP_TYPE_PREFIX    "prefix"        load unit prefixes
     514        //  RP_TYPE_PRESSURE  "pressure"      load units related to pressure
     515        //  RP_TYPE_CONC      "concentration" load units related to concentration
     516        //  RP_TYPE_FORCE     "force"         load units related to force
     517        //  RP_TYPE_MISC      "misc"          load units related to everything else
    514518        //  (no other groups have been created)
    515519
Note: See TracChangeset for help on using the changeset viewer.