diff --git a/Framework/Units/PhysicalConstants.h b/Framework/Units/PhysicalConstants.h index 915f2d59cf7f418255574218f1530b09f1ff37e5..c3d5824e8a1c82fba366b9409add9b543cad8b60 100644 --- a/Framework/Units/PhysicalConstants.h +++ b/Framework/Units/PhysicalConstants.h @@ -54,7 +54,7 @@ namespace corsika::units::si::constants { // unified atomic mass unit constexpr quantity<mass_d> u{Rep(1.6605402e-27L) * kilogram}; - // millibarn + // barn constexpr quantity<area_d> barn{Rep(1.e-28L) * meter * meter}; // etc. diff --git a/Framework/Units/PhysicalUnits.h b/Framework/Units/PhysicalUnits.h index adaa004d30592edd91bf0a2ae154d8906e1841ff..9060037e37486045a8bae8fd133a875ed521e108 100644 --- a/Framework/Units/PhysicalUnits.h +++ b/Framework/Units/PhysicalUnits.h @@ -24,6 +24,31 @@ namespace phys { } // namespace units } // namespace phys +namespace phys { + namespace units { + namespace literals { + QUANTITY_DEFINE_SCALING_LITERALS(barn, area_d, + magnitude(corsika::units::si::constants::barn)) + + // phys::units::quantity<energy_d/mass_d> Joule2Kg = c2; // 1_Joule / 1_kg; + + } // namespace literals + } // namespace units +} + +namespace phys { + namespace units { + namespace literals { + QUANTITY_DEFINE_SCALING_LITERALS(meter, length_d, + magnitude(corsika::units::si::constants::meter)) + + // phys::units::quantity<energy_d/mass_d> Joule2Kg = c2; // 1_Joule / 1_kg; + + } // namespace literals + } // namespace units +} + + namespace corsika::units::si { using namespace phys::units; using namespace phys::units::literals; diff --git a/Framework/Units/testUnits.cc b/Framework/Units/testUnits.cc index 3528cf67cd85cd07d3b38d9f9e23cd6c973b9057..fc844c10860c006466b73d6b2619ece646bb139b 100644 --- a/Framework/Units/testUnits.cc +++ b/Framework/Units/testUnits.cc @@ -54,7 +54,8 @@ TEST_CASE("PhysicalUnits", "[Units]") { REQUIRE(1_mol / 1_amol == Approx(1e18)); REQUIRE(1_K / 1_zK == Approx(1e21)); REQUIRE(1_K / 1_yK == Approx(1e24)); - + // REQUIRE(1_barn / 1_mbarn == Approx(1e3)); + REQUIRE(1_A / 1_hA == Approx(1e-2)); REQUIRE(1_m / 1_km == Approx(1e-3)); REQUIRE(1_m / 1_Mm == Approx(1e-6));