From 1c27d388357c02df0d22d10867196999adaa2662 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Wed, 19 Sep 2018 15:05:23 +0200 Subject: [PATCH] do-clang-format --- Framework/Cascade/Cascade.h | 39 ++++++++++--------- Framework/Cascade/testCascade.cc | 20 +++++----- Framework/Geometry/LineTrajectory.h | 4 +- Framework/Geometry/QuantityVector.h | 6 +-- Framework/Geometry/Trajectory.h | 2 +- Framework/Geometry/testGeometry.cc | 4 +- Framework/Particles/testParticles.cc | 9 ++--- Framework/ProcessSequence/ProcessReturn.h | 6 +-- Framework/ProcessSequence/ProcessSequence.h | 14 ++++--- .../ProcessSequence/testProcessSequence.cc | 10 ++--- Framework/StackInterface/StackIterator.h | 2 +- 11 files changed, 60 insertions(+), 56 deletions(-) diff --git a/Framework/Cascade/Cascade.h b/Framework/Cascade/Cascade.h index ebadbd8a..25935d3a 100644 --- a/Framework/Cascade/Cascade.h +++ b/Framework/Cascade/Cascade.h @@ -3,8 +3,8 @@ #include <corsika/geometry/LineTrajectory.h> // to be removed #include <corsika/geometry/Point.h> // to be removed -#include <corsika/units/PhysicalUnits.h> #include <corsika/process/ProcessReturn.h> +#include <corsika/units/PhysicalUnits.h> using namespace corsika::units::si; @@ -28,19 +28,19 @@ namespace corsika::cascade { void Run() { while (!fStack.IsEmpty()) { while (!fStack.IsEmpty()) { - //Particle& p = *fStack.GetNextParticle(); - EnergyType Emin; - typename Stack::StackIterator pMin(fStack, 0); - bool first = true; - for (typename Stack::StackIterator ip = fStack.begin(); ip!=fStack.end(); ++ip) - { - if (first || ip.GetEnergy()<Emin) { - first = false; - pMin = ip; - Emin = pMin.GetEnergy(); - } - } - + // Particle& p = *fStack.GetNextParticle(); + EnergyType Emin; + typename Stack::StackIterator pMin(fStack, 0); + bool first = true; + for (typename Stack::StackIterator ip = fStack.begin(); ip != fStack.end(); + ++ip) { + if (first || ip.GetEnergy() < Emin) { + first = false; + pMin = ip; + Emin = pMin.GetEnergy(); + } + } + Step(pMin); } // do cascade equations, which can put new particles on Stack, @@ -48,7 +48,7 @@ namespace corsika::cascade { // DoCascadeEquations(); // } } - + void Step(Particle& particle) { double nextStep = fProcesseList.MinStepLength(particle); corsika::geometry::CoordinateSystem root; @@ -56,11 +56,12 @@ namespace corsika::cascade { corsika::geometry::Point(root, {0_m, 0_m, 0_m}), corsika::geometry::Vector<corsika::units::si::SpeedType::dimension_type>( root, 0 * 1_m / second, 0 * 1_m / second, 1 * 1_m / second)); - corsika::process::EProcessReturn status = fProcesseList.DoContinuous(particle, trajectory, fStack); - if (status==corsika::process::EProcessReturn::eParticleAbsorbed) { - fStack.Delete(particle); + corsika::process::EProcessReturn status = + fProcesseList.DoContinuous(particle, trajectory, fStack); + if (status == corsika::process::EProcessReturn::eParticleAbsorbed) { + fStack.Delete(particle); } else { - fProcesseList.DoDiscrete(particle, fStack); + fProcesseList.DoDiscrete(particle, fStack); } } diff --git a/Framework/Cascade/testCascade.cc b/Framework/Cascade/testCascade.cc index c110455c..3279c424 100644 --- a/Framework/Cascade/testCascade.cc +++ b/Framework/Cascade/testCascade.cc @@ -25,8 +25,9 @@ public: } template <typename Particle, typename Trajectory, typename Stack> - EProcessReturn DoContinuous(Particle& p, Trajectory& t, Stack& s) const { return EProcessReturn::eOk; -} + EProcessReturn DoContinuous(Particle& p, Trajectory& t, Stack& s) const { + return EProcessReturn::eOk; + } template <typename Particle, typename Stack> void DoDiscrete(Particle& p, Stack& s) const { @@ -37,7 +38,7 @@ public: } else { p.SetEnergy(E / 2); s.NewParticle().SetEnergy(E / 2); - } + } } void Init() { fCount = 0; } @@ -63,7 +64,7 @@ public: EProcessReturn DoContinuous(Particle& p, Trajectory& t, Stack& s) const { static int countStep = 0; if (!fReport) return EProcessReturn::eOk; - //std::cout << "generation " << countStep << std::endl; + // std::cout << "generation " << countStep << std::endl; int i = 0; EnergyType Etot = 0_GeV; for (auto& iterP : s) { @@ -75,8 +76,9 @@ public: */ } countStep++; - //cout << "#=" << countStep << " " << s.GetSize() << " " << Etot/1_GeV << endl; - cout << countStep << " " << s.GetSize() << " " << Etot/1_GeV << " " << fCount << endl; + // cout << "#=" << countStep << " " << s.GetSize() << " " << Etot/1_GeV << endl; + cout << countStep << " " << s.GetSize() << " " << Etot / 1_GeV << " " << fCount + << endl; return EProcessReturn::eOk; } @@ -91,7 +93,7 @@ TEST_CASE("Cascade", "[Cascade]") { ProcessSplit p1; const auto sequence = p0 + p1; corsika::stack::super_stupid::SuperStupidStack stack; - + corsika::cascade::Cascade<corsika::geometry::LineTrajectory, decltype(sequence), decltype(stack)> EAS(sequence, stack); @@ -111,8 +113,8 @@ TEST_CASE("Cascade", "[Cascade]") { particle.SetEnergy(E0); EAS.Init(); EAS.Run(); - - //cout << "Result: E0=" << E0 / 1_GeV << "GeV, count=" << p1.GetCount() << endl; + + // cout << "Result: E0=" << E0 / 1_GeV << "GeV, count=" << p1.GetCount() << endl; } } } diff --git a/Framework/Geometry/LineTrajectory.h b/Framework/Geometry/LineTrajectory.h index b3aa4423..fcdc8c16 100644 --- a/Framework/Geometry/LineTrajectory.h +++ b/Framework/Geometry/LineTrajectory.h @@ -19,7 +19,9 @@ namespace corsika::geometry { : r0(pR0) , v0(pV0) {} - Point GetPosition(corsika::units::si::TimeType t) const override { return r0 + v0 * t; } + Point GetPosition(corsika::units::si::TimeType t) const override { + return r0 + v0 * t; + } }; } // namespace corsika::geometry diff --git a/Framework/Geometry/QuantityVector.h b/Framework/Geometry/QuantityVector.h index 6066e1d5..f4b6bbe0 100644 --- a/Framework/Geometry/QuantityVector.h +++ b/Framework/Geometry/QuantityVector.h @@ -15,11 +15,11 @@ namespace corsika::geometry { * with a phys::units::si::dimension. Arithmethic operators are defined that * propagate the dimensions by dimensional analysis. */ - + template <typename dim> class QuantityVector { protected: - // todo: check if we need to move "quantity" into namespace corsika::units + // todo: check if we need to move "quantity" into namespace corsika::units using Quantity = phys::units::quantity<dim, double>; //< the phys::units::quantity // corresponding to the dimension @@ -106,7 +106,7 @@ namespace corsika::geometry { auto operator==(QuantityVector<dim> const& p) const { return eVector == p.eVector; } }; -} // end namespace corsika +} // namespace corsika::geometry template <typename dim> auto& operator<<(std::ostream& os, corsika::geometry::QuantityVector<dim> qv) { diff --git a/Framework/Geometry/Trajectory.h b/Framework/Geometry/Trajectory.h index 5c8cc739..773fc242 100644 --- a/Framework/Geometry/Trajectory.h +++ b/Framework/Geometry/Trajectory.h @@ -11,7 +11,7 @@ namespace corsika::geometry { BaseTrajectory const& fTrajectory; public: - Trajectory(corsika::units::si::TimeType pTStart, corsika::units::si::TimeType pTEnd, + Trajectory(corsika::units::si::TimeType pTStart, corsika::units::si::TimeType pTEnd, BaseTrajectory const& pTrajectory) : fTStart(pTStart) , fTEnd(pTEnd) diff --git a/Framework/Geometry/testGeometry.cc b/Framework/Geometry/testGeometry.cc index ac444ef1..5419ad9a 100644 --- a/Framework/Geometry/testGeometry.cc +++ b/Framework/Geometry/testGeometry.cc @@ -16,7 +16,6 @@ using namespace corsika::units::si; double constexpr absMargin = 1.0e-8; - TEST_CASE("transformations between CoordinateSystems") { CoordinateSystem rootCS; @@ -26,8 +25,7 @@ TEST_CASE("transformations between CoordinateSystems") { QuantityVector<length_d> const coordinates{0_m, 0_m, 0_m}; Point p1(rootCS, coordinates); - QuantityVector<magnetic_flux_density_d> components{1. * tesla, 0. * tesla, - 0. * tesla}; + QuantityVector<magnetic_flux_density_d> components{1. * tesla, 0. * tesla, 0. * tesla}; Vector<magnetic_flux_density_d> v1(rootCS, components); REQUIRE((p1.GetCoordinates() - coordinates).norm().magnitude() == diff --git a/Framework/Particles/testParticles.cc b/Framework/Particles/testParticles.cc index 5e80d008..098780ca 100644 --- a/Framework/Particles/testParticles.cc +++ b/Framework/Particles/testParticles.cc @@ -38,10 +38,9 @@ TEST_CASE("ParticleProperties", "[Particles]") { SECTION("PDG") { REQUIRE(GetPDG(Code::PiPlus) == 211); - REQUIRE(GetPDG(Code::DPlus) == 411); - REQUIRE(GetPDG(Code::NuMu) == 14); - REQUIRE(GetPDG(Code::NuE) == 12); - REQUIRE(GetPDG(Code::MuMinus) == 13); + REQUIRE(GetPDG(Code::DPlus) == 411); + REQUIRE(GetPDG(Code::NuMu) == 14); + REQUIRE(GetPDG(Code::NuE) == 12); + REQUIRE(GetPDG(Code::MuMinus) == 13); } - } diff --git a/Framework/ProcessSequence/ProcessReturn.h b/Framework/ProcessSequence/ProcessReturn.h index 9813b025..9d43cdf0 100644 --- a/Framework/ProcessSequence/ProcessReturn.h +++ b/Framework/ProcessSequence/ProcessReturn.h @@ -6,13 +6,13 @@ namespace corsika::process { /** since in a process sequence many status updates can accumulate for a single particle, this enum should define only bit-flags - that can be accumulated easily with "|=" + that can be accumulated easily with "|=" */ - + enum class EProcessReturn { eOk = 1, eParticleAbsorbed = 2, }; -} +} // namespace corsika::process #endif diff --git a/Framework/ProcessSequence/ProcessSequence.h b/Framework/ProcessSequence/ProcessSequence.h index f11c45f5..bfb2c993 100644 --- a/Framework/ProcessSequence/ProcessSequence.h +++ b/Framework/ProcessSequence/ProcessSequence.h @@ -7,8 +7,8 @@ #include <iostream> #include <typeinfo> -namespace corsika::process { - +namespace corsika::process { + /** \class BaseProcess @@ -48,8 +48,8 @@ namespace corsika::process { template <typename Particle, typename Trajectory, typename Stack> inline EProcessReturn DoContinuous(Particle& p, Trajectory& t, Stack& s) const { EProcessReturn ret = EProcessReturn::eOk; - /*ret |=*/ A.DoContinuous(p, t, s); - /*ret |=*/ B.DoContinuous(p, t, s); + /*ret |=*/A.DoContinuous(p, t, s); + /*ret |=*/B.DoContinuous(p, t, s); return ret; } // add trajectory @@ -60,8 +60,10 @@ namespace corsika::process { template <typename Particle, typename Trajectory> inline Trajectory Transport(Particle& p, double& length) const { - A.Transport(p, length); // todo: maybe check (?) if there is more than one Transport process implemented?? - return B.Transport(p, length); // need to do this also to decide which Trajectory to return!!!! + A.Transport(p, length); // todo: maybe check (?) if there is more than one Transport + // process implemented?? + return B.Transport( + p, length); // need to do this also to decide which Trajectory to return!!!! } template <typename Particle, typename Stack> diff --git a/Framework/ProcessSequence/testProcessSequence.cc b/Framework/ProcessSequence/testProcessSequence.cc index efb0a0b2..eb8a8cbb 100644 --- a/Framework/ProcessSequence/testProcessSequence.cc +++ b/Framework/ProcessSequence/testProcessSequence.cc @@ -27,7 +27,7 @@ public: Process2() {} void Init() {} // cout << "Process2::Init" << endl; } template <typename D, typename T, typename S> - inline EProcessReturn DoContinuous(D& d, T& t, S& s) const { + inline EProcessReturn DoContinuous(D& d, T& t, S& s) const { for (int i = 0; i < 10; ++i) d.p[i] *= 0.7; return EProcessReturn::eOk; } @@ -38,7 +38,7 @@ public: Process3() {} void Init() {} // cout << "Process3::Init" << endl; } template <typename D, typename T, typename S> - inline EProcessReturn DoContinuous(D& d, T& t, S& s) const { + inline EProcessReturn DoContinuous(D& d, T& t, S& s) const { for (int i = 0; i < 10; ++i) d.p[i] += 0.933; return EProcessReturn::eOk; } @@ -49,10 +49,10 @@ public: Process4() {} void Init() {} // cout << "Process4::Init" << endl; } template <typename D, typename T, typename S> - inline EProcessReturn DoContinuous(D& d, T& t, S& s) const { + inline EProcessReturn DoContinuous(D& d, T& t, S& s) const { for (int i = 0; i < 10; ++i) d.p[i] /= 1.2; - return EProcessReturn::eOk; - } + return EProcessReturn::eOk; + } // inline double MinStepLength(D& d) { // void DoDiscrete(Particle& p, Stack& s) const { }; diff --git a/Framework/StackInterface/StackIterator.h b/Framework/StackInterface/StackIterator.h index a6ca8bed..2045f785 100644 --- a/Framework/StackInterface/StackIterator.h +++ b/Framework/StackInterface/StackIterator.h @@ -63,7 +63,7 @@ namespace corsika::stack { StackIteratorInterface(const StackIteratorInterface& mit) : fData(mit.fData) , fIndex(mit.fIndex) {} - + public: StackIteratorInterface& operator=(const StackIteratorInterface& mit) { fData = mit.fData; -- GitLab