From 2a41fb4081b921f6dc128487d698a52be9cfb567 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Wed, 21 Oct 2020 17:05:20 +0200 Subject: [PATCH] clang style --- Environment/ShowerAxis.h | 1 - Framework/Analytics/ClassTimer.h | 28 +++++++------ Framework/Analytics/FunctionTimer.h | 13 +++--- Framework/Analytics/testFunctionTimer.cc | 2 - Framework/ProcessSequence/BaseProcess.h | 8 ++-- .../ProcessSequence/BoundaryCrossingProcess.h | 3 +- Framework/ProcessSequence/ContinuousProcess.h | 3 +- Framework/ProcessSequence/DecayProcess.h | 3 +- .../ProcessSequence/InteractionProcess.h | 4 +- .../ProcessSequence/SecondariesProcess.h | 3 +- Framework/ProcessSequence/StackProcess.h | 3 +- Processes/AnalyticProcessors/ExecTime.h | 40 ++++++++++--------- Processes/AnalyticProcessors/ExecTimeImpl.h | 15 ++++--- Processes/AnalyticProcessors/ImplBoundary.h | 7 ++-- Processes/AnalyticProcessors/testExecTime.cc | 2 +- .../DummyBoundaryCrossingProcess.h | 3 +- .../DummyInteractionProcess.h | 3 +- .../DummySecondariesProcess.h | 3 +- Processes/ExampleProcessors/TestDummy.cc | 16 ++++---- .../LongitudinalProfile/LongitudinalProfile.h | 4 +- 20 files changed, 82 insertions(+), 82 deletions(-) diff --git a/Environment/ShowerAxis.h b/Environment/ShowerAxis.h index 6279c36b8..bfc6f1212 100644 --- a/Environment/ShowerAxis.h +++ b/Environment/ShowerAxis.h @@ -26,7 +26,6 @@ #include <boost/math/quadrature/gauss_kronrod.hpp> - namespace corsika::environment { /** diff --git a/Framework/Analytics/ClassTimer.h b/Framework/Analytics/ClassTimer.h index 5d99b3707..cb867a56f 100644 --- a/Framework/Analytics/ClassTimer.h +++ b/Framework/Analytics/ClassTimer.h @@ -20,23 +20,25 @@ namespace corsika::analytics { /// Measure the runtime of a single class function - /** + /** * @tparam TClassFunc Type of the member function pointer that should be wrapped * @tparam TFunc Actual function of the type defined in TClass */ template <typename TClassFunc, TClassFunc TFunc> class ClassTimer; - /// Measure the runtime of a single class function - /** Specialisation to capture exact information about the composition of the member function pointer used. - * - * This class wrapes a single function and allowes the measureing of its runtime if it called via the "call(...)" function - * + /** Specialisation to capture exact information about the composition of the member + * function pointer used. + * + * This class wrapes a single function and allowes the measureing of its runtime if it + * called via the "call(...)" function + * * @tparam TClass Class of the function that should be wrapped * @tparam TRet Return value of the wrapped function * @tparam TArgs Arguments passed to the wrapped function - * @tparam TFuncPtr Actual function of the type defined by TRet TClass::TFuncPtr(TArgs...) + * @tparam TFuncPtr Actual function of the type defined by TRet + * TClass::TFuncPtr(TArgs...) */ template <typename TClass, typename TRet, typename... TArgs, TRet (TClass::*TFuncPtr)(TArgs...)> @@ -54,11 +56,13 @@ namespace corsika::analytics { ClassTimer(TClass& obj) : vObj(obj) {} - /// Executes the wrapped function - /** This function executes and measure the runtime of the wrapped function with the highest precision available (high_resolution_clock). - * + /// Executes the wrapped function + /** This function executes and measure the runtime of the wrapped function with the + * highest precision available (high_resolution_clock). + * * @param args Arguments are perfect forwarded to the wrapped function. - * @return Returns the return value of the wrapped function. This value get copied during the process and therefore must be copie constructible! + * @return Returns the return value of the wrapped function. This value get copied + * during the process and therefore must be copie constructible! */ TRet call(TArgs... args) { vStart = TClock::now(); @@ -97,7 +101,6 @@ namespace corsika::analytics { inline TDuration getTime() const { return vDiff; } }; - /// Specialisation for const member functions template <typename TClass, typename TRet, typename... TArgs, TRet (TClass::*TFuncPtr)(TArgs...) const> @@ -125,7 +128,6 @@ namespace corsika::analytics { inline TDuration getTime() const { return vDiff; } }; - /// Specialisation for const member functions without return value template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...) const> class ClassTimer<void (TClass::*)(TArgs...) const, TFuncPtr> { diff --git a/Framework/Analytics/FunctionTimer.h b/Framework/Analytics/FunctionTimer.h index ce4585ff4..4dfe066b6 100644 --- a/Framework/Analytics/FunctionTimer.h +++ b/Framework/Analytics/FunctionTimer.h @@ -13,12 +13,12 @@ namespace corsika::analytics { /// Wraps and measures the runtime of a single function type object - /** - * - * @tparam TFunc funtion pointer that should be wrapped - * @tparam TClock type of the clock that should be used for measurements - * @tparam TDuration type of std::duration to measure the elapsed time - */ + /** + * + * @tparam TFunc funtion pointer that should be wrapped + * @tparam TClock type of the clock that should be used for measurements + * @tparam TDuration type of std::duration to measure the elapsed time + */ template <typename TFunc, typename TClock = std::chrono::high_resolution_clock, typename TDuration = std::chrono::microseconds> class FunctionTimer { @@ -29,7 +29,6 @@ namespace corsika::analytics { TFunc function_; public: - /// Constructs the wrapper with the given functionpointer FunctionTimer(TFunc f) : function_(f) {} diff --git a/Framework/Analytics/testFunctionTimer.cc b/Framework/Analytics/testFunctionTimer.cc index fcdb08d0b..f703d7cd4 100644 --- a/Framework/Analytics/testFunctionTimer.cc +++ b/Framework/Analytics/testFunctionTimer.cc @@ -23,7 +23,6 @@ int testFunc() { class TestClass { public: - int operator()() { std::this_thread::sleep_for(std::chrono::milliseconds(100)); return 31415; @@ -46,5 +45,4 @@ TEST_CASE("Analytics", "[Timer]") { std::cout << test() << std::endl; std::cout << test.getTime().count() << std::endl; } - } diff --git a/Framework/ProcessSequence/BaseProcess.h b/Framework/ProcessSequence/BaseProcess.h index d83930593..42934bbe9 100644 --- a/Framework/ProcessSequence/BaseProcess.h +++ b/Framework/ProcessSequence/BaseProcess.h @@ -22,7 +22,7 @@ namespace corsika::process { are of type BaseProcess<T> */ - class _BaseProcess{}; + class _BaseProcess {}; template <typename TDerived> class BaseProcess : _BaseProcess { @@ -36,9 +36,9 @@ namespace corsika::process { TDerived& GetRef() { return static_cast<TDerived&>(*this); } const TDerived& GetRef() const { return static_cast<const TDerived&>(*this); } - public: - // Base processor type for use in other template classes - using TProcessType = TDerived; + public: + // Base processor type for use in other template classes + using TProcessType = TDerived; }; } // namespace corsika::process diff --git a/Framework/ProcessSequence/BoundaryCrossingProcess.h b/Framework/ProcessSequence/BoundaryCrossingProcess.h index 3aeb9ab3a..6526648a8 100644 --- a/Framework/ProcessSequence/BoundaryCrossingProcess.h +++ b/Framework/ProcessSequence/BoundaryCrossingProcess.h @@ -19,8 +19,7 @@ namespace corsika::process { class BoundaryCrossingProcess : public BaseProcess<TDerived> { private: protected: - public: - + public: /** * This method is called when a particle crosses the boundary between the nodes * \p from and \p to. diff --git a/Framework/ProcessSequence/ContinuousProcess.h b/Framework/ProcessSequence/ContinuousProcess.h index 6c45a07a7..2c9e7bbc8 100644 --- a/Framework/ProcessSequence/ContinuousProcess.h +++ b/Framework/ProcessSequence/ContinuousProcess.h @@ -27,8 +27,7 @@ namespace corsika::process { class ContinuousProcess : public BaseProcess<TDerived> { private: protected: - public: - + public: // here starts the interface part // -> enforce TDerived to implement DoContinuous... template <typename TParticle, typename TTrack> diff --git a/Framework/ProcessSequence/DecayProcess.h b/Framework/ProcessSequence/DecayProcess.h index 24a9c455c..eb0cf982f 100644 --- a/Framework/ProcessSequence/DecayProcess.h +++ b/Framework/ProcessSequence/DecayProcess.h @@ -26,8 +26,7 @@ namespace corsika::process { template <typename TDerived> struct DecayProcess : BaseProcess<TDerived> { - public: - + public: using BaseProcess<TDerived>::GetRef; /// here starts the interface-definition part diff --git a/Framework/ProcessSequence/InteractionProcess.h b/Framework/ProcessSequence/InteractionProcess.h index ba12d0304..cfecccc81 100644 --- a/Framework/ProcessSequence/InteractionProcess.h +++ b/Framework/ProcessSequence/InteractionProcess.h @@ -26,11 +26,9 @@ namespace corsika::process { template <typename TDerived> class InteractionProcess : public BaseProcess<TDerived> { - public: - + public: using BaseProcess<TDerived>::GetRef; - /// here starts the interface-definition part // -> enforce TDerived to implement DoInteraction... template <typename TParticle> diff --git a/Framework/ProcessSequence/SecondariesProcess.h b/Framework/ProcessSequence/SecondariesProcess.h index 03b2ca82b..355a465c7 100644 --- a/Framework/ProcessSequence/SecondariesProcess.h +++ b/Framework/ProcessSequence/SecondariesProcess.h @@ -26,8 +26,7 @@ namespace corsika::process { template <typename TDerived> class SecondariesProcess : public BaseProcess<TDerived> { - public: - + public: /// here starts the interface-definition part // -> enforce TDerived to implement DoSecondaries... template <typename TSecondaries> diff --git a/Framework/ProcessSequence/StackProcess.h b/Framework/ProcessSequence/StackProcess.h index f5713ff67..64a5dff97 100644 --- a/Framework/ProcessSequence/StackProcess.h +++ b/Framework/ProcessSequence/StackProcess.h @@ -25,11 +25,10 @@ namespace corsika::process { */ template <typename TDerived> - class StackProcess : public BaseProcess<TDerived>{ + class StackProcess : public BaseProcess<TDerived> { private: protected: public: - StackProcess() = delete; StackProcess(const unsigned int nStep) : fNStep(nStep) {} diff --git a/Processes/AnalyticProcessors/ExecTime.h b/Processes/AnalyticProcessors/ExecTime.h index b03252918..e80513ccc 100644 --- a/Processes/AnalyticProcessors/ExecTime.h +++ b/Processes/AnalyticProcessors/ExecTime.h @@ -30,34 +30,36 @@ namespace corsika::process { namespace analytic_processors { /// Time measurement of individual processes - /** This class allowes to log the runtime spend in all default calls to the process. - * No distinction is made between individual function calls of the process, the runtime is accumulated - * and or avaraged without differentiation. - * - * The class is currently only implemented for BoundaryProcess, ContinuousProcess, DecayProcess, InteractionProcess and SecondariesProcess and captures only the according functions of the base class given as template parameter. Trying to access BoundaryProcess functions with a DecayProcess as template parameter will currently give long errormessages. - * - * Inherits all functionality of the class that should be measured, this includes functions like getters and setters + /** This class allowes to log the runtime spend in all default calls to the process. + * No distinction is made between individual function calls of the process, the + * runtime is accumulated and or avaraged without differentiation. + * + * The class is currently only implemented for BoundaryProcess, ContinuousProcess, + * DecayProcess, InteractionProcess and SecondariesProcess and captures only the + * according functions of the base class given as template parameter. Trying to access + * BoundaryProcess functions with a DecayProcess as template parameter will currently + * give long errormessages. + * + * Inherits all functionality of the class that should be measured, this includes + * functions like getters and setters */ template <typename T> class ExecTime : public Boundary<T, std::is_base_of<corsika::process::BoundaryCrossingProcess< typename T::TProcessType>, T>::value>, - public Continuous< - T, - std::is_base_of<corsika::process::ContinuousProcess<typename T::TProcessType>, - T>::value>, + public Continuous<T, std::is_base_of<corsika::process::ContinuousProcess< + typename T::TProcessType>, + T>::value>, public Decay< T, std::is_base_of<corsika::process::DecayProcess<typename T::TProcessType>, T>::value>, - public Interaction< - T, - std::is_base_of<corsika::process::InteractionProcess<typename T::TProcessType>, - T>::value>, - public Secondaries< - T, - std::is_base_of<corsika::process::SecondariesProcess<typename T::TProcessType>, - T>::value> { + public Interaction<T, std::is_base_of<corsika::process::InteractionProcess< + typename T::TProcessType>, + T>::value>, + public Secondaries<T, std::is_base_of<corsika::process::SecondariesProcess< + typename T::TProcessType>, + T>::value> { static_assert(std::is_base_of<corsika::process::_BaseProcess, T>::value, "error message"); diff --git a/Processes/AnalyticProcessors/ExecTimeImpl.h b/Processes/AnalyticProcessors/ExecTimeImpl.h index 31596b08d..1dffcf1fa 100644 --- a/Processes/AnalyticProcessors/ExecTimeImpl.h +++ b/Processes/AnalyticProcessors/ExecTimeImpl.h @@ -31,11 +31,13 @@ namespace corsika::process { namespace detail { - /// Process type independent functionality of the Process runtime measurement class ExecTime - /** Inherits all functionality of the class that should be sampled, this includes special functions for getters and setters - * - * - * + /// Process type independent functionality of the Process runtime measurement class + /// ExecTime + /** Inherits all functionality of the class that should be sampled, this includes + * special functions for getters and setters + * + * + * */ template <typename T> class ExecTimeImpl : public T { @@ -74,7 +76,8 @@ namespace corsika::process { this->update(timeDiv); } - /// Updates the floating mean and variance as well as the global min and max of the sampled runtimes + /// Updates the floating mean and variance as well as the global min and max of + /// the sampled runtimes void update(std::chrono::duration<double, std::micro> timeDif) { cumulatedTime_ += timeDif; diff --git a/Processes/AnalyticProcessors/ImplBoundary.h b/Processes/AnalyticProcessors/ImplBoundary.h index 1c825e340..681c7048f 100644 --- a/Processes/AnalyticProcessors/ImplBoundary.h +++ b/Processes/AnalyticProcessors/ImplBoundary.h @@ -36,11 +36,12 @@ namespace corsika::process { EProcessReturn DoBoundaryCrossing(Particle& p, VTNType const& from, VTNType const& to) { - // Use of the ClassTimer function -> see ClassTimer for documentation + // Use of the ClassTimer function -> see ClassTimer for documentation auto tc = corsika::analytics::ClassTimer< EProcessReturn (detail::ExecTimeImpl<T>::_T::*)(Particle&, VTNType const&, - VTNType const&), - &detail::ExecTimeImpl<T>::_T::template DoBoundaryCrossing<Particle, VTNType>>(*this); + VTNType const&), + &detail::ExecTimeImpl<T>::_T::template DoBoundaryCrossing<Particle, VTNType>>( + *this); EProcessReturn r = tc.call(p, from, to); this->update( diff --git a/Processes/AnalyticProcessors/testExecTime.cc b/Processes/AnalyticProcessors/testExecTime.cc index 52518ddfe..dbda248c8 100644 --- a/Processes/AnalyticProcessors/testExecTime.cc +++ b/Processes/AnalyticProcessors/testExecTime.cc @@ -18,9 +18,9 @@ #include <corsika/process/example_processors/DummyInteractionProcess.h> #include <corsika/process/example_processors/DummySecondariesProcess.h> +#include <cmath> #include <random> #include <vector> -#include <cmath> using namespace corsika::process; using namespace corsika::process::analytic_processors; diff --git a/Processes/ExampleProcessors/DummyBoundaryCrossingProcess.h b/Processes/ExampleProcessors/DummyBoundaryCrossingProcess.h index 936a65a51..235b86996 100644 --- a/Processes/ExampleProcessors/DummyBoundaryCrossingProcess.h +++ b/Processes/ExampleProcessors/DummyBoundaryCrossingProcess.h @@ -21,13 +21,12 @@ namespace corsika::process { : public BoundaryCrossingProcess<DummyBoundaryCrossingProcess<ISleep>> { private: protected: - public: template <typename Particle, typename VTNType> EProcessReturn DoBoundaryCrossing(Particle&, VTNType const&, VTNType const&) { std::this_thread::sleep_for(std::chrono::milliseconds(ISleep)); return EProcessReturn::eOk; - } + } }; } // namespace example_processors diff --git a/Processes/ExampleProcessors/DummyInteractionProcess.h b/Processes/ExampleProcessors/DummyInteractionProcess.h index 51e9bfbe8..3bda555d7 100644 --- a/Processes/ExampleProcessors/DummyInteractionProcess.h +++ b/Processes/ExampleProcessors/DummyInteractionProcess.h @@ -17,7 +17,8 @@ namespace corsika::process { namespace example_processors { template <int ISleep> - class DummyInteractionProcess : public InteractionProcess<DummyInteractionProcess<ISleep> > { + class DummyInteractionProcess + : public InteractionProcess<DummyInteractionProcess<ISleep> > { private: public: template <typename Particle> diff --git a/Processes/ExampleProcessors/DummySecondariesProcess.h b/Processes/ExampleProcessors/DummySecondariesProcess.h index 848e88411..30cdab881 100644 --- a/Processes/ExampleProcessors/DummySecondariesProcess.h +++ b/Processes/ExampleProcessors/DummySecondariesProcess.h @@ -17,7 +17,8 @@ namespace corsika::process { namespace example_processors { template <int ISleep> - class DummySecondariesProcess : public SecondariesProcess<DummySecondariesProcess<ISleep>> { + class DummySecondariesProcess + : public SecondariesProcess<DummySecondariesProcess<ISleep>> { private: public: template <typename TSecondaries> diff --git a/Processes/ExampleProcessors/TestDummy.cc b/Processes/ExampleProcessors/TestDummy.cc index 1cbddbb6c..0781310d0 100644 --- a/Processes/ExampleProcessors/TestDummy.cc +++ b/Processes/ExampleProcessors/TestDummy.cc @@ -48,13 +48,14 @@ TEST_CASE("Dummy Processes") { Approx(1000).margin(1)); start = std::chrono::steady_clock::now(); - REQUIRE(dc.MaxStepLength(nullptr, nullptr) == units::si::meter * std::numeric_limits<double>::infinity()); + REQUIRE(dc.MaxStepLength(nullptr, nullptr) == + units::si::meter * std::numeric_limits<double>::infinity()); end = std::chrono::steady_clock::now(); REQUIRE(std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() == Approx(1000).margin(1)); } - SECTION("Decay") { + SECTION("Decay") { auto start = std::chrono::steady_clock::now(); REQUIRE(dd.DoDecay(tmp) == EProcessReturn::eOk); auto end = std::chrono::steady_clock::now(); @@ -62,13 +63,14 @@ TEST_CASE("Dummy Processes") { Approx(1000).margin(1)); start = std::chrono::steady_clock::now(); - REQUIRE(dd.GetLifetime(tmp) == units::si::second * std::numeric_limits<double>::infinity()); + REQUIRE(dd.GetLifetime(tmp) == + units::si::second * std::numeric_limits<double>::infinity()); end = std::chrono::steady_clock::now(); REQUIRE(std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() == Approx(1000).margin(1)); } - SECTION("Interaction") { + SECTION("Interaction") { auto start = std::chrono::steady_clock::now(); REQUIRE(di.DoInteraction(tmp) == EProcessReturn::eOk); auto end = std::chrono::steady_clock::now(); @@ -76,18 +78,18 @@ TEST_CASE("Dummy Processes") { Approx(1000).margin(1)); start = std::chrono::steady_clock::now(); - REQUIRE(di.GetInteractionLength(tmp) == (units::si::gram / 1_cm / 1_cm) * std::numeric_limits<double>::infinity()); + REQUIRE(di.GetInteractionLength(tmp) == + (units::si::gram / 1_cm / 1_cm) * std::numeric_limits<double>::infinity()); end = std::chrono::steady_clock::now(); REQUIRE(std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() == Approx(1000).margin(1)); } - SECTION("Secondaries") { + SECTION("Secondaries") { auto start = std::chrono::steady_clock::now(); REQUIRE(dse.DoSecondaries(tmp) == EProcessReturn::eOk); auto end = std::chrono::steady_clock::now(); REQUIRE(std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() == Approx(1000).margin(1)); - } } diff --git a/Processes/LongitudinalProfile/LongitudinalProfile.h b/Processes/LongitudinalProfile/LongitudinalProfile.h index a9a1cfa0d..c4d2bf0c6 100644 --- a/Processes/LongitudinalProfile/LongitudinalProfile.h +++ b/Processes/LongitudinalProfile/LongitudinalProfile.h @@ -23,9 +23,9 @@ namespace corsika::process::longitudinal_profile { /** * \class LongitudinalProfile * - * is a ContinuousProcess, which is constructed from an environment::ShowerAxis + * is a ContinuousProcess, which is constructed from an environment::ShowerAxis * object, and a dX in units of g/cm2 - * (corsika::units::si::GrammageType). + * (corsika::units::si::GrammageType). * * LongitudinalProfile does then convert each single Track of the * simulation into a projected grammage range and counts for -- GitLab