forked from mpusz/mp-units
@@ -1,7 +1,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/si/acceleration.h>
|
||||
#include <units/isq/si/acceleration.h>
|
||||
|
||||
namespace units{
|
||||
namespace experimental{
|
||||
@@ -9,7 +9,7 @@ namespace experimental{
|
||||
namespace acceleration {
|
||||
|
||||
template<typename Rep = double>
|
||||
using m_per_s2 = units::physical::si::acceleration<units::physical::si::metre_per_second_sq, Rep>;
|
||||
using m_per_s2 = units::isq::si::acceleration<units::isq::si::metre_per_second_sq, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
constexpr m_per_s2<Rep> g{static_cast<Rep>(9.80665)};
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/si/area.h>
|
||||
#include <units/isq/si/area.h>
|
||||
|
||||
namespace area {
|
||||
|
||||
template<typename Rep = double>
|
||||
using m2 = units::physical::si::area<units::physical::si::square_metre, Rep>;
|
||||
using m2 = units::isq::si::area<units::isq::si::square_metre, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using fm2 = units::physical::si::area<units::physical::si::square_femtometre, Rep>;
|
||||
using fm2 = units::isq::si::area<units::isq::si::square_femtometre, Rep>;
|
||||
|
||||
} // namespace area
|
||||
|
||||
@@ -53,7 +53,7 @@ struct Box {
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::isq::si::literals;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
@@ -20,16 +20,16 @@
|
||||
physical_quantities
|
||||
*/
|
||||
|
||||
#include <units/physical/si/capacitance.h>
|
||||
#include <units/physical/si/resistance.h>
|
||||
#include <units/physical/si/time.h>
|
||||
#include <units/isq/si/capacitance.h>
|
||||
#include <units/isq/si/resistance.h>
|
||||
#include <units/isq/si/time.h>
|
||||
#include <units/math.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include "./voltage.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace units::experimental;
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::isq::si::literals;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "./area.h"
|
||||
#include "./units_str.h"
|
||||
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::physical::si::international;
|
||||
using namespace units::isq::si::literals;
|
||||
using namespace units::isq::si::international;
|
||||
using namespace units::experimental;
|
||||
|
||||
void simple_quantities()
|
||||
|
||||
@@ -41,7 +41,7 @@ inline constexpr std::common_type_t<typename Target::rep, typename Source::rep>
|
||||
|
||||
} // namespace
|
||||
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::isq::si::literals;
|
||||
using namespace units::experimental;
|
||||
|
||||
int main()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/si/density.h>
|
||||
#include <units/isq/si/density.h>
|
||||
|
||||
namespace units{
|
||||
namespace experimental{
|
||||
@@ -10,7 +10,7 @@ namespace experimental{
|
||||
namespace density {
|
||||
|
||||
template<typename Rep = double>
|
||||
using kg_per_m3 = units::physical::si::density<units::physical::si::kilogram_per_metre_cub, Rep>;
|
||||
using kg_per_m3 = units::isq::si::density<units::isq::si::kilogram_per_metre_cub, Rep>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/si/force.h>
|
||||
#include <units/isq/si/force.h>
|
||||
|
||||
namespace units{
|
||||
namespace experimental{
|
||||
@@ -9,7 +9,7 @@ namespace experimental{
|
||||
namespace force {
|
||||
|
||||
template<typename Rep = double>
|
||||
using N = units::physical::si::force<units::physical::si::newton, Rep>;
|
||||
using N = units::isq::si::force<units::isq::si::newton, Rep>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/physical/si/imperial/length.h>
|
||||
#include <units/physical/si/international/length.h>
|
||||
#include <units/physical/si/typographic/length.h>
|
||||
#include <units/physical/si/us/length.h>
|
||||
#include <units/physical/si/iau/length.h>
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/isq/si/imperial/length.h>
|
||||
#include <units/isq/si/international/length.h>
|
||||
#include <units/isq/si/typographic/length.h>
|
||||
#include <units/isq/si/us/length.h>
|
||||
#include <units/isq/si/iau/length.h>
|
||||
|
||||
namespace units{
|
||||
namespace experimental{
|
||||
@@ -15,70 +15,70 @@ namespace experimental{
|
||||
namespace length {
|
||||
|
||||
template<typename Rep = double>
|
||||
using m = units::physical::si::length<units::physical::si::metre, Rep>;
|
||||
using m = units::isq::si::length<units::isq::si::metre, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using mm = units::physical::si::length<units::physical::si::millimetre, Rep>;
|
||||
using mm = units::isq::si::length<units::isq::si::millimetre, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using fm = units::physical::si::length<units::physical::si::femtometre, Rep>;
|
||||
using fm = units::isq::si::length<units::isq::si::femtometre, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using km = units::physical::si::length<units::physical::si::kilometre, Rep>;
|
||||
using km = units::isq::si::length<units::isq::si::kilometre, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using AU = units::physical::si::length<units::physical::si::astronomical_unit, Rep>;
|
||||
using AU = units::isq::si::length<units::isq::si::astronomical_unit, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using in = units::physical::si::length<units::physical::si::international::inch, Rep>;
|
||||
using in = units::isq::si::length<units::isq::si::international::inch, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using angstrom = units::physical::si::length<units::physical::si::iau::angstrom, Rep>;
|
||||
using angstrom = units::isq::si::length<units::isq::si::iau::angstrom, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using ch = units::physical::si::length<units::physical::si::imperial::chain, Rep>;
|
||||
using ch = units::isq::si::length<units::isq::si::imperial::chain, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using fathom = units::physical::si::length<units::physical::si::international::fathom, Rep>;
|
||||
using fathom = units::isq::si::length<units::isq::si::international::fathom, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using fathom_us = units::physical::si::length<units::physical::si::us::fathom, Rep>;
|
||||
using fathom_us = units::isq::si::length<units::isq::si::us::fathom, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using ft = units::physical::si::length<units::physical::si::international::foot, Rep>;
|
||||
using ft = units::isq::si::length<units::isq::si::international::foot, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using ft_us = units::physical::si::length<units::physical::si::us::foot, Rep>;
|
||||
using ft_us = units::isq::si::length<units::isq::si::us::foot, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using ly = units::physical::si::length<units::physical::si::iau::light_year, Rep>;
|
||||
using ly = units::isq::si::length<units::isq::si::iau::light_year, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using mi = units::physical::si::length<units::physical::si::international::mile, Rep>;
|
||||
using mi = units::isq::si::length<units::isq::si::international::mile, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using mi_naut = units::physical::si::length<units::physical::si::international::nautical_mile, Rep>;
|
||||
using mi_naut = units::isq::si::length<units::isq::si::international::nautical_mile, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using pc = units::physical::si::length<units::physical::si::iau::parsec, Rep>;
|
||||
using pc = units::isq::si::length<units::isq::si::iau::parsec, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using pica_comp = units::physical::si::length<units::physical::si::typographic::pica_comp, Rep>;
|
||||
using pica_comp = units::isq::si::length<units::isq::si::typographic::pica_comp, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using pica_prn = units::physical::si::length<units::physical::si::typographic::pica_prn, Rep>;
|
||||
using pica_prn = units::isq::si::length<units::isq::si::typographic::pica_prn, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using point_comp = units::physical::si::length<units::physical::si::typographic::point_comp, Rep>;
|
||||
using point_comp = units::isq::si::length<units::isq::si::typographic::point_comp, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using point_prn = units::physical::si::length<units::physical::si::typographic::point_prn, Rep>;
|
||||
using point_prn = units::isq::si::length<units::isq::si::typographic::point_prn, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using rd = units::physical::si::length<units::physical::si::imperial::rod, Rep>;
|
||||
using rd = units::isq::si::length<units::isq::si::imperial::rod, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using yd = units::physical::si::length<units::physical::si::international::yard, Rep>;
|
||||
using yd = units::isq::si::length<units::isq::si::international::yard, Rep>;
|
||||
|
||||
|
||||
} // namespace length
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/si/mass.h>
|
||||
#include <units/isq/si/mass.h>
|
||||
|
||||
namespace units{
|
||||
namespace experimental{
|
||||
@@ -10,7 +10,7 @@ namespace experimental{
|
||||
namespace mass {
|
||||
|
||||
template<typename Rep = double>
|
||||
using kg = units::physical::si::mass<units::physical::si::kilogram, Rep>;
|
||||
using kg = units::isq::si::mass<units::isq::si::kilogram, Rep>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/si/time.h>
|
||||
#include <units/isq/si/time.h>
|
||||
|
||||
// named qtime due to conflict with time_t time(time_t*)
|
||||
namespace q_time {
|
||||
|
||||
template<typename Rep = double>
|
||||
using s = units::physical::si::time<units::physical::si::second, Rep>;
|
||||
using s = units::isq::si::time<units::isq::si::second, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using ms = units::physical::si::time<units::physical::si::millisecond, Rep>;
|
||||
using ms = units::isq::si::time<units::isq::si::millisecond, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using min = units::physical::si::time<units::physical::si::minute, Rep>;
|
||||
using min = units::isq::si::time<units::isq::si::minute, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using h = units::physical::si::time<units::physical::si::hour, Rep>;
|
||||
using h = units::isq::si::time<units::isq::si::hour, Rep>;
|
||||
|
||||
} // namespace time
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
using namespace units::experimental;
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::isq::si::literals;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/si/prefixes.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <units/quantity.h>
|
||||
// get at the units text of the quantity, without its numeric value
|
||||
inline auto constexpr units_str(const units::Quantity auto& q)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/si/voltage.h>
|
||||
#include <units/isq/si/voltage.h>
|
||||
|
||||
namespace units{
|
||||
namespace experimental{
|
||||
@@ -10,19 +10,19 @@ namespace experimental{
|
||||
namespace voltage {
|
||||
|
||||
template<typename Rep = double>
|
||||
using V = units::physical::si::voltage<units::physical::si::volt, Rep>;
|
||||
using V = units::isq::si::voltage<units::isq::si::volt, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using mV = units::physical::si::voltage<units::physical::si::millivolt, Rep>;
|
||||
using mV = units::isq::si::voltage<units::isq::si::millivolt, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using uV = units::physical::si::voltage<units::physical::si::microvolt, Rep>;
|
||||
using uV = units::isq::si::voltage<units::isq::si::microvolt, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using nV = units::physical::si::voltage<units::physical::si::nanovolt, Rep>;
|
||||
using nV = units::isq::si::voltage<units::isq::si::nanovolt, Rep>;
|
||||
|
||||
template<typename Rep = double>
|
||||
using pV = units::physical::si::voltage<units::physical::si::picovolt, Rep>;
|
||||
using pV = units::isq::si::voltage<units::isq::si::picovolt, Rep>;
|
||||
|
||||
} // namespace voltage
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/physical/si/volume.h>
|
||||
#include <units/isq/si/volume.h>
|
||||
|
||||
namespace units{
|
||||
namespace experimental{
|
||||
@@ -10,7 +10,7 @@ namespace experimental{
|
||||
namespace volume {
|
||||
|
||||
template<typename Rep = double>
|
||||
using m3 = units::physical::si::volume<units::physical::si::cubic_metre, Rep>;
|
||||
using m3 = units::isq::si::volume<units::isq::si::cubic_metre, Rep>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -20,15 +20,15 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/physical/si/cgs/speed.h>
|
||||
#include <units/physical/si/international/speed.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/isq/si/cgs/speed.h>
|
||||
#include <units/isq/si/international/speed.h>
|
||||
#include <units/isq/si/speed.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace units::physical;
|
||||
using namespace units::isq;
|
||||
|
||||
constexpr si::speed<si::metre_per_second, int>
|
||||
fixed_int_si_avg_speed(si::length<si::metre, int> d,
|
||||
@@ -68,7 +68,7 @@ void example()
|
||||
{
|
||||
// SI (int)
|
||||
{
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::isq::si::literals;
|
||||
constexpr Length auto distance = 220_q_km; // constructed from a UDL
|
||||
constexpr si::time<si::hour, int> duration(2); // constructed from a value
|
||||
|
||||
@@ -82,7 +82,7 @@ void example()
|
||||
|
||||
// SI (double)
|
||||
{
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::isq::si::literals;
|
||||
constexpr Length auto distance = 220._q_km; // constructed from a UDL
|
||||
constexpr si::time<si::hour> duration(2); // constructed from a value
|
||||
|
||||
@@ -98,7 +98,7 @@ void example()
|
||||
|
||||
// Customary Units (int)
|
||||
{
|
||||
using namespace units::physical::si::international::literals;
|
||||
using namespace units::isq::si::international::literals;
|
||||
constexpr Length auto distance = 140_q_mi; // constructed from a UDL
|
||||
constexpr si::time<si::hour, int> duration(2); // constructed from a value
|
||||
|
||||
@@ -114,7 +114,7 @@ void example()
|
||||
|
||||
// Customary Units (double)
|
||||
{
|
||||
using namespace units::physical::si::international::literals;
|
||||
using namespace units::isq::si::international::literals;
|
||||
constexpr Length auto distance = 140._q_mi; // constructed from a UDL
|
||||
constexpr si::time<si::hour> duration(2); // constructed from a value
|
||||
|
||||
@@ -132,7 +132,7 @@ void example()
|
||||
|
||||
// CGS (int)
|
||||
{
|
||||
using namespace units::physical::si::cgs::literals;
|
||||
using namespace units::isq::si::cgs::literals;
|
||||
constexpr Length auto distance = 22'000'000_q_cm; // constructed from a UDL
|
||||
constexpr si::cgs::time<si::hour, int> duration(2); // constructed from a value
|
||||
|
||||
@@ -151,7 +151,7 @@ void example()
|
||||
|
||||
// CGS (double)
|
||||
{
|
||||
using namespace units::physical::si::cgs::literals;
|
||||
using namespace units::isq::si::cgs::literals;
|
||||
constexpr Length auto distance = 22'000'000._q_cm; // constructed from a UDL
|
||||
constexpr si::cgs::time<si::hour> duration(2); // constructed from a value
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#include <units/physical/si/constants.h>
|
||||
#include <units/physical/si/area.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/physical/si/density.h>
|
||||
#include <units/physical/si/force.h>
|
||||
#include <units/physical/si/mass.h>
|
||||
#include <units/physical/si/time.h>
|
||||
#include <units/physical/si/volume.h>
|
||||
#include <units/isq/si/constants.h>
|
||||
#include <units/isq/si/area.h>
|
||||
#include <units/isq/si/speed.h>
|
||||
#include <units/isq/si/density.h>
|
||||
#include <units/isq/si/force.h>
|
||||
#include <units/isq/si/mass.h>
|
||||
#include <units/isq/si/time.h>
|
||||
#include <units/isq/si/volume.h>
|
||||
#include <units/format.h>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace units::physical;
|
||||
using namespace units::isq;
|
||||
|
||||
using m = si::metre;
|
||||
using m2 = si::square_metre;
|
||||
|
||||
@@ -20,18 +20,18 @@
|
||||
physical_quantities
|
||||
*/
|
||||
|
||||
#include <units/physical/si/capacitance.h>
|
||||
#include <units/physical/si/resistance.h>
|
||||
#include <units/physical/si/time.h>
|
||||
#include <units/physical/si/voltage.h>
|
||||
#include <units/isq/si/capacitance.h>
|
||||
#include <units/isq/si/resistance.h>
|
||||
#include <units/isq/si/time.h>
|
||||
#include <units/isq/si/voltage.h>
|
||||
#include <units/math.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace units::physical;
|
||||
using namespace units::physical::si;
|
||||
using namespace units::isq;
|
||||
using namespace units::isq::si;
|
||||
|
||||
std::cout << "mp-units capacitor time curve example...\n";
|
||||
std::cout.setf(std::ios_base::fixed, std::ios_base::floatfield);
|
||||
|
||||
+16
-16
@@ -16,15 +16,15 @@
|
||||
*/
|
||||
|
||||
#include <units/format.h>
|
||||
#include <units/physical/si/area.h>
|
||||
#include <units/physical/si/iau/length.h>
|
||||
#include <units/physical/si/imperial/length.h>
|
||||
#include <units/physical/si/international/length.h>
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/physical/si/time.h>
|
||||
#include <units/physical/si/typographic/length.h>
|
||||
#include <units/physical/si/us/length.h>
|
||||
#include <units/physical/si/volume.h>
|
||||
#include <units/isq/si/area.h>
|
||||
#include <units/isq/si/iau/length.h>
|
||||
#include <units/isq/si/imperial/length.h>
|
||||
#include <units/isq/si/international/length.h>
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/isq/si/time.h>
|
||||
#include <units/isq/si/typographic/length.h>
|
||||
#include <units/isq/si/us/length.h>
|
||||
#include <units/isq/si/volume.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <iostream>
|
||||
|
||||
@@ -34,11 +34,11 @@ using namespace units;
|
||||
|
||||
void simple_quantities()
|
||||
{
|
||||
using namespace units::physical::si;
|
||||
using namespace units::physical::si::international;
|
||||
using namespace units::isq::si;
|
||||
using namespace units::isq::si::international;
|
||||
|
||||
using distance = length<metre>;
|
||||
using duration = physical::si::time<second>;
|
||||
using duration = isq::si::time<second>;
|
||||
|
||||
constexpr distance km = 1.0_q_km;
|
||||
constexpr distance miles = 1.0_q_mi;
|
||||
@@ -58,9 +58,9 @@ void simple_quantities()
|
||||
|
||||
void quantities_with_typed_units()
|
||||
{
|
||||
using namespace units::physical;
|
||||
using namespace units::physical::si;
|
||||
using namespace units::physical::si::international;
|
||||
using namespace units::isq;
|
||||
using namespace units::isq::si;
|
||||
using namespace units::isq::si::international;
|
||||
|
||||
constexpr length<kilometre> km = 1.0_q_km;
|
||||
constexpr length<mile> miles = 1.0_q_mi;
|
||||
@@ -106,7 +106,7 @@ void quantities_with_typed_units()
|
||||
|
||||
void calcs_comparison()
|
||||
{
|
||||
using namespace units::physical::si;
|
||||
using namespace units::isq::si;
|
||||
|
||||
std::cout << "\nA distinct unit for each type is efficient and accurate\n"
|
||||
"when adding two values of the same very big\n"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
along with this program. If not, see http://www.gnu.org/licenses./
|
||||
*/
|
||||
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/format.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <iostream>
|
||||
@@ -42,7 +42,7 @@ inline constexpr std::common_type_t<typename Target::rep, typename Source::rep>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace units::physical::si;
|
||||
using namespace units::isq::si;
|
||||
|
||||
std::cout << "conversion factor in mp-units...\n\n";
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/quantity_io.h>
|
||||
#include <units/physical/si/prefixes.h>
|
||||
#include <units/isq/si/prefixes.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace units;
|
||||
@@ -40,8 +40,8 @@ using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
namespace si {
|
||||
|
||||
struct metre : named_unit<metre, "m", units::physical::si::prefix> {};
|
||||
struct kilometre : prefixed_unit<kilometre, units::physical::si::kilo, metre> {};
|
||||
struct metre : named_unit<metre, "m", units::isq::si::prefix> {};
|
||||
struct kilometre : prefixed_unit<kilometre, units::isq::si::kilo, metre> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", metre> {};
|
||||
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
|
||||
#include <units/format.h>
|
||||
#include <units/generic/angle.h>
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/physical/si/energy.h>
|
||||
#include <units/physical/si/torque.h>
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/isq/si/energy.h>
|
||||
#include <units/isq/si/torque.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace units;
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::isq::si::literals;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
@@ -22,21 +22,21 @@
|
||||
|
||||
#include <units/concepts.h>
|
||||
#include <units/format.h>
|
||||
#include <units/physical/si/fps/density.h>
|
||||
#include <units/physical/si/fps/length.h>
|
||||
#include <units/physical/si/fps/mass.h>
|
||||
#include <units/physical/si/fps/power.h>
|
||||
#include <units/physical/si/fps/speed.h>
|
||||
#include <units/physical/si/fps/volume.h>
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/physical/si/mass.h>
|
||||
#include <units/physical/si/power.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/physical/si/volume.h>
|
||||
#include <units/isq/si/fps/density.h>
|
||||
#include <units/isq/si/fps/length.h>
|
||||
#include <units/isq/si/fps/mass.h>
|
||||
#include <units/isq/si/fps/power.h>
|
||||
#include <units/isq/si/fps/speed.h>
|
||||
#include <units/isq/si/fps/volume.h>
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/isq/si/mass.h>
|
||||
#include <units/isq/si/power.h>
|
||||
#include <units/isq/si/speed.h>
|
||||
#include <units/isq/si/volume.h>
|
||||
#include <units/quantity.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace units::physical;
|
||||
using namespace units::isq;
|
||||
|
||||
|
||||
// Some basic specs for the warship
|
||||
@@ -64,7 +64,7 @@ auto fmt_line(const Q a)
|
||||
// Print the ship details in the units as defined in the Ship struct, in other si::imperial units, and in SI
|
||||
void print_details(std::string_view description, const Ship& ship)
|
||||
{
|
||||
using namespace units::physical::si::fps::literals;
|
||||
using namespace units::isq::si::fps::literals;
|
||||
const auto waterDensity = 62.4_q_lb_per_ft3;
|
||||
std::cout << fmt::format("{}\n", description);
|
||||
std::cout << fmt::format("{:20} : {}\n", "length", fmt_line<si::fps::length<si::fps::yard>, si::length<si::metre>>(ship.length))
|
||||
@@ -81,8 +81,8 @@ void print_details(std::string_view description, const Ship& ship)
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::physical::si::fps::literals;
|
||||
using namespace units::isq::si::literals;
|
||||
using namespace units::isq::si::fps::literals;
|
||||
|
||||
// KMS Bismark, using the units the Germans would use, taken from Wiki
|
||||
auto bismark = Ship{.length{251._q_m}, .draft{9.3_q_m}, .beam{36_q_m}, .speed{56_q_km_per_h}, .mass{50'300_q_t}, .mainGuns{380_q_mm}, .shellMass{800_q_kg}, .shellSpeed{820._q_m_per_s}, .power{110.45_q_kW}};
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace units::physical::si::unit_constants;
|
||||
using namespace units::isq::si::unit_constants;
|
||||
inline constexpr auto earth_radius = 6371 * km;
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <units/format.h>
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/quantity_kind.h>
|
||||
#include <compare>
|
||||
|
||||
@@ -116,8 +116,8 @@ struct fmt::formatter<geographic::longitude> : formatter<geographic::longitude::
|
||||
|
||||
namespace geographic {
|
||||
|
||||
struct horizontal_kind : units::kind<horizontal_kind, units::physical::si::dim_length> {};
|
||||
using distance = units::quantity_kind<horizontal_kind, units::physical::si::kilometre>;
|
||||
struct horizontal_kind : units::kind<horizontal_kind, units::isq::si::dim_length> {};
|
||||
using distance = units::quantity_kind<horizontal_kind, units::isq::si::kilometre>;
|
||||
|
||||
struct position {
|
||||
latitude lat;
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "geographic.h"
|
||||
#include <units/format.h>
|
||||
#include <units/math.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/physical/si/international/length.h>
|
||||
#include <units/isq/si/speed.h>
|
||||
#include <units/isq/si/international/length.h>
|
||||
#include <units/quantity_point_kind.h>
|
||||
|
||||
// An example of a really simplified tactical glide computer
|
||||
@@ -44,7 +44,7 @@
|
||||
// - flight path exactly on a shortest possible line to destination
|
||||
|
||||
using namespace units;
|
||||
using namespace units::physical;
|
||||
using namespace units::isq;
|
||||
|
||||
template<units::QuantityKind QK>
|
||||
struct fmt::formatter<QK> : formatter<typename QK::quantity_type> {
|
||||
@@ -95,11 +95,11 @@ std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>&
|
||||
} // namespace glide_computer
|
||||
|
||||
template<>
|
||||
struct fmt::formatter<glide_computer::altitude> : formatter<units::physical::si::length<units::physical::si::metre>> {
|
||||
struct fmt::formatter<glide_computer::altitude> : formatter<units::isq::si::length<units::isq::si::metre>> {
|
||||
template<typename FormatContext>
|
||||
auto format(glide_computer::altitude a, FormatContext& ctx)
|
||||
{
|
||||
formatter<units::physical::si::length<units::physical::si::metre>>::format(a.relative().common(), ctx);
|
||||
formatter<units::isq::si::length<units::isq::si::metre>>::format(a.relative().common(), ctx);
|
||||
return format_to(ctx.out(), " AMSL");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ auto get_weather_conditions()
|
||||
auto get_waypoints()
|
||||
{
|
||||
using namespace geographic::literals;
|
||||
using namespace units::physical::si::international::unit_constants;
|
||||
using namespace units::isq::si::international::unit_constants;
|
||||
static const std::array waypoints = {
|
||||
waypoint{"EPPR", {54.24772_N, 18.6745_E}, altitude(16 * ft)}, // N54°14'51.8" E18°40'28.2"
|
||||
waypoint{"EPGI", {53.52442_N, 18.84947_E}, altitude(115 * ft)} // N53°31'27.9" E18°50'58.1"
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/format.h>
|
||||
#include <units/physical/si/international/speed.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/isq/si/international/speed.h>
|
||||
#include <units/isq/si/speed.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <iostream>
|
||||
|
||||
using namespace units::physical;
|
||||
using namespace units::isq;
|
||||
|
||||
constexpr Speed auto avg_speed(Length auto d, Time auto t)
|
||||
{
|
||||
@@ -35,8 +35,8 @@ constexpr Speed auto avg_speed(Length auto d, Time auto t)
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::physical::si::unit_constants;
|
||||
using namespace units::isq::si::literals;
|
||||
using namespace units::isq::si::unit_constants;
|
||||
|
||||
constexpr Speed auto v1 = 110 * km / h;
|
||||
constexpr Speed auto v2 = avg_speed(220_q_km, 2_q_h);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <units/format.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/isq/si/speed.h>
|
||||
#include <iostream>
|
||||
#include <array>
|
||||
|
||||
@@ -16,8 +16,8 @@ struct state_variable {
|
||||
Q predicted_next_state;
|
||||
};
|
||||
|
||||
using namespace units::physical;
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::isq;
|
||||
using namespace units::isq::si::literals;
|
||||
|
||||
constexpr auto radar_transmit_interval = 5.0_q_s;
|
||||
constexpr double kalman_range_gain = 0.2;
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/physical/si/force.h>
|
||||
#include <units/physical/si/energy.h>
|
||||
#include <units/isq/si/speed.h>
|
||||
#include <units/isq/si/force.h>
|
||||
#include <units/isq/si/energy.h>
|
||||
#include <units/format.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <linear_algebra.hpp>
|
||||
@@ -58,8 +58,8 @@ std::ostream& operator<<(std::ostream& os, const matrix<ET, OT>& v)
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace units::physical;
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::isq;
|
||||
using namespace units::isq::si::literals;
|
||||
|
||||
template<typename Rep = double>
|
||||
using vector = std::math::fs_vector<Rep, 3>;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/physical/si/acceleration.h>
|
||||
#include <units/isq/si/acceleration.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <cmath>
|
||||
#include <compare>
|
||||
@@ -124,7 +124,7 @@ static_assert(units::QuantityValue<measurement<double>>);
|
||||
|
||||
void example()
|
||||
{
|
||||
using namespace units::physical;
|
||||
using namespace units::isq;
|
||||
|
||||
const auto a = si::acceleration<si::metre_per_second_sq, measurement<double>>(measurement(9.8, 0.1));
|
||||
const auto t = si::time<si::second, measurement<double>>(measurement(1.2, 0.1));
|
||||
|
||||
@@ -20,18 +20,18 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/physical/natural/constants.h>
|
||||
#include <units/physical/si/energy.h>
|
||||
#include <units/physical/si/momentum.h>
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/physical/si/constants.h>
|
||||
#include <units/isq/natural/constants.h>
|
||||
#include <units/isq/si/energy.h>
|
||||
#include <units/isq/si/momentum.h>
|
||||
#include <units/isq/si/speed.h>
|
||||
#include <units/isq/si/constants.h>
|
||||
#include <units/math.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace units::physical;
|
||||
using namespace units::isq;
|
||||
|
||||
Energy auto total_energy(Momentum auto p, Mass auto m, Speed auto c)
|
||||
{
|
||||
@@ -40,7 +40,7 @@ Energy auto total_energy(Momentum auto p, Mass auto m, Speed auto c)
|
||||
|
||||
void si_example()
|
||||
{
|
||||
using namespace units::physical::si;
|
||||
using namespace units::isq::si;
|
||||
using GeV = gigaelectronvolt;
|
||||
|
||||
constexpr Speed auto c = si2019::speed_of_light<>;
|
||||
@@ -71,7 +71,7 @@ void si_example()
|
||||
|
||||
void natural_example()
|
||||
{
|
||||
using namespace units::physical::natural;
|
||||
using namespace units::isq::natural;
|
||||
using GeV = gigaelectronvolt;
|
||||
|
||||
constexpr Speed auto c = speed_of_light<>;
|
||||
|
||||
@@ -20,22 +20,22 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <units/physical/si/speed.h>
|
||||
#include <units/isq/si/speed.h>
|
||||
#include <units/quantity_io.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace {
|
||||
|
||||
template<units::physical::Length D, units::physical::Time T>
|
||||
constexpr units::physical::Speed auto avg_speed(D d, T t)
|
||||
template<units::isq::Length D, units::isq::Time T>
|
||||
constexpr units::isq::Speed auto avg_speed(D d, T t)
|
||||
{
|
||||
return d / t;
|
||||
}
|
||||
|
||||
void example()
|
||||
{
|
||||
using namespace units::physical;
|
||||
using namespace units::physical::si::literals;
|
||||
using namespace units::isq;
|
||||
using namespace units::isq::si::literals;
|
||||
|
||||
Length auto d1 = 123_q_m;
|
||||
Time auto t1 = 10_q_s;
|
||||
|
||||
Reference in New Issue
Block a user