Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Copyright (c) 2003-2019 Andy Little.
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see http://www.gnu.org/licenses./
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <units/physical/si/length.h>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
#include <units/physical/international/length.h>
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
#include <units/physical/us/length.h>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
#include <units/physical/iau/length.h>
|
|
|
|
#include <units/physical/typographic/length.h>
|
|
|
|
#include <units/physical/imperial/length.h>
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
#include <units/physical/si/area.h>
|
|
|
|
#include <units/physical/si/volume.h>
|
|
|
|
#include <units/physical/si/time.h>
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
namespace length{
|
|
|
|
|
|
|
|
template <typename Rep = double>
|
|
|
|
using m = units::si::length<units::si::metre,Rep>;
|
|
|
|
|
|
|
|
template <typename Rep = double>
|
|
|
|
using mm = units::si::length<units::si::millimetre,Rep>;
|
|
|
|
|
|
|
|
template <typename Rep = double>
|
|
|
|
using fm = units::si::length<units::si::femtometre,Rep>;
|
|
|
|
|
|
|
|
template <typename Rep = double>
|
|
|
|
using km = units::si::length<units::si::kilometre,Rep>;
|
|
|
|
|
|
|
|
template <typename Rep = double>
|
|
|
|
using AU = units::si::length<units::si::astronomical_unit,Rep>;
|
|
|
|
|
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using in = units::si::length<units::international::inch,Rep>;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using angstrom = units::si::length<units::iau::angstrom,Rep>;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using ch = units::si::length<units::imperial::chain,Rep>;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using fathom = units::si::length<units::international::fathom,Rep>;
|
2020-01-10 04:36:20 +00:00
|
|
|
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using fathom_us = units::si::length<units::us::fathom,Rep>;
|
2020-01-10 04:36:20 +00:00
|
|
|
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using ft = units::si::length<units::international::foot,Rep>;
|
2020-01-10 04:36:20 +00:00
|
|
|
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using ft_us = units::si::length<units::us::foot,Rep>;
|
2020-01-10 04:36:20 +00:00
|
|
|
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using ly = units::si::length<units::iau::light_year,Rep>;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using mi = units::si::length<units::international::mile,Rep>;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using mi_naut = units::si::length<units::international::nautical_mile,Rep>;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using pc = units::si::length<units::iau::parsec,Rep>;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using pica_comp = units::si::length<units::typographic::pica_comp,Rep>;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using pica_prn = units::si::length<units::typographic::pica_prn,Rep>;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using point_comp = units::si::length<units::typographic::point_comp,Rep>;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using point_prn = units::si::length<units::typographic::point_prn,Rep>;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using rd = units::si::length<units::imperial::rod,Rep>;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
template <typename Rep = double>
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using yd = units::si::length<units::international::yard,Rep>;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace time{
|
|
|
|
|
|
|
|
template <typename Rep = double>
|
|
|
|
using s = units::si::time<units::si::second,Rep>;
|
|
|
|
|
|
|
|
template <typename Rep = double>
|
|
|
|
using min = units::si::time<units::si::minute,Rep>;
|
|
|
|
|
|
|
|
template <typename Rep = double>
|
|
|
|
using h = units::si::time<units::si::hour,Rep>;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace area{
|
|
|
|
|
|
|
|
template <typename Rep = double>
|
|
|
|
using m2 = units::si::area<units::si::square_metre,Rep>;
|
|
|
|
|
|
|
|
template <typename Rep = double>
|
|
|
|
using fm2 = units::si::area<units::si::square_femtometre,Rep>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
using namespace units::si::literals;
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
using namespace units::international;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
void simple_quantities()
|
|
|
|
{
|
|
|
|
using distance = length::m<>;
|
|
|
|
using time = time::s<>;
|
|
|
|
|
2020-01-12 00:27:03 +00:00
|
|
|
constexpr distance km = 1.0km;
|
|
|
|
constexpr distance miles = 1.0mi;
|
|
|
|
|
|
|
|
constexpr time sec = 1s;
|
|
|
|
constexpr time min = 1min;
|
|
|
|
constexpr time hr = 1h;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
std::cout << "A physical quantities library can choose the simple\n";
|
|
|
|
std::cout << "option to provide output using a single type for each base unit:\n\n";
|
|
|
|
std::cout << km << '\n';
|
|
|
|
std::cout << miles << '\n';
|
|
|
|
std::cout << sec << '\n';
|
|
|
|
std::cout << min << '\n';
|
|
|
|
std::cout << hr << "\n\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
void quantities_with_typed_units()
|
|
|
|
{
|
2020-01-12 00:27:03 +00:00
|
|
|
constexpr length::km<> km = 1km;
|
|
|
|
constexpr length::mi<> miles = 1.0mi;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
std::cout.precision(6);
|
|
|
|
|
2020-01-12 00:27:03 +00:00
|
|
|
constexpr time::s<> sec = 1s;
|
|
|
|
constexpr time::min<> min = 1min;
|
|
|
|
constexpr time::h<> hr = 1h;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
|
|
|
|
std::cout << "A more flexible option is to provide separate types for each unit,\n\n";
|
|
|
|
std::cout << km << '\n';
|
|
|
|
std::cout << miles << '\n';
|
|
|
|
std::cout << sec << '\n';
|
|
|
|
std::cout << min << '\n';
|
|
|
|
std::cout << hr << "\n\n";
|
|
|
|
|
2020-01-12 00:27:03 +00:00
|
|
|
constexpr length::m<> meter = 1m;
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
std::cout << "then a wide range of pre-defined units can be defined and converted,\n"
|
|
|
|
" for consistency and repeatability across applications:\n\n";
|
|
|
|
|
|
|
|
std::cout << meter << '\n' ;
|
|
|
|
|
|
|
|
std::cout << " = " << length::AU<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::angstrom<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::ch<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::fathom<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::fathom_us<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::ft<>(meter) << '\n';
|
Split the various non-si length units into their own namespaces.
new namespaces are
international ( combination of us and imperial + Canada etc)
iau (https://www.iau.org/
imperial ( old imperial units)
typographical ( for sizes of printing fonts etc)
These namespace are based on some research , mainly on wikipedia.
Look in src/include/units/physical/si/length.h to see links to see the references to documentation justifying the change.
Unfortunately there are 3 foot units for example, an old imperial version, an old us version and an international version, which is more recent and attempts to unify the two previous ones. All versions have slight changes in value, so I opted to use the international version
The main change in the layout is that inch,foot and yard have been moved from us to international.
With this modification, I also modified the physical/us/area.hpp, volume.hpp and volume.hpp headers to refer to the international units.
This may not be correct, but if the modified us::foot (rather than international foot is used as a basis for these units, then
there is a ratio integer overflow during compilation, probably due to taking 3rd power of a ratio. After this commit. I will try to show that on another branch.
2020-01-10 02:03:27 +00:00
|
|
|
std::cout << " = " << length::ft_us<>(meter) << '\n';
|
Third party examples : add box example
Add si::density quantity header .
Add si::resistance quantity header.
Update si::capacitance header with mF, uF, nF, pF.
Update si::voltage header with mV, uV, nV,pV
Third party example : add capacitor time curve example
Add incoherent length units, TODO move them out from si header.
Third party examples : add clcpp_response showing effectivenes of typed units for physical quantity library
Third party examples : add conversion factor example
Add third party examples to cmake
Third party examples : box example : Add air_density constant for clarity remove explicit this-> and tidy up.
Third party examples : in clcpp response example, change base unit from km to m for single type or all units example.
Third party examples : conversion_factor , add inline constexpr to units_str function.
Third party examples : box_example, change quantity::unit syntax to quantity::unit<> to allow generic(default double) value_type.
examples : remove examples from third party to main examples directory. Update cmake.
physical/si/resistance.hpp : remove underscores from kiloohm etc, UDL collision with 'R' so prefix with underscore
2020-01-06 21:29:05 +00:00
|
|
|
std::cout << " = " << length::in<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::ly<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::mi<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::mi_naut<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::pc<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::pica_comp<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::pica_prn<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::point_comp<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::point_prn<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::rd<>(meter) << '\n';
|
|
|
|
std::cout << " = " << length::yd<>(meter) << '\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
void calcs_comparison()
|
|
|
|
{
|
|
|
|
std::cout.precision(20);
|
|
|
|
std::cout << "\nA distinct unit for each type is efficient and accurate\n"
|
|
|
|
"when adding two values of the same very big\n"
|
|
|
|
"or very small type:\n\n";
|
|
|
|
|
|
|
|
length::fm<float> L1A = 2fm;
|
|
|
|
length::fm<float> L2A = 3fm;
|
|
|
|
length::fm<float> LrA = L1A + L2A;
|
|
|
|
|
|
|
|
std::cout << L1A << " + " << L2A << " = " << LrA << "\n\n";
|
|
|
|
|
|
|
|
std::cout << "The single unit method must convert large\n"
|
|
|
|
"or small values in other units to the base unit.\n"
|
|
|
|
"This is both inefficient and inaccurate\n\n";
|
|
|
|
|
|
|
|
length::m<float> L1B = L1A;
|
|
|
|
length::m<float> L2B = L2A;
|
|
|
|
length::m<float> LrB = L1B + L2B;
|
|
|
|
|
|
|
|
std::cout << L1B << " + " << L2B << " = " << LrB << "\n\n";
|
|
|
|
|
|
|
|
std::cout << "In multiplication and division:\n\n";
|
|
|
|
|
|
|
|
area::fm2<float> ArA = L1A * L2A ;
|
|
|
|
std::cout << L1A << " * " << L2A << " = " << ArA << "\n\n";
|
|
|
|
|
|
|
|
std::cout <<"similar problems arise\n\n";
|
|
|
|
|
|
|
|
area::m2<float> ArB = L1B * L2B;
|
|
|
|
std::cout << L1B << " * " << L2B << "\n = " << ArB << '\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
std::cout << "This demo was originally posted on com.lang.c++.moderated in 2006\n";
|
|
|
|
std::cout << "http://compgroups.net/comp.lang.c++.moderated/dimensional-analysis-units/51712\n";
|
|
|
|
std::cout << "Here converted to use mpusz/units library.\n\n";
|
|
|
|
|
|
|
|
simple_quantities();
|
|
|
|
quantities_with_typed_units();
|
|
|
|
calcs_comparison();
|
|
|
|
}
|