Commit Graph

54 Commits

Author SHA1 Message Date
Mateusz Pusz
901b09fd52 refactor: quantity::count() renamed to quantity::number()
Resolves #259
2021-03-19 06:47:37 +01:00
Mateusz Pusz
bbbb77286c refactor: physical replaced with isq
Refers to #249
2021-03-16 12:03:25 +01:00
Mateusz Pusz
cfc90f4aac refactor: 💥 basic_concepts, quantity and quantity_cast refactored
BREAKING CHANGE:  ScalableNumber renamed to QuantityValue

Resolves #107
2020-10-06 18:17:52 +02:00
Mateusz Pusz
2a56438f1c refactor: file tree with systems defninitions refactored to limit ODR issues
Relates to #32 as with this commit we created something like modules for derived quantities
2020-09-11 18:11:25 +02:00
Mateusz Pusz
e367afed71 Merge branch 'downcasting_2.0' 2020-09-09 20:31:03 +02:00
Mateusz Pusz
9527b39005 refactor: 💥 q_* UDL renamed to _q_*
We had some fun exploring the STD UDLs for potential collisions,
we have learnt our lesson and know how to proceed.
Now is high time to start behaving and obeying C++ rules.
2020-09-09 19:20:35 +02:00
Mateusz Pusz
3e9d5ca189 refactor: ♻️ unitless renamed to one
Resolves #27
2020-09-09 11:20:55 +02:00
Mateusz Pusz
76b6c2972d test: more unit tests for dimensionless quantity 2020-09-08 18:45:14 +02:00
Mateusz Pusz
563b358d5e feat!: 💥 dimensionless quantities refactored
Dimensionless quantities are now represented by quantity types rather
than by plain representation types. Only dimensionless quantities with
`unitless` unit are implicitly convertible from representation types.

`units::exp()` now is a function doing std::exp() on a representation
type (previous `units::exp` class template was renamed to
`units::exponent`).

