scifir-units 2.0.0
scifir-units is a library of units of measurement, angles, coordinates, fields, and related data, all lightweight, that help in the development of scientific software and scientific machines
|
#include "./prefix.hpp"
#include "boost/algorithm/string.hpp"
#include "unicode/uchar.h"
#include <algorithm>
#include <cstring>
#include <cstddef>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
Go to the source code of this file.
Classes | |
class | scifir::dimension |
Class that represents dimensions of the SI system of units. Each dimension sizes 6 bytes, 1 byte for the dimension type, 1 byte for the prefix, 1 byte for the position (which can be the NUMERATOR or the DENOMINATOR), and 3 bytes for the custom dimension (in case it's used one). A base dimension is a dimension that doesn't has more base dimensions, a derived dimension has always base dimensions from which it's defined. More... | |
Namespaces | |
namespace | scifir |
The namespace scifir contains all scifir-units, excepting the string literals, which are outside. | |
Functions | |
vector< dimension > | scifir::create_dimensions (string init_dimensions) |
Creates the dimensions from an initialization string of dimensions. | |
vector< dimension > | scifir::create_base_dimensions (const string &init_dimensions) |
Creates the base dimensions from an initialization string of dimensions. | |
string | scifir::to_string (const dimension &x) |
Creates the string representation of a dimension. | |
string | scifir::to_string (const vector< dimension > &x_dimensions, bool with_brackets) |
Creates the string representation of a vector of dimensions. Used to display the dimensions of scalar_unit and all vector_unit classes. The dimensions can be displayed optionally between brackets like '[]' too. | |
string | scifir::to_latex (const vector< dimension > &x_dimensions, bool with_brackets) |
vector< dimension > | scifir::create_base_dimensions (const vector< dimension > &x) |
Creates all the base dimensions from a vector of dimensions. | |
vector< dimension > | scifir::create_base_dimensions (const vector< dimension > &x, long double &value) |
Creates all the base dimensions from a vector of dimensions, updating also the associated value related to those dimensions based on the prefix math and the conversion factor of the dimension, if that conversion factor is different than one. | |
vector< dimension > | scifir::multiply_dimensions (const vector< dimension > &x, const vector< dimension > &y) |
Multiplies two vectors of dimensions. The result is normalized after, which means that equal dimensions at the numerator and at the denominator are cancelled. | |
vector< dimension > | scifir::multiply_dimensions (vector< dimension > x, const vector< dimension > &y, long double &value) |
Multiplies two vectors of dimensions. The result is normalized after, which means that equal dimensions at the numerator and at the denominator are cancelled. It also updates the value associated with those two vectors of dimensions with the prefix m ath and the conversion factor of those dimensions. | |
vector< dimension > | scifir::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, which means that equal dimensions at the numerator and at the denominator are cancelled. It also updates the value associated with those two vectors of dimensions with the prefix m ath and the conversion factor of those dimensions. | |
vector< dimension > | scifir::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 the conversion factor of this operation. | |
vector< dimension > | scifir::power_dimensions (const vector< dimension > &x, int exponent) |
Powers the dimensions by an exponent. | |
vector< dimension > | scifir::normalize_dimensions (const vector< dimension > &x) |
Normalizes the dimensions, which means that repited dimensions at the numerator and at the denominator are cancelled. | |
vector< dimension > | scifir::normalize_dimensions (const vector< dimension > &x, long double &value) |
Normalizes the dimensions, which means that repited dimensions at the numerator and at the denominator are cancelled. The value is updated if there are dimensions cancelled. | |
bool | scifir::is_dimension_char (const UChar32 &x) |
bool | scifir::common_dimension (const dimension &x, const dimension &y) |
Checks if there's an equal basic dimension between the basic dimensions of those two dimensions. | |
bool | scifir::equal_dimensions (const string &init_dimensions_x, const string &init_dimensions_y) |
Checks if two initialization strings of dimensions initialize the same basic dimensions. | |
bool | scifir::equal_dimensions (const vector< dimension > &x, const vector< dimension > &y) |
bool | scifir::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 prefixes. | |
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. | |
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. The prefix is not compared. | |
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 and the position of two dimensions are any of them different. The prefix is not compared.
Definition at line 2471 of file dimension.cpp.
ostream & operator<< | ( | ostream & | os, |
const scifir::dimension & | x | ||
) |
Adds the string representation of a dimension to an output stream.
Definition at line 2476 of file dimension.cpp.
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.
Definition at line 2459 of file dimension.cpp.