check: run pre-commit on all files

This commit is contained in:
Markus Hofbauer committed 2022-03-18 16:12:21 +01:00
1 parent 7b8d97646c
commit 4c127797da
29 files changed
+92 -92

No files matched your search

+1 -1
View File
@@ -113,4 +113,4 @@ JVM: Java HotSpot(TM) 64-Bit Server VM
Default Encoding: UTF-8
Language: en
Country: US
--></g></svg>
--></g></svg>

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

+2 -2
View File
@@ -18,7 +18,7 @@ package Dimension <<Frame>> {
abstract base_dimension<Symbol, Unit> [[../../framework/units.html]]
abstract exponent<Dimension, Num, Den> [[../../framework/dimensions.html#derived-dimensions]]
abstract derived_dimension<Unit, Exponent...> [[../../framework/dimensions.html#derived-dimensions]]
base_dimension <.. exponent
exponent <.. "0..n" derived_dimension
exponent ..> derived_dimension
@@ -32,4 +32,4 @@ JVM: Java HotSpot(TM) 64-Bit Server VM
Default Encoding: UTF-8
Language: en
Country: US
--></g></svg>
--></g></svg>

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

+3 -3
View File
@@ -58,7 +58,7 @@ package Unit <<Frame>> [[../../framework/units.html]] {
abstract named_scaled_unit<Symbol, PrefixFamily, Ratio, Unit> [[../../framework/units.html#named-scaled-units]]
abstract named_unit<Symbol, PrefixFamily> [[../../framework/units.html#base-units]]
abstract unit [[../../framework/units.html#derived-unnamed-units]]
scaled_unit <|- - unit
scaled_unit <|- - named_unit
scaled_unit <|- - named_scaled_unit
@@ -100,7 +100,7 @@ package Unit <<Frame>> [[../../framework/units.html]] {
abstract named_scaled_unit<Symbol, PrefixFamily, Ratio, Unit> [[../../framework/units.html#named-scaled-units]]
abstract named_unit<Symbol, PrefixFamily> [[../../framework/units.html#base-units]]
abstract unit [[../../framework/units.html#derived-unnamed-units]]
scaled_unit <|- - unit
scaled_unit <|- - named_unit
scaled_unit <|- - named_scaled_unit
@@ -119,4 +119,4 @@ JVM: Java HotSpot(TM) 64-Bit Server VM
Default Encoding: UTF-8
Language: en
Country: US
--></g></svg>
--></g></svg>

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

+3 -3
View File
@@ -345,7 +345,7 @@ html_static_path = ['_static']
# configuration directory) that is the logo of the docs. It is placed at the
# top of the sidebar; its width should therefore not exceed 200 pixels.
# Default: None.
# html_logo =
# html_logo =
# These paths are either relative to html_static_path or fully qualified
# paths (eg. https://...)
@@ -359,10 +359,10 @@ html_css_files = [
def configureDoxyfile(input_dir, output_dir):
with open('Doxyfile.in', 'r') as file:
filedata = file.read()
filedata = filedata.replace('@DOXYGEN_INPUT_DIR@', input_dir)
filedata = filedata.replace('@DOXYGEN_OUTPUT_DIR@', output_dir)
with open('Doxyfile', 'w') as file:
file.write(filedata)
+3 -3
View File
@@ -45,7 +45,7 @@ to use inheritance:
.. image:: /_static/img/downcast_1.png
:align: center
..
..
http://www.nomnoml.com
[derived_dimension_base<exponent<si::dim_length, 2>>]<:-[dim_area]
@@ -76,7 +76,7 @@ The downcasting facility is provided by injecting two classes into our hierarchy
.. image:: /_static/img/downcast_2.png
:align: center
..
..
http://www.nomnoml.com
[downcast_base<detail::derived_dimension_base<exponent<si::dim_length, 2>>>]<:-[detail::derived_dimension_base<exponent<si::dim_length, 2>>]
@@ -93,7 +93,7 @@ In the above example:
idiom, stores the base of a downcasting operation in a ``downcast_base_type`` member type,
and provides only a Hidden Friend non-member function declaration of ``downcast_guide`` which is an
:abbr:`ADL (Argument Dependent Lookup)` entry point for the downcasting operation::
template<typename BaseType>
struct downcast_base {
using downcast_base_type = BaseType;
+1 -1
View File
@@ -13,7 +13,7 @@ The most important concepts in the library are `Unit`, `Dimension`,
..
https://www.planttext.com
@startuml
skinparam monochrome true
+1 -1
View File
@@ -12,7 +12,7 @@ dimensions.
<object data="../_images/dimensions.svg" type="image/svg+xml" class="align-center" style="max-width: 100%;"></object>
..
..
https://www.planttext.com
+14 -14
View File
@@ -38,7 +38,7 @@ Quantity Construction Helpers
quantities of different dimensions and units. Users are encourages to try them
out, vote, and share feedback in this
`discussion on GitHub <https://github.com/mpusz/units/discussions/274>`_.
Most probably only one of the options will be included in the final product so
please do not hesitate to vote on the one that suits you the best.
@@ -83,7 +83,7 @@ each and every :term:`unit` in the library::
template<Representation Rep = double> using m_per_s = units::isq::si::speed<units::isq::si::metre_per_second, Rep>;
template<Representation Rep = double> using km_per_h = units::isq::si::speed<units::isq::si::kilometre_per_hour, Rep>;
}
#endif // UNITS_NO_ALIASES
@@ -159,7 +159,7 @@ It is also possible to easily define custom quantity references from existing on
User Defined Literals (Experimental)
++++++++++++++++++++++++++++++++++++
Alternatively, to construct quantities with compile-time known values the library provides
:abbr:`UDL (User Defined Literal)` s for each :term:`unit` of every :term:`dimension`::
@@ -191,7 +191,7 @@ Thanks to them the same code can be as simple as::
language (i.e. ``F`` (farad), ``J`` (joule), ``W`` (watt), ``K`` (kelvin),
``d`` (day), ``l`` or ``L`` (litre), ``erg``, ``ergps``). This is why the
``_q_`` prefix was consistently applied to all the UDLs.
UDLs vs Quantity References
+++++++++++++++++++++++++++
@@ -258,12 +258,12 @@ UDLs are helpful but they also have some disadvantages compared to Quantity Refe
4. UDLs are verbose to define and standardize
- UDLs:
- for each unit an integral and a floating-point UDL have to be defined
- have to be provided for unnamed derived units (i.e. ``_q_km_per_h``)
- Quantity References:
- one reference per unit
- unnamed derived units are constructed from base references so no explicit
definition is required (i.e. ``km / h``)
@@ -276,9 +276,9 @@ UDLs are helpful but they also have some disadvantages compared to Quantity Refe
by the user so there is no chance for a truncating conversion on a quantity construction.
6. UDLs take long to compile
- UDLs:
Every unit requires two UDLs to be defined which in turns requires two instantiations
of "heavy" `quantity` class template. Those are then not often used by non-UDL construction
as most users instantiate `quantity` class template with `int` or `double` which
@@ -298,7 +298,7 @@ Quantity References vs Unit-specific Aliases
++++++++++++++++++++++++++++++++++++++++++++
1. Shadowing issues
- Quantity References
References occupy a pool of many short identifiers which sometimes shadow the variables,
@@ -357,11 +357,11 @@ Quantity References vs Unit-specific Aliases
using namespace units::isq::si::time_references;
return d * m / (t * s);
}
Notice that if ``using namespace units::isq::si::references;`` was used instead above it could
cause a clash of ``t`` function parameter with ``si::tonne`` unit symbol if ``si/mass.h`` was
included.
- Unit-specific Aliases
The same using aliases can look as follows::
@@ -392,7 +392,7 @@ Quantity References vs Unit-specific Aliases
static_assert(2 * km / (2 * (km / h)) == 1 * h);
- Unit-specific Aliases
Aliases do not use operator syntax thus they are not affected by the precedence issue.
5. Composition for unnamed derived units
@@ -425,7 +425,7 @@ Quantity References vs Unit-specific Aliases
constexpr auto meter = 1 * m;
std::cout << " = " << quantity_cast<si::international::foot>(meter) << '\n';
The above code for references may look as follows::
constexpr auto meter = m(1);
+6 -6
View File
@@ -25,7 +25,7 @@ of a `scaled_unit` class template:
<object data="../_images/units.svg" type="image/svg+xml" class="align-center" style="max-width: 100%;"></object>
..
..
https://www.planttext.com
@startuml
@@ -65,7 +65,7 @@ of a `scaled_unit` class template:
abstract named_scaled_unit<Symbol, PrefixFamily, Ratio, Unit> [[../../framework/units.html#named-scaled-units]]
abstract named_unit<Symbol, PrefixFamily> [[../../framework/units.html#base-units]]
abstract unit [[../../framework/units.html#derived-unnamed-units]]
scaled_unit <|-- unit
scaled_unit <|-- named_unit
scaled_unit <|-- named_scaled_unit
@@ -209,7 +209,7 @@ and define units like::
struct electronvolt : named_scaled_unit<electronvolt, "eV", prefix,
ratio(1'602'176'634, 1'000'000'000, -19), joule> {};
..
..
TODO Submit a bug for above lexing problem
Finally, the last of the `named_scaled_unit` class template parameters
@@ -256,16 +256,16 @@ Alternative hierarchy of prefixes is the one used in data information
domain::
namespace iec80000 {
struct binary_prefix : prefix_family {};
struct kibi : units::prefix<kibi, binary_prefix, "Ki", ratio( 1'024)> {};
struct mebi : units::prefix<mebi, binary_prefix, "Mi", ratio( 1'048'576)> {};
struct gibi : units::prefix<gibi, binary_prefix, "Gi", ratio( 1'073'741'824)> {};
struct tebi : units::prefix<tebi, binary_prefix, "Ti", ratio( 1'099'511'627'776)> {};
struct pebi : units::prefix<pebi, binary_prefix, "Pi", ratio( 1'125'899'906'842'624)> {};
struct exbi : units::prefix<exbi, binary_prefix, "Ei", ratio(1'152'921'504'606'846'976)> {};
}
With the definitions like above we can easily define prefixed unit. For
+5 -5
View File
@@ -48,20 +48,20 @@ of basic library features::
#include <units/isq/si/time.h>
#include <units/quantity_io.h>
#include <iostream>
using namespace units::isq;
constexpr Speed auto avg_speed(Length auto d, Time auto t)
{
return d / t;
}
int main()
{
using namespace units::isq::si::literals;
using namespace units::isq::si::references;
using namespace units::aliases::isq::si::international;
constexpr Speed auto v1 = 110 * (km / h);
constexpr Speed auto v2 = mi_per_h(70.);
constexpr Speed auto v3 = avg_speed(220_q_km, 2_q_h);
@@ -69,7 +69,7 @@ of basic library features::
constexpr Speed auto v5 = quantity_cast<si::speed<si::metre_per_second>>(v3);
constexpr Speed auto v6 = quantity_cast<si::metre_per_second>(v4);
constexpr Speed auto v7 = quantity_cast<int>(v6);
std::cout << v1 << '\n'; // 110 km/h
std::cout << v2 << '\n'; // 70 mi/h
std::cout << std::format("{}", v3) << '\n'; // 110 km/h
+3 -3
View File
@@ -144,11 +144,11 @@ Concepts
.. concept:: template<typename QK1, typename QK2> QuantityKindEquivalentTo
A concept matching two equivalent quantity kinds. Satisfied by quantity kinds having equivalent kinds.
.. concept:: template<typename QPK, typename PK> QuantityPointKindOf
A concept matching only quantity point kinds of a specific point kind.
:tparam QPK: Quantity point kind to verify.
:tparam PK: Point kind type to use for verification.
+1 -1
View File
@@ -12,7 +12,7 @@ International System of Quantities (ISQ)
Systems of Units based on the SI
--------------------------------
.. toctree::
:maxdepth: 2