Ignore:
Timestamp:
Apr 27, 2012, 12:26:07 AM (13 years ago)
Author:
ansari
Message:

Petites ameliorations classes Units et PhysQty, documentation doxygen, ajout fichiers pqnumber.h et sunitpcst.h ds basetools.h, passage numero de version a 2.30, Reza 27/04/2012

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/BaseTools/sunitpcst.cc

    r4056 r4062  
    77   \class Units
    88   \ingroup BaseTools
    9    Class for representing physical units
     9   This class represents physical dimension and units. Static methods return Units
     10   objects corresponding to the usual units, such as meter or watt
    1011   
    1112   \code
    12    // Create ....
     13   Units w=Units::watt();
     14   cout << " Power unit (watt) : " << w.Name() << " (" << w << ")" << endl;
     15   // define the speed SI unit (m/s) :
     16   Units mos = Units::meter()/Units::second() ;
     17   cout << " SI speed unit : " << mos << "  -> "; mos.Print() ; 
     18   // mutiple of an existing unit :
     19   Units mw=Units::watt().mega();
     20   cout << " Megawatt: " << mw.Name() << " (" << mw << ")  -> "; mw.Print() ;
    1321   \endcode
    1422*/
     
    2634
    2735/* --Methode-- */
     36/*!
     37  The Units object is created by specifying its name and short name, and the integer powers
     38  for the seven SI base physical quantities (length, mass, time \ldots), and the value of the
     39  unit in term of the SI unit.
     40*/
    2841Units::Units(const char* nom, const char* snom, int m, int kg, int s, r_8 val, int A, int K, int mol, int cd)
    2942  : mLength_(m), mMass_(kg), mTime_(s), mCurr_(A),
     
    3851{
    3952  Set(un);
     53}
     54
     55/* --Methode-- */
     56Units::Units(Units const& un, r_8 scale, const char* nom, const char* snom)
     57{
     58  Set(un);
     59  mSI_Value_*=scale;
     60  mName_=nom;
     61  mShortName_=snom;
    4062}
    4163
     
    179201   \class PhysQty
    180202   \ingroup BaseTools
    181    Class for representing physical quantities and constants
     203   Class for representing physical quantities and constants. A physical quantity
     204   has a unit and a value, and optionally a precision and/or a name. A number of
     205   physical constants and standard quantities can be obtained as PhysQty objects
     206   through static methods.
    182207   
     208   \sa SOPHYA::Units
     209
    183210   \code
    184    // Create ....
     211   cout <<  " k_Boltzmann: " << PhysQty::k() << endl;
     212   cout <<  " m_e: " << PhysQty::electron_mass() << endl;
     213   // Conversion of a quantity to a different unit
     214   PhysQty aj(Units::joule(), 25.);
     215   PhysQty aev=aj.ConvertTo(Units::electronvolt().giga());
     216   cout <<  " A : " << aj << " -> " << aev << endl;
    185217   \endcode
    186218*/
     
    191223
    192224/* --Methode-- */
     225//! Default constructor: zero valued dimensionless quantity
    193226PhysQty::PhysQty()
    194227  : unit_(), val_(0.), prec_(0.)
     
    197230
    198231/* --Methode-- */
     232/*!
     233  \brief standard constructor
     234  The object is constructed through the specification of the unit \b u, the value \b val,
     235  and optional relative precision \b prec (=delta val/val) and an optional name.
     236*/
    199237PhysQty::PhysQty(Units const & u, r_8 val, r_8 prec, const char* nom)
    200238  : unit_(u), val_(val), prec_(prec), name_((nom==NULL)?"":nom)
     
    203241
    204242/* --Methode-- */
     243//! Copy constructor
    205244PhysQty::PhysQty(PhysQty const & qty)
    206245  : unit_(qty.unit_), val_(qty.val_), prec_(qty.prec_), name_(qty.name_)
Note: See TracChangeset for help on using the changeset viewer.