1#ifndef SCIFIR_UNITS_UNITS_DIMENSION_HPP_INCLUDED
2#define SCIFIR_UNITS_UNITS_DIMENSION_HPP_INCLUDED
6#include "boost/algorithm/string.hpp"
8#include "unicode/uchar.h"
35 NONE,
METRE,
DEGREE,
RADIAN,
STERADIAN,
SECOND,
GRAM,
COULOMB,
KELVIN,
CELSIUS,
MOLE,
CANDELA,
BYTE,
BIT,
HERTZ,
NEWTON,
PASCAL,
JOULE,
WATT,
AMPERE,
VOLT,
FARAD,
OHM,
SIEMENS,
WEBER,
TESLA,
HENRY,
LUMEN,
LUX,
BECQUEREL,
GRAY,
SIEVERT,
KATAL,
ANGSTROM,
LITRE,
MINUTE,
HOUR,
DAY,
LIGHT_YEAR,
ASTRONOMICAL_UNIT,
PARSEC,
ELECTRON_VOLT,
DALTON,
ATOMIC_MASS_UNIT,
BARN,
MOLARITY,
PARTICLES,
CUSTOM,
CUSTOM_BASIC,
CUSTOM_FULL_SYMBOL,
MONEY,
PIXEL,
MEMO,
INTERNATIONAL_UNIT,
MILLIEQUIVALENT,
DECIBEL
Class that represents dimensions of the SI system of units. Each dimension sizes 6 bytes,...
bool is_dimensionless() const
If the dimension_type is DEGREE, RADIAN or STERADIAN, it's considered dimensionless,...
position
Represents the position of the dimension, which can be at the numerator or at the denominator....
@ DENOMINATOR
The dimension is at the denominator.
@ NO_POSITION
The dimension is not ready and yet being used.
@ NUMERATOR
The dimension is at the numerator.
dimension & operator=(const dimension &x)
Copy assignment. The dimension copies the dimension x.
string get_fullplural() const
Returns the plural of the dimension with the name of the prefix first.
bool is_composite_dimension() const
If the dimension has more simple dimensions, it's a composite dimension.
string get_name() const
Returns the name of the dimension.
scifir::prefix prefix
The prefix of the dimension. It's used along with the symbol of the dimension when printing it.
dimension::position dimension_position
The position of the dimension, which can be the NUMERATOR, the DENOMINATOR or NO_POSITION....
bool is_base_dimension() const
Returns true if the dimension is a base dimension, which includes all base dimensions of the SI syste...
char symbol[3]
The value of the position of the character of a custom dimension in the map of full_symbols.
string get_fullname() const
Returns the name of the dimension with the name of the prefix first.
bool is_SI_derived_dimension() const
If the dimension is not a SI base dimension, it's considered a SI derived dimension.
static int total_full_symbols
dimension::type dimension_type
The type of the dimension.
static map< string, vector< dimension > > base_dimensions
dimension(dimension &&x)
Move constructor. The dimension is initialized with a move of the dimension x.
bool is_SI_base_dimension() const
Returns true if the dimension is a SI base dimension. Following the SI system of units,...
bool is_simple_dimension() const
If the dimension doesn't has more base dimensions, it's a simple dimension.
type
Represents a dimension of the SI system of units. All the dimensions of the SI system of units are su...
@ MOLARITY
Molarity, plural molarities. The derived dimensions are mol / L. Dimension of concentration of a chem...
@ NONE
No dimension. Default value for the default constructor.
@ BECQUEREL
Becquerel, plural becquerels. The derived dimensions are 1 / s. Dimension of radioactivity....
@ KATAL
Katal, plural katals. The derived dimensions are mol / s. Dimension of catalytic activity....
@ LITRE
Litre, plural litres. The derived dimensions are dm3. Dimension of volume. Symbol L.
@ LUMEN
Lumen, plural lumens. The derived dimensions are cd * sr Dimension of luminous flux....
@ MEMO
Memo, plural memos. Invented unit inside Scifir, it's not part of the SI system of units....
@ STERADIAN
Steradian, plural steradians. Dimension of solid angle. A solid angle is an angle in volume....
@ TESLA
Tesla, plural teslas. The derived dimensions are V * s / m2. Dimension of magnetic strength....
@ INTERNATIONAL_UNIT
International unit, plural international units. It measures the amount of effect or biological activi...
@ BARN
Barn, plural barns. Dimension of area. The derived dimensions are 10^-28 m2. It's used inside nuclear...
@ LIGHT_YEAR
Light year, plural light years. Dimension of length. The derived dimensions are 9,...
@ HENRY
Henry, plural henries. The derived dimensions are V * s / A. Dimension of electric inductance....
@ AMPERE
Ampere, plural amperes. The derived dimensions are C / s. Dimension of electric current....
@ MOLE
Mole, plural moles. SI dimension of quantity. Symbol mol.
@ CUSTOM_FULL_SYMBOL
Custom dimension. It's identical to a CUSTOM dimension in his use, but its symbol is stored in the st...
@ VOLT
Volt, plural volts. The derived dimensions are J / C, W / A. Dimension of voltage....
@ OHM
Ohm, plural ohms. The derived dimensions are V / A. Dimension of electric resistance....
@ COULOMB
Coulomb, plural coulombs. SI dimension of charge. Special name. Symbol C.
@ LUX
Lux, plural luxes. The derived dimensions are cd * sr / m2. Dimension of illuminance....
@ GRAY
Gray, plural grays. The derived dimensions are m2 / s2. Dimension of ionising radiation (absorbed dos...
@ ANGSTROM
Ángstrom, plural angstroms. The derived dimensions are 10^-10 m. Dimension of length,...
@ ELECTRON_VOLT
Electron volt, plural electron volts. The derived dimensions are 1.602176634 * 10^−19 J....
@ GRAM
Gram, plural grams. SI dimension of mass. Symbol g.
@ SIEVERT
Sievert, plural sieverts. The derived dimensions are J / kg. Dimension of ionising radiation (equival...
@ DALTON
Dalton, plural daltons. The derived dimensions are 1,66053886 * 10^-24. Dimension of mass....
@ MILLIEQUIVALENT
Milliequivalent, plural Milliequivalents. Amount of moles in a given chemical reaction needed to reac...
@ CELSIUS
Celsius, plural celsius. SI dimension of temperature, derived from kelvin. Symbol °C....
@ DEGREE
Degree, plural degrees. Dimension of angle. Symbol θ.
@ PASCAL
Pascal, plural pascals. The derived dimensions are kg / s2 * m. Dimension of pressure....
@ PIXEL
Pixel, plural pixels. it represents the amount of pixels, it can be used as a replacemet of the metre...
@ ATOMIC_MASS_UNIT
Atomic mass unit, plural atomic mass units. The derived dimensions are Da. Equivalent to the Dalton....
@ ASTRONOMICAL_UNIT
Astronomical unit, plural astronomical units. Dimension of length. The derived dimensions are 149,...
@ HERTZ
Hertz, plural hertz. The derived dimensions are 1 / s. Dimension of frequency. Special name....
@ DAY
Day, plural days. The derived dimensions are 86,400 s. Dimension of time. Symbol day,...
@ WATT
Watt, plural watts. The derived dimensions are kg * m2 / s3. Dimension of power. Special name....
@ NEWTON
Newton, plural newtons. The derived dimensions are kg * m / s2. Dimension of force....
@ HOUR
Hour, plural hours. The derived dimensions are 3,600 s. Dimension of time. Symbol hour,...
@ PARTICLES
Total of particles, the total amount that the mole represents. It's not exactly a dimension,...
@ MONEY
Money, plural money. The money is not specified in a specific currency, you must use the ISO 4217 of ...
@ BIT
Bit, plural bits. Dimension of amount of information, of each binary digit. Symbol bit.
@ SECOND
Second, plural seconds. SI dimension of time. Symbol s.
@ MINUTE
Minute, plural minutes. The derived dimensions are 60 s. Dimension of time. Symbol min.
@ CANDELA
Candela, plural candelas. SI dimension of luminous intensity. Symbol cd.
@ RADIAN
Radian, plural radians. Dimension of angle. Special name. Symbol rad.
@ BYTE
Byte, plural bytes. Dimension of amount of information. Symbol B.
@ SIEMENS
Siemens, plural siemens. The derived dimensions are 1 / Ω. Dimension of electric conductance....
@ JOULE
Joule, plural joules. The derived dimensions are kg * m2 / s2. Dimension of energy....
@ FARAD
Farad, plural farads. The derived dimensions are A * s / V. Dimension of electric capacitance....
@ WEBER
Weber, plural webers. The derived dimensions are T * m2. Dimension of magnetic flux....
@ KELVIN
Kelvin, plural kelvins. SI dimension of temperature. Symbol K.
@ METRE
Meter, plural meters. SI dimension of length. Symbol m.
@ PARSEC
Parsec, plural parsecs. Dimension of length. The derived dimensions are 3.2616 ly....
@ CUSTOM
Custom dimension. It means the dimension is a custom dimension, which can have any value and meaning,...
static void create_custom_dimension(const string &new_symbol, const string &init_dimensions)
Creates a new custom dimension, that's stored with its symbol, which is given as an string,...
string get_symbol() const
Returns the symbol of the dimension. In the case of a custom dimension, it returns the custom dimensi...
string get_plural() const
Returns the plural of the dimension.
static set< string > prefixes_options
dimension(const dimension &x)
Copy constructor. The dimension is initialized to be a copy of the dimension x.
vector< dimension > get_base_dimensions() const
Returns the base dimensions of the dimensions, which can be the same dimension or all the base dimens...
long double get_conversion_factor() const
Returns the conversion factor of the dimension.
static map< int, string > full_symbols
bool is_derived_dimension() const
If the dimension is not a base dimension, it's considered a derived dimension.
static string get_full_symbol(const char *x_symbol)
Returns the symbol of a custom_full_symbol dimension stored in the private static map dimension::full...
dimension()
Default constructor. The dimension_type is NONE, the dimension_position is NO_POSITION,...
long double prefix_math() const
Returns the math between the prefix and the dimension, which varies if the dimension is a B or anothe...
void invert()
Changes the position of the dimension to the reverse, from the NUMERATOR to the DENOMINATOR,...
static char * create_full_symbol(const string &full_symbol)
Creates a new dimension that's stored in the private static map dimension::full_symbols.
Class that represents prefixes of the SI system of units. Each prefix sizes 1 byte....
type
Represents a prefix of the SI system of units. All the prefixes of the SI system of units are support...
bool operator!=(const scifir::dimension &x, const scifir::dimension &y)
Checks if the dimension type and the position of two dimensions are any of them different....
ostream & operator<<(ostream &os, const scifir::dimension &x)
Adds the string representation of a dimension to an output stream.
bool operator==(const scifir::dimension &x, const scifir::dimension &y)
Checks if the dimension type, the position and the prefix of two dimensions are the same.
The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
bool equal_dimensions(const string &init_dimensions_x, const string &init_dimensions_y)
Checks if two initialization strings of dimensions initialize the same basic dimensions.
vector< dimension > divide_dimensions(vector< dimension > x, const vector< dimension > &y, long double &value)
Divides the first vector of dimensions with the other. The result is normalized after,...
bool equal_dimensions_and_prefixes(const vector< dimension > &x, const vector< dimension > &y)
Checks if the base dimensions of two vectors of dimensions are equal, and if they have also the same ...
bool common_dimension(const dimension &x, const dimension &y)
Checks if there's an equal basic dimension between the basic dimensions of those two dimensions.
vector< dimension > normalize_dimensions(const vector< dimension > &x)
Normalizes the dimensions, which means that repited dimensions at the numerator and at the denominato...
string to_string(const aid &x)
Creates a string representation of aid, it's for aid equivalent to the display() function of aid.
vector< dimension > create_base_dimensions(const string &init_dimensions)
Creates the base dimensions from an initialization string of dimensions.
bool is_dimension_char(const UChar32 &x)
string to_latex(const vector< dimension > &x_dimensions, bool with_brackets)
vector< dimension > multiply_dimensions(const vector< dimension > &x, const vector< dimension > &y)
Multiplies two vectors of dimensions. The result is normalized after, which means that equal dimensio...
vector< dimension > square_dimensions(vector< dimension > x, int index, long double &value)
Squares a vector of dimensions by an index. The value is updated too related to the prefix math and t...
vector< dimension > create_dimensions(string init_dimensions)
Creates the dimensions from an initialization string of dimensions.
vector< dimension > power_dimensions(const vector< dimension > &x, int exponent)
Powers the dimensions by an exponent.