antioch-0.4.0
|
An advanced unit class. More...
#include <units.h>
Public Member Functions | |
Units (const std::string &sym, const std::string &na, const T &conva, const T &convb, int mi, int kgi=0, int si=0, int Ai=0, int Ki=0, int moli=0, int cdi=0, int radi=0) | |
Fully descriptive constructor, mainly for internal purposes. More... | |
Units (const std::string &sym, const std::string &na="") | |
User-friendly constructor, from a symbol and an optionnal name. More... | |
Units (const std::string &sym, const Converter< T > &conv, const std::string &na="") | |
Constructor for a user imposed conversion. More... | |
Units () | |
Default constructor. More... | |
~Units () | |
Default destructor. More... | |
void | print (std::ostream &os=std::cout) const |
Formatted print. More... | |
bool | operator== (const Units< T > &rhs) const |
Comparison operator. More... | |
bool | operator!= (const Units< T > &rhs) const |
Comparison operator, not equal is not "equal". More... | |
Units< T > & | operator= (const Units< T > &rhs) |
Assignement operator. More... | |
Units< T > & | operator+= (const Units< T > &rhs) |
Adding operator. More... | |
Units< T > & | operator-= (const Units< T > &rhs) |
Substracting operator. More... | |
Units< T > | operator+ (const Units< T > &rhs) const |
Adding operator, uses Units &operator+=(const Units&) More... | |
Units< T > | operator- (const Units< T > &rhs) const |
Substracting operator, uses Units &operator-=(const Units&) More... | |
Units< T > & | operator*= (int r) |
Multiplying operator by an integer. More... | |
Units< T > | operator* (int r) const |
Multiplying operator by an integer, uses Units &operator*=(int) More... | |
Units< T > & | operator/= (int r) |
dividing operator by an integer More... | |
Units< T > | operator/ (int r) const |
Dividing operator by an integer, uses Units &operator/=(int) More... | |
void | equalize (const Units< T > &rhs) |
Alternative call to Units& operator=(const Units &) More... | |
void | equalize (Units< T > *rhs) |
Alternative call to Units& operator=(const Units &) More... | |
void | equalize (std::string unit) |
Alternative call to Units& operator=(const Units &) More... | |
void | add (const Units< T > &rhs) |
Alternative call to Units& operator+=(const Units &) More... | |
void | add (Units< T > *rhs) |
Alternative call to Units& operator+=(const Units &) More... | |
void | add (std::string unit) |
Alternative call to Units& operator+=(const Units &) More... | |
void | substract (const Units< T > &rhs) |
Alternative call to Units& operator-=(const Units &) More... | |
void | substract (Units< T > *rhs) |
Alternative call to Units& operator-=(const Units &) More... | |
void | substract (const std::string &unit) |
Alternative call to Units& operator-=(const Units &) More... | |
void | root (int r) |
Alternative method to Units& operator/=(int) More... | |
void | set_unit (const std::string &sym, std::string na) |
Units setter, sets the unit to the given symbol and name. More... | |
void | set_unit (const std::string &sym) |
Units setter, sets the unit to the given symbol and name. More... | |
void | set_name (const std::string &na) |
Name setter. More... | |
void | set_symbol (const std::string &symb) |
Symbol setter. More... | |
void | set_SI_converter (const Converter< T > &conv) |
Coefficient setter. More... | |
void | set_power_to_SI (const InSI &mat) |
Power std::vector setter. More... | |
bool | is_homogeneous (const Units< T > &rhs) const |
Homogenity testing with another Units. More... | |
bool | is_homogeneous (std::string target) const |
Homogenity testing with a std::string. More... | |
bool | is_united () const |
Test if the unit is non empty. More... | |
T | factor_to_some_unit (const Units< T > &target) const |
Calculates the factor to any given unit. More... | |
T | factor_to_some_unit (const std::string &target) const |
Calculates the factor to any given unit, uses factor_to_some_unit(const Units&). More... | |
T | translator_to_some_unit (const Units< T > &target) const |
Calculates the translator to any given unit, see factor_to_some_unit(const Units&) for the equations. More... | |
T | translator_to_some_unit (const std::string &target) const |
Calculates the translator to any given unit, uses translator_to_some_unit(const Units&). More... | |
const std::string | get_name () const |
String name getter. More... | |
const std::string | get_symbol () const |
String symbol getter. More... | |
const Converter< T > | get_SI_coef () const |
Coefficient getter. More... | |
T | get_SI_factor () const |
Multiplicative coefficient getter. More... | |
T | get_SI_translator () const |
Translationnal coefficient getter. More... | |
const InSI | get_power () const |
Power std::vector getter. More... | |
const std::string | get_SI_symb () const |
Corresponding SI symbol getter. More... | |
int | get_SI_power (const std::string &SIask) const |
Power of the asked SI unit. More... | |
const std::string | get_SI_convenient_symb () const |
Corresponding SI symbol getter. More... | |
const std::string | harmonized_symbol (const std::string &input="") const |
Simplify the symbol when possible. More... | |
const std::string | contracted_symbol (const std::string &input="") const |
Contract the symbol when possible. More... | |
void | clear () |
Clear the unit. More... | |
void | showAll (std::ostream &out=std::cout) |
showAll(). More... | |
Private Member Functions | |
const std::string | manipulate_symbol (std::string input, bool contract) const |
Root method for contracting or harmonizing the symbol. More... | |
void | fill_in_power (bool doConv) |
This method fills the power vector and will calculate the coefficient if the bool doConv is set to true. More... | |
bool | parse_single_unit (int signe, std::string unit, bool doConv) |
Calculates the corresponding coefficient and power of the given unit. More... | |
void | parse_prefix_unit (int &iUnit, int &iPre, const std::string &unit) const |
Unit parser, parse a std::string of type Prefixes[] knownUnits[]. More... | |
int | indexUnit (std::string unit) const |
Scanner of knownUnits[], sends back the corresponding iUnit, -1 if not found. More... | |
int | parse_power (std::string unit, int &nc) const |
brief parser for std::string of type "some_unit power_associated". More... | |
bool | is_number (char c) const |
Small method to check if a character is a numerical. More... | |
Converter< T > | raise (const Converter< T > &tbm, int power) const |
Raise to an integer power a Converter object. More... | |
Converter< T > | raise (const Converter< T > &tbm, double power) const |
Overload to simplify division. More... | |
void | develop_symbol (std::string &subsymbol) |
Supress the parenthesises. More... | |
void | reverse_power_symbol (std::string &subsymbol) |
Treat part of symbol depending on parenthesises. More... | |
bool | is_in_symb (char c) const |
Small method that checks if the symbol is within a unit std::string. More... | |
int | n_dimension_of_units () const |
Number of dimensions of the unit in the SI basis. More... | |
const std::string | add_SI (int pow, std::string SIsymb) const |
Small method to add the SI symbol and power to a std::string. More... | |
void | symbol_to_the_power (int r, const int &key) |
Rewrite the symbol to put it at a given power. More... | |
int | get_integer_power (int unit, int r, const int &key) |
Multiply or divide a power. More... | |
void | check_if_name (std::string &nameOut, const Units< T > &un) const |
Fill the name if empty and name obvious. More... | |
Private Attributes | |
std::string | symbol |
Strings for the symbol. More... | |
std::string | name |
Strings for the name. More... | |
Converter< T > | toSI |
A Converter for the coefficient. More... | |
InSI | power |
An InSI for the power vector. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Units< T > &unit) |
Formatted print. More... | |
An advanced unit class.
This class contains:
The idea of this class is to keep track of the unit without performing any operation on the values. To characterize an unit, the unit is projected against the SI basis of units, with the addition of angle unit:
(meter,kilogram,second,ampere,kelvin,mol,candela,radian)
Thus any unit can be expressed as a linear composition of this std::vector. This is the role of the class InSI to store this linear composition. This linear composition is called the power vector.
With the linear composition, comes a coefficient that correspond to the conversion of the considered unit to the SI system. The class Converter takes care of storing it.
Thus this class performs a parsing of the symbol of the given unit, compares each unit of the symbol to a set of known units, and construct the linear composition and coefficient by successive additions of the units of the symbol. For instance, the unit m.A/s is seen as , and thus the composition and coefficient are calculated correspondingly:
At each unit parsing level, the unit is parsed between a prefix, a symbol and a power. The symbol "cm-3" will be parsed as a prefix "c", a symbol "m" and a power "-3". To this parsing, the symbol before the unit is considered. If there is none or it is a dot, nothing to do, but if this is a slash, the power has to be multiplied by -1. Thus the Converter object will have the corresponding SIPrefixes values (Prefixe[6] is this case, which is ("c",1e-2)), and the InSI power vector will add the value "-3" to the corresponding power (0 in this case) if the character before the unit is a dot or does not exist, the value 3 if this character is a slash. The correspondancies between the index in the power vector and the unit is done explicitely.
A special treatment is reserved for the kg unit, as it contains a prefix.
This method supports a wide variety of symbol writing, like the use of parenthesises. The used symbol is a fully developped one.
|
inline |
Fully descriptive constructor, mainly for internal purposes.
Definition at line 592 of file units.h.
References Antioch::Units< T >::develop_symbol(), and Antioch::Units< T >::symbol.
|
inline |
User-friendly constructor, from a symbol and an optionnal name.
Definition at line 605 of file units.h.
References Antioch::Units< T >::fill_in_power().
|
inline |
Constructor for a user imposed conversion.
Definition at line 614 of file units.h.
References Antioch::Units< T >::fill_in_power().
|
inline |
|
inline |
|
inline |
Alternative call to Units& operator+=(const Units &)
|
inline |
Alternative call to Units& operator+=(const Units &)
|
inline |
Alternative call to Units& operator+=(const Units &)
Same remarks than void equalize(std::string).
|
private |
Small method to add the SI symbol and power to a std::string.
This method is useful in the std::string const Units::get_SI_symb() const method.
Definition at line 977 of file units.h.
References std::pow().
|
private |
Fill the name if empty and name obvious.
Usually we give only the symbol, even for simple unit. Thus this method will fill the name if the name is obvious, i.e. if the dimension of the power vector is 1. The suffixe is given by the factor value.
|
inline |
Clear the unit.
Definition at line 390 of file units.h.
References Antioch::InSI::clear(), Antioch::Units< T >::name, Antioch::Units< T >::power, Antioch::Units< T >::symbol, and Antioch::Units< T >::toSI.
Referenced by Antioch::ChemKinParser< NumericType >::rate_constant_preexponential_parameter(), and Antioch::read_reaction_set_data().
|
inline |
Contract the symbol when possible.
The contraction will aggregate only exactly equal units.
Definition at line 387 of file units.h.
References Antioch::Units< T >::manipulate_symbol().
|
private |
Supress the parenthesises.
Two types of parenthesises are to be treated:
The idea is to treat every serial pairs one by one. Thus every pair found is sent back to develop_symbol(std::string&). Once the we have treated the inside string by this recursive method, we treat the string:
Definition at line 669 of file units.h.
References std::pow().
Referenced by Antioch::Units< T >::Units().
|
inline |
Alternative call to Units& operator=(const Units &)
|
inline |
Alternative call to Units& operator=(const Units &)
|
inline |
Alternative call to Units& operator=(const Units &)
This method should not really be used. It is provided for simplicity, but equalizing a Units object to a std::string is weird. Instead, the user should prefer to write ``*this = Units(std::string)''. This is exactly what does the method.
It is provided to ensure that the idea of equalizing the unit to a symbol is coded, but in this object, a unit is more than just a symbol.
T Antioch::Units< T >::factor_to_some_unit | ( | const Units< T > & | target | ) | const |
Calculates the factor to any given unit.
Before calculating the factor to another unit, the homogeneity is tested. If the units are homogeneous, then the factor is the current factor divided by the target factor:
It is important to understand that this is the factor to the wanted unit. Thus to express a value of unit in unit , one should use the conversion rule given above. factor_to_some_unit(unit ) will provide the factor while translator_to_some_unit(unit ) will provide the translationnal term .
Definition at line 755 of file units.h.
References antioch_unit_error, Antioch::Units< T >::get_SI_factor(), and Antioch::Units< T >::get_symbol().
Referenced by Antioch::read_reaction_set_data(), test_factor(), and tester().
T Antioch::Units< T >::factor_to_some_unit | ( | const std::string & | target | ) | const |
Calculates the factor to any given unit, uses factor_to_some_unit(const Units&).
Definition at line 768 of file units.h.
|
private |
This method fills the power vector and will calculate the coefficient if the bool doConv is set to true.
The method scans the symbol, and calls bool parse_single_unit(int,std::string,bool) for each unit found. The character in front of the unit ('.' or '/') is taken into account into the first integer (resp. 1 or -1). This is this latter method that actually calculates the coefficients and power vector.
Definition at line 623 of file units.h.
References antioch_unit_error.
Referenced by Antioch::Units< T >::Units().
|
private |
Multiply or divide a power.
It ensures that the result of the operation performed is an integer. Natural in case of multiplication, to be checked in case of division. It returns 0 if it is not correct, this has to be checked by the wrapping method. The key is to choose between division or multiplication. Key is:
Definition at line 1210 of file units.h.
References antioch_error.
|
inline |
String name getter.
Definition at line 328 of file units.h.
References Antioch::Units< T >::name.
Referenced by Antioch::Units< T >::operator+=(), Antioch::Units< T >::operator-=(), and Antioch::Units< T >::operator=().
|
inline |
Power std::vector getter.
Definition at line 338 of file units.h.
References Antioch::Units< T >::power.
Referenced by Antioch::Units< T >::is_homogeneous(), Antioch::Units< T >::operator+=(), and Antioch::Units< T >::operator-=().
|
inline |
Coefficient getter.
Definition at line 332 of file units.h.
References Antioch::Units< T >::toSI.
Referenced by Antioch::Units< T >::operator+=(), and Antioch::Units< T >::operator-=().
const std::string Antioch::Units< T >::get_SI_convenient_symb | ( | ) | const |
Corresponding SI symbol getter.
This method returns the symbol that of the SI unit (so a coefficient of (1.,0.)). If none is found, it returns const std::string get_SI_symb(). For instance a unit J/s will be returned as W.
This method is not able to combine different SI units. The unit J.s will not be recognized as J.s, only as m2.kg.s-1
Definition at line 1125 of file units.h.
References Antioch::UnitBaseStorage::known_units().
|
inline |
Multiplicative coefficient getter.
Definition at line 334 of file units.h.
References Antioch::Units< T >::toSI.
Referenced by Antioch::Units< T >::factor_to_some_unit(), Antioch::read_reaction_set_data(), test_factor(), AntiochTesting::ArrheniusRateTest< long double >::test_reset_scalar_params(), tester(), and Antioch::Units< T >::translator_to_some_unit().
int Antioch::Units< T >::get_SI_power | ( | const std::string & | SIask | ) | const |
Power of the asked SI unit.
This method returns the power to the asked unit SI.
Definition at line 912 of file units.h.
References antioch_unit_error.
std::string const Antioch::Units< T >::get_SI_symb | ( | ) | const |
Corresponding SI symbol getter.
This method returns the symbol that correspond to the power vector. For instance a unit J/s will be returned as m2.kg.s-3
Definition at line 929 of file units.h.
|
inline |
Translationnal coefficient getter.
Definition at line 336 of file units.h.
References Antioch::Units< T >::toSI.
Referenced by Antioch::Units< T >::translator_to_some_unit().
|
inline |
String symbol getter.
Definition at line 330 of file units.h.
References Antioch::Units< T >::symbol.
Referenced by Antioch::Units< T >::factor_to_some_unit(), Antioch::Units< T >::manipulate_symbol(), Antioch::Units< T >::operator+=(), Antioch::Units< T >::operator-=(), Antioch::Units< T >::operator=(), Antioch::ChemKinParser< NumericType >::rate_constant_preexponential_parameter(), Antioch::read_reaction_set_data(), test_factor(), and Antioch::verify_unit_of_parameter().
|
inline |
Simplify the symbol when possible.
This method will densify the symbol. As calculations merely add the symbol, it is necessary to be able to group together the same units and eliminate those that compensate.
The method will scan unit by unit the symbol std::string and combine the units that are homogeneous. The unit "l" is converted to "m3" to ensure meter harmonization. The chosen unit symbol between two homogeneous units is the first symbol encountered.
Definition at line 381 of file units.h.
References Antioch::Units< T >::manipulate_symbol().
|
private |
Scanner of knownUnits[], sends back the corresponding iUnit, -1 if not found.
Definition at line 840 of file units.h.
References Antioch::UnitBaseStorage::known_units().
bool Antioch::Units< T >::is_homogeneous | ( | const Units< T > & | rhs | ) | const |
Homogenity testing with another Units.
Testing the homogeneity between units is different from testing equality. J and cal are homogeneous but not equal for instance. Thus this method merely compares the power vectors, if they're equal the units are homogeneous, if not, they're not.
Definition at line 892 of file units.h.
References Antioch::Units< T >::get_power().
Referenced by Antioch::Units< T >::manipulate_symbol(), Antioch::read_reaction_set_data(), test_factor(), test_homogeneity(), and Antioch::verify_unit_of_parameter().
bool Antioch::Units< T >::is_homogeneous | ( | std::string | target | ) | const |
Homogenity testing with a std::string.
Testing homogeneity with a std::string needs to build a Units object and testing homogeneity with it. In the case of an empty std::string, instead of building a Units object the boolean is_united() is tested.
Definition at line 898 of file units.h.
|
private |
Small method that checks if the symbol is within a unit std::string.
This method checks if the symbol is not a number (bool is_number(char)), and not any of the following character: '/', '.' and '-'. Then this symbol is consider to belong to a unit symbol.
Definition at line 1242 of file units.h.
|
inlineprivate |
Small method to check if a character is a numerical.
This method uses the values of the ascii table, which basically means that is checks if the ascii integer associated to the character is in the range [48,57].
|
inline |
Test if the unit is non empty.
Definition at line 298 of file units.h.
References Antioch::InSI::empty(), and Antioch::Units< T >::power.
Referenced by Antioch::read_reaction_set_data(), and Antioch::verify_unit_of_parameter().
|
private |
Root method for contracting or harmonizing the symbol.
The symbol MUST be developped prior to be used in this method.
Definition at line 996 of file units.h.
References antioch_unit_error, Antioch::Units< T >::get_symbol(), and Antioch::Units< T >::is_homogeneous().
Referenced by Antioch::Units< T >::contracted_symbol(), and Antioch::Units< T >::harmonized_symbol().
|
private |
|
inline |
Units< T > Antioch::Units< T >::operator* | ( | int | r | ) | const |
Multiplying operator by an integer, uses Units &operator*=(int)
Units< T > & Antioch::Units< T >::operator*= | ( | int | r | ) |
Multiplying operator by an integer.
This operator is needed for power elevation operation of a physical quantity.
The operations needed are as follow:
Elevating to the power with a double is not supported, and the physical sense of it anyway is not obvious...
Definition at line 1310 of file units.h.
Units< T > Antioch::Units< T >::operator+ | ( | const Units< T > & | rhs | ) | const |
Adding operator, uses Units &operator+=(const Units&)
Units< T > & Antioch::Units< T >::operator+= | ( | const Units< T > & | rhs | ) |
Adding operator.
Adding units occurs when multiplying physical quantities.
Adding a unit needs to add first the name if the added name is not empty. Addition of name consist simply of putting them side by side with a blank space in between.
The symbol is added in the same fashion, but with a dot in between to ensure parsability. If the current symbol is empty, them it is simply copied.
The power is added and the coefficient is multiplied.
Definition at line 1274 of file units.h.
References Antioch::Units< T >::get_name(), Antioch::Units< T >::get_power(), Antioch::Units< T >::get_SI_coef(), and Antioch::Units< T >::get_symbol().
Units< T > Antioch::Units< T >::operator- | ( | const Units< T > & | rhs | ) | const |
Substracting operator, uses Units &operator-=(const Units&)
Units< T > & Antioch::Units< T >::operator-= | ( | const Units< T > & | rhs | ) |
Substracting operator.
Substracting units occurs when dividing physical quantities.
Substracting is close to adding (see Units &operator+=(const Units&)), with little differences. The adding of the name is done with the sequence blank-slash-blank (" / ") between the names. The symbol needs a bit more processing: if the added symbol is not empty, is it put between parenthesises and added with a slash in between. Then the void develop_symbol() method is called to suppress the parenthesises and obtain a correct symbol.
The coefficient is divided and the power vector substracted.
Definition at line 1295 of file units.h.
References Antioch::Units< T >::get_name(), Antioch::Units< T >::get_power(), Antioch::Units< T >::get_SI_coef(), and Antioch::Units< T >::get_symbol().
Units< T > Antioch::Units< T >::operator/ | ( | int | r | ) | const |
Dividing operator by an integer, uses Units &operator/=(int)
Units< T > & Antioch::Units< T >::operator/= | ( | int | r | ) |
dividing operator by an integer
This operator is needed for root operation of a physical quantity.
The operations needed are as follow:
Definition at line 1324 of file units.h.
Units< T > & Antioch::Units< T >::operator= | ( | const Units< T > & | rhs | ) |
Assignement operator.
It assigns the symbol std::string, the power vector and coefficient are filled.
Definition at line 1262 of file units.h.
References Antioch::Units< T >::get_name(), and Antioch::Units< T >::get_symbol().
bool Antioch::Units< T >::operator== | ( | const Units< T > & | rhs | ) | const |
Comparison operator.
Compares the power vector and the coefficient, regardless of the symbol and the name.
|
private |
brief parser for std::string of type "some_unit power_associated".
std::string | unit. Input, std::string to be parsed. |
int | &nc. Output, number of charaters of the power. |
Definition at line 862 of file units.h.
References antioch_unit_error.
|
private |
Unit parser, parse a std::string of type Prefixes[] knownUnits[].
int | &iUnit. Output, indice of the found unit, if not found, set to -1. |
int | &iPre. Output, indice of the found prefixes, if not found, set to -1. |
std::string | unit. Input, std::string to be parsed. |
This method will parse a std::string, assuming the std::string is of the form Prefixes[]knownUnits[]. No power should be present (see int parse_power(std::string,int&) for power management).
This method scans the Prefixes[] array, if one is found at the start of the std::string, then the remaining std::string is tested to see if it is a unit (method int indexUnit(std::string)). If the test fail the scanning resumes. If a Prefixes[] and a knownUnits[] are found, then its over. If no Prefixes[] associated to a knownUnits[] is found, then the whole std::string is tested to be a knownUnits[].
This method relies on the hypothesis that all possible pairs of Prefixes[] and knownUnits[] (including no prefix) are different.
Definition at line 788 of file units.h.
References Antioch::UnitBaseStorage::known_prefixes(), and Antioch::UnitBaseStorage::known_units().
|
private |
Calculates the corresponding coefficient and power of the given unit.
int | signe, 1 or -1. Image of the sign before the unit '.' or '/'. |
std::string | unit. The unit to be parsed. |
bool | doConv. Switch to perform or not the coefficient calculation. |
The method works in two times:
The parsing uses the methods int parse_power(std::string,int&) and parse_prefix_unit(int&,int&,std::string). The idea is to scan the knownUnits[] and Prefixes[] array and find the corresponding unit and prefix. The method int parse_power returns the power, while the integer iPre and iUnit characterize the prefix and unit, with a value of -1 if not found. An unknown unit will return an error.
The update then is twofold. Adding to the power vector the power vector of the found unit multiplied by the signe and the power:
with being the updated power vector, the power of the parsed unit, the power vector of the found knownUnit[], $s_u$ the integer associated to the sign of the parsed unit.
If the conversion is to be done, multiplying the coefficient by the coefficient of the known unit found, multiplied by the coefficient of the prefix, raise to the power by the parsed power, updated by the signe:
with being the updated complex coefficient, the complex coefficient of the found unit, the coefficient of the found Prefixes (if found, if not, it is unity), the sign of the parsed unit and the power of the parsed unit.
Definition at line 812 of file units.h.
References Antioch::UnitBaseStorage::known_prefixes(), and Antioch::UnitBaseStorage::known_units().
void Antioch::Units< T >::print | ( | std::ostream & | os = std::cout | ) | const |
|
private |
Raise to an integer power a Converter object.
The rising to the power of a type Converter is done as follow:
Definition at line 1230 of file units.h.
References Antioch::Converter< T >::geta(), Antioch::Converter< T >::getb(), and std::pow().
|
private |
Overload to simplify division.
Another method, to secure multiplication. Division is thus put apart, to secure against non integer power.
Definition at line 1236 of file units.h.
References Antioch::Converter< T >::geta(), Antioch::Converter< T >::getb(), and std::pow().
|
private |
|
inline |
Alternative method to Units& operator/=(int)
|
inline |
|
inline |
Power std::vector setter.
Definition at line 279 of file units.h.
References Antioch::Units< T >::power.
|
inline |
Coefficient setter.
Definition at line 277 of file units.h.
References Antioch::init_clone(), and Antioch::Units< T >::toSI.
|
inline |
void Antioch::Units< T >::set_unit | ( | const std::string & | sym, |
std::string | na | ||
) |
Units setter, sets the unit to the given symbol and name.
Definition at line 1144 of file units.h.
Referenced by Antioch::read_reaction_set_data(), test_factor(), and Antioch::verify_unit_of_parameter().
|
inline |
Units setter, sets the unit to the given symbol and name.
Definition at line 271 of file units.h.
References Antioch::Units< T >::set_unit().
Referenced by Antioch::Units< T >::set_unit().
void Antioch::Units< T >::showAll | ( | std::ostream & | out = std::cout | ) |
|
inline |
Alternative call to Units& operator-=(const Units &)
Definition at line 257 of file units.h.
Referenced by Antioch::ChemKinParser< NumericType >::rate_constant_preexponential_parameter(), and Antioch::read_reaction_set_data().
|
inline |
Alternative call to Units& operator-=(const Units &)
|
inline |
Alternative call to Units& operator-=(const Units &)
Same remarks than void equalize(std::string).
|
private |
Rewrite the symbol to put it at a given power.
This method scans the symbol, parse the units, and changes the power by the power multiplied or divided by the given integer. It uses the method get_integer_power(int,int,int) to ensure integer power.
Definition at line 1172 of file units.h.
T Antioch::Units< T >::translator_to_some_unit | ( | const Units< T > & | target | ) | const |
Calculates the translator to any given unit, see factor_to_some_unit(const Units&) for the equations.
Definition at line 774 of file units.h.
References antioch_unit_error, Antioch::Units< T >::get_SI_factor(), and Antioch::Units< T >::get_SI_translator().
|
inline |
Calculates the translator to any given unit, uses translator_to_some_unit(const Units&).
Definition at line 325 of file units.h.
References Antioch::Units< T >::translator_to_some_unit().
Referenced by Antioch::Units< T >::translator_to_some_unit().
|
friend |
|
private |
Strings for the name.
Definition at line 581 of file units.h.
Referenced by Antioch::Units< T >::clear(), Antioch::Units< T >::get_name(), and Antioch::Units< T >::set_name().
|
private |
An InSI for the power vector.
Definition at line 585 of file units.h.
Referenced by Antioch::Units< T >::clear(), Antioch::Units< T >::get_power(), Antioch::Units< T >::is_united(), and Antioch::Units< T >::set_power_to_SI().
|
private |
Strings for the symbol.
Definition at line 579 of file units.h.
Referenced by Antioch::Units< T >::clear(), Antioch::Units< T >::get_symbol(), Antioch::Units< T >::set_symbol(), and Antioch::Units< T >::Units().
|
private |
A Converter for the coefficient.
Definition at line 583 of file units.h.
Referenced by Antioch::Units< T >::clear(), Antioch::Units< T >::get_SI_coef(), Antioch::Units< T >::get_SI_factor(), Antioch::Units< T >::get_SI_translator(), and Antioch::Units< T >::set_SI_converter().