BREAKING_CHANGE: gcc-9.3 support removed
BREAKING_CHANGE: `exp` and `Exp` renamed to `exponent` and `Exponent`
Resolves #27
Resolves #42
2020-09-08 11:02:16 +02:00
Mateusz Pusz
5c98924efb Downcasting reworked to allow OFF and AUTO modes 2020-08-19 13:37:57 +02:00
Mateusz Pusz
9f94a73bba Custom is_same implementation added 2020-06-29 20:30:59 +02:00
Mateusz Pusz
d2c66e79f5 angular_velocity support fixed 2020-06-27 19:23:32 +02:00
Mateusz Pusz
9125c1bf2e Merge branch 'master' of github.com:mpusz/units 2020-06-27 19:15:57 +02:00
Mateusz Pusz
d171f5451e NTTP ratio support added (resolves #49) 2020-06-27 19:15:46 +02:00
Mike Ford
db5a6e9cbd added angular velocity dimension, header file and test in si system 2020-06-27 19:00:46 +02:00
Mateusz Pusz
61fadb8ebc dim_velocity renamed to dim_speed 2020-05-14 16:00:38 +02:00
Mateusz Pusz
ce301748dd Velocity renamed to Speed (resolves #103) 2020-05-10 17:31:47 +02:00
Mateusz Pusz
7e935a4108 Physical units put in the physical namespace (I am sorry) 2020-05-08 22:39:24 +02:00
Ramzi Sabra
7b8ad8e37c changed hectare to an alias_unit 2020-05-08 10:41:38 +02:00
Ramzi Sabra
6f8bddc832 added more prefixed SI units; added alias_unit and prefixed_alias_unit types 2020-05-08 10:41:38 +02:00
Mateusz Pusz
ff21e1e899 GCC 10 compilation fixed 2020-05-05 21:25:56 +02:00
rbrugo
9ec5c77602 Added molar heat capacity 2020-04-10 16:36:08 +02:00
rbrugo
7dda8319a2 Added molar energy 2020-04-10 16:36:08 +02:00
rbrugo
89dbc30a92 Added permeability 2020-04-10 16:36:08 +02:00
rbrugo
596161cca5 Added permittivity 2020-04-10 16:36:08 +02:00
rbrugo
1cf0074483 Added charge density 2020-04-10 16:36:08 +02:00
rbrugo
7803da0bdf Added electric field strength 2020-04-10 16:36:08 +02:00
rbrugo
15138286e5 Added thermal conductivity 2020-04-10 16:36:08 +02:00
rbrugo
017e88ca28 Added heat capacity and specific heat capacity 2020-04-10 16:36:08 +02:00
rbrugo
07b5364c97 Added dynamic viscosity 2020-04-10 16:36:08 +02:00
rbrugo
4b4cc70764 Added luminance 2020-04-10 16:36:08 +02:00
rbrugo
8ddd7e1233 Added concentration 2020-04-10 16:36:08 +02:00
rbrugo
e6b34b6b1b Added current density 2020-04-10 16:36:08 +02:00
rbrugo
43f475fb80 Added absorbed dose 2020-04-10 16:36:08 +02:00
rbrugo
561773da7e Added catalytic activity 2020-04-10 16:36:08 +02:00
rbrugo
3cd77de2e9 Added conductance 2020-04-10 16:36:08 +02:00
rbrugo
14f00ef775 Added inductance 2020-04-10 16:36:08 +02:00
rbrugo
86eefe1b0d Added magnetic flux 2020-04-10 16:36:08 +02:00
rbrugo
7b0ba64cba Static tests for magnetic induction 2020-04-10 16:36:08 +02:00
Mateusz Pusz
f5df68253e symbol_text refactored 2020-03-27 15:21:05 +01:00
Mateusz Pusz
6a5f25750d UDL naming refactored 2020-03-10 20:53:53 +01:00
Mateusz Pusz
18620044c5 All UDLs are now prefixed with q_ 2020-02-17 15:56:06 +01:00
Mateusz Pusz
a01c811f5f Square and cubic UDLs renamed 2020-01-09 10:03:41 +01:00
Oliver Schönrock
509b6c9653 implementing ratio<num,den,exp> which replaces ratio<num,den>
https://github.com/mpusz/units/issues/14

This "works", as in it passes all static and runtime tests.
However quite a few of the tests have been "modified" to make them pass. Whether
this is legitimate is debatable and should be the source of some thought /
discussion.

1. many of the static tests and some of the runtime tests have had the input
ratios of the tests modified in the following way. eg ratio<3,1000> =>
ratio<3,1,-3>. ie they have been "canonicalised".

There are obviously an infinite number of ratios which represent the same
rational number. The way `ratio` is implemented it always moves as "many powers
of 10" from the `num` and `den` into the `exp` and that makes the `canonical`
ratio.

Because these are all "types" and the lib uses is_same all over the place, only
exact matches will be `is_same`. ie ratio<300,4,0> !is_same ratio<3,4,2> (the
latter is the canonical ratio). This is perhaps fine for tests in the devlopment
phase, but there may be a need for "more forgiving" comparison / concept of
value equality. One such comparison which compares den,num,exp after
canonicalisation is the constexpr function `same` as defined at top of
`ratio_test.cpp`. We may need to expose this and perhaps add even more soft
comparisions.

2. In the runtime tests it is "subjective" how some resukts should be
printed. There is the question of "how exactly to format certain ratios". eg
omit denominators of "1" and exponents of "0". However before even addressing
these in detail a decision needs to be made about the general form of
"non-floating-point-converted" ratios which do not map exactly to a "Symbol
prefix".

Arguably these are "relatively ugly" whatever we do, so we could just
go for an easily canonicalised form. An example is:

-        CHECK(stream.str() == "10 [1/60]W");
+        CHECK(stream.str() == "10 [1/6 x 10⁻¹]W");

Which of thses is "better"? Is there a "third", better form?  It's not obvious.

My opnion is: Both of 1&2 are fine for now, unless we think they go down the
wrong avenue, and can be "perfected later"? ie we can expose a softer version of
ratio based equality, and decide on canonical way of printing ratios (as far as
that is actually a very useful output form, compared with decimal, scientific or
engineering notation).
2019-12-28 17:59:47 +01:00
Mateusz Pusz
594f92241a tonne added 2019-12-26 10:27:20 +01:00
Mateusz Pusz
2a7f2efa15 hectometre and hectare added 2019-12-26 10:20:30 +01:00
Mateusz Pusz
70fbf300b4 astronomical unit added 2019-12-26 10:11:12 +01:00
Mateusz Pusz
15e148381d decimetre and litre added 2019-12-26 10:07:02 +01:00
Mateusz Pusz
22fabb5a1b day unit added 2019-12-26 09:59:05 +01:00
Mateusz Pusz
80a13b1a94 US system isolated from SI 2019-12-17 12:29:19 +01:00