Libraries such as boost::units allow unit handling where we know the units at compile time.
More...
|
| Unit (const std::string &Name, double Conversion_to_si, const boost::rational< int > &Length_power, const boost::rational< int > &Mass_power, const boost::rational< int > &Time_power, const boost::rational< int > &Current_power, const boost::rational< int > &Temperature_power, const boost::rational< int > &Amount_power, const boost::rational< int > &Luminous_intensity_power, const boost::rational< int > &Solid_angle_power, const boost::rational< int > &Angle_power, const boost::rational< int > &Photon_count_power, const boost::rational< int > &Sample_index) |
| Create a unit. More...
|
|
| Unit (const std::string &Name, const Unit &Dunit) |
| Create a unit. More...
|
|
| Unit (const std::string &Name_to_parse) |
| Variation of constructor that uses parse on the given string to determine the units. More...
|
|
| Unit () |
| Default constructor. This creates a dimensionless unit. More...
|
|
const boost::array< boost::rational< int >, number_base_unit > & | base_unit_powers () const |
| Array of the powers of the base units (so m^2 would return (1,0,0,0,0,0,0,0)) More...
|
|
double | conversion_to_si () const |
| Conversion factor to go to SI units. More...
|
|
bool | is_commensurate (const Unit &Units) const |
| Test if this set of units is commensurate with another set. More...
|
|
const std::string & | name () const |
| Name of unit. May be an empty string if a name wasn't assigned. More...
|
|
void | name (const std::string &V) |
| Set name of unit. More...
|
|
Unit & | operator*= (const Unit &Dunit) |
| Basic math operators for units. More...
|
|
Unit & | operator*= (double Scale_factor) |
| Scale a unit. More...
|
|
Unit & | operator/= (double Scale_factor) |
|
Unit & | operator/= (const Unit &Dunit) |
| Divide two units. More...
|
|
bool | operator== (const Unit &U) const |
| Test for equality. More...
|
|
void | print (std::ostream &Os) const |
| Print to a stream. More...
|
|
std::string | print_to_string () const |
| Print to string. More...
|
|
Libraries such as boost::units allow unit handling where we know the units at compile time.
This class provide the same sort of handling, but for instances where we know the units at runtime rather than compile time (e.g., based on input read).
We do dimensional analysis based on the SI base units. In order, these are meter, kilogram, second, Kelvin, Ampere, mole, candela, steradian, radian, photon, sample_index
Note that steradian, radian and sample_index are actually dimensionless, but it is useful to track them. Also photon is a photon count, which doesn't really have units either. But it is useful to track because we can determine the photon count at a particular wavelength to convert to cm^-1.
Definition at line 25 of file unit.h.