IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 4de279f2 authored by ralfulrich's avatar ralfulrich
Browse files

fixed remaining rebase errors

parent 6dfb512a
No related merge requests found
...@@ -9,43 +9,25 @@ ...@@ -9,43 +9,25 @@
/** /**
* @file PhysicalUnits * @file PhysicalUnits
* *
* Define _XeV literals, alowing 10_GeV in the code. * Define new units and unit-types
*/ */
namespace phys {
namespace units {
namespace literals {
QUANTITY_DEFINE_SCALING_LITERALS(eV, energy_d,
magnitude(corsika::units::si::constants::eV));
// 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 { namespace corsika::units::si {
using namespace phys::units; using namespace phys::units;
using namespace phys::units::literals; using namespace phys::units::literals;
// namespace literals = phys::units::literals; // namespace literals = phys::units::literals;
/// defining momentum you suckers
/// dimensions, i.e. composition in base SI dimensions
using momentum_d = phys::units::dimensions<1, 1, -1>;
// defining the unit of momentum, so far newton-meter, maybe go to HEP?
constexpr phys::units::quantity<momentum_d> newton_second{meter * kilogram / second};
/// defining cross section
using sigma_d = phys::units::dimensions<2, 0, 0>;
constexpr phys::units::quantity<sigma_d> barn{Rep(1.e-28L) * meter * meter};
/// add the unit-types
using LengthType = phys::units::quantity<phys::units::length_d, double>; using LengthType = phys::units::quantity<phys::units::length_d, double>;
using TimeType = phys::units::quantity<phys::units::time_interval_d, double>; using TimeType = phys::units::quantity<phys::units::time_interval_d, double>;
using SpeedType = phys::units::quantity<phys::units::speed_d, double>; using SpeedType = phys::units::quantity<phys::units::speed_d, double>;
...@@ -53,46 +35,43 @@ namespace corsika::units::si { ...@@ -53,46 +35,43 @@ namespace corsika::units::si {
using ElectricChargeType = using ElectricChargeType =
phys::units::quantity<phys::units::electric_charge_d, double>; phys::units::quantity<phys::units::electric_charge_d, double>;
using EnergyType = phys::units::quantity<phys::units::energy_d, double>; using EnergyType = phys::units::quantity<phys::units::energy_d, double>;
using MassType = phys::units::quantity<phys::units::mass_d, double>; using MassType = phys::units::quantity<phys::units::mass_d, double>;
// defining momentum you suckers
// dimensions, i.e. composition in base SI dimensions
using momentum_d = phys::units::dimensions< 1, 1, -1 >;
// defining the unit of momentum, so far newton-meter, maybe go to HEP?
constexpr phys::units::quantity< momentum_d > newton_second { meter * kilogram / second };
// defining the type
using MomentumType = phys::units::quantity<momentum_d, double>; using MomentumType = phys::units::quantity<momentum_d, double>;
// defining cross section
using sigma_d = phys::units::dimensions< 2, 0, 0 >;
constexpr phys::units::quantity< sigma_d > barn {Rep(1.e-28L) * meter * meter};
using CrossSectionType = phys::units::quantity<sigma_d, double>; using CrossSectionType = phys::units::quantity<sigma_d, double>;
} // end namespace corsika::units::si } // end namespace corsika::units::si
/**
* @file PhysicalUnits
*
* Define _XeV literals, alowing 10_GeV in the code.
* Define _meter literal
* Define _barn literal
* Define _newton_second literal for SI momenta
*/
namespace phys { namespace phys {
namespace units { namespace units {
namespace literals { namespace literals {
QUANTITY_DEFINE_SCALING_LITERALS(eV, energy_d,
magnitude(corsika::units::si::constants::eV))
QUANTITY_DEFINE_SCALING_LITERALS(barn, corsika::units::si::sigma_d, QUANTITY_DEFINE_SCALING_LITERALS(barn, corsika::units::si::sigma_d,
magnitude(corsika::units::si::constants::barn)) magnitude(corsika::units::si::constants::barn))
// phys::units::quantity<energy_d/mass_d> Joule2Kg = c2; // 1_Joule / 1_kg; // phys::units::quantity<energy_d/mass_d> Joule2Kg = c2; // 1_Joule / 1_kg;
} // namespace literals QUANTITY_DEFINE_SCALING_LITERALS(meter, length_d,
} // namespace units magnitude(corsika::units::si::constants::meter))
}
namespace phys {
namespace units {
namespace literals {
QUANTITY_DEFINE_SCALING_LITERALS(newton_second, corsika::units::si::momentum_d, QUANTITY_DEFINE_SCALING_LITERALS(newton_second, corsika::units::si::momentum_d,
magnitude(corsika::units::si::newton_second)) magnitude(corsika::units::si::newton_second))
// phys::units::quantity<energy_d/mass_d> Joule2Kg = c2; // 1_Joule / 1_kg;
} // namespace literals } // namespace literals
} // namespace units } // namespace units
} } // namespace phys
// we want to call the operator<< without namespace... I think // we want to call the operator<< without namespace... I think
using namespace phys::units::io; using namespace phys::units::io;
......
...@@ -33,12 +33,13 @@ namespace corsika::stack { ...@@ -33,12 +33,13 @@ namespace corsika::stack {
using corsika::units::si::second; using corsika::units::si::second;
using corsika::units::si::meter; using corsika::units::si::meter;
using corsika::units::si::joule; using corsika::units::si::joule;
using corsika::units::si::newton_second;
using corsika::units::si::energy_d; using corsika::units::si::energy_d;
using corsika::units::si::momentum_d;
using corsika::geometry::Point; using corsika::geometry::Point;
using corsika::geometry::Vector; using corsika::geometry::Vector;
#warning replace this with a proper momentum vector: typedef Vector<momentum_d> MomentumVector;
typedef Vector<energy_d> MomentumVector; // should be momentum_d !!!
/** /**
* Example of a particle object on the stack. * Example of a particle object on the stack.
...@@ -123,7 +124,7 @@ namespace corsika::stack { ...@@ -123,7 +124,7 @@ namespace corsika::stack {
#warning this here makes no sense: see issue #48 #warning this here makes no sense: see issue #48
auto const dummyCS = corsika::geometry::CoordinateSystem::CreateRootCS(); auto const dummyCS = corsika::geometry::CoordinateSystem::CreateRootCS();
fMomentum.push_back(MomentumVector(dummyCS, fMomentum.push_back(MomentumVector(dummyCS,
{0 * joule, 0 * joule, 0 * joule})); {0 * newton_second, 0 * newton_second, 0 * newton_second}));
fPosition.push_back(Point(dummyCS, fPosition.push_back(Point(dummyCS,
{0 * meter, 0 * meter, 0 * meter})); {0 * meter, 0 * meter, 0 * meter}));
fTime.push_back(0 * second); fTime.push_back(0 * second);
...@@ -143,7 +144,7 @@ namespace corsika::stack { ...@@ -143,7 +144,7 @@ namespace corsika::stack {
std::vector<Code> fDataPID; std::vector<Code> fDataPID;
std::vector<EnergyType> fDataE; std::vector<EnergyType> fDataE;
std::vector<Vector<corsika::units::si::energy_d>> fMomentum; // should be Momentum !!!! std::vector<MomentumVector> fMomentum;
std::vector<Point> fPosition; std::vector<Point> fPosition;
std::vector<TimeType> fTime; std::vector<TimeType> fTime;
......
...@@ -36,7 +36,7 @@ TEST_CASE("SuperStupidStack", "[stack]") { ...@@ -36,7 +36,7 @@ TEST_CASE("SuperStupidStack", "[stack]") {
p.SetPID(corsika::particles::Code::Electron); p.SetPID(corsika::particles::Code::Electron);
p.SetEnergy(1.5_GeV); p.SetEnergy(1.5_GeV);
auto const dummyCS = corsika::geometry::CoordinateSystem::CreateRootCS(); auto const dummyCS = corsika::geometry::CoordinateSystem::CreateRootCS();
p.SetMomentum(MomentumVector(dummyCS, {1 * joule, 1 * joule, 1 * joule})); p.SetMomentum(MomentumVector(dummyCS, {1 * newton_second, 1 * newton_second, 1 * newton_second}));
p.SetPosition(Point(dummyCS, {1 * meter, 1 * meter, 1 * meter})); p.SetPosition(Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}));
p.SetTime(100_s); p.SetTime(100_s);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment