Flow123d  jenkins-Flow123d-windows32-release-multijob-51
Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | Friends | List of all members
UnitSI Class Reference

Class for representation SI units of Fields. More...

#include <unit_si.hh>

Collaboration diagram for UnitSI:
Collaboration graph
[legend]

Public Member Functions

 UnitSI ()
 Constructor. More...
 
UnitSIm (int exp=1)
 Methods set values of exponents for SI units with similar name. More...
 
UnitSIkg (int exp=1)
 
UnitSIs (int exp=1)
 
UnitSIA (int exp=1)
 
UnitSIK (int exp=1)
 
UnitSImol (int exp=1)
 
UnitSIcd (int exp=1)
 
UnitSImd (int exp=-1)
 Method sets value of exponent for m^{-d}, where d is dimension of region. More...
 
std::string format () const
 
void undef (bool val=true)
 
bool is_def () const
 Return true if the unit is defined. More...
 

Static Public Member Functions

static UnitSIN ()
 
static UnitSIJ ()
 Returns Joule. More...
 
static UnitSIW ()
 Returns Watt. More...
 
static UnitSIPa ()
 Returns Pascal. More...
 
static UnitSIdimensionless ()
 Returns dimensionless unit. More...
 

Private Types

enum  UnitOrder {
  order_m =0, order_kg =1, order_s =2, order_A =3,
  order_K =4, order_mol =5, order_cd =6, order_md =7
}
 Values determine positions of exponents in exponents_ vector. More...
 

Private Attributes

std::vector< int > exponents_
 
bool undef_
 

Friends

UnitSI operator* (const UnitSI &a, const UnitSI &b)
 Product of two units. More...
 
UnitSI operator/ (const UnitSI &a, const UnitSI &b)
 Proportion of two units. More...
 

Detailed Description

Class for representation SI units of Fields.

Units are set through exponents of basic SI units. These exponents are set in methods with same name as unit symbols (e.g. kg(), K() etc).

Class contains method that provides formated string representing full unit symbol (usable in LaTeX output).

UnitSI object contains flag that says if it is defined

Class contains static methods that return frequently used derived units (Watt, Pascal etc).

Definition at line 31 of file unit_si.hh.

Member Enumeration Documentation

enum UnitSI::UnitOrder
private

Values determine positions of exponents in exponents_ vector.

Enumerator
order_m 
order_kg 
order_s 
order_A 
order_K 
order_mol 
order_cd 
order_md 

Definition at line 80 of file unit_si.hh.

Constructor & Destructor Documentation

UnitSI::UnitSI ( )

Constructor.

Definition at line 18 of file unit_si.cc.

Member Function Documentation

UnitSI & UnitSI::A ( int  exp = 1)

Definition at line 67 of file unit_si.cc.

UnitSI & UnitSI::cd ( int  exp = 1)

Definition at line 85 of file unit_si.cc.

UnitSI & UnitSI::dimensionless ( )
static

Returns dimensionless unit.

Definition at line 44 of file unit_si.cc.

Here is the caller graph for this function:

std::string UnitSI::format ( ) const

Makes unit description string in Latex format, e.g. "$[m.kg^{2}.s^{-2}]$"

Have assert for undefined units.

Definition at line 97 of file unit_si.cc.

bool UnitSI::is_def ( ) const

Return true if the unit is defined.

Definition at line 145 of file unit_si.cc.

Here is the caller graph for this function:

UnitSI & UnitSI::J ( )
static

Returns Joule.

Definition at line 29 of file unit_si.cc.

Here is the caller graph for this function:

UnitSI & UnitSI::K ( int  exp = 1)

Definition at line 73 of file unit_si.cc.

UnitSI & UnitSI::kg ( int  exp = 1)

Definition at line 55 of file unit_si.cc.

Here is the caller graph for this function:

UnitSI & UnitSI::m ( int  exp = 1)

Methods set values of exponents for SI units with similar name.

Definition at line 49 of file unit_si.cc.

Here is the caller graph for this function:

UnitSI & UnitSI::md ( int  exp = -1)

Method sets value of exponent for m^{-d}, where d is dimension of region.

Definition at line 91 of file unit_si.cc.

UnitSI & UnitSI::mol ( int  exp = 1)

Definition at line 79 of file unit_si.cc.

UnitSI & UnitSI::N ( )
static

Methods return frequently used derived units Returns Newton

Definition at line 24 of file unit_si.cc.

UnitSI & UnitSI::Pa ( )
static

Returns Pascal.

Definition at line 39 of file unit_si.cc.

UnitSI & UnitSI::s ( int  exp = 1)

Definition at line 61 of file unit_si.cc.

Here is the caller graph for this function:

void UnitSI::undef ( bool  val = true)

Set flag that unit is undefined.

Default value is true (set in constructor). If any exponent is set, undef_ flag is unset. In all fields unit must be defined by user.

Definition at line 141 of file unit_si.cc.

UnitSI & UnitSI::W ( )
static

Returns Watt.

Definition at line 34 of file unit_si.cc.

Here is the caller graph for this function:

Friends And Related Function Documentation

UnitSI operator* ( const UnitSI a,
const UnitSI b 
)
friend

Product of two units.

Definition at line 150 of file unit_si.cc.

UnitSI operator/ ( const UnitSI a,
const UnitSI b 
)
friend

Proportion of two units.

Definition at line 163 of file unit_si.cc.

Member Data Documentation

std::vector<int> UnitSI::exponents_
private

Stores exponents of base SI units in this order: [m, kg, s, A, K, mol, cd, md]

where md represents value of exponent depended on dimension (m^{-d})

Definition at line 97 of file unit_si.hh.

bool UnitSI::undef_
private

Flag if object is undefined.

Value is set on true in constructor, when any exponent is changed, false value is set.

Definition at line 104 of file unit_si.hh.


The documentation for this class was generated from the following files: