#include <SIUnit.hpp>
Related Symbols | |
(Note that these are not member symbols.) | |
using | OptionalSIUnit = boost::optional<SIUnit> |
using | SIUnitVector = std::vector<SIUnit> |
Create Functions Used by UnitFactory | |
SIUnit | createSIMass () |
SIUnit | createSILength () |
SIUnit | createSITime () |
SIUnit | createSITemperature () |
SIUnit | createSIElectricCurrent () |
SIUnit | createSILuminousIntensity () |
SIUnit | createSIAmountOfSubstance () |
SIUnit | createSIAngle () |
SIUnit | createSISolidAngle () |
SIUnit | createSIPeople () |
SIUnit | createSICycle () |
SIUnit | createSICurrency () |
SIUnit | createSIForce () |
Newton (N) = kg*m/s^2. | |
SIUnit | createSIEnergy () |
Joule (J) = N*m = kg*m^2/s^2. | |
SIUnit | createSIPower () |
Watt (W) = J/s = N*m/s = kg*m^2/s^3. | |
SIUnit | createSIElectricCharge () |
Coulomb (C) = s*A. | |
SIUnit | createSIElectricalPotential () |
Volt (V) = W/A = J/C = kg*m^2/s^3*A. | |
SIUnit | createSIElectricCapacitance () |
Farad (F) = C/V = C^2/J = s^4*A^2/kg*m^2. | |
SIUnit | createSIElectricResistance () |
Ohm (ohm) = V/A = W/A^2 = kg*m^2/s^3*A^2. | |
SIUnit | createSIMagneticFlux () |
Weber (Wb) = J/A = kg*m^2/s^2*A. | |
SIUnit | createSIMagneticFieldStrength () |
Tesla (T) = Wb/m^2 = J/m^2*A = kg/s^2*A. | |
SIUnit | createSIInductance () |
Henry (H) = Wb/A = s*V/A = kg*m^2/s^2*A^2. | |
SIUnit | createSILuminousFlux () |
Lumen (lm) = cd*sr. | |
SIUnit | createSIIlluminance () |
Lux (lux or lx) = lm/m^2 = cd*sr/m^2. | |
SIUnit | createSIFrequency () |
Hertz (Hz) = cycles/s. | |
SIUnit | createSIEnergyUseIntensity () |
J/m^2 = kg/s^2. | |
SIUnit | createSIPowerDensity () |
W/m^2 = kg/s^3. | |
SIUnit | createSIPowerPerPerson () |
W/person = kg*m^2/s^3*person. | |
SIUnit | createSIPressure () |
Pa = N/m^2 = kg/m*s^2. | |
SIUnit | createSIThermalConductance () |
W/m^2*K = kg/s^3*K. | |
SIUnit | createSIThermalResistance () |
m^2*K/W = s^3*K/kg | |
SIUnit | createSIHeatCapacity () |
J/m^2*K = kg/s^2*K. | |
![]() | |
using | OptionalUnit = boost::optional<Unit> |
using | UnitVector = std::vector<Unit> |
Constructors and Destructors | |
SIUnit (const SIExpnt &exponents=SIExpnt(), int scaleExponent=0, const std::string &prettyString="") | |
Default constructor. | |
SIUnit (const std::string &scaleAbbreviation, const SIExpnt &exponents=SIExpnt(), const std::string &prettyString="") | |
Alternate constructor. | |
virtual | ~SIUnit () override=default |
Additional Inherited Members | |
![]() | |
Unit (int scaleExponent=0, const std::string &prettyString="") | |
Default constructor. | |
Unit (const std::string &scaleAbbreviation, const std::string &prettyString="") | |
Constructor using scale abbreviations registered in ScaleFactory. | |
virtual | ~Unit ()=default |
Unit | clone () const |
Deep copy constructor. | |
Unit | cloneToMixed () const |
Deep copy constructor that discards system designation. | |
std::vector< std::string > | baseUnits () const |
Returns base units already available in Unit. | |
bool | isBaseUnit (const std::string &baseUnit) const |
Returns true if baseUnit is available in Unit. | |
int | baseUnitExponent (const std::string &baseUnit) const |
Base unit exponent getter. Returns 0 if baseUnit not present. */. | |
void | setBaseUnitExponent (const std::string &baseUnit, int exponent) |
Sets baseUnit^exponent. If baseUnit not yet present, is added and return value is true. | |
Scale | scale () const |
Scale getter. | |
bool | setScale (int scaleExponent) |
Sets the scale to the one registered in ScaleFactory for 10^scaleExponent. | |
bool | setScale (const std::string &scaleAbbreviation) |
Sets the scale to the one registered in ScaleFactory under scaleAbbreviation. | |
std::string | standardString (bool withScale=true) const |
Returns the standard output string for this unit. | |
std::string | prettyString (bool withScale=true) const |
Returns the preferred output string for this unit. | |
void | setPrettyString (const std::string &str) |
Setter for prettyString (do not include scale abbreviation). | |
std::string | print (bool withScale=true) const |
Returns prettyString(withScale) if it exists; otherwise returns standardString(withScale). | |
UnitSystem | system () const |
Getter for this Unit's system. | |
bool | operator== (const Unit &rUnit) const |
Equality for units. | |
Unit & | operator*= (const Unit &rUnit) |
Multiply-assign operator. | |
Unit & | operator/= (const Unit &rUnit) |
Divide-assign operator. | |
Unit & | pow (int expNum, int expDenom=1, bool okToCallFactory=true) |
Raise Unit to a rational power. | |
template<typename T > | |
T | cast () const |
Cast to type T. | |
template<typename T > | |
boost::optional< T > | optionalCast () const |
Cast to boost::optional<T>. | |
SIUnit is a Unit with baseUnits are fixed by its constructors, see SIExpnt.
setBaseUnitExponent throws an exception if any other string is passed in as a baseUnit. SIUnit.hpp declares related operators and UnitFactory callback functions.
openstudio::SIUnit::SIUnit | ( | const SIExpnt & | exponents = SIExpnt(), |
int | scaleExponent = 0, | ||
const std::string & | prettyString = "" ) |
Default constructor.
Example:
SIUnit myEnergy(SIExpnt(1,2,-2),3,"J"); std::cout << myEnergy; // produces "kJ"
[in] | exponents | holds the exponents for each base unit. |
[in] | scaleExponent | exponent for scale. For instance 3 for kilo. |
[in] | prettyString | optional string to use in place of standardString. |
openstudio::SIUnit::SIUnit | ( | const std::string & | scaleAbbreviation, |
const SIExpnt & | exponents = SIExpnt(), | ||
const std::string & | prettyString = "" ) |
Alternate constructor.
Specify the abbreviation of the scale, rather than its exponent. Example:
SIUnit myEnergy("k",SIExpnt(1,2,-2),"J"); std::cout << myEnergy; // produces "kJ
[in] | scaleAbbreviation | is string equal to a scale abbreviation. For instance "k" for kilo. |
[in] | exponents | holds the exponents for each base unit. |
[in] | prettyString | optional string to use in place of standardString. |
|
overridevirtualdefault |
|
related |
|
related |
|
related |
|
related |
|
related |
Volt (V) = W/A = J/C = kg*m^2/s^3*A.
|
related |
Farad (F) = C/V = C^2/J = s^4*A^2/kg*m^2.
|
related |
Coulomb (C) = s*A.
|
related |
|
related |
Ohm (ohm) = V/A = W/A^2 = kg*m^2/s^3*A^2.
|
related |
Joule (J) = N*m = kg*m^2/s^2.
|
related |
J/m^2 = kg/s^2.
That this is measured on an annual basis is implied.
|
related |
Newton (N) = kg*m/s^2.
|
related |
Hertz (Hz) = cycles/s.
Making the distinction between 1/s and cycles/s here mainly to be consistent with the rotations per minute (rpm) designation made elsewhere.
|
related |
J/m^2*K = kg/s^2*K.
|
related |
Lux (lux or lx) = lm/m^2 = cd*sr/m^2.
|
related |
Henry (H) = Wb/A = s*V/A = kg*m^2/s^2*A^2.
|
related |
|
related |
Lumen (lm) = cd*sr.
|
related |
|
related |
Tesla (T) = Wb/m^2 = J/m^2*A = kg/s^2*A.
|
related |
Weber (Wb) = J/A = kg*m^2/s^2*A.
|
related |
|
related |
|
related |
Watt (W) = J/s = N*m/s = kg*m^2/s^3.
|
related |
W/m^2 = kg/s^3.
|
related |
W/person = kg*m^2/s^3*person.
|
related |
Pa = N/m^2 = kg/m*s^2.
|
related |
|
related |
|
related |
W/m^2*K = kg/s^3*K.
|
related |
m^2*K/W = s^3*K/kg
|
related |
|
related |
|
related |