diff --git a/corsika/detail/framework/analytics/ClassTimer.inl b/corsika/detail/framework/analytics/ClassTimer.inl index dca6fb5ce128761146936929895d3ce8a65ddb00..8f2c6945a62271b2a51cb079944c518cbd3ad8a9 100644 --- a/corsika/detail/framework/analytics/ClassTimer.inl +++ b/corsika/detail/framework/analytics/ClassTimer.inl @@ -23,12 +23,13 @@ namespace corsika { template <typename TClass, typename TRet, typename... TArgs, TRet (TClass::*TFuncPtr)(TArgs...), typename TTimer> - ClassTimer<TRet (TClass::*)(TArgs...), TFuncPtr, TTimer>::ClassTimer(TClass& obj) + inline ClassTimer<TRet (TClass::*)(TArgs...), TFuncPtr, TTimer>::ClassTimer(TClass& obj) : ClassTimerImpl<TClass, TTimer>(obj) {} template <typename TClass, typename TRet, typename... TArgs, TRet (TClass::*TFuncPtr)(TArgs...), typename TTimer> - TRet ClassTimer<TRet (TClass::*)(TArgs...), TFuncPtr, TTimer>::call(TArgs... args) { + inline TRet ClassTimer<TRet (TClass::*)(TArgs...), TFuncPtr, TTimer>::call( + TArgs... args) { this->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now(); auto tmp = (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...); this->timeDiff_ = std::chrono::duration_cast< @@ -41,12 +42,13 @@ namespace corsika { template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...), typename TTimer> - ClassTimer<void (TClass::*)(TArgs...), TFuncPtr, TTimer>::ClassTimer(TClass& obj) + inline ClassTimer<void (TClass::*)(TArgs...), TFuncPtr, TTimer>::ClassTimer(TClass& obj) : ClassTimerImpl<TClass, TTimer>(obj) {} template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...), typename TTimer> - void ClassTimer<void (TClass::*)(TArgs...), TFuncPtr, TTimer>::call(TArgs... args) { + inline void ClassTimer<void (TClass::*)(TArgs...), TFuncPtr, TTimer>::call( + TArgs... args) { this->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now(); (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...); this->timeDiff_ = std::chrono::duration_cast< @@ -59,12 +61,13 @@ namespace corsika { template <typename TClass, typename TRet, typename... TArgs, TRet (TClass::*TFuncPtr)(TArgs...) const, typename TTimer> - ClassTimer<TRet (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::ClassTimer(TClass& obj) + inline ClassTimer<TRet (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::ClassTimer( + TClass& obj) : ClassTimerImpl<TClass, TTimer>(obj) {} template <typename TClass, typename TRet, typename... TArgs, TRet (TClass::*TFuncPtr)(TArgs...) const, typename TTimer> - TRet ClassTimer<TRet (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::call( + inline TRet ClassTimer<TRet (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::call( TArgs... args) { this->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now(); auto tmp = (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...); @@ -77,12 +80,13 @@ namespace corsika { /// Specialisation 3 template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...) const, typename TTimer> - ClassTimer<void (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::ClassTimer(TClass& obj) + inline ClassTimer<void (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::ClassTimer( + TClass& obj) : ClassTimerImpl<TClass, TTimer>(obj) {} template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...) const, typename TTimer> - void ClassTimer<void (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::call( + inline void ClassTimer<void (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::call( TArgs... args) { this->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now(); (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...); @@ -92,4 +96,4 @@ namespace corsika { return; } -} // namespace corsika \ No newline at end of file +} // namespace corsika diff --git a/corsika/detail/framework/analytics/FunctionTimer.inl b/corsika/detail/framework/analytics/FunctionTimer.inl index e00bebc338db81acf099763e01adb7cc3a3d3bf5..911fb683ce86ff5aa6fe38a8bc223ce327fab48e 100644 --- a/corsika/detail/framework/analytics/FunctionTimer.inl +++ b/corsika/detail/framework/analytics/FunctionTimer.inl @@ -13,12 +13,12 @@ namespace corsika { template <typename TFunc, typename TTime> - FunctionTimer<TFunc, TTime>::FunctionTimer(TFunc f) + inline FunctionTimer<TFunc, TTime>::FunctionTimer(TFunc f) : function_(f) {} template <typename TFunc, typename TTime> template <typename... TArgs> - auto FunctionTimer<TFunc, TTime>::operator()(TArgs&&... args) + inline auto FunctionTimer<TFunc, TTime>::operator()(TArgs&&... args) -> std::invoke_result_t<TFunc, TArgs...> { this->startTimer(); auto tmp = function_(std::forward<TArgs>(args)...); diff --git a/corsika/detail/framework/core/Cascade.inl b/corsika/detail/framework/core/Cascade.inl index 0e9161259de194737b19c46504645b79233c5b3d..5f218b8780c063abfbbcbcd8339641ff5846f3f9 100644 --- a/corsika/detail/framework/core/Cascade.inl +++ b/corsika/detail/framework/core/Cascade.inl @@ -18,9 +18,6 @@ #include <corsika/framework/stack/SecondaryView.hpp> #include <corsika/media/Environment.hpp> -#include <corsika/setup/SetupStack.hpp> -#include <corsika/setup/SetupTrajectory.hpp> - #include <cassert> #include <cmath> #include <iostream> @@ -31,7 +28,7 @@ namespace corsika { template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> - void Cascade<TTracking, TProcessList, TStack, TStackView>::run() { + inline void Cascade<TTracking, TProcessList, TStack, TStackView>::run() { setNodes(); // put each particle on stack in correct environment volume while (!stack_.isEmpty()) { @@ -58,7 +55,7 @@ namespace corsika { template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> - void Cascade<TTracking, TProcessList, TStack, TStackView>::forceInteraction() { + inline void Cascade<TTracking, TProcessList, TStack, TStackView>::forceInteraction() { CORSIKA_LOG_TRACE("forced interaction!"); setNodes(); auto vParticle = stack_.getNextParticle(); @@ -70,7 +67,8 @@ namespace corsika { template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> - void Cascade<TTracking, TProcessList, TStack, TStackView>::step(Particle& vParticle) { + inline void Cascade<TTracking, TProcessList, TStack, TStackView>::step( + Particle& vParticle) { // determine combined total interaction length (inverse) InverseGrammageType const total_inv_lambda = @@ -139,7 +137,6 @@ namespace corsika { distance_interact / 1_m, continuous_max_dist / 1_m); // here the particle is actually moved along the trajectory to new position: - // std::visit(setup::ParticleUpdate<particle_type>{vParticle}, step); step.setLength(min_distance); vParticle.setPosition(step.getPosition(1)); // assumption: tracking does not change absolute momentum: @@ -240,7 +237,7 @@ namespace corsika { template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> - ProcessReturn Cascade<TTracking, TProcessList, TStack, TStackView>::decay( + inline ProcessReturn Cascade<TTracking, TProcessList, TStack, TStackView>::decay( TStackView& view) { CORSIKA_LOG_DEBUG("decay"); InverseTimeType const actual_decay_time = sequence_.getInverseLifetime(view.parent()); @@ -258,7 +255,7 @@ namespace corsika { template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> - ProcessReturn Cascade<TTracking, TProcessList, TStack, TStackView>::interaction( + inline ProcessReturn Cascade<TTracking, TProcessList, TStack, TStackView>::interaction( TStackView& view) { CORSIKA_LOG_DEBUG("collide"); @@ -278,7 +275,7 @@ namespace corsika { template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> - void Cascade<TTracking, TProcessList, TStack, TStackView>::setNodes() { + inline void Cascade<TTracking, TProcessList, TStack, TStackView>::setNodes() { std::for_each(stack_.begin(), stack_.end(), [&](auto& p) { auto const* numericalNode = environment_.getUniverse()->getContainingNode(p.getPosition()); @@ -288,7 +285,7 @@ namespace corsika { template <typename TTracking, typename TProcessList, typename TStack, typename TStackView> - void Cascade<TTracking, TProcessList, TStack, TStackView>::setEventType( + inline void Cascade<TTracking, TProcessList, TStack, TStackView>::setEventType( TStackView& view, [[maybe_unused]] history::EventType eventType) { if constexpr (TStackView::has_event) { for (auto&& sec : view) { sec.getEvent()->setEventType(eventType); } diff --git a/corsika/detail/framework/core/ParticleProperties.inl b/corsika/detail/framework/core/ParticleProperties.inl index b478b1e17f3f12f850482c6c652c8c884f104656..7d0aa253b838adf8a06d5f0cdfbb71022d896695 100644 --- a/corsika/detail/framework/core/ParticleProperties.inl +++ b/corsika/detail/framework/core/ParticleProperties.inl @@ -13,72 +13,74 @@ namespace corsika { - HEPEnergyType constexpr get_energy_threshold(Code const p) { + inline HEPEnergyType constexpr get_energy_threshold(Code const p) { return particle::detail::thresholds[static_cast<CodeIntType>(p)]; } - void constexpr set_energy_threshold(Code const p, HEPEnergyType const val) { + inline void constexpr set_energy_threshold(Code const p, HEPEnergyType const val) { particle::detail::thresholds[static_cast<CodeIntType>(p)] = val; } - HEPMassType constexpr get_mass(Code const p) { + inline HEPMassType constexpr get_mass(Code const p) { if (p == Code::Nucleus) throw std::runtime_error("Cannot GetMass() of particle::Nucleus -> unspecified"); return particle::detail::masses[static_cast<CodeIntType>(p)]; } - PDGCode constexpr get_PDG(Code const p) { + inline PDGCode constexpr get_PDG(Code const p) { return particle::detail::pdg_codes[static_cast<CodeIntType>(p)]; } - int16_t constexpr get_charge_number(Code const code) { + inline int16_t constexpr get_charge_number(Code const code) { if (code == Code::Nucleus) throw std::runtime_error("charge of particle::Nucleus undefined"); return particle::detail::electric_charges[static_cast<CodeIntType>(code)]; } - ElectricChargeType constexpr get_charge(Code const code) { + inline ElectricChargeType constexpr get_charge(Code const code) { return get_charge_number(code) * constants::e; } - std::string_view constexpr get_name(Code const code) { + inline std::string_view constexpr get_name(Code const code) { return particle::detail::names[static_cast<CodeIntType>(code)]; } - TimeType constexpr get_lifetime(Code const p) { + inline TimeType constexpr get_lifetime(Code const p) { return particle::detail::lifetime[static_cast<CodeIntType>(p)] * second; } - bool constexpr is_hadron(Code const p) { + inline bool constexpr is_hadron(Code const p) { return particle::detail::isHadron[static_cast<CodeIntType>(p)]; } - bool constexpr is_em(Code c) { + inline bool constexpr is_em(Code c) { return c == Code::Electron || c == Code::Positron || c == Code::Gamma; } - bool constexpr is_muon(Code c) { return c == Code::MuPlus || c == Code::MuMinus; } + inline bool constexpr is_muon(Code c) { + return c == Code::MuPlus || c == Code::MuMinus; + } - bool constexpr is_neutrino(Code c) { + inline bool constexpr is_neutrino(Code c) { return c == Code::NuE || c == Code::NuMu || c == Code::NuTau || c == Code::NuEBar || c == Code::NuMuBar || c == Code::NuTauBar; } - int constexpr get_nucleus_A(Code const code) { + inline int constexpr get_nucleus_A(Code const code) { if (code == Code::Nucleus) { throw std::runtime_error("get_nucleus_A(Code::Nucleus) is impossible!"); } return particle::detail::nucleusA[static_cast<CodeIntType>(code)]; } - int constexpr get_nucleus_Z(Code const code) { + inline int constexpr get_nucleus_Z(Code const code) { if (code == Code::Nucleus) { throw std::runtime_error("get_nucleus_Z(Code::Nucleus) is impossible!"); } return particle::detail::nucleusZ[static_cast<CodeIntType>(code)]; } - bool constexpr is_nucleus(Code const code) { + inline bool constexpr is_nucleus(Code const code) { return (code == Code::Nucleus) || (get_nucleus_A(code) != 0); } @@ -102,7 +104,7 @@ namespace corsika { return get_mass(Code::Proton) * Z + (A - Z) * get_mass(Code::Neutron); } - std::initializer_list<Code> constexpr get_all_particles() { + inline std::initializer_list<Code> constexpr get_all_particles() { return particle::detail::all_particles; } diff --git a/corsika/detail/framework/geometry/BaseVector.inl b/corsika/detail/framework/geometry/BaseVector.inl index 50ec4b03b249ec3bfbe89f41c25fd4f33d04dc3f..486a62d2650e47b7163a2d4092169e42a820e442 100644 --- a/corsika/detail/framework/geometry/BaseVector.inl +++ b/corsika/detail/framework/geometry/BaseVector.inl @@ -14,17 +14,18 @@ namespace corsika { template <typename TDimension> - CoordinateSystemPtr BaseVector<TDimension>::getCoordinateSystem() const { + inline CoordinateSystemPtr BaseVector<TDimension>::getCoordinateSystem() const { return cs_; } template <typename TDimension> - QuantityVector<TDimension> const& BaseVector<TDimension>::getQuantityVector() const { + inline QuantityVector<TDimension> const& BaseVector<TDimension>::getQuantityVector() + const { return quantityVector_; } template <typename TDimension> - QuantityVector<TDimension>& BaseVector<TDimension>::getQuantityVector() { + inline QuantityVector<TDimension>& BaseVector<TDimension>::getQuantityVector() { return quantityVector_; } diff --git a/corsika/detail/framework/geometry/CoordinateSystem.inl b/corsika/detail/framework/geometry/CoordinateSystem.inl index efcf716d3320487334713dd79bdf77ddd67f0a24..faa759aa769f9cd3382d06bca45377bb5488c3ee 100644 --- a/corsika/detail/framework/geometry/CoordinateSystem.inl +++ b/corsika/detail/framework/geometry/CoordinateSystem.inl @@ -19,9 +19,11 @@ namespace corsika { - CoordinateSystemPtr CoordinateSystem::getReferenceCS() const { return referenceCS_; } + inline CoordinateSystemPtr CoordinateSystem::getReferenceCS() const { + return referenceCS_; + } - EigenTransform const& CoordinateSystem::getTransform() const { return transf_; } + inline EigenTransform const& CoordinateSystem::getTransform() const { return transf_; } inline bool CoordinateSystem::operator==(CoordinateSystem const& cs) const { return referenceCS_ == cs.referenceCS_ && transf_.matrix() == cs.transf_.matrix(); diff --git a/corsika/detail/framework/geometry/FourVector.inl b/corsika/detail/framework/geometry/FourVector.inl index 6c0a039e5466ef46d2d3014b7e91a6f0621c922c..5d871430dad5390aaa7b80d8fb83d7e16c165f03 100644 --- a/corsika/detail/framework/geometry/FourVector.inl +++ b/corsika/detail/framework/geometry/FourVector.inl @@ -15,47 +15,47 @@ namespace corsika { template <typename TTimeType, typename TSpaceVecType> - TTimeType FourVector<TTimeType, TSpaceVecType>::getTimeLikeComponent() const { + inline TTimeType FourVector<TTimeType, TSpaceVecType>::getTimeLikeComponent() const { return timeLike_; } template <typename TTimeType, typename TSpaceVecType> - TSpaceVecType& FourVector<TTimeType, TSpaceVecType>::getSpaceLikeComponents() { + inline TSpaceVecType& FourVector<TTimeType, TSpaceVecType>::getSpaceLikeComponents() { return spaceLike_; } template <typename TTimeType, typename TSpaceVecType> - TSpaceVecType const& FourVector<TTimeType, TSpaceVecType>::getSpaceLikeComponents() - const { + inline TSpaceVecType const& + FourVector<TTimeType, TSpaceVecType>::getSpaceLikeComponents() const { return spaceLike_; } template <typename TTimeType, typename TSpaceVecType> - typename FourVector<TTimeType, TSpaceVecType>::norm_square_type + inline typename FourVector<TTimeType, TSpaceVecType>::norm_square_type FourVector<TTimeType, TSpaceVecType>::getNormSqr() const { return getTimeSquared() - spaceLike_.getSquaredNorm(); } template <typename TTimeType, typename TSpaceVecType> - typename FourVector<TTimeType, TSpaceVecType>::norm_type + inline typename FourVector<TTimeType, TSpaceVecType>::norm_type FourVector<TTimeType, TSpaceVecType>::getNorm() const { return sqrt(abs(getNormSqr())); } template <typename TTimeType, typename TSpaceVecType> - bool FourVector<TTimeType, TSpaceVecType>::isTimelike() const { + inline bool FourVector<TTimeType, TSpaceVecType>::isTimelike() const { return getTimeSquared() < spaceLike_.getSquaredNorm(); } template <typename TTimeType, typename TSpaceVecType> - bool FourVector<TTimeType, TSpaceVecType>::isSpacelike() const { + inline bool FourVector<TTimeType, TSpaceVecType>::isSpacelike() const { return getTimeSquared() > spaceLike_.getSquaredNorm(); } template <typename TTimeType, typename TSpaceVecType> - FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::operator+=( - FourVector const& b) { + inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: + operator+=(FourVector const& b) { timeLike_ += b.timeLike_; spaceLike_ += b.spaceLike_; @@ -63,38 +63,38 @@ namespace corsika { } template <typename TTimeType, typename TSpaceVecType> - FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::operator-=( - FourVector const& b) { + inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: + operator-=(FourVector const& b) { timeLike_ -= b.timeLike_; spaceLike_ -= b.spaceLike_; return *this; } template <typename TTimeType, typename TSpaceVecType> - FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::operator*=( - double const b) { + inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: + operator*=(double const b) { timeLike_ *= b; spaceLike_ *= b; return *this; } template <typename TTimeType, typename TSpaceVecType> - FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::operator/=( - double const b) { + inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: + operator/=(double const b) { timeLike_ /= b; spaceLike_.getComponents() /= b; return *this; } template <typename TTimeType, typename TSpaceVecType> - FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::operator/( - double const b) { + inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>:: + operator/(double const b) { *this /= b; return *this; } template <typename TTimeType, typename TSpaceVecType> - typename FourVector<TTimeType, TSpaceVecType>::norm_type + inline typename FourVector<TTimeType, TSpaceVecType>::norm_type FourVector<TTimeType, TSpaceVecType>::operator*(FourVector const& b) { if constexpr (std::is_same<time_type, decltype(std::declval<space_type>() / meter * second)>::value) @@ -104,7 +104,7 @@ namespace corsika { } template <typename TTimeType, typename TSpaceVecType> - typename FourVector<TTimeType, TSpaceVecType>::norm_square_type + inline typename FourVector<TTimeType, TSpaceVecType>::norm_square_type FourVector<TTimeType, TSpaceVecType>::getTimeSquared() const { if constexpr (std::is_same<time_type, decltype(std::declval<space_type>() / meter * second)>::value) diff --git a/corsika/detail/framework/geometry/Helix.inl b/corsika/detail/framework/geometry/Helix.inl index daf0c310fcd14762c3942d20221be35130431f06..03c0fd85decf43765f75dd390b60c71a62ae58ac 100644 --- a/corsika/detail/framework/geometry/Helix.inl +++ b/corsika/detail/framework/geometry/Helix.inl @@ -15,23 +15,23 @@ namespace corsika { - LengthType Helix::getRadius() const { return radius_; } + inline LengthType Helix::getRadius() const { return radius_; } - Point Helix::getPosition(TimeType const t) const { + inline Point Helix::getPosition(TimeType const t) const { return r0_ + vPar_ * t + (vPerp_ * (std::cos(omegaC_ * t) - 1) + uPerp_ * std::sin(omegaC_ * t)) / omegaC_; } - Point Helix::getPositionFromArclength(LengthType const l) const { + inline Point Helix::getPositionFromArclength(LengthType const l) const { return getPosition(getTimeFromArclength(l)); } - LengthType Helix::getArcLength(TimeType const t1, TimeType const t2) const { + inline LengthType Helix::getArcLength(TimeType const t1, TimeType const t2) const { return (vPar_ + vPerp_).getNorm() * (t2 - t1); } - TimeType Helix::getTimeFromArclength(LengthType const l) const { + inline TimeType Helix::getTimeFromArclength(LengthType const l) const { return l / (vPar_ + vPerp_).getNorm(); } diff --git a/corsika/detail/framework/geometry/Plane.inl b/corsika/detail/framework/geometry/Plane.inl index d32167cf138254a3325b4fe9503dd4884bdbde79..54e60157c0b6ab4194365b4bdddfa6311fb67bac 100644 --- a/corsika/detail/framework/geometry/Plane.inl +++ b/corsika/detail/framework/geometry/Plane.inl @@ -26,7 +26,7 @@ namespace corsika { inline Point const& Plane::getCenter() const { return center_; } - inline Plane::DimLessVec const& Plane::getNormal() const { return normal_; } + inline DirectionVector const& Plane::getNormal() const { return normal_; } inline std::string Plane::asString() const { std::ostringstream txt; diff --git a/corsika/detail/framework/geometry/Point.inl b/corsika/detail/framework/geometry/Point.inl index 45c6900f58ff152400e9cc44c7419aee8efbcf01..c5c0a98a64491d3c6c752b647d60cdb1c2090e73 100644 --- a/corsika/detail/framework/geometry/Point.inl +++ b/corsika/detail/framework/geometry/Point.inl @@ -15,11 +15,11 @@ namespace corsika { - QuantityVector<length_d> const& Point::getCoordinates() const { + inline QuantityVector<length_d> const& Point::getCoordinates() const { return BaseVector<length_d>::getQuantityVector(); } - QuantityVector<length_d>& Point::getCoordinates() { + inline QuantityVector<length_d>& Point::getCoordinates() { return BaseVector<length_d>::getQuantityVector(); } @@ -60,7 +60,8 @@ namespace corsika { } /// this always returns a QuantityVector as triple - QuantityVector<length_d> Point::getCoordinates(CoordinateSystemPtr const& pCS) const { + inline QuantityVector<length_d> Point::getCoordinates( + CoordinateSystemPtr const& pCS) const { CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem(); if (*pCS == *cs) { return BaseVector<length_d>::getQuantityVector(); @@ -72,12 +73,12 @@ namespace corsika { } /// this always returns a QuantityVector as triple - QuantityVector<length_d>& Point::getCoordinates(CoordinateSystemPtr const& pCS) { + inline QuantityVector<length_d>& Point::getCoordinates(CoordinateSystemPtr const& pCS) { if (*pCS != *BaseVector<length_d>::getCoordinateSystem()) { rebase(pCS); } return BaseVector<length_d>::getQuantityVector(); } - void Point::rebase(CoordinateSystemPtr const& pCS) { + inline void Point::rebase(CoordinateSystemPtr const& pCS) { BaseVector<length_d>::setQuantityVector(QuantityVector<length_d>( get_transformation(*BaseVector<length_d>::getCoordinateSystem().get(), *pCS.get()) * @@ -85,12 +86,12 @@ namespace corsika { BaseVector<length_d>::setCoordinateSystem(pCS); } - Point Point::operator+(Vector<length_d> const& pVec) const { + inline Point Point::operator+(Vector<length_d> const& pVec) const { CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem(); return Point(cs, getCoordinates() + pVec.getComponents(cs)); } - Vector<length_d> Point::operator-(Point const& pB) const { + inline Vector<length_d> Point::operator-(Point const& pB) const { CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem(); return Vector<length_d>(cs, getCoordinates() - pB.getCoordinates(cs)); } diff --git a/corsika/detail/framework/geometry/Vector.inl b/corsika/detail/framework/geometry/Vector.inl index ff968693f8542ef2f95629c4d7ca7050b406a549..352eb8b3095ddec2221c1af41dc8f71b499746e2 100644 --- a/corsika/detail/framework/geometry/Vector.inl +++ b/corsika/detail/framework/geometry/Vector.inl @@ -88,7 +88,7 @@ namespace corsika { } template <typename TDimension> - void Vector<TDimension>::rebase(CoordinateSystemPtr const& pCS) { + inline void Vector<TDimension>::rebase(CoordinateSystemPtr const& pCS) { BaseVector<TDimension>::setQuantityVector(QuantityVector<TDimension>( get_transformation(*BaseVector<TDimension>::getCoordinateSystem().get(), *pCS.get()) @@ -110,7 +110,7 @@ namespace corsika { template <typename TDimension> template <typename TDimension2> - auto Vector<TDimension>::getParallelProjectionOnto( + inline auto Vector<TDimension>::getParallelProjectionOnto( Vector<TDimension2> const& pVec, CoordinateSystemPtr const& pCS) const { auto const ourCompVec = getComponents(pCS); auto const otherCompVec = pVec.getComponents(pCS); @@ -123,34 +123,36 @@ namespace corsika { template <typename TDimension> template <typename TDimension2> - auto Vector<TDimension>::getParallelProjectionOnto( + inline auto Vector<TDimension>::getParallelProjectionOnto( Vector<TDimension2> const& pVec) const { return getParallelProjectionOnto<TDimension2>( pVec, BaseVector<TDimension>::getCoordinateSystem()); } template <typename TDimension> - Vector<TDimension> Vector<TDimension>::operator+(Vector<TDimension> const& pVec) const { + inline Vector<TDimension> Vector<TDimension>::operator+( + Vector<TDimension> const& pVec) const { CoordinateSystemPtr const& cs = BaseVector<TDimension>::getCoordinateSystem(); auto const components = getComponents(cs) + pVec.getComponents(cs); return Vector<TDimension>(BaseVector<TDimension>::getCoordinateSystem(), components); } template <typename TDimension> - Vector<TDimension> Vector<TDimension>::operator-(Vector<TDimension> const& pVec) const { + inline Vector<TDimension> Vector<TDimension>::operator-( + Vector<TDimension> const& pVec) const { CoordinateSystemPtr const& cs = BaseVector<TDimension>::getCoordinateSystem(); return Vector<TDimension>(cs, getComponents() - pVec.getComponents(cs)); } template <typename TDimension> - auto& Vector<TDimension>::operator*=(double const p) { + inline auto& Vector<TDimension>::operator*=(double const p) { BaseVector<TDimension>::getQuantityVector() *= p; return *this; } template <typename TDimension> template <typename TScalarDim> - auto Vector<TDimension>::operator*( + inline auto Vector<TDimension>::operator*( phys::units::quantity<TScalarDim, double> const p) const { using ProdDim = phys::units::detail::product_d<TDimension, TScalarDim>; @@ -160,51 +162,51 @@ namespace corsika { template <typename TDimension> template <typename TScalarDim> - auto Vector<TDimension>::operator/( + inline auto Vector<TDimension>::operator/( phys::units::quantity<TScalarDim, double> const p) const { return (*this) * (1 / p); } template <typename TDimension> - auto Vector<TDimension>::operator*(double const p) const { + inline auto Vector<TDimension>::operator*(double const p) const { return Vector<TDimension>(BaseVector<TDimension>::getCoordinateSystem(), BaseVector<TDimension>::getQuantityVector() * p); } template <typename TDimension> - auto Vector<TDimension>::operator/(double const p) const { + inline auto Vector<TDimension>::operator/(double const p) const { return Vector<TDimension>(BaseVector<TDimension>::getCoordinateSystem(), BaseVector<TDimension>::getQuantityVector() / p); } template <typename TDimension> - auto& Vector<TDimension>::operator+=(Vector<TDimension> const& pVec) { + inline auto& Vector<TDimension>::operator+=(Vector<TDimension> const& pVec) { BaseVector<TDimension>::getQuantityVector() += pVec.getComponents(BaseVector<TDimension>::getCoordinateSystem()); return *this; } template <typename TDimension> - auto& Vector<TDimension>::operator-=(Vector<TDimension> const& pVec) { + inline auto& Vector<TDimension>::operator-=(Vector<TDimension> const& pVec) { BaseVector<TDimension>::getQuantityVector() -= pVec.getComponents(BaseVector<TDimension>::getCoordinateSystem()); return *this; } template <typename TDimension> - auto& Vector<TDimension>::operator-() const { + inline auto& Vector<TDimension>::operator-() const { return Vector<TDimension>(BaseVector<TDimension>::getCoordinateSystem(), -BaseVector<TDimension>::getQuantityVector()); } template <typename TDimension> - auto Vector<TDimension>::normalized() const { + inline auto Vector<TDimension>::normalized() const { return (*this) * (1 / getNorm()); } template <typename TDimension> template <typename TDimension2> - auto Vector<TDimension>::cross(Vector<TDimension2> const& pV) const { + inline auto Vector<TDimension>::cross(Vector<TDimension2> const& pV) const { auto const c1 = getComponents().eigenVector_; auto const c2 = pV.getComponents(BaseVector<TDimension>::getCoordinateSystem()).eigenVector_; @@ -216,7 +218,7 @@ namespace corsika { template <typename TDimension> template <typename TDimension2> - auto Vector<TDimension>::dot(Vector<TDimension2> const& pV) const { + inline auto Vector<TDimension>::dot(Vector<TDimension2> const& pV) const { auto const c1 = getComponents().eigenVector_; auto const c2 = pV.getComponents(BaseVector<TDimension>::getCoordinateSystem()).eigenVector_; diff --git a/corsika/detail/framework/process/InteractionCounter.inl b/corsika/detail/framework/process/InteractionCounter.inl index 34c93ce43120bdd25f1c5824e6b0a561e3a7f06e..d3572bf98ef63faf37f50d2a58cfdf4b610a4179 100644 --- a/corsika/detail/framework/process/InteractionCounter.inl +++ b/corsika/detail/framework/process/InteractionCounter.inl @@ -13,7 +13,7 @@ namespace corsika { template <class TCountedProcess> - InteractionCounter<TCountedProcess>::InteractionCounter(TCountedProcess& process) + inline InteractionCounter<TCountedProcess>::InteractionCounter(TCountedProcess& process) : process_(process) {} template <class TCountedProcess> diff --git a/corsika/detail/framework/process/InteractionHistogram.inl b/corsika/detail/framework/process/InteractionHistogram.inl index e6cfae869ea9ba6a9c8adc36d4e817a872822609..efeb29c0027e98d52d49722334b9ebb51bf1460a 100644 --- a/corsika/detail/framework/process/InteractionHistogram.inl +++ b/corsika/detail/framework/process/InteractionHistogram.inl @@ -16,13 +16,13 @@ namespace corsika { - InteractionHistogram::InteractionHistogram() + inline InteractionHistogram::InteractionHistogram() : inthist_cms_{detail::hist_factory(num_bins_cms, lower_edge_cms, upper_edge_cms)} , inthist_lab_{detail::hist_factory(num_bins_lab, lower_edge_lab, upper_edge_lab)} { } - void InteractionHistogram::fill(Code projectile_id, HEPEnergyType lab_energy, - HEPEnergyType mass_target, int A, int Z) { + inline void InteractionHistogram::fill(Code projectile_id, HEPEnergyType lab_energy, + HEPEnergyType mass_target, int A, int Z) { auto constexpr inv_eV = 1 / 1_eV; if (projectile_id == Code::Nucleus) { auto const sqrtS = sqrt(A * A * (constants::nucleonMass * constants::nucleonMass) + @@ -42,7 +42,7 @@ namespace corsika { } } - InteractionHistogram& InteractionHistogram::operator+=( + inline InteractionHistogram& InteractionHistogram::operator+=( InteractionHistogram const& other) { inthist_lab_ += other.inthist_lab_; inthist_cms_ += other.inthist_cms_; @@ -50,7 +50,8 @@ namespace corsika { return *this; } - InteractionHistogram InteractionHistogram::operator+(InteractionHistogram other) const { + inline InteractionHistogram InteractionHistogram::operator+( + InteractionHistogram other) const { other.inthist_lab_ += inthist_lab_; other.inthist_cms_ += inthist_cms_; diff --git a/corsika/detail/framework/process/ProcessSequence.inl b/corsika/detail/framework/process/ProcessSequence.inl index 19056ad6c696c8c74268742e7f1447bdca0be856..7a0d6409feadf182a1e8402c581d118009a75b2f 100644 --- a/corsika/detail/framework/process/ProcessSequence.inl +++ b/corsika/detail/framework/process/ProcessSequence.inl @@ -29,7 +29,7 @@ namespace corsika { template <typename TProcess1, typename TProcess2, int IndexStart, int IndexProcess1, int IndexProcess2> template <typename TParticle> - ProcessReturn ProcessSequence< + inline ProcessReturn ProcessSequence< TProcess1, TProcess2, IndexStart, IndexProcess1, IndexProcess2>::doBoundaryCrossing(TParticle& particle, typename TParticle::node_type const& from, @@ -54,7 +54,7 @@ namespace corsika { template <typename TProcess1, typename TProcess2, int IndexStart, int IndexProcess1, int IndexProcess2> template <typename TParticle, typename TTrack> - ProcessReturn + inline ProcessReturn ProcessSequence<TProcess1, TProcess2, IndexStart, IndexProcess1, IndexProcess2>:: doContinuous(TParticle& particle, TTrack& vT, [[maybe_unused]] ContinuousProcessIndex const limitId) { @@ -81,8 +81,8 @@ namespace corsika { template <typename TProcess1, typename TProcess2, int IndexStart, int IndexProcess1, int IndexProcess2> template <typename TSecondaries> - void ProcessSequence<TProcess1, TProcess2, IndexStart, IndexProcess1, - IndexProcess2>::doSecondaries(TSecondaries& vS) { + inline void ProcessSequence<TProcess1, TProcess2, IndexStart, IndexProcess1, + IndexProcess2>::doSecondaries(TSecondaries& vS) { if constexpr (std::is_base_of_v<SecondariesProcess<process1_type>, process1_type> || t1ProcSeq) { A_.doSecondaries(vS); @@ -95,8 +95,8 @@ namespace corsika { template <typename TProcess1, typename TProcess2, int IndexStart, int IndexProcess1, int IndexProcess2> - bool ProcessSequence<TProcess1, TProcess2, IndexStart, IndexProcess1, - IndexProcess2>::checkStep() { + inline bool ProcessSequence<TProcess1, TProcess2, IndexStart, IndexProcess1, + IndexProcess2>::checkStep() { bool ret = false; if constexpr (std::is_base_of_v<StackProcess<process1_type>, process1_type> || (t1ProcSeq && !t1SwitchProcSeq)) { @@ -112,8 +112,8 @@ namespace corsika { template <typename TProcess1, typename TProcess2, int IndexStart, int IndexProcess1, int IndexProcess2> template <typename TStack> - void ProcessSequence<TProcess1, TProcess2, IndexStart, IndexProcess1, - IndexProcess2>::doStack(TStack& stack) { + inline void ProcessSequence<TProcess1, TProcess2, IndexStart, IndexProcess1, + IndexProcess2>::doStack(TStack& stack) { if constexpr (std::is_base_of_v<StackProcess<process1_type>, process1_type> || (t1ProcSeq && !t1SwitchProcSeq)) { if (A_.checkStep()) { A_.doStack(stack); } @@ -124,20 +124,10 @@ namespace corsika { } } - /** - * Calculate the maximum allowed length of the next tracking step, based on all - * ContinuousProcess-es - * - * The maximum allowed step length is the minimum of the allowed track lenght over all - * ContinuousProcess-es in the ProcessSequence. - * - * \return: ContinuousProcessStepLength which contains the step length itself in - * LengthType, and a unique identifier of the related ContinuousProcess. - **/ template <typename TProcess1, typename TProcess2, int IndexStart, int IndexProcess1, int IndexProcess2> template <typename TParticle, typename TTrack> - ContinuousProcessStepLength + inline ContinuousProcessStepLength ProcessSequence<TProcess1, TProcess2, IndexStart, IndexProcess1, IndexProcess2>::getMaxStepLength(TParticle& particle, TTrack& vTrack) { // if no other process in the sequence implements it @@ -167,7 +157,7 @@ namespace corsika { template <typename TProcess1, typename TProcess2, int IndexStart, int IndexProcess1, int IndexProcess2> template <typename TParticle> - InverseGrammageType + inline InverseGrammageType ProcessSequence<TProcess1, TProcess2, IndexStart, IndexProcess1, IndexProcess2>::getInverseInteractionLength(TParticle&& particle) { diff --git a/corsika/detail/framework/process/SwitchProcessSequence.inl b/corsika/detail/framework/process/SwitchProcessSequence.inl index 2eadc8782bf164ee7074c97db4f35d37db2abbd9..c4f8ede12f859e7c063f91cabbcc01af8b99cbc4 100644 --- a/corsika/detail/framework/process/SwitchProcessSequence.inl +++ b/corsika/detail/framework/process/SwitchProcessSequence.inl @@ -30,7 +30,7 @@ namespace corsika { template <typename TProcess1, typename TProcess2, typename TSelect, int IndexStart, int IndexProcess1, int IndexProcess2> template <typename TParticle, typename TVTNType> - ProcessReturn + inline ProcessReturn SwitchProcessSequence<TProcess1, TProcess2, TSelect, IndexStart, IndexProcess1, IndexProcess2>::doBoundaryCrossing(TParticle& particle, TVTNType const& from, diff --git a/corsika/detail/framework/stack/CombinedStack.inl b/corsika/detail/framework/stack/CombinedStack.inl index 0c95ad15e8a8c57eabf1615e07b60c4bb54f3393..1cdc7abd9e23a5139939b78bffa6b9ce1c7ed7e4 100644 --- a/corsika/detail/framework/stack/CombinedStack.inl +++ b/corsika/detail/framework/stack/CombinedStack.inl @@ -59,7 +59,6 @@ namespace corsika { pi_b_type::setParticleData(static_cast<pi_b_type&>(p), vB); } - ///@} template <template <typename> class TParticleInterfaceA, template <typename> class TParticleInterfaceB, typename TStackIterator> inline std::string CombinedParticleInterface<TParticleInterfaceA, TParticleInterfaceB, diff --git a/corsika/detail/framework/stack/SecondaryView.inl b/corsika/detail/framework/stack/SecondaryView.inl index 33160aa08b9b56f09d0929a3abc75a156c818309..4b27a50871893a6763ccae1f268fd6a1968ac882 100644 --- a/corsika/detail/framework/stack/SecondaryView.inl +++ b/corsika/detail/framework/stack/SecondaryView.inl @@ -15,17 +15,11 @@ #include <vector> namespace corsika { - /* - template <typename TStackDataType, template <typename> typename TParticleInterface, - template <typename T1, template <class> class T2> class MSecondaryProducer> - SecondaryView< TStackDataType,TParticleInterface, MSecondaryProducer>:: - - */ template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> template <typename... Args> - typename SecondaryView<TStackDataType, TParticleInterface, - MSecondaryProducer>::stack_view_iterator + inline typename SecondaryView<TStackDataType, TParticleInterface, + MSecondaryProducer>::stack_view_iterator SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::addSecondary( const Args... v) { CORSIKA_LOG_TRACE("SecondaryView::addSecondary(Args&&)"); @@ -35,8 +29,8 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> - typename SecondaryView<TStackDataType, TParticleInterface, - MSecondaryProducer>::stack_view_iterator + inline typename SecondaryView<TStackDataType, TParticleInterface, + MSecondaryProducer>::stack_view_iterator SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::begin() { unsigned int i = 0; for (; i < getSize(); ++i) { @@ -48,8 +42,8 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> - typename SecondaryView<TStackDataType, TParticleInterface, - MSecondaryProducer>::const_stack_view_iterator + inline typename SecondaryView<TStackDataType, TParticleInterface, + MSecondaryProducer>::const_stack_view_iterator SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::begin() const { unsigned int i = 0; for (; i < getSize(); ++i) { @@ -61,8 +55,8 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> - typename SecondaryView<TStackDataType, TParticleInterface, - MSecondaryProducer>::const_stack_view_iterator + inline typename SecondaryView<TStackDataType, TParticleInterface, + MSecondaryProducer>::const_stack_view_iterator SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::cbegin() const { unsigned int i = 0; for (; i < getSize(); ++i) { @@ -74,8 +68,8 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> - typename SecondaryView<TStackDataType, TParticleInterface, - MSecondaryProducer>::stack_view_iterator + inline typename SecondaryView<TStackDataType, TParticleInterface, + MSecondaryProducer>::stack_view_iterator SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::last() { unsigned int i = 0; for (; i < getSize(); ++i) { @@ -86,8 +80,8 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> - typename SecondaryView<TStackDataType, TParticleInterface, - MSecondaryProducer>::const_stack_view_iterator + inline typename SecondaryView<TStackDataType, TParticleInterface, + MSecondaryProducer>::const_stack_view_iterator SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::last() const { unsigned int i = 0; for (; i < getSize(); ++i) { @@ -98,8 +92,8 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> - typename SecondaryView<TStackDataType, TParticleInterface, - MSecondaryProducer>::const_stack_view_iterator + inline typename SecondaryView<TStackDataType, TParticleInterface, + MSecondaryProducer>::const_stack_view_iterator SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::clast() const { unsigned int i = 0; for (; i < getSize(); ++i) { @@ -111,7 +105,7 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> - void SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::swap( + inline void SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::swap( stack_view_iterator a, stack_view_iterator b) { CORSIKA_LOG_TRACE("View::swap"); @@ -121,7 +115,7 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> - void SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::copy( + inline void SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::copy( stack_view_iterator a, stack_view_iterator b) { CORSIKA_LOG_TRACE("View::copy"); @@ -131,7 +125,7 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> - void SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::copy( + inline void SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::copy( const_stack_view_iterator a, stack_view_iterator b) { CORSIKA_LOG_TRACE("View::copy"); @@ -141,8 +135,8 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> - void SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::erase( - stack_view_iterator p) { + inline void SecondaryView<TStackDataType, TParticleInterface, + MSecondaryProducer>::erase(stack_view_iterator p) { CORSIKA_LOG_TRACE("SecondaryView::Delete"); if (isEmpty()) { /*error*/ @@ -157,8 +151,8 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> - bool SecondaryView<TStackDataType, TParticleInterface, - MSecondaryProducer>::purgeLastIfDeleted() { + inline bool SecondaryView<TStackDataType, TParticleInterface, + MSecondaryProducer>::purgeLastIfDeleted() { CORSIKA_LOG_TRACE("SecondaryView::purgeLastIfDeleted"); if (!isErased(getSize() - 1)) return false; // the last particle is not marked for deletion. Do nothing. @@ -170,7 +164,8 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> - void SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::purge() { + inline void + SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::purge() { unsigned int iStack = 0; unsigned int size = getSize(); while (iStack < size) { @@ -187,8 +182,8 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> - std::string SecondaryView<TStackDataType, TParticleInterface, - MSecondaryProducer>::asString() const { + inline std::string SecondaryView<TStackDataType, TParticleInterface, + MSecondaryProducer>::asString() const { std::string str(fmt::format("size {}\n", getSize())); // we make our own begin/end since we want ALL entries std::string new_line = " "; @@ -206,8 +201,8 @@ namespace corsika { template <typename TStackDataType, template <typename> typename TParticleInterface, template <typename T1, template <class> class T2> class MSecondaryProducer> template <typename... Args> - typename SecondaryView<TStackDataType, TParticleInterface, - MSecondaryProducer>::stack_view_iterator + inline typename SecondaryView<TStackDataType, TParticleInterface, + MSecondaryProducer>::stack_view_iterator SecondaryView<TStackDataType, TParticleInterface, MSecondaryProducer>::addSecondary( stack_view_iterator& proj, const Args... v) { CORSIKA_LOG_TRACE("SecondaryView::addSecondary(stack_view_iterator&, Args&&)"); diff --git a/corsika/detail/framework/stack/Stack.inl b/corsika/detail/framework/stack/Stack.inl index 30c7c746095e89323e01bbfdae6b8735b99806a4..4569a23a8ab49c16af4aa6a29a78759bcfc807a1 100644 --- a/corsika/detail/framework/stack/Stack.inl +++ b/corsika/detail/framework/stack/Stack.inl @@ -21,15 +21,15 @@ namespace corsika { template <typename StackData, template <typename> typename MParticleInterface> template <typename... TArgs> - void Stack<StackData, MParticleInterface>::clear(TArgs... args) { + inline void Stack<StackData, MParticleInterface>::clear(TArgs... args) { data_.clear(args...); deleted_ = std::vector<bool>(data_.getSize(), false); nDeleted_ = 0; } template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::stack_iterator_type - Stack<StackData, MParticleInterface>::begin() { + typename Stack<StackData, MParticleInterface>::stack_iterator_type inline Stack< + StackData, MParticleInterface>::begin() { unsigned int i = 0; for (; i < getSize(); ++i) { if (!deleted_[i]) break; @@ -38,14 +38,14 @@ namespace corsika { } template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::stack_iterator_type - Stack<StackData, MParticleInterface>::end() { + typename Stack<StackData, MParticleInterface>::stack_iterator_type inline Stack< + StackData, MParticleInterface>::end() { return stack_iterator_type(*this, getSize()); } template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::stack_iterator_type - Stack<StackData, MParticleInterface>::last() { + typename Stack<StackData, MParticleInterface>::stack_iterator_type inline Stack< + StackData, MParticleInterface>::last() { unsigned int i = 0; for (; i < getSize(); ++i) { if (!deleted_[getSize() - 1 - i]) break; @@ -54,8 +54,8 @@ namespace corsika { } template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::const_stack_iterator_type - Stack<StackData, MParticleInterface>::begin() const { + typename Stack<StackData, MParticleInterface>::const_stack_iterator_type inline Stack< + StackData, MParticleInterface>::begin() const { unsigned int i = 0; for (; i < getSize(); ++i) { if (!deleted_[i]) break; @@ -64,8 +64,8 @@ namespace corsika { } template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::const_stack_iterator_type - Stack<StackData, MParticleInterface>::end() const { + typename Stack<StackData, MParticleInterface>::const_stack_iterator_type inline Stack< + StackData, MParticleInterface>::end() const { return const_stack_iterator_type(*this, getSize()); } @@ -80,8 +80,8 @@ namespace corsika { } template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::const_stack_iterator_type - Stack<StackData, MParticleInterface>::cbegin() const { + typename Stack<StackData, MParticleInterface>::const_stack_iterator_type inline Stack< + StackData, MParticleInterface>::cbegin() const { unsigned int i = 0; for (; i < getSize(); ++i) { if (!deleted_[i]) break; @@ -90,14 +90,14 @@ namespace corsika { } template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::const_stack_iterator_type - Stack<StackData, MParticleInterface>::cend() const { + typename Stack<StackData, MParticleInterface>::const_stack_iterator_type inline Stack< + StackData, MParticleInterface>::cend() const { return const_stack_iterator_type(*this, getSize()); } template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::const_stack_iterator_type - Stack<StackData, MParticleInterface>::clast() const { + typename Stack<StackData, MParticleInterface>::const_stack_iterator_type inline Stack< + StackData, MParticleInterface>::clast() const { unsigned int i = 0; for (; i < getSize(); ++i) { if (!deleted_[getSize() - 1 - i]) break; @@ -107,41 +107,40 @@ namespace corsika { } template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::stack_iterator_type - Stack<StackData, MParticleInterface>::at(unsigned int i) { + typename Stack<StackData, MParticleInterface>::stack_iterator_type inline Stack< + StackData, MParticleInterface>::at(unsigned int i) { return stack_iterator_type(*this, i); } template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::const_stack_iterator_type - Stack<StackData, MParticleInterface>::at(unsigned int i) const { + typename Stack<StackData, MParticleInterface>::const_stack_iterator_type inline Stack< + StackData, MParticleInterface>::at(unsigned int i) const { return const_stack_iterator_type(*this, i); } template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::stack_iterator_type - Stack<StackData, MParticleInterface>::first() { + typename Stack<StackData, MParticleInterface>::stack_iterator_type inline Stack< + StackData, MParticleInterface>::first() { return stack_iterator_type{*this, 0}; } template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::const_stack_iterator_type - Stack<StackData, MParticleInterface>::cfirst() const { + typename Stack<StackData, MParticleInterface>::const_stack_iterator_type inline Stack< + StackData, MParticleInterface>::cfirst() const { return const_stack_iterator_type{*this, 0}; } - /// @} template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::stack_iterator_type - Stack<StackData, MParticleInterface>::getNextParticle() { + typename Stack<StackData, MParticleInterface>::stack_iterator_type inline Stack< + StackData, MParticleInterface>::getNextParticle() { while (purgeLastIfDeleted()) {} return last(); } template <typename StackData, template <typename> typename MParticleInterface> template <typename... TArgs> - typename Stack<StackData, MParticleInterface>::stack_iterator_type - Stack<StackData, MParticleInterface>::addParticle(const TArgs... v) { + typename Stack<StackData, MParticleInterface>::stack_iterator_type inline Stack< + StackData, MParticleInterface>::addParticle(const TArgs... v) { CORSIKA_LOG_TRACE("Stack::AddParticle"); data_.incrementSize(); deleted_.push_back(false); @@ -149,22 +148,22 @@ namespace corsika { } template <typename StackData, template <typename> typename MParticleInterface> - void Stack<StackData, MParticleInterface>::swap(stack_iterator_type a, - stack_iterator_type b) { + inline void Stack<StackData, MParticleInterface>::swap(stack_iterator_type a, + stack_iterator_type b) { CORSIKA_LOG_TRACE("Stack::Swap"); swap(a.getIndex(), b.getIndex()); } template <typename StackData, template <typename> typename MParticleInterface> - void Stack<StackData, MParticleInterface>::copy(stack_iterator_type a, - stack_iterator_type b) { + inline void Stack<StackData, MParticleInterface>::copy(stack_iterator_type a, + stack_iterator_type b) { CORSIKA_LOG_TRACE("Stack::Copy"); copy(a.getIndex(), b.getIndex()); } template <typename StackData, template <typename> typename MParticleInterface> - void Stack<StackData, MParticleInterface>::copy(const_stack_iterator_type a, - stack_iterator_type b) { + inline void Stack<StackData, MParticleInterface>::copy(const_stack_iterator_type a, + stack_iterator_type b) { CORSIKA_LOG_TRACE("Stack::Copy"); data_.copy(a.getIndex(), b.getIndex()); if (deleted_[b.getIndex()] && !deleted_[a.getIndex()]) nDeleted_--; @@ -173,7 +172,7 @@ namespace corsika { } template <typename StackData, template <typename> typename MParticleInterface> - void Stack<StackData, MParticleInterface>::erase(stack_iterator_type p) { + inline void Stack<StackData, MParticleInterface>::erase(stack_iterator_type p) { CORSIKA_LOG_TRACE("Stack::Delete"); if (this->isEmpty()) { /*error*/ throw std::runtime_error("Stack, cannot delete entry since size is zero"); @@ -183,54 +182,52 @@ namespace corsika { } this->erase(p.getIndex()); } - /** + + /* * delete this particle */ - template <typename StackData, template <typename> typename MParticleInterface> - void Stack<StackData, MParticleInterface>::erase(particle_interface_type p) { + inline void Stack<StackData, MParticleInterface>::erase(particle_interface_type p) { this->erase(p.getIterator()); } - /** + /* * check if there are no further non-deleted particles on stack */ template <typename StackData, template <typename> typename MParticleInterface> - bool Stack<StackData, MParticleInterface>::isEmpty() { + inline bool Stack<StackData, MParticleInterface>::isEmpty() { return getEntries() == 0; } - /** + /* * check if this particle was already deleted */ - template <typename StackData, template <typename> typename MParticleInterface> - bool Stack<StackData, MParticleInterface>::isErased( + inline bool Stack<StackData, MParticleInterface>::isErased( const stack_iterator_type& p) const { return isErased(p.getIndex()); } template <typename StackData, template <typename> typename MParticleInterface> - bool Stack<StackData, MParticleInterface>::isErased( + inline bool Stack<StackData, MParticleInterface>::isErased( const const_stack_iterator_type& p) const { return isErased(p.getIndex()); } template <typename StackData, template <typename> typename MParticleInterface> - bool Stack<StackData, MParticleInterface>::isErased( + inline bool Stack<StackData, MParticleInterface>::isErased( const particle_interface_type& p) const { return isErased(p.getIterator()); } - /** + /* * Function to ultimatively remove the last entry from the stack, * if it was marked as deleted before. If this is not the case, * the function will just return false and do nothing. */ - template <typename StackData, template <typename> typename MParticleInterface> - bool Stack<StackData, MParticleInterface>::purgeLastIfDeleted() { + inline bool Stack<StackData, MParticleInterface>::purgeLastIfDeleted() { if (!deleted_.back()) return false; // the last particle is not marked for deletion. Do nothing. @@ -241,7 +238,7 @@ namespace corsika { return true; } - /** + /* * Function to ultimatively remove all entries from the stack * marked as deleted. * @@ -251,7 +248,7 @@ namespace corsika { */ template <typename StackData, template <typename> typename MParticleInterface> - void Stack<StackData, MParticleInterface>::purge() { + inline void Stack<StackData, MParticleInterface>::purge() { unsigned int iStackFront = 0; unsigned int iStackBack = getSize() - 1; @@ -269,12 +266,12 @@ namespace corsika { } template <typename StackData, template <typename> typename MParticleInterface> - unsigned int Stack<StackData, MParticleInterface>::getSize() const { + inline unsigned int Stack<StackData, MParticleInterface>::getSize() const { return data_.getSize(); } template <typename StackData, template <typename> typename MParticleInterface> - std::string Stack<StackData, MParticleInterface>::asString() const { + inline std::string Stack<StackData, MParticleInterface>::asString() const { std::string str(fmt::format("size {}, entries {}, deleted {} \n", getSize(), getEntries(), getErased())); // we make our own begin/end since we want ALL entries @@ -290,7 +287,7 @@ namespace corsika { template <typename StackData, template <typename> typename MParticleInterface> template <typename... TArgs> - typename Stack<StackData, MParticleInterface>::stack_iterator_type + inline typename Stack<StackData, MParticleInterface>::stack_iterator_type Stack<StackData, MParticleInterface>::addSecondary(stack_iterator_type& parent, const TArgs... v) { CORSIKA_LOG_TRACE("Stack::AddSecondary"); @@ -300,16 +297,16 @@ namespace corsika { } template <typename StackData, template <typename> typename MParticleInterface> - void Stack<StackData, MParticleInterface>::swap(unsigned int const a, - unsigned int const b) { + inline void Stack<StackData, MParticleInterface>::swap(unsigned int const a, + unsigned int const b) { CORSIKA_LOG_TRACE("Stack::Swap(unsigned int)"); data_.swap(a, b); std::swap(deleted_[a], deleted_[b]); } template <typename StackData, template <typename> typename MParticleInterface> - void Stack<StackData, MParticleInterface>::copy(unsigned int const a, - unsigned int const b) { + inline void Stack<StackData, MParticleInterface>::copy(unsigned int const a, + unsigned int const b) { CORSIKA_LOG_TRACE("Stack::Copy"); data_.copy(a, b); if (deleted_[b] && !deleted_[a]) nDeleted_--; @@ -318,24 +315,23 @@ namespace corsika { } template <typename StackData, template <typename> typename MParticleInterface> - bool Stack<StackData, MParticleInterface>::isErased(unsigned int const i) const { + inline bool Stack<StackData, MParticleInterface>::isErased(unsigned int const i) const { if (i >= deleted_.size()) return false; return deleted_.at(i); } template <typename StackData, template <typename> typename MParticleInterface> - void Stack<StackData, MParticleInterface>::erase(unsigned int const i) { + inline void Stack<StackData, MParticleInterface>::erase(unsigned int const i) { deleted_[i] = true; nDeleted_++; } - /** + /* * will remove from storage the element i. This is a helper * function for SecondaryView. */ - template <typename StackData, template <typename> typename MParticleInterface> - void Stack<StackData, MParticleInterface>::purge(unsigned int i) { + inline void Stack<StackData, MParticleInterface>::purge(unsigned int i) { unsigned int iStackBack = getSize() - 1; // search for last non-deleted particle on stack while (deleted_[iStackBack]) { iStackBack--; } @@ -347,33 +343,21 @@ namespace corsika { deleted_.pop_back(); } - /** - * Function to perform eventual transformation from - * StackIterator::getIndex() to index in data stored in - * StackData data_. By default (and in almost all cases) this - * should just be identiy. See class SecondaryView for an alternative implementation. - */ - template <typename StackData, template <typename> typename MParticleInterface> - unsigned int Stack<StackData, MParticleInterface>::getIndexFromIterator( + inline unsigned int Stack<StackData, MParticleInterface>::getIndexFromIterator( const unsigned int vI) const { // this is too much: CORSIKA_LOG_TRACE("Stack::getIndexFromIterator({})={}", vI, vI); return vI; } - /** - * @name Return reference to StackData object data_ for data access - * @{ - */ - template <typename StackData, template <typename> typename MParticleInterface> - typename Stack<StackData, MParticleInterface>::value_type& + inline typename Stack<StackData, MParticleInterface>::value_type& Stack<StackData, MParticleInterface>::getStackData() { return data_; } template <typename StackData, template <typename> typename MParticleInterface> - const typename Stack<StackData, MParticleInterface>::value_type& + inline const typename Stack<StackData, MParticleInterface>::value_type& Stack<StackData, MParticleInterface>::getStackData() const { return data_; } diff --git a/corsika/detail/framework/utility/COMBoost.inl b/corsika/detail/framework/utility/COMBoost.inl index 54d1162c327b8ba2f8be9dea485238a0c343ce46..9b05bef0e5e5d0193d74b637416a0056b520c535 100644 --- a/corsika/detail/framework/utility/COMBoost.inl +++ b/corsika/detail/framework/utility/COMBoost.inl @@ -108,6 +108,6 @@ namespace corsika { inverseBoost_ << coshEta, -sinhEta, -sinhEta, coshEta; } - CoordinateSystemPtr COMBoost::getRotatedCS() const { return rotatedCS_; } + inline CoordinateSystemPtr COMBoost::getRotatedCS() const { return rotatedCS_; } } // namespace corsika diff --git a/corsika/detail/framework/utility/CorsikaData.inl b/corsika/detail/framework/utility/CorsikaData.inl index 80a1b77caa404185bc618183590d48c67a730dbb..e2ea1e99bc3742783020312f725419fbd0d63846 100644 --- a/corsika/detail/framework/utility/CorsikaData.inl +++ b/corsika/detail/framework/utility/CorsikaData.inl @@ -11,7 +11,7 @@ #include <stdexcept> #include <string> -std::string corsika::corsika_data(std::string const& key) { +inline std::string corsika::corsika_data(std::string const& key) { if (auto const* p = std::getenv("CORSIKA_DATA"); p != nullptr) { auto const path = std::string(p) + "/" + key; return path; diff --git a/corsika/detail/framework/utility/CorsikaFenvOSX.inl b/corsika/detail/framework/utility/CorsikaFenvOSX.inl index b57a6973da4b892e8da1f2f0ce68a6a3c2486292..e1f7cc480b88bc0d29b52dc9feb04ca7eaf9fe75 100644 --- a/corsika/detail/framework/utility/CorsikaFenvOSX.inl +++ b/corsika/detail/framework/utility/CorsikaFenvOSX.inl @@ -28,7 +28,7 @@ extern "C" { -int feenableexcept(int excepts) noexcept { +inline int feenableexcept(int excepts) noexcept { static fenv_t fenv; int new_excepts = excepts & FE_ALL_EXCEPT; // previous masks @@ -44,7 +44,7 @@ int feenableexcept(int excepts) noexcept { return fesetenv(&fenv) ? -1 : old_excepts; } -int fedisableexcept(int excepts) noexcept { +inline int fedisableexcept(int excepts) noexcept { static fenv_t fenv; int new_excepts = excepts & FE_ALL_EXCEPT; // all previous masks diff --git a/corsika/detail/media/BaseExponential.inl b/corsika/detail/media/BaseExponential.inl index 35b506610419a1a7ce5574b3ab16e7192505d785..a40981bef9feb867c082e0d43ddb791352d8768b 100644 --- a/corsika/detail/media/BaseExponential.inl +++ b/corsika/detail/media/BaseExponential.inl @@ -15,12 +15,12 @@ namespace corsika { template <typename TDerived> - auto const& BaseExponential<TDerived>::getImplementation() const { + inline auto const& BaseExponential<TDerived>::getImplementation() const { return *static_cast<TDerived const*>(this); } template <typename TDerived> - GrammageType BaseExponential<TDerived>::getIntegratedGrammage( + inline GrammageType BaseExponential<TDerived>::getIntegratedGrammage( setup::Trajectory const& traj, LengthType vL, DirectionVector const& axis) const { if (vL == LengthType::zero()) { return GrammageType::zero(); } @@ -35,7 +35,7 @@ namespace corsika { } template <typename TDerived> - LengthType BaseExponential<TDerived>::getArclengthFromGrammage( + inline LengthType BaseExponential<TDerived>::getArclengthFromGrammage( setup::Trajectory const& traj, GrammageType grammage, DirectionVector const& axis) const { auto const uDotA = traj.getDirection(0).dot(axis).magnitude(); @@ -55,8 +55,9 @@ namespace corsika { } template <typename TDerived> - BaseExponential<TDerived>::BaseExponential(Point const& point, MassDensityType rho0, - LengthType lambda) + inline BaseExponential<TDerived>::BaseExponential(Point const& point, + MassDensityType rho0, + LengthType lambda) : rho0_(rho0) , lambda_(lambda) , invLambda_(1 / lambda) diff --git a/corsika/detail/media/Environment.inl b/corsika/detail/media/Environment.inl index 792182a9efee3d45fc07176524d6fdb017ed0dca..40ab05db95ad200fbdf98bfcd4e9585fcf8ceabc 100644 --- a/corsika/detail/media/Environment.inl +++ b/corsika/detail/media/Environment.inl @@ -13,33 +13,34 @@ namespace corsika { template <typename IEnvironmentModel> - Environment<IEnvironmentModel>::Environment() + inline Environment<IEnvironmentModel>::Environment() : coordinateSystem_{get_root_CoordinateSystem()} , universe_(std::make_unique<BaseNodeType>( std::make_unique<Universe>(coordinateSystem_))) {} template <typename IEnvironmentModel> - typename Environment<IEnvironmentModel>::BaseNodeType::VTNUPtr& + inline typename Environment<IEnvironmentModel>::BaseNodeType::VTNUPtr& Environment<IEnvironmentModel>::getUniverse() { return universe_; } template <typename IEnvironmentModel> - typename Environment<IEnvironmentModel>::BaseNodeType::VTNUPtr const& + inline typename Environment<IEnvironmentModel>::BaseNodeType::VTNUPtr const& Environment<IEnvironmentModel>::getUniverse() const { return universe_; } template <typename IEnvironmentModel> - CoordinateSystemPtr const& Environment<IEnvironmentModel>::getCoordinateSystem() const { + inline CoordinateSystemPtr const& Environment<IEnvironmentModel>::getCoordinateSystem() + const { return coordinateSystem_; } // factory method for creation of VolumeTreeNodes template <typename IEnvironmentModel> template <class TVolumeType, typename... TVolumeArgs> - std::unique_ptr<VolumeTreeNode<IEnvironmentModel> > - Environment<IEnvironmentModel>::createNode(TVolumeArgs&&... args) { + std::unique_ptr<VolumeTreeNode<IEnvironmentModel> > inline Environment< + IEnvironmentModel>::createNode(TVolumeArgs&&... args) { static_assert(std::is_base_of_v<IVolume, TVolumeType>, "unusable type provided, needs to be derived from " "\"Volume\""); @@ -48,4 +49,4 @@ namespace corsika { std::make_unique<TVolumeType>(std::forward<TVolumeArgs>(args)...)); } -} // namespace corsika \ No newline at end of file +} // namespace corsika diff --git a/corsika/detail/media/FlatExponential.inl b/corsika/detail/media/FlatExponential.inl index bc782945fe67cc3a6ea21d778913f948a788e62a..cdada02df557031db3c80ce91eb1de75eca1415e 100644 --- a/corsika/detail/media/FlatExponential.inl +++ b/corsika/detail/media/FlatExponential.inl @@ -17,16 +17,16 @@ namespace corsika { template <typename T> - FlatExponential<T>::FlatExponential(Point const& point, - Vector<dimensionless_d> const& axis, - MassDensityType rho, LengthType lambda, - NuclearComposition const& nuclComp) + inline FlatExponential<T>::FlatExponential(Point const& point, + Vector<dimensionless_d> const& axis, + MassDensityType rho, LengthType lambda, + NuclearComposition const& nuclComp) : BaseExponential<FlatExponential<T>>(point, rho, lambda) , axis_(axis) , nuclComp_(nuclComp) {} template <typename T> - MassDensityType FlatExponential<T>::getMassDensity(Point const& point) const { + inline MassDensityType FlatExponential<T>::getMassDensity(Point const& point) const { return BaseExponential<FlatExponential<T>>::getRho0() * exp(BaseExponential<FlatExponential<T>>::getInvLambda() * (point - BaseExponential<FlatExponential<T>>::getAnchorPoint()) @@ -34,19 +34,19 @@ namespace corsika { } template <typename T> - NuclearComposition const& FlatExponential<T>::getNuclearComposition() const { + inline NuclearComposition const& FlatExponential<T>::getNuclearComposition() const { return nuclComp_; } template <typename T> - GrammageType FlatExponential<T>::getIntegratedGrammage(setup::Trajectory const& line, - LengthType to) const { + inline GrammageType FlatExponential<T>::getIntegratedGrammage( + setup::Trajectory const& line, LengthType to) const { return BaseExponential<FlatExponential<T>>::getIntegratedGrammage(line, to, axis_); } template <typename T> - LengthType FlatExponential<T>::getArclengthFromGrammage(setup::Trajectory const& line, - GrammageType grammage) const { + inline LengthType FlatExponential<T>::getArclengthFromGrammage( + setup::Trajectory const& line, GrammageType grammage) const { return BaseExponential<FlatExponential<T>>::getArclengthFromGrammage(line, grammage, axis_); } diff --git a/corsika/detail/media/HomogeneousMedium.inl b/corsika/detail/media/HomogeneousMedium.inl index d73354aa680c085241c1f71c37daed4bb1221b47..fd0148b0278dcbad64f5ae37ca4a1d9b01243ba6 100644 --- a/corsika/detail/media/HomogeneousMedium.inl +++ b/corsika/detail/media/HomogeneousMedium.inl @@ -16,29 +16,30 @@ namespace corsika { template <typename T> - HomogeneousMedium<T>::HomogeneousMedium(MassDensityType density, - NuclearComposition const& nuclComp) + inline HomogeneousMedium<T>::HomogeneousMedium(MassDensityType density, + NuclearComposition const& nuclComp) : density_(density) , nuclComp_(nuclComp) {} template <typename T> - MassDensityType HomogeneousMedium<T>::getMassDensity(Point const&) const { + inline MassDensityType HomogeneousMedium<T>::getMassDensity(Point const&) const { return density_; } + template <typename T> - NuclearComposition const& HomogeneousMedium<T>::getNuclearComposition() const { + inline NuclearComposition const& HomogeneousMedium<T>::getNuclearComposition() const { return nuclComp_; } template <typename T> - GrammageType HomogeneousMedium<T>::getIntegratedGrammage(setup::Trajectory const&, - LengthType to) const { + inline GrammageType HomogeneousMedium<T>::getIntegratedGrammage( + setup::Trajectory const&, LengthType to) const { return to * density_; } template <typename T> - LengthType HomogeneousMedium<T>::getArclengthFromGrammage(setup::Trajectory const&, - GrammageType grammage) const { + inline LengthType HomogeneousMedium<T>::getArclengthFromGrammage( + setup::Trajectory const&, GrammageType grammage) const { return grammage / density_; } } // namespace corsika diff --git a/corsika/detail/media/InhomogeneousMedium.inl b/corsika/detail/media/InhomogeneousMedium.inl index 064e9610efe4ed04e7707cf626cae8f0a355c076..48d1d266e5f308cddb6b990678aa6b66ace2e473 100644 --- a/corsika/detail/media/InhomogeneousMedium.inl +++ b/corsika/detail/media/InhomogeneousMedium.inl @@ -17,31 +17,31 @@ namespace corsika { template <typename T, typename TDensityFunction> template <typename... TArgs> - InhomogeneousMedium<T, TDensityFunction>::InhomogeneousMedium( + inline InhomogeneousMedium<T, TDensityFunction>::InhomogeneousMedium( NuclearComposition const& nuclComp, TArgs&&... rhoTArgs) : nuclComp_(nuclComp) , densityFunction_(rhoTArgs...) {} template <typename T, typename TDensityFunction> - MassDensityType InhomogeneousMedium<T, TDensityFunction>::getMassDensity( + inline MassDensityType InhomogeneousMedium<T, TDensityFunction>::getMassDensity( Point const& point) const { return densityFunction_.evaluateAt(point); } template <typename T, typename TDensityFunction> - NuclearComposition const& + inline NuclearComposition const& InhomogeneousMedium<T, TDensityFunction>::getNuclearComposition() const { return nuclComp_; } template <typename T, typename TDensityFunction> - GrammageType InhomogeneousMedium<T, TDensityFunction>::getIntegratedGrammage( + inline GrammageType InhomogeneousMedium<T, TDensityFunction>::getIntegratedGrammage( setup::Trajectory const& line, LengthType to) const { return densityFunction_.getIntegrateGrammage(line, to); } template <typename T, typename TDensityFunction> - LengthType InhomogeneousMedium<T, TDensityFunction>::getArclengthFromGrammage( + inline LengthType InhomogeneousMedium<T, TDensityFunction>::getArclengthFromGrammage( setup::Trajectory const& line, GrammageType grammage) const { return densityFunction_.getArclengthFromGrammage(line, grammage); } diff --git a/corsika/detail/media/LayeredSphericalAtmosphereBuilder.inl b/corsika/detail/media/LayeredSphericalAtmosphereBuilder.inl index e42310da2c7b13dc51480ff753b836a181557988..74f00f101bd284fc79f06e8f0e7c02a655b197c7 100644 --- a/corsika/detail/media/LayeredSphericalAtmosphereBuilder.inl +++ b/corsika/detail/media/LayeredSphericalAtmosphereBuilder.inl @@ -18,8 +18,9 @@ namespace corsika { template <typename TMediumInterface, template <typename> typename TMediumModelExtra, typename... TModelArgs> - void LayeredSphericalAtmosphereBuilder<TMediumInterface, TMediumModelExtra, - TModelArgs...>::checkRadius(LengthType r) const { + inline void LayeredSphericalAtmosphereBuilder<TMediumInterface, TMediumModelExtra, + TModelArgs...>::checkRadius(LengthType r) + const { if (r <= previousRadius_) { throw std::runtime_error("radius must be greater than previous"); } @@ -27,7 +28,7 @@ namespace corsika { template <typename TMediumInterface, template <typename> typename TMediumModelExtra, typename... TModelArgs> - void LayeredSphericalAtmosphereBuilder< + inline void LayeredSphericalAtmosphereBuilder< TMediumInterface, TMediumModelExtra, TModelArgs...>::setNuclearComposition(NuclearComposition const& composition) { composition_ = std::make_unique<NuclearComposition>(composition); @@ -35,7 +36,7 @@ namespace corsika { template <typename TMediumInterface, template <typename> typename TMediumModelExtra, typename... TModelArgs> - void LayeredSphericalAtmosphereBuilder< + inline void LayeredSphericalAtmosphereBuilder< TMediumInterface, TMediumModelExtra, TModelArgs...>::addExponentialLayer(GrammageType b, LengthType c, LengthType upperBoundary) { @@ -70,7 +71,7 @@ namespace corsika { template <typename TMediumInterface, template <typename> typename TMediumModelExtra, typename... TModelArgs> - void LayeredSphericalAtmosphereBuilder< + inline void LayeredSphericalAtmosphereBuilder< TMediumInterface, TMediumModelExtra, TModelArgs...>::addLinearLayer(LengthType c, LengthType upperBoundary) { auto const radius = earthRadius_ + upperBoundary; @@ -104,7 +105,7 @@ namespace corsika { template <typename TMediumInterface, template <typename> typename TMediumModelExtra, typename... TModelArgs> - Environment<TMediumInterface> LayeredSphericalAtmosphereBuilder< + inline Environment<TMediumInterface> LayeredSphericalAtmosphereBuilder< TMediumInterface, TMediumModelExtra, TModelArgs...>::assemble() { Environment<TMediumInterface> env; assemble(env); @@ -113,7 +114,7 @@ namespace corsika { template <typename TMediumInterface, template <typename> typename TMediumModelExtra, typename... TModelArgs> - void LayeredSphericalAtmosphereBuilder< + inline void LayeredSphericalAtmosphereBuilder< TMediumInterface, TMediumModelExtra, TModelArgs...>::assemble(Environment<TMediumInterface>& env) { auto& universe = env.getUniverse(); diff --git a/corsika/detail/media/LinearApproximationIntegrator.inl b/corsika/detail/media/LinearApproximationIntegrator.inl index 7452ff31d3047b235aaf292fedb78dd0b0552ba5..78b7733ed138f12ace9e99ed381776487094cadc 100644 --- a/corsika/detail/media/LinearApproximationIntegrator.inl +++ b/corsika/detail/media/LinearApproximationIntegrator.inl @@ -13,12 +13,12 @@ namespace corsika { template <typename TDerived> - auto const& LinearApproximationIntegrator<TDerived>::getImplementation() const { + inline auto const& LinearApproximationIntegrator<TDerived>::getImplementation() const { return *static_cast<TDerived const*>(this); } template <typename TDerived> - auto LinearApproximationIntegrator<TDerived>::getIntegrateGrammage( + inline auto LinearApproximationIntegrator<TDerived>::getIntegrateGrammage( setup::Trajectory const& line, LengthType length) const { auto const c0 = getImplementation().evaluateAt(line.getPosition(0)); auto const c1 = getImplementation().rho_.getFirstDerivative(line.getPosition(0), @@ -27,7 +27,7 @@ namespace corsika { } template <typename TDerived> - auto LinearApproximationIntegrator<TDerived>::getArclengthFromGrammage( + inline auto LinearApproximationIntegrator<TDerived>::getArclengthFromGrammage( setup::Trajectory const& line, GrammageType grammage) const { auto const c0 = getImplementation().rho_(line.getPosition(0)); auto const c1 = getImplementation().rho_.getFirstDerivative(line.getPosition(0), @@ -37,7 +37,7 @@ namespace corsika { } template <typename TDerived> - auto LinearApproximationIntegrator<TDerived>::getMaximumLength( + inline auto LinearApproximationIntegrator<TDerived>::getMaximumLength( setup::Trajectory const& line, [[maybe_unused]] double relError) const { [[maybe_unused]] auto const c1 = getImplementation().rho_.getSecondDerivative( line.getPosition(0), line.getDirection(0)); diff --git a/corsika/detail/media/MediumPropertyModel.inl b/corsika/detail/media/MediumPropertyModel.inl index 90cdd9754774e9a8c55a6625f2172922fec83c76..604175989c410c8ae129b1d2012631dc29c49cc1 100644 --- a/corsika/detail/media/MediumPropertyModel.inl +++ b/corsika/detail/media/MediumPropertyModel.inl @@ -14,17 +14,17 @@ namespace corsika { template <typename T> template <typename... Args> - MediumPropertyModel<T>::MediumPropertyModel(Medium const medium, Args&&... args) + inline MediumPropertyModel<T>::MediumPropertyModel(Medium const medium, Args&&... args) : T(std::forward<Args>(args)...) , medium_(medium) {} template <typename T> - Medium MediumPropertyModel<T>::getMedium(Point const&) const { + inline Medium MediumPropertyModel<T>::getMedium(Point const&) const { return medium_; } template <typename T> - void MediumPropertyModel<T>::setMedium(Medium const medium) { + inline void MediumPropertyModel<T>::setMedium(Medium const medium) { medium_ = medium; } diff --git a/corsika/detail/media/NuclearComposition.inl b/corsika/detail/media/NuclearComposition.inl index 230dfe1a144fd7c82cc52b06b7d87f2cf40c8bd5..85582510e5cb0e115c7e97133ee215de1193b2b2 100644 --- a/corsika/detail/media/NuclearComposition.inl +++ b/corsika/detail/media/NuclearComposition.inl @@ -22,8 +22,8 @@ namespace corsika { - NuclearComposition::NuclearComposition(std::vector<Code> const& pComponents, - std::vector<float> const& pFractions) + inline NuclearComposition::NuclearComposition(std::vector<Code> const& pComponents, + std::vector<float> const& pFractions) : numberFractions_(pFractions) , components_(pComponents) , avgMassNumber_(std::inner_product( diff --git a/corsika/detail/media/ShowerAxis.inl b/corsika/detail/media/ShowerAxis.inl index 1be5d40a66c801299e57c95d1eee3b538839f953..a42989e9222f0c4ec6131d42fe37110ff62faf5a 100644 --- a/corsika/detail/media/ShowerAxis.inl +++ b/corsika/detail/media/ShowerAxis.inl @@ -14,9 +14,9 @@ namespace corsika { template <typename TEnvModel> - ShowerAxis::ShowerAxis(Point const& pStart, Vector<length_d> const& length, - Environment<TEnvModel> const& env, bool const doThrow, - int const steps) + inline ShowerAxis::ShowerAxis(Point const& pStart, Vector<length_d> const& length, + Environment<TEnvModel> const& env, bool const doThrow, + int const steps) : pointStart_(pStart) , length_(length) , throw_(doThrow) @@ -58,7 +58,7 @@ namespace corsika { assert(std::is_sorted(d_.cbegin(), d_.cend())); } - GrammageType ShowerAxis::getX(LengthType l) const { + inline GrammageType ShowerAxis::getX(LengthType l) const { double const fractionalBin = l / steplength_; int const lower = fractionalBin; // indices of nearest X support points double const fraction = fractionalBin - lower; @@ -97,21 +97,21 @@ namespace corsika { return X_[upper] * fraction + X_[lower] * (1 - fraction); } - LengthType ShowerAxis::getSteplength() const { return steplength_; } + inline LengthType ShowerAxis::getSteplength() const { return steplength_; } - GrammageType ShowerAxis::getMaximumX() const { return *X_.rbegin(); } + inline GrammageType ShowerAxis::getMaximumX() const { return *X_.rbegin(); } - GrammageType ShowerAxis::getMinimumX() const { return GrammageType::zero(); } + inline GrammageType ShowerAxis::getMinimumX() const { return GrammageType::zero(); } - GrammageType ShowerAxis::getProjectedX(Point const& p) const { + inline GrammageType ShowerAxis::getProjectedX(Point const& p) const { auto const projectedLength = (p - pointStart_).dot(axis_normalized_); return getX(projectedLength); } - Vector<dimensionless_d> const& ShowerAxis::getDirection() const { + inline DirectionVector const& ShowerAxis::getDirection() const { return axis_normalized_; } - Point const& ShowerAxis::getStart() const { return pointStart_; } + inline Point const& ShowerAxis::getStart() const { return pointStart_; } } // namespace corsika diff --git a/corsika/detail/media/SlidingPlanarExponential.inl b/corsika/detail/media/SlidingPlanarExponential.inl index c5c517954bcc06858cd66e8142bcd1b30ebb097e..56d99404ce835b860e93ba8db21ec2ce34462d4b 100644 --- a/corsika/detail/media/SlidingPlanarExponential.inl +++ b/corsika/detail/media/SlidingPlanarExponential.inl @@ -13,7 +13,7 @@ namespace corsika { template <typename T> - SlidingPlanarExponential<T>::SlidingPlanarExponential( + inline SlidingPlanarExponential<T>::SlidingPlanarExponential( Point const& p0, MassDensityType rho0, LengthType lambda, NuclearComposition const& nuclComp, LengthType referenceHeight) : BaseExponential<SlidingPlanarExponential<T>>(p0, rho0, lambda) @@ -21,7 +21,8 @@ namespace corsika { , referenceHeight_(referenceHeight) {} template <typename T> - MassDensityType SlidingPlanarExponential<T>::getMassDensity(Point const& point) const { + inline MassDensityType SlidingPlanarExponential<T>::getMassDensity( + Point const& point) const { auto const height = (point - BaseExponential<SlidingPlanarExponential<T>>::getAnchorPoint()) .getNorm() - @@ -31,12 +32,13 @@ namespace corsika { } template <typename T> - NuclearComposition const& SlidingPlanarExponential<T>::getNuclearComposition() const { + inline NuclearComposition const& SlidingPlanarExponential<T>::getNuclearComposition() + const { return nuclComp_; } template <typename T> - GrammageType SlidingPlanarExponential<T>::getIntegratedGrammage( + inline GrammageType SlidingPlanarExponential<T>::getIntegratedGrammage( setup::Trajectory const& traj, LengthType l) const { auto const axis = (traj.getPosition(0) - BaseExponential<SlidingPlanarExponential<T>>::getAnchorPoint()) @@ -46,7 +48,7 @@ namespace corsika { } template <typename T> - LengthType SlidingPlanarExponential<T>::getArclengthFromGrammage( + inline LengthType SlidingPlanarExponential<T>::getArclengthFromGrammage( setup::Trajectory const& traj, GrammageType const grammage) const { auto const axis = (traj.getPosition(0) - BaseExponential<SlidingPlanarExponential<T>>::getAnchorPoint()) diff --git a/corsika/detail/media/UniformRefractiveIndex.inl b/corsika/detail/media/UniformRefractiveIndex.inl index 1abea247066330608dfb4ace74eedddbbe91c7cc..d6e5f5a9d753c9ccf5e6d1154c50433a1ae482d2 100644 --- a/corsika/detail/media/UniformRefractiveIndex.inl +++ b/corsika/detail/media/UniformRefractiveIndex.inl @@ -14,17 +14,17 @@ namespace corsika { template <typename T> template <typename... Args> - UniformRefractiveIndex<T>::UniformRefractiveIndex(double const n, Args&&... args) + inline UniformRefractiveIndex<T>::UniformRefractiveIndex(double const n, Args&&... args) : T(std::forward<Args>(args)...) , n_(n) {} template <typename T> - double UniformRefractiveIndex<T>::getRefractiveIndex(Point const&) const { + inline double UniformRefractiveIndex<T>::getRefractiveIndex(Point const&) const { return n_; } template <typename T> - void UniformRefractiveIndex<T>::setRefractiveIndex(double const& n) { + inline void UniformRefractiveIndex<T>::setRefractiveIndex(double const& n) { n_ = n; } diff --git a/corsika/detail/media/Universe.inl b/corsika/detail/media/Universe.inl index b3f4d2541473ac7f3430ecd40bf607cbf4227464..c965ab3352071aa81a89b39f72b8ef612c6803b0 100644 --- a/corsika/detail/media/Universe.inl +++ b/corsika/detail/media/Universe.inl @@ -12,10 +12,10 @@ namespace corsika { - Universe::Universe(CoordinateSystemPtr const& pCS) + inline Universe::Universe(CoordinateSystemPtr const& pCS) : corsika::Sphere(Point{pCS, 0 * meter, 0 * meter, 0 * meter}, meter * std::numeric_limits<double>::infinity()) {} - bool Universe::contains(corsika::Point const&) const { return true; } + inline bool Universe::contains(corsika::Point const&) const { return true; } } // namespace corsika diff --git a/corsika/detail/media/VolumeTreeNode.inl b/corsika/detail/media/VolumeTreeNode.inl index bdae7cc12b3525ef932c3319a67e5e05c683121e..7a334e61f90199063509d7f4cca7cdaf46e4c540 100644 --- a/corsika/detail/media/VolumeTreeNode.inl +++ b/corsika/detail/media/VolumeTreeNode.inl @@ -14,7 +14,7 @@ namespace corsika { template <typename IModelProperties> - bool VolumeTreeNode<IModelProperties>::contains(Point const& p) const { + inline bool VolumeTreeNode<IModelProperties>::contains(Point const& p) const { return geoVolume_->contains(p); } @@ -32,7 +32,7 @@ namespace corsika { * \class Point \p p, or nullptr iff \p p is not contained in this volume. */ template <typename IModelProperties> - VolumeTreeNode<IModelProperties> const* + inline VolumeTreeNode<IModelProperties> const* VolumeTreeNode<IModelProperties>::getContainingNode(Point const& p) const { if (!contains(p)) { return nullptr; } @@ -54,7 +54,7 @@ namespace corsika { template <typename IModelProperties> template <typename TCallable, bool preorder> - void VolumeTreeNode<IModelProperties>::walk(TCallable func) { + inline void VolumeTreeNode<IModelProperties>::walk(TCallable func) { if constexpr (preorder) { func(*this); } std::for_each(childNodes_.begin(), childNodes_.end(), @@ -64,7 +64,7 @@ namespace corsika { } template <typename IModelProperties> - void VolumeTreeNode<IModelProperties>::addChild( + inline void VolumeTreeNode<IModelProperties>::addChild( typename VolumeTreeNode<IModelProperties>::VTNUPtr pChild) { pChild->parentNode_ = this; childNodes_.push_back(std::move(pChild)); @@ -74,19 +74,9 @@ namespace corsika { } template <typename IModelProperties> - void VolumeTreeNode<IModelProperties>::excludeOverlapWith( + inline void VolumeTreeNode<IModelProperties>::excludeOverlapWith( typename VolumeTreeNode<IModelProperties>::VTNUPtr const& pNode) { excludedNodes_.push_back(pNode.get()); } - /* - template <typename IModelProperties> - template <class MediumType, typename... Args> - auto VolumeTreeNode<IModelProperties>::createMedium(Args&&... args) { - static_assert(std::is_base_of_v<IMediumModel, MediumType>, - "unusable type provided, needs to be derived from \"IMediumModel\""); - - return std::make_shared<MediumType>(std::forward<Args>(args)...); - } - */ } // namespace corsika diff --git a/corsika/detail/media/WeightProvider.inl b/corsika/detail/media/WeightProvider.inl index af9849aa3ca75b9bdaeefc661d56232f1ab895f4..b9cf1be7ae0e94d0a99b66366373ae62861fffc6 100644 --- a/corsika/detail/media/WeightProvider.inl +++ b/corsika/detail/media/WeightProvider.inl @@ -13,19 +13,19 @@ namespace corsika { template <class AConstIterator, class BConstIterator> - WeightProviderIterator<AConstIterator, BConstIterator>::WeightProviderIterator( + inline WeightProviderIterator<AConstIterator, BConstIterator>::WeightProviderIterator( AConstIterator a, BConstIterator b) : aIter_(a) , bIter_(b) {} template <class AConstIterator, class BConstIterator> - typename WeightProviderIterator<AConstIterator, BConstIterator>::value_type + inline typename WeightProviderIterator<AConstIterator, BConstIterator>::value_type WeightProviderIterator<AConstIterator, BConstIterator>::operator*() const { return ((*aIter_) * (*bIter_)).magnitude(); } template <class AConstIterator, class BConstIterator> - WeightProviderIterator<AConstIterator, BConstIterator>& + inline WeightProviderIterator<AConstIterator, BConstIterator>& WeightProviderIterator<AConstIterator, BConstIterator>::operator++() { // prefix ++ ++aIter_; @@ -34,15 +34,15 @@ namespace corsika { } template <class AConstIterator, class BConstIterator> - bool WeightProviderIterator<AConstIterator, BConstIterator>::operator==( + inline bool WeightProviderIterator<AConstIterator, BConstIterator>::operator==( WeightProviderIterator other) { return aIter_ == other.aIter_; } template <class AConstIterator, class BConstIterator> - bool WeightProviderIterator<AConstIterator, BConstIterator>::operator!=( + inline bool WeightProviderIterator<AConstIterator, BConstIterator>::operator!=( WeightProviderIterator other) { return !(*this == other); } -} // namespace corsika \ No newline at end of file +} // namespace corsika diff --git a/corsika/detail/modules/HadronicElasticModel.inl b/corsika/detail/modules/HadronicElasticModel.inl index bb5c16133ee16ebdde6cac89de9ad1dd84014191..e048a2d9179fb4cd195af22bafa5e51f403ded65 100644 --- a/corsika/detail/modules/HadronicElasticModel.inl +++ b/corsika/detail/modules/HadronicElasticModel.inl @@ -23,13 +23,14 @@ namespace corsika { - HadronicElasticInteraction::HadronicElasticInteraction(CrossSectionType x, - CrossSectionType y) + inline HadronicElasticInteraction::HadronicElasticInteraction(CrossSectionType x, + CrossSectionType y) : parX_(x) , parY_(y) {} template <> - GrammageType HadronicElasticInteraction::getInteractionLength(SetupParticle const& p) { + inline GrammageType HadronicElasticInteraction::getInteractionLength( + SetupParticle const& p) { if (p.getPID() == Code::Proton) { auto const* currentNode = p.getNode(); auto const& mediumComposition = @@ -69,7 +70,7 @@ namespace corsika { } template <typename TParticle> - ProcessReturn HadronicElasticInteraction::doInteraction(TParticle& p) { + inline ProcessReturn HadronicElasticInteraction::doInteraction(TParticle& p) { if (p.getPID() != Code::Proton) { return ProcessReturn::Ok; } const auto* currentNode = p.getNode(); @@ -160,7 +161,7 @@ namespace corsika { return ProcessReturn::Ok; } - HadronicElasticInteraction::inveV2 HadronicElasticInteraction::B(eV2 s) const { + inline HadronicElasticInteraction::inveV2 HadronicElasticInteraction::B(eV2 s) const { auto constexpr b_p = 2.3; auto const result = (2 * b_p + 2 * b_p + 4 * pow(s * constants::invGeVsq, gfEpsilon) - 4.2) * @@ -170,7 +171,7 @@ namespace corsika { return result; } - CrossSectionType HadronicElasticInteraction::getCrossSection( + inline CrossSectionType HadronicElasticInteraction::getCrossSection( SquaredHEPEnergyType s) const { // assuming every target behaves like a proton, parX_ and parY_ are universal CrossSectionType const sigmaTotal = parX_ * pow(s * constants::invGeVsq, gfEpsilon) + diff --git a/corsika/detail/modules/LongitudinalProfile.inl b/corsika/detail/modules/LongitudinalProfile.inl index df6bb471dbb04c4dfeff3a9c62cc86f3501f2ec1..d332913b5d995c83135fdbcb2adf4d383cf13456 100644 --- a/corsika/detail/modules/LongitudinalProfile.inl +++ b/corsika/detail/modules/LongitudinalProfile.inl @@ -20,14 +20,16 @@ namespace corsika { - LongitudinalProfile::LongitudinalProfile(ShowerAxis const& shower_axis, GrammageType dX) + inline LongitudinalProfile::LongitudinalProfile(ShowerAxis const& shower_axis, + GrammageType dX) : dX_(dX) , shower_axis_{shower_axis} , profiles_{static_cast<unsigned int>(shower_axis.getMaximumX() / dX_) + 1} {} template <typename TParticle, typename TTrack> - ProcessReturn LongitudinalProfile::doContinuous(TParticle const& vP, - TTrack const& vTrack, bool const) { + inline ProcessReturn LongitudinalProfile::doContinuous(TParticle const& vP, + TTrack const& vTrack, + bool const) { auto const pid = vP.getPID(); GrammageType const grammageStart = shower_axis_.getProjectedX(vTrack.getPosition(0)); @@ -60,8 +62,8 @@ namespace corsika { return ProcessReturn::Ok; } - void LongitudinalProfile::save(std::string const& filename, const int width, - const int precision) { + inline void LongitudinalProfile::save(std::string const& filename, const int width, + const int precision) { std::ofstream f{filename}; f << "# X / g·cm¯², gamma, e+, e-, mu+, mu-, all hadrons" << std::endl; for (size_t b = 0; b < profiles_.size(); ++b) { diff --git a/corsika/detail/modules/ObservationPlane.inl b/corsika/detail/modules/ObservationPlane.inl index 697481b8b9cd6557c65d550c52b90c6fcfe69cda..33cb556ec0021a6fedf2d254b2d35ff559df18bb 100644 --- a/corsika/detail/modules/ObservationPlane.inl +++ b/corsika/detail/modules/ObservationPlane.inl @@ -14,8 +14,9 @@ namespace corsika { - ObservationPlane::ObservationPlane(Plane const& obsPlane, DirectionVector const& x_axis, - std::string const& filename, bool deleteOnHit) + inline ObservationPlane::ObservationPlane(Plane const& obsPlane, + DirectionVector const& x_axis, + std::string const& filename, bool deleteOnHit) : plane_(obsPlane) , outputStream_(filename) , deleteOnHit_(deleteOnHit) @@ -27,7 +28,7 @@ namespace corsika { << std::endl; } - ProcessReturn ObservationPlane::doContinuous( + inline ProcessReturn ObservationPlane::doContinuous( corsika::setup::Stack::particle_type& particle, corsika::setup::Trajectory&, bool const stepLimit) { @@ -54,17 +55,13 @@ namespace corsika { } } - LengthType ObservationPlane::getMaxStepLength( + inline LengthType ObservationPlane::getMaxStepLength( corsika::setup::Stack::particle_type const& particle, corsika::setup::Trajectory const& trajectory) { - auto const& volumeNode = particle.getNode(); - typedef typename std::remove_const_t< - std::remove_reference_t<decltype(volumeNode->getModelProperties())>> - medium_type; Intersections const intersection = - setup::Tracking::intersect<corsika::setup::Stack::particle_type, medium_type>( - particle, plane_, volumeNode->getModelProperties()); + setup::Tracking::intersect<corsika::setup::Stack::particle_type>(particle, + plane_); TimeType const timeOfIntersection = intersection.getEntry(); CORSIKA_LOG_TRACE("particle={}, pos={}, dir={}, plane={}, timeOfIntersection={}", particle.asString(), particle.getPosition(), @@ -82,7 +79,7 @@ namespace corsika { return dist; } - void ObservationPlane::showResults() const { + inline void ObservationPlane::showResults() const { CORSIKA_LOG_INFO( " ******************************\n" " ObservationPlane: \n" @@ -92,7 +89,7 @@ namespace corsika { energy_ground_ / 1_GeV, count_ground_); } - void ObservationPlane::reset() { + inline void ObservationPlane::reset() { energy_ground_ = 0_GeV; count_ground_ = 0; } diff --git a/corsika/detail/modules/OnShellCheck.inl b/corsika/detail/modules/OnShellCheck.inl index f8f0b0081657c4b7d03d0c66dc2dc71c75a6b71e..c7ee250f23b6445919b5f0ab637536fcdff2759e 100644 --- a/corsika/detail/modules/OnShellCheck.inl +++ b/corsika/detail/modules/OnShellCheck.inl @@ -14,8 +14,8 @@ namespace corsika { - OnShellCheck::OnShellCheck(double const vMassTolerance, double const vEnergyTolerance, - bool const vError) + inline OnShellCheck::OnShellCheck(double const vMassTolerance, + double const vEnergyTolerance, bool const vError) : mass_tolerance_(vMassTolerance) , energy_tolerance_(vEnergyTolerance) , throw_error_(vError) { @@ -25,7 +25,7 @@ namespace corsika { energy_tolerance_ * 100); } - OnShellCheck::~OnShellCheck() { + inline OnShellCheck::~OnShellCheck() { logger_->info( " summary \n" " particles shifted: {} \n" @@ -35,7 +35,7 @@ namespace corsika { } template <typename TView> - void OnShellCheck::doSecondaries(TView& vS) { + inline void OnShellCheck::doSecondaries(TView& vS) { for (auto& p : vS) { auto const pid = p.getPID(); if (is_nucleus(pid)) continue; diff --git a/corsika/detail/modules/ParticleCut.inl b/corsika/detail/modules/ParticleCut.inl index 3fd882225fec411ced5ef823dff9b35fcea0ef56..f4d75667518b743a421b429a6afb8170c71e9869 100644 --- a/corsika/detail/modules/ParticleCut.inl +++ b/corsika/detail/modules/ParticleCut.inl @@ -12,9 +12,10 @@ namespace corsika { - ParticleCut::ParticleCut(HEPEnergyType const eEleCut, HEPEnergyType const ePhoCut, - HEPEnergyType const eHadCut, HEPEnergyType const eMuCut, - bool const inv) + inline ParticleCut::ParticleCut(HEPEnergyType const eEleCut, + HEPEnergyType const ePhoCut, + HEPEnergyType const eHadCut, HEPEnergyType const eMuCut, + bool const inv) : doCutEm_(false) , doCutInv_(inv) , energy_(0_GeV) @@ -41,8 +42,8 @@ namespace corsika { printThresholds(); } - ParticleCut::ParticleCut(HEPEnergyType const eHadCut, HEPEnergyType const eMuCut, - bool const inv) + inline ParticleCut::ParticleCut(HEPEnergyType const eHadCut, HEPEnergyType const eMuCut, + bool const inv) : doCutEm_(true) , doCutInv_(inv) , energy_(0_GeV) @@ -63,7 +64,7 @@ namespace corsika { printThresholds(); } - ParticleCut::ParticleCut(HEPEnergyType const eCut, bool const em, bool const inv) + inline ParticleCut::ParticleCut(HEPEnergyType const eCut, bool const em, bool const inv) : doCutEm_(em) , doCutInv_(inv) , energy_(0_GeV) @@ -76,7 +77,7 @@ namespace corsika { printThresholds(); } - ParticleCut::ParticleCut( + inline ParticleCut::ParticleCut( std::unordered_map<Code const, HEPEnergyType const> const& eCuts, bool const em, bool const inv) : doCutEm_(em) @@ -92,7 +93,7 @@ namespace corsika { } template <typename TParticle> - bool ParticleCut::isBelowEnergyCut(TParticle const& vP) const { + inline bool ParticleCut::isBelowEnergyCut(TParticle const& vP) const { auto const energyLab = vP.getEnergy(); auto const pid = vP.getPID(); // nuclei @@ -105,10 +106,12 @@ namespace corsika { } } - bool ParticleCut::isInvisible(Code const& vCode) const { return is_neutrino(vCode); } + inline bool ParticleCut::isInvisible(Code const& vCode) const { + return is_neutrino(vCode); + } template <typename TParticle> - bool ParticleCut::checkCutParticle(TParticle const& particle) { + inline bool ParticleCut::checkCutParticle(TParticle const& particle) { Code const pid = particle.getPID(); HEPEnergyType energy = particle.getEnergy(); @@ -136,7 +139,7 @@ namespace corsika { return false; // this particle will not be removed/cut } - void ParticleCut::doSecondaries(corsika::setup::StackView& vS) { + inline void ParticleCut::doSecondaries(corsika::setup::StackView& vS) { auto particle = vS.begin(); while (particle != vS.end()) { if (checkCutParticle(particle)) { particle.erase(); } @@ -144,8 +147,9 @@ namespace corsika { } } - ProcessReturn ParticleCut::doContinuous(corsika::setup::Stack::particle_type& particle, - corsika::setup::Trajectory const&, bool const) { + inline ProcessReturn ParticleCut::doContinuous( + corsika::setup::Stack::particle_type& particle, corsika::setup::Trajectory const&, + bool const) { CORSIKA_LOG_TRACE("ParticleCut::DoContinuous"); if (checkCutParticle(particle)) { CORSIKA_LOG_TRACE("removing during continuous"); @@ -156,14 +160,14 @@ namespace corsika { return ProcessReturn::Ok; } - void ParticleCut::printThresholds() { + inline void ParticleCut::printThresholds() { for (auto p : get_all_particles()) { auto const Eth = get_energy_threshold(p); CORSIKA_LOG_INFO("energy threshold for particle {} is {} GeV", p, Eth / 1_GeV); } } - void ParticleCut::showResults() { + inline void ParticleCut::showResults() { CORSIKA_LOG_INFO( " ******************************\n" " energy in em. component (GeV): {} \n " @@ -175,7 +179,7 @@ namespace corsika { em_energy_ / 1_GeV, em_count_, inv_energy_ / 1_GeV, inv_count_, energy_ / 1_GeV); } - void ParticleCut::reset() { + inline void ParticleCut::reset() { em_energy_ = 0_GeV; em_count_ = 0; inv_energy_ = 0_GeV; diff --git a/corsika/detail/modules/StackInspector.inl b/corsika/detail/modules/StackInspector.inl index b657e15316efc371091071ceeaaf265ca9f9a1aa..10b0f1582a31fcc01ada4b638f428917fc369747 100644 --- a/corsika/detail/modules/StackInspector.inl +++ b/corsika/detail/modules/StackInspector.inl @@ -24,18 +24,18 @@ namespace corsika { template <typename TStack> - StackInspector<TStack>::StackInspector(const int vNStep, const bool vReportStack, - const HEPEnergyType vE0) + inline StackInspector<TStack>::StackInspector(const int vNStep, const bool vReportStack, + const HEPEnergyType vE0) : StackProcess<StackInspector<TStack>>(vNStep) , ReportStack_(vReportStack) , E0_(vE0) , StartTime_(std::chrono::system_clock::now()) {} template <typename TStack> - StackInspector<TStack>::~StackInspector() {} + inline StackInspector<TStack>::~StackInspector() {} template <typename TStack> - void StackInspector<TStack>::doStack(const TStack& vS) { + inline void StackInspector<TStack>::doStack(const TStack& vS) { [[maybe_unused]] int i = 0; HEPEnergyType Etot = 0_GeV; diff --git a/corsika/detail/modules/TrackWriter.inl b/corsika/detail/modules/TrackWriter.inl index c6f72edf437b4d49cf728cf3ab16b358176f78f9..6d4ef2c737decc093430821d0b8663867f93723b 100644 --- a/corsika/detail/modules/TrackWriter.inl +++ b/corsika/detail/modules/TrackWriter.inl @@ -20,7 +20,7 @@ namespace corsika { - TrackWriter::TrackWriter(std::string const& filename) + inline TrackWriter::TrackWriter(std::string const& filename) : filename_(filename) { using namespace std::string_literals; @@ -31,8 +31,8 @@ namespace corsika { } template <typename TParticle, typename TTrack> - ProcessReturn TrackWriter::doContinuous(const TParticle& vP, const TTrack& vT, - bool const) { + inline ProcessReturn TrackWriter::doContinuous(const TParticle& vP, const TTrack& vT, + bool const) { auto const start = vT.getPosition(0).getCoordinates(); auto const delta = vT.getPosition(1).getCoordinates() - start; auto const pdg = static_cast<int>(get_PDG(vP.getPID())); @@ -54,7 +54,7 @@ namespace corsika { } template <typename TParticle, typename TTrack> - LengthType TrackWriter::getMaxStepLength(const TParticle&, const TTrack&) { + inline LengthType TrackWriter::getMaxStepLength(const TParticle&, const TTrack&) { return meter * std::numeric_limits<double>::infinity(); } diff --git a/corsika/detail/modules/TrackingLine.inl b/corsika/detail/modules/TrackingLine.inl index 52200c42d839d85c21fb8d6676d36c418f03c9e7..84400b81d24555d8022c259e5112cb1da6abe0b5 100644 --- a/corsika/detail/modules/TrackingLine.inl +++ b/corsika/detail/modules/TrackingLine.inl @@ -20,7 +20,7 @@ namespace corsika::tracking_line { - std::optional<std::pair<TimeType, TimeType>> TimeOfIntersection( + inline std::optional<std::pair<TimeType, TimeType>> TimeOfIntersection( corsika::Line const& line, corsika::Sphere const& sphere) { auto const delta = line.getStartPoint() - sphere.getCenter(); auto const v = line.getVelocity(); @@ -42,7 +42,7 @@ namespace corsika::tracking_line { } } - TimeType getTimeOfIntersection(Line const& vLine, Plane const& vPlane) { + inline TimeType getTimeOfIntersection(Line const& vLine, Plane const& vPlane) { auto const delta = vPlane.getCenter() - vLine.getStartPoint(); auto const v = vLine.getVelocity(); diff --git a/corsika/detail/modules/conex/CONEXhybrid.inl b/corsika/detail/modules/conex/CONEXhybrid.inl index 29c3886aab16fccc25a42ed48c8ea2a2ee7cfa15..5b350013f27d75eeaf7ed2ed8f1ea5c0bed6cb61 100644 --- a/corsika/detail/modules/conex/CONEXhybrid.inl +++ b/corsika/detail/modules/conex/CONEXhybrid.inl @@ -22,9 +22,9 @@ namespace corsika { - CONEXhybrid::CONEXhybrid(Point center, ShowerAxis const& showerAxis, - LengthType groundDist, LengthType injectionHeight, - HEPEnergyType primaryEnergy, PDGCode primaryPDG) + inline CONEXhybrid::CONEXhybrid(Point center, ShowerAxis const& showerAxis, + LengthType groundDist, LengthType injectionHeight, + HEPEnergyType primaryEnergy, PDGCode primaryPDG) : center_{center} , showerAxis_{showerAxis} , groundDist_{groundDist} @@ -124,7 +124,7 @@ namespace corsika { ::conex::conexrun_(ipart, eprima, theta, phi, xminp, dimpact, ioseed.data()); } - void CONEXhybrid::doSecondaries(setup::StackView& vS) { + inline void CONEXhybrid::doSecondaries(setup::StackView& vS) { auto p = vS.begin(); while (p != vS.end()) { Code const pid = p.getPID(); @@ -136,9 +136,9 @@ namespace corsika { } } - bool CONEXhybrid::addParticle(Code pid, HEPEnergyType energy, HEPEnergyType mass, - Point const& position, DirectionVector const& direction, - TimeType t) { + inline bool CONEXhybrid::addParticle(Code pid, HEPEnergyType energy, HEPEnergyType mass, + Point const& position, + DirectionVector const& direction, TimeType t) { auto const it = std::find_if(egs_em_codes_.cbegin(), egs_em_codes_.cend(), [=](auto const& p) { return pid == p.first; }); @@ -222,7 +222,7 @@ namespace corsika { return true; } - void CONEXhybrid::solveCE() { + inline void CONEXhybrid::solveCE() { ::conex::conexcascade_(); diff --git a/corsika/detail/modules/energy_loss/BetheBlochPDG.inl b/corsika/detail/modules/energy_loss/BetheBlochPDG.inl index cbabb0892dc3c4880c74d910ddef99ce7036736c..dff3b2bfb7dddd48309fe91a0b4ca94c0f1fad18 100644 --- a/corsika/detail/modules/energy_loss/BetheBlochPDG.inl +++ b/corsika/detail/modules/energy_loss/BetheBlochPDG.inl @@ -26,14 +26,14 @@ namespace corsika { return sqrt((Elab - m) * (Elab + m)); }; - BetheBlochPDG::BetheBlochPDG(ShowerAxis const& shower_axis) + inline BetheBlochPDG::BetheBlochPDG(ShowerAxis const& shower_axis) : dX_(10_g / square(1_cm)) // profile binning , dX_threshold_(0.0001_g / square(1_cm)) , shower_axis_(shower_axis) , profile_(int(shower_axis.getMaximumX() / dX_) + 1) {} - HEPEnergyType BetheBlochPDG::getBetheBloch(setup::Stack::particle_type const& p, - GrammageType const dX) { + inline HEPEnergyType BetheBlochPDG::getBetheBloch(setup::Stack::particle_type const& p, + GrammageType const dX) { // all these are material constants and have to come through Environment // right now: values for nitrogen_D @@ -126,21 +126,22 @@ namespace corsika { } // radiation losses according to PDG 2018, ch. 33 ref. [5] - HEPEnergyType BetheBlochPDG::getRadiationLosses(setup::Stack::particle_type const& vP, - GrammageType const vDX) { + inline HEPEnergyType BetheBlochPDG::getRadiationLosses( + setup::Stack::particle_type const& vP, GrammageType const vDX) { // simple-minded hard-coded value for b(E) inspired by data from // http://pdg.lbl.gov/2018/AtomicNuclearProperties/ for N and O. auto constexpr b = 3.0 * 1e-6 * square(1_cm) / 1_g; return -vP.getEnergy() * b * vDX; } - HEPEnergyType BetheBlochPDG::getTotalEnergyLoss(setup::Stack::particle_type const& vP, - GrammageType const vDX) { + inline HEPEnergyType BetheBlochPDG::getTotalEnergyLoss( + setup::Stack::particle_type const& vP, GrammageType const vDX) { return getBetheBloch(vP, vDX) + getRadiationLosses(vP, vDX); } - ProcessReturn BetheBlochPDG::doContinuous(setup::Stack::particle_type& p, - setup::Trajectory const& t, bool const) { + inline ProcessReturn BetheBlochPDG::doContinuous(setup::Stack::particle_type& p, + setup::Trajectory const& t, + bool const) { if (p.getChargeNumber() == 0) return ProcessReturn::Ok; GrammageType const dX = @@ -159,8 +160,9 @@ namespace corsika { return ProcessReturn::Ok; } - LengthType BetheBlochPDG::getMaxStepLength(setup::Stack::particle_type const& vParticle, - setup::Trajectory const& vTrack) const { + inline LengthType BetheBlochPDG::getMaxStepLength( + setup::Stack::particle_type const& vParticle, + setup::Trajectory const& vTrack) const { if (vParticle.getChargeNumber() == 0) { return meter * std::numeric_limits<double>::infinity(); } @@ -187,15 +189,15 @@ namespace corsika { vTrack, maxGrammage); } - void BetheBlochPDG::updateMomentum(corsika::setup::Stack::particle_type& vP, - HEPEnergyType Enew) { + inline void BetheBlochPDG::updateMomentum(corsika::setup::Stack::particle_type& vP, + HEPEnergyType Enew) { HEPMomentumType Pnew = elab2plab(Enew, vP.getMass()); auto pnew = vP.getMomentum(); vP.setMomentum(pnew * Pnew / pnew.getNorm()); } - void BetheBlochPDG::fillProfile(setup::Trajectory const& vTrack, - const HEPEnergyType dE) { + inline void BetheBlochPDG::fillProfile(setup::Trajectory const& vTrack, + const HEPEnergyType dE) { GrammageType grammageStart = shower_axis_.getProjectedX(vTrack.getPosition(0)); GrammageType grammageEnd = shower_axis_.getProjectedX(vTrack.getPosition(1)); @@ -243,7 +245,7 @@ namespace corsika { CORSIKA_LOG_DEBUG("total energy added to histogram: {} ", energyCount); } - void BetheBlochPDG::printProfile() const { + inline void BetheBlochPDG::printProfile() const { std::ofstream file("EnergyLossProfile.dat"); file << "# EnergyLoss profile" << std::endl << "# lower X bin edge [g/cm2] dE/dX [GeV/g/cm2]\n"; @@ -255,11 +257,11 @@ namespace corsika { file.close(); } - HEPEnergyType BetheBlochPDG::getTotal() const { + inline HEPEnergyType BetheBlochPDG::getTotal() const { return std::accumulate(profile_.cbegin(), profile_.cend(), HEPEnergyType::zero()); } - void BetheBlochPDG::showResults() const { + inline void BetheBlochPDG::showResults() const { CORSIKA_LOG_INFO( " ******************************\n" " PROCESS::ContinuousProcess: \n" @@ -267,6 +269,6 @@ namespace corsika { energy_lost_ / 1_GeV); } - void BetheBlochPDG::reset() { energy_lost_ = 0_GeV; } + inline void BetheBlochPDG::reset() { energy_lost_ = 0_GeV; } } // namespace corsika diff --git a/corsika/detail/modules/proposal/ContinuousProcess.inl b/corsika/detail/modules/proposal/ContinuousProcess.inl index b494c7b72b62a64bf2fdf3cea24f038587c58af1..b4b0bf9638fbc6dd00d4d258d465cc6da4e65ca1 100644 --- a/corsika/detail/modules/proposal/ContinuousProcess.inl +++ b/corsika/detail/modules/proposal/ContinuousProcess.inl @@ -23,7 +23,8 @@ namespace corsika::proposal { - void ContinuousProcess::buildCalculator(Code code, NuclearComposition const& comp) { + inline void ContinuousProcess::buildCalculator(Code code, + NuclearComposition const& comp) { // search crosssection builder for given particle auto p_cross = cross.find(code); if (p_cross == cross.end()) @@ -47,13 +48,13 @@ namespace corsika::proposal { } template <> - ContinuousProcess::ContinuousProcess(setup::Environment const& _env) + inline ContinuousProcess::ContinuousProcess(setup::Environment const& _env) : ProposalProcessBase(_env) {} template <> - void ContinuousProcess::scatter(setup::Stack::particle_type& vP, - HEPEnergyType const& loss, - GrammageType const& grammage) { + inline void ContinuousProcess::scatter(setup::Stack::particle_type& vP, + HEPEnergyType const& loss, + GrammageType const& grammage) { // get or build corresponding calculators auto c = getCalculator(vP, calc); @@ -87,8 +88,9 @@ namespace corsika::proposal { } template <> - ProcessReturn ContinuousProcess::doContinuous(setup::Stack::particle_type& vP, - setup::Trajectory const& vT, bool const) { + inline ProcessReturn ContinuousProcess::doContinuous(setup::Stack::particle_type& vP, + setup::Trajectory const& vT, + bool const) { if (!canInteract(vP.getPID())) return ProcessReturn::Ok; if (vT.getLength() == 0_m) return ProcessReturn::Ok; @@ -114,8 +116,8 @@ namespace corsika::proposal { } template <> - LengthType ContinuousProcess::getMaxStepLength(setup::Stack::particle_type const& vP, - setup::Trajectory const& vT) { + inline LengthType ContinuousProcess::getMaxStepLength( + setup::Stack::particle_type const& vP, setup::Trajectory const& vT) { auto const code = vP.getPID(); if (!canInteract(code)) return meter * std::numeric_limits<double>::infinity(); @@ -148,7 +150,7 @@ namespace corsika::proposal { return dist; } - void ContinuousProcess::showResults() const { + inline void ContinuousProcess::showResults() const { CORSIKA_LOG_DEBUG( " ******************************\n" " PROCESS::ContinuousProcess: \n" @@ -156,6 +158,6 @@ namespace corsika::proposal { energy_lost_ / 1_GeV); } - void ContinuousProcess::reset() { energy_lost_ = 0_GeV; } + inline void ContinuousProcess::reset() { energy_lost_ = 0_GeV; } } // namespace corsika::proposal diff --git a/corsika/detail/modules/proposal/Interaction.inl b/corsika/detail/modules/proposal/Interaction.inl index 4874bda1f7fb7f6ca89d898cf7f1e01e8a51b791..fb6c157da082f6bd9865521bbf34642a8fa245b8 100644 --- a/corsika/detail/modules/proposal/Interaction.inl +++ b/corsika/detail/modules/proposal/Interaction.inl @@ -24,10 +24,10 @@ namespace corsika::proposal { template <> - Interaction::Interaction(setup::Environment const& _env) + inline Interaction::Interaction(setup::Environment const& _env) : ProposalProcessBase(_env) {} - void Interaction::buildCalculator(Code code, NuclearComposition const& comp) { + inline void Interaction::buildCalculator(Code code, NuclearComposition const& comp) { // search crosssection builder for given particle auto p_cross = cross.find(code); if (p_cross == cross.end()) @@ -52,7 +52,7 @@ namespace corsika::proposal { } template <> - ProcessReturn Interaction::doInteraction(setup::StackView& view) { + inline ProcessReturn Interaction::doInteraction(setup::StackView& view) { auto const projectile = view.getProjectile(); @@ -103,7 +103,7 @@ namespace corsika::proposal { } template <> - GrammageType Interaction::getInteractionLength( + inline GrammageType Interaction::getInteractionLength( setup::Stack::particle_type const& projectile) { if (canInteract(projectile.getPID())) { diff --git a/corsika/detail/modules/proposal/ProposalProcessBase.inl b/corsika/detail/modules/proposal/ProposalProcessBase.inl index 21d0cce576f306055d745a8d50a6a2baa3f21466..992d24e4d5feefc081ca658e6fd270c534ee5d25 100644 --- a/corsika/detail/modules/proposal/ProposalProcessBase.inl +++ b/corsika/detail/modules/proposal/ProposalProcessBase.inl @@ -25,12 +25,12 @@ namespace corsika::proposal { - bool ProposalProcessBase::canInteract(Code pcode) const { + inline bool ProposalProcessBase::canInteract(Code pcode) const { if (std::find(begin(tracked), end(tracked), pcode) != end(tracked)) return true; return false; } - ProposalProcessBase::ProposalProcessBase(setup::Environment const& _env) + inline ProposalProcessBase::ProposalProcessBase(setup::Environment const& _env) : RNG_(RNGManager::getInstance().getRandomStream("proposal")) { _env.getUniverse()->walk([&](auto& vtn) { if (vtn.hasModelProperties()) { @@ -71,7 +71,8 @@ namespace corsika::proposal { } } - size_t ProposalProcessBase::hash::operator()(const calc_key_t& p) const noexcept { + inline size_t ProposalProcessBase::hash::operator()(const calc_key_t& p) const + noexcept { return p.first ^ std::hash<Code>{}(p.second); } diff --git a/corsika/detail/modules/pythia8/Decay.inl b/corsika/detail/modules/pythia8/Decay.inl index a0dcc7e7c211447cad2e15a63d9ad3bcd53237b7..d41c149024ff2d932fb259a909e07e6ac2ac2e63 100644 --- a/corsika/detail/modules/pythia8/Decay.inl +++ b/corsika/detail/modules/pythia8/Decay.inl @@ -17,21 +17,21 @@ namespace corsika::pythia8 { - Decay::Decay(bool const print_listing) + inline Decay::Decay(bool const print_listing) : Pythia8::Pythia(CORSIKA_Pythia8_XML_DIR) , print_listing_(print_listing) { init(); } - Decay::Decay(std::set<Code> const& those) + inline Decay::Decay(std::set<Code> const& those) : handleAllDecays_(false) , handledDecays_(those) { init(); } - Decay::~Decay() { CORSIKA_LOG_INFO("Pythia::Decay n={}", count_); } + inline Decay::~Decay() { CORSIKA_LOG_INFO("Pythia::Decay n={}", count_); } - void Decay::init() { + inline void Decay::init() { // run this only once during construction @@ -66,7 +66,7 @@ namespace corsika::pythia8 { throw std::runtime_error("Pythia::Decay: Initialization failed!"); } - bool Decay::canHandleDecay(Code const vParticleCode) { + inline bool Decay::canHandleDecay(Code const vParticleCode) { // if known to pythia and not proton, electron or neutrino it can decay if (vParticleCode == Code::Proton || vParticleCode == Code::AntiProton || vParticleCode == Code::NuE || vParticleCode == Code::NuMu || @@ -80,7 +80,7 @@ namespace corsika::pythia8 { return false; } - void Decay::setHandleDecay(Code const vParticleCode) { + inline void Decay::setHandleDecay(Code const vParticleCode) { handleAllDecays_ = false; CORSIKA_LOG_INFO("Pythia::Decay: set to handle decay of {} ", vParticleCode); if (Decay::canHandleDecay(vParticleCode)) @@ -89,37 +89,37 @@ namespace corsika::pythia8 { throw std::runtime_error("this decay can not be handled by pythia!"); } - void Decay::setHandleDecay(std::vector<Code> const& vParticleList) { + inline void Decay::setHandleDecay(std::vector<Code> const& vParticleList) { handleAllDecays_ = false; for (auto p : vParticleList) setHandleDecay(p); } - bool Decay::isDecayHandled(Code const vParticleCode) { + inline bool Decay::isDecayHandled(Code const vParticleCode) { if (handleAllDecays_ && canHandleDecay(vParticleCode)) return true; else return handledDecays_.find(vParticleCode) != Decay::handledDecays_.end(); } - void Decay::setStable(std::vector<Code> const& particleList) { + inline void Decay::setStable(std::vector<Code> const& particleList) { for (auto p : particleList) Decay::setStable(p); } - void Decay::setUnstable(Code const pCode) { + inline void Decay::setUnstable(Code const pCode) { CORSIKA_LOG_INFO("Pythia::Decay: setting {} unstable..", pCode); Pythia8::Pythia::particleData.mayDecay(static_cast<int>(get_PDG(pCode)), true); } - void Decay::setStable(Code const pCode) { + inline void Decay::setStable(Code const pCode) { CORSIKA_LOG_INFO("Pythia::Decay: setting {} stable..", pCode); Pythia8::Pythia::particleData.mayDecay(static_cast<int>(get_PDG(pCode)), false); } - bool Decay::isStable(Code const vCode) { + inline bool Decay::isStable(Code const vCode) { return Pythia8::Pythia::particleData.canDecay(static_cast<int>(get_PDG(vCode))); } - bool Decay::canDecay(Code const pCode) { + inline bool Decay::canDecay(Code const pCode) { bool const ans = Pythia8::Pythia::particleData.canDecay(static_cast<int>(get_PDG(pCode))); CORSIKA_LOG_INFO("Pythia::Decay: checking if particle: {} can decay in PYTHIA? {} ", @@ -127,12 +127,12 @@ namespace corsika::pythia8 { return ans; } - void Decay::printDecayConfig(Code const vCode) { + inline void Decay::printDecayConfig(Code const vCode) { CORSIKA_LOG_INFO("Decay: Pythia decay configuration:"); CORSIKA_LOG_INFO(" {} is {} ", vCode, (isStable(vCode) ? "stable" : "unstable")); } - void Decay::printDecayConfig() { + inline void Decay::printDecayConfig() { CORSIKA_LOG_INFO("Pythia::Decay: decay configuration:"); if (handleAllDecays_) CORSIKA_LOG_INFO(" all particles known to Pythia are handled by Pythia::Decay!"); @@ -142,7 +142,7 @@ namespace corsika::pythia8 { } template <typename TParticle> - TimeType Decay::getLifetime(TParticle const& particle) { + inline TimeType Decay::getLifetime(TParticle const& particle) { auto const pid = particle.getPID(); if (canDecay(pid)) { @@ -167,7 +167,7 @@ namespace corsika::pythia8 { } template <typename TView> - void Decay::doDecay(TView& view) { + inline void Decay::doDecay(TView& view) { auto projectile = view.getProjectile(); diff --git a/corsika/detail/modules/pythia8/Interaction.inl b/corsika/detail/modules/pythia8/Interaction.inl index 5395e8b1fa86308a4936f6099d34ee851ee67b67..4b74ed67f44a9084bfa951c39c98116b5a2945e1 100644 --- a/corsika/detail/modules/pythia8/Interaction.inl +++ b/corsika/detail/modules/pythia8/Interaction.inl @@ -21,9 +21,11 @@ namespace corsika::pythia8 { - Interaction::~Interaction() { CORSIKA_LOG_INFO("Pythia::Interaction n= {}", count_); } + inline Interaction::~Interaction() { + CORSIKA_LOG_INFO("Pythia::Interaction n= {}", count_); + } - Interaction::Interaction(bool const print_listing) + inline Interaction::Interaction(bool const print_listing) : Pythia8::Pythia(CORSIKA_Pythia8_XML_DIR) , print_listing_(print_listing) { @@ -64,22 +66,23 @@ namespace corsika::pythia8 { &(Pythia8::Pythia::particleData), &(Pythia8::Pythia::rndm)); } - void Interaction::setStable(std::vector<Code> const& particleList) { + inline void Interaction::setStable(std::vector<Code> const& particleList) { for (auto p : particleList) Interaction::setStable(p); } - void Interaction::setUnstable(Code const pCode) { + inline void Interaction::setUnstable(Code const pCode) { CORSIKA_LOG_DEBUG("Pythia::Interaction: setting {} unstable..", pCode); Pythia8::Pythia::particleData.mayDecay(static_cast<int>(get_PDG(pCode)), true); } - void Interaction::setStable(Code const pCode) { + inline void Interaction::setStable(Code const pCode) { CORSIKA_LOG_DEBUG("Pythia::Interaction: setting {} stable..", pCode); Pythia8::Pythia::particleData.mayDecay(static_cast<int>(get_PDG(pCode)), false); } - void Interaction::configureLabFrameCollision(Code const BeamId, Code const TargetId, - HEPEnergyType const BeamEnergy) { + inline void Interaction::configureLabFrameCollision(Code const BeamId, + Code const TargetId, + HEPEnergyType const BeamEnergy) { // Pythia configuration of the current event // very clumsy. I am sure this can be done better.. @@ -111,12 +114,12 @@ namespace corsika::pythia8 { throw std::runtime_error("Pythia::Interaction: Initialization failed!"); } - bool Interaction::canInteract(Code const pCode) { + inline bool Interaction::canInteract(Code const pCode) { return pCode == Code::Proton || pCode == Code::Neutron || pCode == Code::AntiProton || pCode == Code::AntiNeutron || pCode == Code::PiMinus || pCode == Code::PiPlus; } - std::tuple<CrossSectionType, CrossSectionType> Interaction::getCrossSection( + inline std::tuple<CrossSectionType, CrossSectionType> Interaction::getCrossSection( Code const BeamId, Code const TargetId, HEPEnergyType const CoMenergy) { // interaction possible in pythia? if (TargetId == Code::Proton || TargetId == Code::Hydrogen) { @@ -146,7 +149,7 @@ namespace corsika::pythia8 { } } - GrammageType Interaction::getInteractionLength( + inline GrammageType Interaction::getInteractionLength( corsika::setup::Stack::particle_type const& particle) { // coordinate system, get global frame of reference @@ -216,7 +219,7 @@ namespace corsika::pythia8 { } template <class TView> - void Interaction::doInteraction(TView& view) { + inline void Interaction::doInteraction(TView& view) { auto projectile = view.getProjectile(); diff --git a/corsika/detail/modules/pythia8/Random.inl b/corsika/detail/modules/pythia8/Random.inl index c077e0bf732474bdfef413fac35885294f8b14f8..cf1408f1e1fcf722e1f13b0f5960c9ca531659e0 100644 --- a/corsika/detail/modules/pythia8/Random.inl +++ b/corsika/detail/modules/pythia8/Random.inl @@ -12,6 +12,6 @@ namespace corsika::pythia8 { - double Random::flat() { return Dist_(RNG_); } + inline double Random::flat() { return Dist_(RNG_); } } // namespace corsika::pythia8 diff --git a/corsika/detail/modules/qgsjetII/Interaction.inl b/corsika/detail/modules/qgsjetII/Interaction.inl index da703d7ef604c47088c495b65674b2f025d9df6d..a97265abc3a3aa442e9d373d579a37fe3da66412 100644 --- a/corsika/detail/modules/qgsjetII/Interaction.inl +++ b/corsika/detail/modules/qgsjetII/Interaction.inl @@ -27,7 +27,7 @@ namespace corsika::qgsjetII { - Interaction::Interaction(const std::string& dataPath) + inline Interaction::Interaction(const std::string& dataPath) : data_path_(dataPath) { if (dataPath == "") { if (std::getenv("CORSIKA_DATA")) { @@ -46,14 +46,15 @@ namespace corsika::qgsjetII { } } - Interaction::~Interaction() { + inline Interaction::~Interaction() { CORSIKA_LOG_DEBUG("QgsjetII::Interaction n= {}", count_); } - CrossSectionType Interaction::getCrossSection(const Code beamId, const Code targetId, - const HEPEnergyType Elab, - const unsigned int Abeam, - const unsigned int targetA) const { + inline CrossSectionType Interaction::getCrossSection(const Code beamId, + const Code targetId, + const HEPEnergyType Elab, + const unsigned int Abeam, + const unsigned int targetA) const { double sigProd = std::numeric_limits<double>::infinity(); if (corsika::qgsjetII::canInteract(beamId)) { @@ -88,7 +89,7 @@ namespace corsika::qgsjetII { } template <typename TParticle> - GrammageType Interaction::getInteractionLength(const TParticle& vP) const { + inline GrammageType Interaction::getInteractionLength(const TParticle& vP) const { // coordinate system, get global frame of reference CoordinateSystemPtr const& rootCS = get_root_CoordinateSystem(); @@ -160,7 +161,7 @@ namespace corsika::qgsjetII { */ template <typename TView> - void Interaction::doInteraction(TView& view) { + inline void Interaction::doInteraction(TView& view) { auto const projectile = view.getProjectile(); diff --git a/corsika/detail/modules/qgsjetII/QGSJetIIStack.inl b/corsika/detail/modules/qgsjetII/QGSJetIIStack.inl index 60f86fb48130ba5df29da5d27c5741baa80c1c47..92422c1dc08fb44f270311b3ddee81a7fb1e2425 100644 --- a/corsika/detail/modules/qgsjetII/QGSJetIIStack.inl +++ b/corsika/detail/modules/qgsjetII/QGSJetIIStack.inl @@ -10,58 +10,61 @@ namespace corsika::qgsjetII { - void QGSJetIIStackData::clear() { + inline void QGSJetIIStackData::clear() { qgarr12_.nsp = 0; qgarr13_.nsf = 0; qgarr55_.nwt = 0; } - unsigned int QGSJetIIStackData::getSize() const { return qgarr12_.nsp; } - unsigned int QGSJetIIStackData::getCapacity() const { return nptmax; } + inline unsigned int QGSJetIIStackData::getSize() const { return qgarr12_.nsp; } + inline unsigned int QGSJetIIStackData::getCapacity() const { return nptmax; } - void QGSJetIIStackData::setId(const unsigned int i, const int v) { + inline void QGSJetIIStackData::setId(const unsigned int i, const int v) { qgarr14_.ich[i] = v; } - void QGSJetIIStackData::setEnergy(const unsigned int i, const HEPEnergyType v) { + inline void QGSJetIIStackData::setEnergy(const unsigned int i, const HEPEnergyType v) { qgarr14_.esp[i][0] = v / 1_GeV; } - void QGSJetIIStackData::setMomentum(const unsigned int i, const MomentumVector& v) { + inline void QGSJetIIStackData::setMomentum(const unsigned int i, + const MomentumVector& v) { auto tmp = v.getComponents(); qgarr14_.esp[i][2] = tmp[0] / 1_GeV; qgarr14_.esp[i][3] = tmp[1] / 1_GeV; qgarr14_.esp[i][1] = tmp[2] / 1_GeV; } - int QGSJetIIStackData::getId(const unsigned int i) const { return qgarr14_.ich[i]; } - HEPEnergyType QGSJetIIStackData::getEnergy(const int i) const { + inline int QGSJetIIStackData::getId(const unsigned int i) const { + return qgarr14_.ich[i]; + } + inline HEPEnergyType QGSJetIIStackData::getEnergy(const int i) const { return qgarr14_.esp[i][0] * 1_GeV; } - MomentumVector QGSJetIIStackData::getMomentum(const unsigned int i, - const CoordinateSystemPtr& CS) const { + inline MomentumVector QGSJetIIStackData::getMomentum( + const unsigned int i, const CoordinateSystemPtr& CS) const { QuantityVector<hepmomentum_d> components = {qgarr14_.esp[i][2] * 1_GeV, qgarr14_.esp[i][3] * 1_GeV, qgarr14_.esp[i][1] * 1_GeV}; return MomentumVector(CS, components); } - void QGSJetIIStackData::copy(const unsigned int i1, const unsigned int i2) { + inline void QGSJetIIStackData::copy(const unsigned int i1, const unsigned int i2) { qgarr14_.ich[i2] = qgarr14_.ich[i1]; for (unsigned int i = 0; i < 4; ++i) qgarr14_.esp[i2][i] = qgarr14_.esp[i1][i]; } - void QGSJetIIStackData::swap(const unsigned int i1, const unsigned int i2) { + inline void QGSJetIIStackData::swap(const unsigned int i1, const unsigned int i2) { std::swap(qgarr14_.ich[i1], qgarr14_.ich[i2]); for (unsigned int i = 0; i < 4; ++i) std::swap(qgarr14_.esp[i1][i], qgarr14_.esp[i2][i]); } - void QGSJetIIStackData::incrementSize() { qgarr12_.nsp++; } - void QGSJetIIStackData::decrementSize() { + inline void QGSJetIIStackData::incrementSize() { qgarr12_.nsp++; } + inline void QGSJetIIStackData::decrementSize() { if (qgarr12_.nsp > 0) { qgarr12_.nsp--; } } template <typename StackIteratorInterface> - void ParticleInterface<StackIteratorInterface>::setParticleData( + inline void ParticleInterface<StackIteratorInterface>::setParticleData( const int vID, const HEPEnergyType vE, const MomentumVector& vP, const HEPMassType) { setPID(vID); @@ -70,7 +73,7 @@ namespace corsika::qgsjetII { } template <typename StackIteratorInterface> - void ParticleInterface<StackIteratorInterface>::setParticleData( + inline void ParticleInterface<StackIteratorInterface>::setParticleData( ParticleInterface<StackIteratorInterface>& /*parent*/, const int vID, const HEPEnergyType vE, const MomentumVector& vP, const HEPMassType) { setPID(vID); @@ -79,34 +82,36 @@ namespace corsika::qgsjetII { } template <typename StackIteratorInterface> - void ParticleInterface<StackIteratorInterface>::setEnergy(const HEPEnergyType v) { + inline void ParticleInterface<StackIteratorInterface>::setEnergy( + const HEPEnergyType v) { getStackData().setEnergy(getIndex(), v); } template <typename StackIteratorInterface> - HEPEnergyType ParticleInterface<StackIteratorInterface>::getEnergy() const { + inline HEPEnergyType ParticleInterface<StackIteratorInterface>::getEnergy() const { return getStackData().getEnergy(getIndex()); } template <typename StackIteratorInterface> - void ParticleInterface<StackIteratorInterface>::setPID(const int v) { + inline void ParticleInterface<StackIteratorInterface>::setPID(const int v) { getStackData().setId(getIndex(), v); } template <typename StackIteratorInterface> - corsika::qgsjetII::QgsjetIICode ParticleInterface<StackIteratorInterface>::getPID() - const { + inline corsika::qgsjetII::QgsjetIICode + ParticleInterface<StackIteratorInterface>::getPID() const { return static_cast<corsika::qgsjetII::QgsjetIICode>(getStackData().getId(getIndex())); } template <typename StackIteratorInterface> - MomentumVector ParticleInterface<StackIteratorInterface>::getMomentum( + inline MomentumVector ParticleInterface<StackIteratorInterface>::getMomentum( const CoordinateSystemPtr& CS) const { return getStackData().getMomentum(getIndex(), CS); } template <typename StackIteratorInterface> - void ParticleInterface<StackIteratorInterface>::setMomentum(const MomentumVector& v) { + inline void ParticleInterface<StackIteratorInterface>::setMomentum( + const MomentumVector& v) { getStackData().setMomentum(getIndex(), v); } diff --git a/corsika/detail/modules/qgsjetII/qgsjet-II-04.inl b/corsika/detail/modules/qgsjetII/qgsjet-II-04.inl index aca1429c3bfd93fac96a6519746eb88714ebbf09..a36268cf597f1d4fa812b848174d7c7b8828fc26 100644 --- a/corsika/detail/modules/qgsjetII/qgsjet-II-04.inl +++ b/corsika/detail/modules/qgsjetII/qgsjet-II-04.inl @@ -16,7 +16,7 @@ #include <iostream> #include <random> -datadir::datadir(const std::string& dir) { +inline datadir::datadir(const std::string& dir) { if (dir.length() > 130) { CORSIKA_LOG_ERROR("QGSJetII error, will cut datadir \"{}\" to 130 characters: ", {}); } @@ -26,7 +26,7 @@ datadir::datadir(const std::string& dir) { data[i + 1] = '\0'; } -double qgran_(int&) { +inline double qgran_(int&) { static corsika::default_prng_type& rng = corsika::RNGManager::getInstance().GetRandomStream("qgran"); @@ -34,6 +34,6 @@ double qgran_(int&) { return dist(rng); } -void lzmaopenfile_(const char*, int) {} -void lzmaclosefile_() {} -void lzmafillarray_(const double&, const int&) {} +inline void lzmaopenfile_(const char*, int) {} +inline void lzmaclosefile_() {} +inline void lzmafillarray_(const double&, const int&) {} diff --git a/corsika/detail/modules/sibyll/NuclearInteraction.inl b/corsika/detail/modules/sibyll/NuclearInteraction.inl index e5d8662fbab3fec61f00846e2dfd1511c414acce..91b85c68126ffbdebb2417867fcdd2420361fcbc 100644 --- a/corsika/detail/modules/sibyll/NuclearInteraction.inl +++ b/corsika/detail/modules/sibyll/NuclearInteraction.inl @@ -27,8 +27,8 @@ namespace corsika::sibyll { template <typename TEnvironment> - NuclearInteraction<TEnvironment>::NuclearInteraction(sibyll::Interaction& hadint, - TEnvironment const& env) + inline NuclearInteraction<TEnvironment>::NuclearInteraction(sibyll::Interaction& hadint, + TEnvironment const& env) : environment_(env) , hadronicInteraction_(hadint) { @@ -49,12 +49,12 @@ namespace corsika::sibyll { } template <typename TEnvironment> - NuclearInteraction<TEnvironment>::~NuclearInteraction() { + inline NuclearInteraction<TEnvironment>::~NuclearInteraction() { CORSIKA_LOG_DEBUG("Nuclib::NuclearInteraction n={} Nnuc={}", count_, nucCount_); } template <typename TEnvironment> - void NuclearInteraction<TEnvironment>::printCrossSectionTable(Code pCode) { + inline void NuclearInteraction<TEnvironment>::printCrossSectionTable(Code pCode) { const int k = targetComponentsIndex_.at(pCode); Code pNuclei[] = {Code::Helium, Code::Lithium7, Code::Oxygen, Code::Neon, Code::Argon, Code::Iron}; @@ -79,7 +79,7 @@ namespace corsika::sibyll { } template <typename TEnvironment> - void NuclearInteraction<TEnvironment>::initializeNuclearCrossSections() { + inline void NuclearInteraction<TEnvironment>::initializeNuclearCrossSections() { auto& universe = *(environment_.getUniverse()); @@ -143,7 +143,7 @@ namespace corsika::sibyll { } template <typename TEnvironment> - CrossSectionType NuclearInteraction<TEnvironment>::readCrossSectionTable( + inline CrossSectionType NuclearInteraction<TEnvironment>::readCrossSectionTable( const int ia, Code pTarget, HEPEnergyType elabnuc) { const int ib = targetComponentsIndex_.at(pTarget) + 1; // table index in fortran @@ -161,9 +161,8 @@ namespace corsika::sibyll { // TODO: remove elastic cross section? template <typename TEnvironment> template <typename TParticle> - std::tuple<CrossSectionType, CrossSectionType> - NuclearInteraction<TEnvironment>::getCrossSection(TParticle const& projectile, - Code const TargetId) { + std::tuple<CrossSectionType, CrossSectionType> inline NuclearInteraction< + TEnvironment>::getCrossSection(TParticle const& projectile, Code const TargetId) { if (projectile.getPID() != Code::Nucleus) throw std::runtime_error( @@ -203,7 +202,7 @@ namespace corsika::sibyll { template <typename TEnvironment> template <typename TParticle> - GrammageType NuclearInteraction<TEnvironment>::getInteractionLength( + inline GrammageType NuclearInteraction<TEnvironment>::getInteractionLength( TParticle const& projectile) { // coordinate system, get global frame of reference @@ -310,7 +309,7 @@ namespace corsika::sibyll { template <typename TEnvironment> template <typename TSecondaryView> - void NuclearInteraction<TEnvironment>::doInteraction(TSecondaryView& view) { + inline void NuclearInteraction<TEnvironment>::doInteraction(TSecondaryView& view) { auto projectile = view.getProjectile(); diff --git a/corsika/detail/modules/tracking/Intersect.inl b/corsika/detail/modules/tracking/Intersect.inl index fef16a955801992b636516605eec118d24fd3a04..79cfa6984f2bdc33ee5570c24be7e0efd7c8c371 100644 --- a/corsika/detail/modules/tracking/Intersect.inl +++ b/corsika/detail/modules/tracking/Intersect.inl @@ -38,7 +38,7 @@ namespace corsika { // first check, where we leave the current volume // this assumes our convention, that all Volume primitives must be convex // thus, the last entry is always the exit point - const Intersections time_intersections_curr = + Intersections const time_intersections_curr = TDerived::intersect(particle, volumeNode); CORSIKA_LOG_TRACE("curr node {}, parent node {}, hasIntersections={} ", fmt::ptr(&volumeNode), fmt::ptr(volumeNode.getParent()), @@ -56,16 +56,16 @@ namespace corsika { // where do we collide with any of the next-tree-level volumes // entirely contained by currentLogicalVolumeNode - for (const auto& node : volumeNode.getChildNodes()) { + for (auto const& node : volumeNode.getChildNodes()) { - const Intersections time_intersections = TDerived::intersect(particle, *node); + Intersections const time_intersections = TDerived::intersect(particle, *node); if (!time_intersections.hasIntersections()) { continue; } CORSIKA_LOG_DEBUG("intersection times with child volume {} : enter {} s, exit {} s", fmt::ptr(node), time_intersections.getEntry() / 1_s, time_intersections.getExit() / 1_s); - const auto t_entry = time_intersections.getEntry(); - const auto t_exit = time_intersections.getExit(); + auto const t_entry = time_intersections.getEntry(); + auto const t_exit = time_intersections.getExit(); CORSIKA_LOG_TRACE("children t-entry: {}, t-exit: {}, smaller? {} ", t_entry, t_exit, t_entry <= minTime); // note, theoretically t can even be smaller than 0 since we @@ -86,14 +86,14 @@ namespace corsika { // current volume for (node_type* node : volumeNode.getExcludedNodes()) { - const Intersections time_intersections = TDerived::intersect(particle, *node); + Intersections const time_intersections = TDerived::intersect(particle, *node); if (!time_intersections.hasIntersections()) { continue; } CORSIKA_LOG_DEBUG( "intersection times with exclusion volume {} : enter {} s, exit {} s", fmt::ptr(node), time_intersections.getEntry() / 1_s, time_intersections.getExit() / 1_s); - const auto t_entry = time_intersections.getEntry(); - const auto t_exit = time_intersections.getExit(); + auto const t_entry = time_intersections.getEntry(); + auto const t_exit = time_intersections.getExit(); CORSIKA_LOG_TRACE("children t-entry: {}, t-exit: {}, smaller? {} ", t_entry, t_exit, t_entry <= minTime); // note, theoretically t can even be smaller than 0 since we diff --git a/corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl b/corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl index 8545d2bbdc434501070f6a1b11232dc93184c47d..8dc9f1f3a2ce5ae9330135956629c2178868ecd9 100644 --- a/corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl +++ b/corsika/detail/modules/tracking/TrackingLeapFrogCurved.inl @@ -30,7 +30,7 @@ namespace corsika { template <typename TParticle> inline auto make_LeapFrogStep(TParticle const& particle, LengthType steplength) { - if (particle.getMomentum().norm() == 0_GeV) { + if (particle.getMomentum().getNorm() == 0_GeV) { return std::make_tuple(particle.getPosition(), particle.getMomentum() / 1_GeV, double(0)); } // charge of the particle @@ -103,9 +103,9 @@ namespace corsika { LengthType const gyroradius = (pAlongB_delta * 1_V / (constants::c * abs(chargeNumber) * magnitudeB * 1_eV)); - const double maxRadians = 0.01; - const LengthType steplimit = 2 * cos(maxRadians) * sin(maxRadians) * gyroradius; - const TimeType steplimit_time = steplimit / initialVelocity.getNorm(); + double const maxRadians = 0.01; + LengthType const steplimit = 2 * cos(maxRadians) * sin(maxRadians) * gyroradius; + TimeType const steplimit_time = steplimit / initialVelocity.getNorm(); CORSIKA_LOG_DEBUG("gyroradius {}, steplimit: {} = {}", gyroradius, steplimit, steplimit_time); @@ -113,7 +113,7 @@ namespace corsika { // intersection auto [minTime, minNode] = nextIntersect(particle, steplimit_time); - const auto k = + auto const k = chargeNumber * constants::cSquared * 1_eV / (particle.getEnergy() * 1_V); return std::make_tuple( LeapFrogTrajectory(position, initialVelocity, magneticfield, k, @@ -121,10 +121,9 @@ namespace corsika { minNode); // next volume node } - template <typename TParticle, typename TMedium> - inline Intersections Tracking::intersect(const TParticle& particle, - const Sphere& sphere, - const TMedium& medium) { + template <typename TParticle> + inline Intersections Tracking::intersect(TParticle const& particle, + Sphere const& sphere) { if (sphere.getRadius() == 1_km * std::numeric_limits<double>::infinity()) { return Intersections(); @@ -132,7 +131,9 @@ namespace corsika { int const chargeNumber = particle.getChargeNumber(); auto const& position = particle.getPosition(); - MagneticFieldVector const& magneticfield = medium.getMagneticField(position); + auto const* currentLogicalVolumeNode = particle.getNode(); + MagneticFieldVector const& magneticfield = + currentLogicalVolumeNode->getModelProperties().getMagneticField(position); VelocityVector const velocity = particle.getMomentum() / particle.getEnergy() * constants::c; @@ -144,26 +145,23 @@ namespace corsika { bool const isParallel = (projectedDirectionSqrNorm == 0 * square(1_T)); if (chargeNumber == 0 || magneticfield.getNorm() == 0_T || isParallel) { - return tracking_line::Tracking::intersect<TParticle, TMedium>(particle, sphere, - medium); + return tracking_line::Tracking::intersect<TParticle>(particle, sphere); } bool const numericallyInside = sphere.contains(particle.getPosition()); - const auto absVelocity = velocity.getNorm(); + auto const absVelocity = velocity.getNorm(); auto energy = particle.getEnergy(); auto k = chargeNumber * constants::cSquared * 1_eV / (absVelocity * energy * 1_V); - auto const denom = (directionBefore.cross(magneticfield)).getSquaredNorm() * k * k; - const double a = - ((directionBefore.cross(magneticfield)).dot(position - sphere.getCenter()) * k + - 1) * - 4 / (1_m * 1_m * denom); - const double b = directionBefore.dot(position - sphere.getCenter()) * 8 / - (denom * 1_m * 1_m * 1_m); - const double c = ((position - sphere.getCenter()).getSquaredNorm() - - (sphere.getRadius() * sphere.getRadius())) * - 4 / (denom * 1_m * 1_m * 1_m * 1_m); + auto const direction_B_perp = directionBefore.cross(magneticfield); + auto const denom = direction_B_perp.getSquaredNorm() * k * k; + Vector<length_d> const deltaPos = position - sphere.getCenter(); + double const a = (direction_B_perp.dot(deltaPos) * k + 1) * 4 / (1_m * 1_m * denom); + double const b = directionBefore.dot(deltaPos) * 8 / (denom * 1_m * 1_m * 1_m); + double const c = + (deltaPos.getSquaredNorm() - (sphere.getRadius() * sphere.getRadius())) * 4 / + (denom * 1_m * 1_m * 1_m * 1_m); CORSIKA_LOG_TRACE("denom={}, a={}, b={}, c={}", denom, a, b, c); std::complex<double>* solutions = quartic_solver::solve_quartic(0, a, b, c); LengthType d_enter, d_exit; @@ -225,13 +223,86 @@ namespace corsika { return Intersections(d_enter / absVelocity, d_exit / absVelocity); } - template <typename TParticle, typename TBaseNodeType> - inline Intersections Tracking::intersect(const TParticle& particle, - const TBaseNodeType& volumeNode) { - const Sphere* sphere = dynamic_cast<const Sphere*>(&volumeNode.getVolume()); - if (sphere) { - return intersect(particle, *sphere, volumeNode.getModelProperties()); + template <typename TParticle> + inline Intersections Tracking::intersect(TParticle const& particle, + Plane const& plane) { + + int chargeNumber; + if (is_nucleus(particle.getPID())) { + chargeNumber = particle.getNuclearZ(); + } else { + chargeNumber = get_charge_number(particle.getPID()); } + auto const* currentLogicalVolumeNode = particle.getNode(); + VelocityVector const velocity = + particle.getMomentum() / particle.getEnergy() * constants::c; + auto const absVelocity = velocity.getNorm(); + DirectionVector const direction = + velocity.normalized(); // determine steplength to next volume + Point const position = particle.getPosition(); + + auto const magneticfield = + currentLogicalVolumeNode->getModelProperties().getMagneticField(position); + + if (chargeNumber != 0 && abs(plane.getNormal().dot(velocity.cross(magneticfield))) > + 1e-6_T * 1_m / 1_s) { + + auto const* currentLogicalVolumeNode = particle.getNode(); + auto const magneticfield = + currentLogicalVolumeNode->getModelProperties().getMagneticField(position); + auto const k = + chargeNumber * (constants::c * 1_eV / 1_V) / particle.getMomentum().getNorm(); + + auto const direction_B_perp = direction.cross(magneticfield); + auto const denom = plane.getNormal().dot(direction_B_perp) * k; + auto const sqrtArg = + direction.dot(plane.getNormal()) * direction.dot(plane.getNormal()) - + (plane.getNormal().dot(position - plane.getCenter()) * denom * 2); + + if (sqrtArg < 0) { + return Intersections(std::numeric_limits<double>::infinity() * 1_s); + } + double const sqrSqrtArg = sqrt(sqrtArg); + auto const norm_projected = + direction.dot(plane.getNormal()) / direction.getNorm(); + LengthType const MaxStepLength1 = (sqrSqrtArg - norm_projected) / denom; + LengthType const MaxStepLength2 = (-sqrSqrtArg - norm_projected) / denom; + + // check: both intersections in past + if (MaxStepLength1 <= 0_m && MaxStepLength2 <= 0_m) { + return Intersections(std::numeric_limits<double>::infinity() * 1_s); + + // check: next intersection is MaxStepLength2 + } else if (MaxStepLength1 <= 0_m || MaxStepLength2 < MaxStepLength1) { + CORSIKA_LOG_TRACE(" steplength to obs plane 2: {} ", MaxStepLength2); + return Intersections( + MaxStepLength2 * + (direction + direction_B_perp * MaxStepLength2 * k / 2).getNorm() / + absVelocity); + + // check: next intersections is MaxStepLength1 + } else if (MaxStepLength2 <= 0_m || MaxStepLength1 < MaxStepLength2) { + CORSIKA_LOG_TRACE(" steplength to obs plane 2: {} ", MaxStepLength1); + return Intersections( + MaxStepLength1 * + (direction + direction_B_perp * MaxStepLength1 * k / 2).getNorm() / + absVelocity); + } + + CORSIKA_LOG_WARN( + "Particle wasn't tracked with curved trajectory -> straight (is this an " + "ERROR?)"); + + } // end if curved-tracking + + return tracking_line::Tracking::intersect(particle, plane); + } + + template <typename TParticle, typename TBaseNodeType> + inline Intersections Tracking::intersect(TParticle const& particle, + TBaseNodeType const& volumeNode) { + Sphere const* sphere = dynamic_cast<Sphere const*>(&volumeNode.getVolume()); + if (sphere) { return intersect(particle, *sphere); } throw std::runtime_error( "The Volume type provided is not supported in intersect(particle, node)"); } diff --git a/corsika/detail/modules/tracking/TrackingLeapFrogStraight.inl b/corsika/detail/modules/tracking/TrackingLeapFrogStraight.inl index 132a87e5d80abc129bc3375b4cab921c701a565c..61ad3793d0537c47c0efb1b870d11281c663072c 100644 --- a/corsika/detail/modules/tracking/TrackingLeapFrogStraight.inl +++ b/corsika/detail/modules/tracking/TrackingLeapFrogStraight.inl @@ -9,8 +9,6 @@ #pragma once #include <corsika/framework/geometry/Line.hpp> -#include <corsika/framework/geometry/Plane.hpp> -#include <corsika/framework/geometry/Sphere.hpp> #include <corsika/framework/geometry/StraightTrajectory.hpp> #include <corsika/framework/geometry/Vector.hpp> #include <corsika/framework/core/ParticleProperties.hpp> @@ -30,7 +28,7 @@ namespace corsika { VelocityVector initialVelocity = particle.getMomentum() / particle.getEnergy() * constants::c; - const Point initialPosition = particle.getPosition(); + Point const initialPosition = particle.getPosition(); CORSIKA_LOG_DEBUG( "TrackingB pid: {}" " , E = {} GeV", @@ -55,17 +53,17 @@ namespace corsika { const int chargeNumber = particle.getChargeNumber(); auto magneticfield = volumeNode->getModelProperties().getMagneticField(initialPosition); - const auto magnitudeB = magneticfield.getNorm(); + auto const magnitudeB = magneticfield.getNorm(); CORSIKA_LOG_DEBUG("field={} uT, chargeNumber={}, magnitudeB={} uT", magneticfield.getComponents() / 1_uT, chargeNumber, magnitudeB / 1_T); bool const no_deflection = chargeNumber == 0 || magnitudeB == 0_T; // check, where the first halve-step direction has geometric intersections - const auto [initialTrack, initialTrackNextVolume] = + auto const [initialTrack, initialTrackNextVolume] = tracking_line::Tracking::getTrack(particle); { [[maybe_unused]] auto& initialTrackNextVolume_dum = initialTrackNextVolume; } - const auto initialTrackLength = initialTrack.getLength(1); + auto const initialTrackLength = initialTrack.getLength(1); CORSIKA_LOG_DEBUG("initialTrack(0)={}, initialTrack(1)={}, initialTrackLength={}", initialTrack.getPosition(0).getCoordinates(), @@ -96,8 +94,8 @@ namespace corsika { // need to follow strongly curved trajectories segment-wise, // at least if we don't employ concepts as "Helix // Trajectories" or similar - const double maxRadians = 0.01; - const LengthType steplimit = 2 * cos(maxRadians) * sin(maxRadians) * gyroradius; + double const maxRadians = 0.01; + LengthType const steplimit = 2 * cos(maxRadians) * sin(maxRadians) * gyroradius; CORSIKA_LOG_DEBUG("gyroradius {}, Steplimit: {}", gyroradius, steplimit); // calculate first halve step for "steplimit" @@ -112,12 +110,12 @@ namespace corsika { CORSIKA_LOG_DEBUG("first halve step length {}, steplimit={}, initialTrackLength={}", firstHalveSteplength, steplimit, initialTrackLength); // perform the first halve-step - const Point position_mid = initialPosition + direction * firstHalveSteplength; - const auto k = - chargeNumber * constants::c * 1_eV / (particle.getMomentum().getNorm() * 1_V); - const auto new_direction = + Point const position_mid = initialPosition + direction * firstHalveSteplength; + auto const k = + chargeNumber * (constants::c * 1_eV / 1_V) / particle.getMomentum().getNorm(); + auto const new_direction = direction + direction.cross(magneticfield) * firstHalveSteplength * 2 * k; - const auto new_direction_norm = new_direction.getNorm(); // by design this is >1 + auto const new_direction_norm = new_direction.getNorm(); // by design this is >1 CORSIKA_LOG_DEBUG( "position_mid={}, new_direction={}, (new_direction_norm)={}, deflection={}", position_mid.getCoordinates(), new_direction.getComponents(), @@ -128,7 +126,7 @@ namespace corsika { // check, where the second halve-step direction has geometric intersections particle.setPosition(position_mid); particle.setMomentum(new_direction * absMomentum); - const auto [finalTrack, finalTrackNextVolume] = + auto const [finalTrack, finalTrackNextVolume] = tracking_line::Tracking::getTrack(particle); particle.setPosition(initialPosition); // this is not nice... particle.setMomentum(initialMomentum); // this is not nice... @@ -162,12 +160,12 @@ namespace corsika { // perform the second halve-step auto const new_direction_normalized = new_direction.normalized(); - const Point finalPosition = + Point const finalPosition = position_mid + new_direction_normalized * secondHalveStepLength; - const LengthType totalStep = firstHalveSteplength + secondHalveStepLength; - const auto delta_pos = finalPosition - initialPosition; - const auto distance = delta_pos.getNorm(); + LengthType const totalStep = firstHalveSteplength + secondHalveStepLength; + auto const delta_pos = finalPosition - initialPosition; + auto const distance = delta_pos.getNorm(); return std::make_tuple( StraightTrajectory( diff --git a/corsika/detail/modules/tracking/TrackingStraight.inl b/corsika/detail/modules/tracking/TrackingStraight.inl index 5869601a566d959ffac3432424b5fb9eaa4929cf..411ab54ff1b049e0b646599edb0259e4bedcc700 100644 --- a/corsika/detail/modules/tracking/TrackingStraight.inl +++ b/corsika/detail/modules/tracking/TrackingStraight.inl @@ -48,9 +48,9 @@ namespace corsika::tracking_line { minNode); // next volume node } - template <typename TParticle, typename TMedium> - Intersections Tracking::intersect(TParticle const& particle, Sphere const& sphere, - TMedium const&) { + template <typename TParticle> + inline Intersections Tracking::intersect(TParticle const& particle, + Sphere const& sphere) { auto const delta = particle.getPosition() - sphere.getCenter(); auto const velocity = particle.getMomentum() / particle.getEnergy() * constants::c; auto const vSqNorm = velocity.getSquaredNorm(); @@ -70,23 +70,17 @@ namespace corsika::tracking_line { } template <typename TParticle, typename TBaseNodeType> - Intersections Tracking::intersect(TParticle const& particle, - TBaseNodeType const& volumeNode) { + inline Intersections Tracking::intersect(TParticle const& particle, + TBaseNodeType const& volumeNode) { Sphere const* sphere = dynamic_cast<Sphere const*>(&volumeNode.getVolume()); - if (sphere) { - typedef typename std::remove_const_t< - std::remove_reference_t<decltype(volumeNode.getModelProperties())>> - medium_type; - return Tracking::intersect<TParticle, medium_type>(particle, *sphere, - volumeNode.getModelProperties()); - } + if (sphere) { return Tracking::intersect<TParticle>(particle, *sphere); } throw std::runtime_error( "The Volume type provided is not supported in Intersect(particle, node)"); } - template <typename TParticle, typename TMedium> - Intersections Tracking::intersect(TParticle const& particle, Plane const& plane, - TMedium const&) { + template <typename TParticle> + inline Intersections Tracking::intersect(TParticle const& particle, + Plane const& plane) { auto const delta = plane.getCenter() - particle.getPosition(); auto const velocity = particle.getMomentum() / particle.getEnergy() * constants::c; auto const n = plane.getNormal(); diff --git a/corsika/detail/modules/urqmd/UrQMD.inl b/corsika/detail/modules/urqmd/UrQMD.inl index c0f530a811a12809b68ccb5caa125e1d7319ef11..a1abaa6abf994b7f07a165b4f42599c3b4aaa89f 100644 --- a/corsika/detail/modules/urqmd/UrQMD.inl +++ b/corsika/detail/modules/urqmd/UrQMD.inl @@ -23,11 +23,11 @@ namespace corsika::urqmd { - UrQMD::UrQMD() { ::urqmd::iniurqmdc8_(); } + inline UrQMD::UrQMD() { ::urqmd::iniurqmdc8_(); } - CrossSectionType UrQMD::getCrossSection(Code vProjectileCode, Code vTargetCode, - HEPEnergyType vLabEnergy, - int vAProjectile = 1) { + inline CrossSectionType UrQMD::getCrossSection(Code vProjectileCode, Code vTargetCode, + HEPEnergyType vLabEnergy, + int vAProjectile = 1) { // the following is a translation of ptsigtot() into C++ if (vProjectileCode != Code::Nucleus && @@ -63,8 +63,8 @@ namespace corsika::urqmd { template <typename TParticle> // need template here, as this is called both with // SetupParticle as well as SetupProjectile - CrossSectionType UrQMD::getCrossSection(TParticle const& vProjectile, - Code vTargetCode) const { + inline CrossSectionType UrQMD::getCrossSection(TParticle const& vProjectile, + Code vTargetCode) const { // TODO: return 0 for non-hadrons? auto const projectileCode = vProjectile.getPID(); @@ -79,7 +79,7 @@ namespace corsika::urqmd { return getCrossSection(projectileCode, vTargetCode, projectileEnergyLab, Ap); } - bool UrQMD::canInteract(Code vCode) const { + inline bool UrQMD::canInteract(Code vCode) const { // According to the manual, UrQMD can use all mesons, baryons and nucleons // which are modeled also as input particles. I think it is safer to accept // only the usual long-lived species as input. @@ -95,7 +95,7 @@ namespace corsika::urqmd { } template <typename TParticle> - GrammageType UrQMD::getInteractionLength(TParticle const& vParticle) const { + inline GrammageType UrQMD::getInteractionLength(TParticle const& vParticle) const { if (!canInteract(vParticle.getPID())) { // we could do the canInteract check in getCrossSection, too but if @@ -115,7 +115,7 @@ namespace corsika::urqmd { } template <typename TView> - void UrQMD::doInteraction(TView& view) { + inline void UrQMD::doInteraction(TView& view) { auto projectile = view.getProjectile(); @@ -231,7 +231,7 @@ namespace corsika::urqmd { CORSIKA_LOG_DEBUG("UrQMD generated {} secondaries!", ::urqmd::sys_.npart); } - Code convertFromUrQMD(int vItyp, int vIso3) { + inline Code convertFromUrQMD(int vItyp, int vIso3) { int const pdgInt = ::urqmd::pdgid_(vItyp, vIso3); // use the conversion function provided by UrQMD if (pdgInt == 0) { // ::urqmd::pdgid_ returns 0 on error @@ -241,7 +241,7 @@ namespace corsika::urqmd { return convert_from_PDG(pdg); } - std::pair<int, int> convertToUrQMD(Code code) { + inline std::pair<int, int> convertToUrQMD(Code code) { static const std::map<int, std::pair<int, int>> mapPDGToUrQMD{ // data mostly from github.com/afedynitch/ParticleDataTool {22, {100, 0}}, // gamma diff --git a/corsika/detail/stack/VectorStack.inl b/corsika/detail/stack/VectorStack.inl index 44384a131f8733711c52c72baff2d471af87da79..a89c85ed951595ed585cee02649dc8e698733aac 100644 --- a/corsika/detail/stack/VectorStack.inl +++ b/corsika/detail/stack/VectorStack.inl @@ -23,7 +23,7 @@ namespace corsika { template <typename StackIteratorInterface> - void ParticleInterface<StackIteratorInterface>::setParticleData( + inline void ParticleInterface<StackIteratorInterface>::setParticleData( std::tuple<Code, HEPEnergyType, MomentumVector, Point, TimeType> const& v) { this->setPID(std::get<0>(v)); this->setEnergy(std::get<1>(v)); @@ -33,7 +33,7 @@ namespace corsika { } template <typename StackIteratorInterface> - void ParticleInterface<StackIteratorInterface>::setParticleData( + inline void ParticleInterface<StackIteratorInterface>::setParticleData( ParticleInterface<StackIteratorInterface> const&, std::tuple<Code, HEPEnergyType, MomentumVector, Point, TimeType> const& v) { this->setPID(std::get<0>(v)); diff --git a/corsika/detail/stack/history/HistoryObservationPlane.inl b/corsika/detail/stack/history/HistoryObservationPlane.inl index 0536eaf3ada84db7382461ec95d2ff7cc6ffac1b..66b0f11e450e83b422ce4d0f4d6a5340e86ebf9f 100644 --- a/corsika/detail/stack/history/HistoryObservationPlane.inl +++ b/corsika/detail/stack/history/HistoryObservationPlane.inl @@ -13,14 +13,14 @@ namespace corsika::history { - HistoryObservationPlane::HistoryObservationPlane(setup::Stack const& stack, - Plane const& obsPlane, - bool deleteOnHit) + inline HistoryObservationPlane::HistoryObservationPlane(setup::Stack const& stack, + Plane const& obsPlane, + bool deleteOnHit) : stack_{stack} , plane_{obsPlane} , deleteOnHit_{deleteOnHit} {} - ProcessReturn HistoryObservationPlane::DoContinuous( + inline ProcessReturn HistoryObservationPlane::DoContinuous( setup::Stack::ParticleType const& particle, setup::Trajectory const& trajectory) { TimeType const timeOfIntersection = (plane_.getCenter() - trajectory.getR0()).dot(plane_.getNormal()) / @@ -45,8 +45,8 @@ namespace corsika::history { } } - LengthType HistoryObservationPlane::MaxStepLength(setup::Stack::ParticleType const&, - setup::Trajectory const& trajectory) { + inline LengthType HistoryObservationPlane::MaxStepLength( + setup::Stack::ParticleType const&, setup::Trajectory const& trajectory) { TimeType const timeOfIntersection = (plane_.getCenter() - trajectory.getR0()).dot(plane_.getNormal()) / trajectory.getV0().dot(plane_.getNormal()); @@ -59,7 +59,7 @@ namespace corsika::history { return (trajectory.getR0() - pointOfIntersection).norm() * 1.0001; } - void HistoryObservationPlane::fillHistoryHistogram( + inline void HistoryObservationPlane::fillHistoryHistogram( setup::Stack::ParticleType const& muon) { double const muon_energy = muon.getEnergy() / 1_GeV; diff --git a/corsika/framework/analytics/Timer.hpp b/corsika/framework/analytics/Timer.hpp index 4df67f488dfaa0ebc998d67689d28238b6e2834b..a2dba0ea5e756046a5740ee9412ddc2fc965de2f 100644 --- a/corsika/framework/analytics/Timer.hpp +++ b/corsika/framework/analytics/Timer.hpp @@ -36,10 +36,10 @@ namespace corsika { : timeDiff_(0){}; /// Start the timer - inline void startTimer() { start_ = clock_type::now(); } + void startTimer() { start_ = clock_type::now(); } /// Stop the timer - inline void stopTimer() { + void stopTimer() { timeDiff_ = std::chrono::duration_cast<duration_type>(clock_type::now() - start_); } @@ -48,7 +48,7 @@ namespace corsika { * @return Returns the measured runtime of the wrapped function/functor in the unit * given by TDuration **/ - inline duration_type getTime() const { return timeDiff_; } + duration_type getTime() const { return timeDiff_; } }; std::false_type is_timer_impl(...); @@ -56,7 +56,7 @@ namespace corsika { std::true_type is_timer_impl(Timer<T, U> const volatile&); template <typename T> - inline constexpr bool is_timer_v = + constexpr bool is_timer_v = std::is_same_v<decltype(is_timer_impl(std::declval<T&>())), std::true_type>; -} // namespace corsika \ No newline at end of file +} // namespace corsika diff --git a/corsika/framework/core/ParticleProperties.hpp b/corsika/framework/core/ParticleProperties.hpp index 85227425c42bf584ffcde2cea20c75d11570709e..dafc1f02437fcecc0c926b9b9b94a283997c03b6 100644 --- a/corsika/framework/core/ParticleProperties.hpp +++ b/corsika/framework/core/ParticleProperties.hpp @@ -81,15 +81,15 @@ namespace corsika { int constexpr get_nucleus_Z(Code); //!< returns Z for hard-coded nucleus, otherwise 0 //! returns mass of (A,Z) nucleus, disregarding binding energy - inline HEPMassType get_nucleus_mass(unsigned int const, unsigned int const); + HEPMassType get_nucleus_mass(unsigned int const, unsigned int const); //! convert PDG code to CORSIKA 8 internal code - inline Code convert_from_PDG(PDGCode); + Code convert_from_PDG(PDGCode); std::initializer_list<Code> constexpr get_all_particles(); //! the output stream operator for human-readable particle codes - inline std::ostream& operator<<(std::ostream&, corsika::Code); + std::ostream& operator<<(std::ostream&, corsika::Code); } // namespace corsika // data arrays, etc., as generated automatically diff --git a/corsika/framework/core/PhysicalGeometry.hpp b/corsika/framework/core/PhysicalGeometry.hpp index 36b897f75ed37aa7f8acacb4c6a3bfef15ae307a..b325ad2805a13afa54af891f806ab0b1492d79e7 100644 --- a/corsika/framework/core/PhysicalGeometry.hpp +++ b/corsika/framework/core/PhysicalGeometry.hpp @@ -20,6 +20,21 @@ namespace corsika { + /** + * A 3D vector defined in a specific coordinate system with units HEPMomentumType + **/ typedef Vector<hepmomentum_d> MomentumVector; + /** + * A 3D vector defined in a specific coordinate system with no units. But, note, this is + * not automatically normaliyed! It is not a "NormalVector". + **/ + typedef Vector<dimensionless_d> DirectionVector; + + /** + * A 3D vector defined in a specific coordinate system with units "velocity_t". + * + **/ + typedef Vector<SpeedType::dimension_type> VelocityVector; + } // namespace corsika diff --git a/corsika/framework/geometry/CoordinateSystem.hpp b/corsika/framework/geometry/CoordinateSystem.hpp index ed9c8184853e61c9d19d102d2543a79d7806d7fc..f15b89e994d6399600322b479a287d1a726e1abd 100644 --- a/corsika/framework/geometry/CoordinateSystem.hpp +++ b/corsika/framework/geometry/CoordinateSystem.hpp @@ -40,31 +40,30 @@ namespace corsika { /** * Creates new CoordinateSystemPtr by translation along \a vector */ - inline CoordinateSystemPtr make_translation(CoordinateSystemPtr const& cs, - QuantityVector<length_d> const& vector); + CoordinateSystemPtr make_translation(CoordinateSystemPtr const& cs, + QuantityVector<length_d> const& vector); /** * creates a new CoordinateSystem in which vVec points in direction of the new z-axis, * \a vVec */ template <typename TDim> - inline CoordinateSystemPtr make_rotationToZ(CoordinateSystemPtr const& cs, - Vector<TDim> const& vVec); + CoordinateSystemPtr make_rotationToZ(CoordinateSystemPtr const& cs, + Vector<TDim> const& vVec); /** * creates a new CoordinateSystem, rotated around axis by angle. */ template <typename TDim> - inline CoordinateSystemPtr make_rotation(CoordinateSystemPtr const& cs, - QuantityVector<TDim> const& axis, - double const angle); + CoordinateSystemPtr make_rotation(CoordinateSystemPtr const& cs, + QuantityVector<TDim> const& axis, double const angle); /** * creates a new CoordinateSystem, translated by \a translation and rotated around \a * axis by \a angle. */ template <typename TDim> - inline CoordinateSystemPtr make_translationAndRotation( + CoordinateSystemPtr make_translationAndRotation( CoordinateSystemPtr const& cs, QuantityVector<length_d> const& translation, QuantityVector<TDim> const& axis, double const angle); @@ -119,14 +118,14 @@ namespace corsika { /** * Checks, if this is the unique ROOT CS */ - inline bool isRoot() const { return !referenceCS_; } + bool isRoot() const { return !referenceCS_; } - inline CoordinateSystemPtr getReferenceCS() const; + CoordinateSystemPtr getReferenceCS() const; - inline EigenTransform const& getTransform() const; + EigenTransform const& getTransform() const; - inline bool operator==(CoordinateSystem const&) const; - inline bool operator!=(CoordinateSystem const&) const; + bool operator==(CoordinateSystem const&) const; + bool operator!=(CoordinateSystem const&) const; protected: static CoordinateSystem createCS() { return CoordinateSystem(); } @@ -171,8 +170,8 @@ namespace corsika { * * \todo make this a protected member of CoordinateSystem */ - inline EigenTransform get_transformation(CoordinateSystem const& c1, - CoordinateSystem const& c2); + EigenTransform get_transformation(CoordinateSystem const& c1, + CoordinateSystem const& c2); } // namespace corsika diff --git a/corsika/framework/geometry/FourVector.hpp b/corsika/framework/geometry/FourVector.hpp index 99932012d0ca5d4d99ae7427c62e957e0d37850c..0b87accec038a6d5d796ea91318d86fbbe004317 100644 --- a/corsika/framework/geometry/FourVector.hpp +++ b/corsika/framework/geometry/FourVector.hpp @@ -190,8 +190,8 @@ namespace corsika { **/ template <typename TTimeType, typename TSpaceVecType> - inline std::ostream& operator<<( - std::ostream& os, corsika::FourVector<TTimeType, TSpaceVecType> const& qv); + std::ostream& operator<<(std::ostream& os, + corsika::FourVector<TTimeType, TSpaceVecType> const& qv); } // namespace corsika diff --git a/corsika/framework/geometry/Helix.hpp b/corsika/framework/geometry/Helix.hpp index 5bd9fac77b71ec5e80ba54d26a19b6a3ab7b9d86..3862389889b4d0dcbaba55d00530713f07b25f92 100644 --- a/corsika/framework/geometry/Helix.hpp +++ b/corsika/framework/geometry/Helix.hpp @@ -8,11 +8,13 @@ #pragma once -#include <cmath> #include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/framework/core/PhysicalGeometry.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Vector.hpp> +#include <cmath> + namespace corsika { /*! @@ -31,12 +33,9 @@ namespace corsika { class Helix { - ///! \todo move VelocityVec into PhysicalUnits - using VelocityVec = Vector<SpeedType::dimension_type>; - public: - Helix(Point const& pR0, FrequencyType pOmegaC, VelocityVec const& pvPar, - VelocityVec const& pvPerp) + Helix(Point const& pR0, FrequencyType pOmegaC, VelocityVector const& pvPar, + VelocityVector const& pvPerp) : r0_(pR0) , omegaC_(pOmegaC) , vPar_(pvPar) @@ -44,24 +43,24 @@ namespace corsika { , uPerp_(vPerp_.cross(vPar_.normalized())) , radius_(pvPar.getNorm() / abs(pOmegaC)) {} - inline LengthType getRadius() const; + LengthType getRadius() const; - inline Point getPosition(TimeType const t) const; + Point getPosition(TimeType const t) const; - VelocityVec getVelocity(TimeType const t) const; + VelocityVector getVelocity(TimeType const t) const; - inline Point getPositionFromArclength(LengthType const l) const; + Point getPositionFromArclength(LengthType const l) const; - inline LengthType getArcLength(TimeType const t1, TimeType const t2) const; + LengthType getArcLength(TimeType const t1, TimeType const t2) const; - inline TimeType getTimeFromArclength(LengthType const l) const; + TimeType getTimeFromArclength(LengthType const l) const; private: Point r0_; ///! origin of helix, but this is in the center of the ///! "cylinder" on which the helix rotates FrequencyType omegaC_; ///! speed of angular rotation - VelocityVec vPar_; ///! speed along direction of "cylinder" - VelocityVec vPerp_, uPerp_; + VelocityVector vPar_; ///! speed along direction of "cylinder" + VelocityVector vPerp_, uPerp_; LengthType radius_; }; diff --git a/corsika/framework/geometry/Line.hpp b/corsika/framework/geometry/Line.hpp index cdb03d6245945a421d31badeae339fa49d9ef71f..7f68984bd07178589e8c24e814e05d65c173e8dc 100644 --- a/corsika/framework/geometry/Line.hpp +++ b/corsika/framework/geometry/Line.hpp @@ -31,21 +31,21 @@ namespace corsika { : start_point_(pR0) , velocity_(pV0) {} - inline Point getPosition(TimeType const t) const; + Point getPosition(TimeType const t) const; - inline VelocityVector const& getVelocity(TimeType const) const; + VelocityVector const& getVelocity(TimeType const) const; - inline Point getPositionFromArclength(LengthType const l) const; + Point getPositionFromArclength(LengthType const l) const; - inline LengthType getArcLength(TimeType const t1, TimeType const t2) const; + LengthType getArcLength(TimeType const t1, TimeType const t2) const; - inline TimeType getTimeFromArclength(LengthType const t) const; + TimeType getTimeFromArclength(LengthType const t) const; - inline Point const& getStartPoint() const; + Point const& getStartPoint() const; - inline DirectionVector getDirection() const; + DirectionVector getDirection() const; - inline VelocityVector const& getVelocity() const; + VelocityVector const& getVelocity() const; private: Point start_point_; diff --git a/corsika/framework/geometry/Plane.hpp b/corsika/framework/geometry/Plane.hpp index 7218e6b3564e857946669743be61c6519f467f12..454b527fde9ca1dee0fd4f3e2fd0728317b784e8 100644 --- a/corsika/framework/geometry/Plane.hpp +++ b/corsika/framework/geometry/Plane.hpp @@ -9,6 +9,7 @@ #pragma once #include <corsika/framework/core/PhysicalUnits.hpp> +#include <corsika/framework/core/PhysicalGeometry.hpp> #include <corsika/framework/geometry/Point.hpp> #include <corsika/framework/geometry/Vector.hpp> @@ -18,27 +19,24 @@ namespace corsika { class Plane { - ///! \todo move to PhysicalUnits - using DimLessVec = Vector<dimensionless_d>; - public: - Plane(Point const& vCenter, DimLessVec const& vNormal) + Plane(Point const& vCenter, DirectionVector const& vNormal) : center_(vCenter) , normal_(vNormal.normalized()) {} bool isAbove(Point const& vP) const; - LengthType getDistanceTo(corsika::Point const& vP) const; + LengthType getDistanceTo(Point const& vP) const; Point const& getCenter() const; - DimLessVec const& getNormal() const; + DirectionVector const& getNormal() const; std::string asString() const; public: Point const center_; - DimLessVec const normal_; + DirectionVector const normal_; }; } // namespace corsika diff --git a/corsika/framework/geometry/Point.hpp b/corsika/framework/geometry/Point.hpp index b06a68bdebc236f2520007da1031bb76491f6a70..2c684438438455985d0bebfbb95ed6bdafa4c86b 100644 --- a/corsika/framework/geometry/Point.hpp +++ b/corsika/framework/geometry/Point.hpp @@ -31,8 +31,8 @@ namespace corsika { /** \todo TODO: this should be private or protected, we don NOT want to expose numbers * without reference to outside: */ - inline QuantityVector<length_d> const& getCoordinates() const; - inline QuantityVector<length_d>& getCoordinates(); + QuantityVector<length_d> const& getCoordinates() const; + QuantityVector<length_d>& getCoordinates(); /** this always returns a QuantityVector as triple @@ -40,7 +40,7 @@ namespace corsika { \returns A value type QuantityVector, since it may have to create a temporary object to transform to pCS. **/ - inline QuantityVector<length_d> getCoordinates(CoordinateSystemPtr const& pCS) const; + QuantityVector<length_d> getCoordinates(CoordinateSystemPtr const& pCS) const; /** * this always returns a QuantityVector as triple @@ -49,7 +49,7 @@ namespace corsika { * is actually transformed to pCS, if needed. Thus, there may be an implicit call to * \ref rebase. **/ - inline QuantityVector<length_d>& getCoordinates(CoordinateSystemPtr const& pCS); + QuantityVector<length_d>& getCoordinates(CoordinateSystemPtr const& pCS); /** * \name access coordinate components @@ -60,23 +60,23 @@ namespace corsika { * created and destroyed each call. This can be avoided by using * \ref rebase first. **/ - inline LengthType getX(CoordinateSystemPtr const& pCS) const; - inline LengthType getY(CoordinateSystemPtr const& pCS) const; - inline LengthType getZ(CoordinateSystemPtr const& pCS) const; + LengthType getX(CoordinateSystemPtr const& pCS) const; + LengthType getY(CoordinateSystemPtr const& pCS) const; + LengthType getZ(CoordinateSystemPtr const& pCS) const; /** \} **/ /*! * transforms the Point into another CoordinateSystem by changing its * coordinates interally */ - inline void rebase(CoordinateSystemPtr const& pCS); + void rebase(CoordinateSystemPtr const& pCS); - inline Point operator+(Vector<length_d> const& pVec) const; + Point operator+(Vector<length_d> const& pVec) const; /*! * returns the distance Vector between two points */ - inline Vector<length_d> operator-(Point const& pB) const; + Vector<length_d> operator-(Point const& pB) const; }; } // namespace corsika diff --git a/corsika/framework/geometry/QuantityVector.hpp b/corsika/framework/geometry/QuantityVector.hpp index eb6c2f11e2679d434e2dbf617875254a60af621f..d9199dc57490bea7c0204c6256eddc7d4f80ef8c 100644 --- a/corsika/framework/geometry/QuantityVector.hpp +++ b/corsika/framework/geometry/QuantityVector.hpp @@ -113,8 +113,8 @@ namespace corsika { **/ template <typename TDimension> - inline std::ostream& operator<<(std::ostream& os, - corsika::QuantityVector<TDimension> const& qv); + std::ostream& operator<<(std::ostream& os, + corsika::QuantityVector<TDimension> const& qv); } // namespace corsika diff --git a/corsika/framework/geometry/Vector.hpp b/corsika/framework/geometry/Vector.hpp index 0d37c66c7afb5460e09a8f0001ad248bbe59835c..fec720e4df43f33acb09aa536b6d6b482087cf5d 100644 --- a/corsika/framework/geometry/Vector.hpp +++ b/corsika/framework/geometry/Vector.hpp @@ -47,14 +47,14 @@ namespace corsika { * \todo this should best be protected, we don't want users to use * bare coordinates without reference frame */ - inline QuantityVector<TDimension> const& getComponents() const; - inline QuantityVector<TDimension>& getComponents(); + QuantityVector<TDimension> const& getComponents() const; + QuantityVector<TDimension>& getComponents(); /*! * returns a QuantityVector with the components given in an arbitrary * CoordinateSystem */ - inline QuantityVector<TDimension> getComponents(CoordinateSystemPtr const& pCS) const; + QuantityVector<TDimension> getComponents(CoordinateSystemPtr const& pCS) const; /** * this always returns a QuantityVector as triple @@ -63,7 +63,7 @@ namespace corsika { * is actually transformed to pCS, if needed. Thus, there may be an implicit call to * \ref rebase. **/ - inline QuantityVector<TDimension>& getComponents(CoordinateSystemPtr const& pCS); + QuantityVector<TDimension>& getComponents(CoordinateSystemPtr const& pCS); /** * \name Access coordinate components @@ -76,28 +76,28 @@ namespace corsika { * \{ **/ - inline quantity_type getX(CoordinateSystemPtr const& pCS) const; - inline quantity_type getY(CoordinateSystemPtr const& pCS) const; - inline quantity_type getZ(CoordinateSystemPtr const& pCS) const; + quantity_type getX(CoordinateSystemPtr const& pCS) const; + quantity_type getY(CoordinateSystemPtr const& pCS) const; + quantity_type getZ(CoordinateSystemPtr const& pCS) const; /** \} **/ /*! * transforms the Vector into another CoordinateSystem by changing * its components internally */ - inline void rebase(CoordinateSystemPtr const& pCS); + void rebase(CoordinateSystemPtr const& pCS); /*! * returns the norm/length of the Vector. Before using this method, * think about whether squaredNorm() might be cheaper for your computation. */ - inline quantity_type getNorm() const; + quantity_type getNorm() const; /*! * returns the squared norm of the Vector. Before using this method, * think about whether norm() might be cheaper for your computation. */ - inline quantity_square_type getSquaredNorm() const; + quantity_square_type getSquaredNorm() const; /*! * returns a Vector \f$ \vec{v}_{\parallel} \f$ which is the parallel projection diff --git a/corsika/framework/process/ProcessSequence.hpp b/corsika/framework/process/ProcessSequence.hpp index d909d07151c4d15a1bdf040af11ce46e8a930f24..30c270bcbf30acaf0c8a539aada621eb0618886e 100644 --- a/corsika/framework/process/ProcessSequence.hpp +++ b/corsika/framework/process/ProcessSequence.hpp @@ -118,11 +118,11 @@ namespace corsika { typename TParticle::node_type const& to); template <typename TParticle, typename TTrack> - inline ProcessReturn doContinuous(TParticle& particle, TTrack& vT, - ContinuousProcessIndex const limitID); + ProcessReturn doContinuous(TParticle& particle, TTrack& vT, + ContinuousProcessIndex const limitID); template <typename TSecondaries> - inline void doSecondaries(TSecondaries& vS); + void doSecondaries(TSecondaries& vS); /** The processes of type StackProcess do have an internal counter, @@ -132,53 +132,53 @@ namespace corsika { tested if either A_ or B_ are StackProcess and if they are due for execution. */ - inline bool checkStep(); + bool checkStep(); /** Execute the StackProcess-es in the ProcessSequence */ template <typename TStack> - inline void doStack(TStack& stack); + void doStack(TStack& stack); /** - * Determines the step-length limitation caused by ContinuousProcess-es in this - ProcessSequence. + * Calculate the maximum allowed length of the next tracking step, based on all + * ContinuousProcess-es * - * Returns a ContinuousProcessStepLength object, which contains both: the actual - * length (LengthType) as well as the index of the ContinuousProcess inside the - * ProcessSequence (for identification). - + * The maximum allowed step length is the minimum of the allowed track lenght over all + * ContinuousProcess-es in the ProcessSequence. + * + * \return: ContinuousProcessStepLength which contains the step length itself in + * LengthType, and a unique identifier of the related ContinuousProcess. **/ template <typename TParticle, typename TTrack> - inline ContinuousProcessStepLength getMaxStepLength(TParticle& particle, - TTrack& vTrack); + ContinuousProcessStepLength getMaxStepLength(TParticle& particle, TTrack& vTrack); template <typename TParticle> - inline GrammageType getInteractionLength(TParticle&& particle) { + GrammageType getInteractionLength(TParticle&& particle) { return 1. / getInverseInteractionLength(particle); } template <typename TParticle> - inline InverseGrammageType getInverseInteractionLength(TParticle&& particle); + InverseGrammageType getInverseInteractionLength(TParticle&& particle); template <typename TSecondaryView> - inline ProcessReturn selectInteraction( + ProcessReturn selectInteraction( TSecondaryView& view, [[maybe_unused]] InverseGrammageType lambda_inv_select, [[maybe_unused]] InverseGrammageType lambda_inv_sum = InverseGrammageType::zero()); template <typename TParticle> - inline TimeType getLifetime(TParticle& particle) { + TimeType getLifetime(TParticle& particle) { return 1. / getInverseLifetime(particle); } template <typename TParticle> - inline InverseTimeType getInverseLifetime(TParticle&& particle); + InverseTimeType getInverseLifetime(TParticle&& particle); // select decay process template <typename TSecondaryView> - inline ProcessReturn selectDecay( + ProcessReturn selectDecay( TSecondaryView& view, [[maybe_unused]] InverseTimeType decay_inv_select, [[maybe_unused]] InverseTimeType decay_inv_sum = InverseTimeType::zero()); @@ -219,7 +219,7 @@ namespace corsika { **/ template <typename... TProcesses, typename TProcess1> - inline typename std::enable_if_t< + typename std::enable_if_t< is_process_v<typename std::decay_t<TProcess1>>, ProcessSequence<TProcess1, decltype(make_sequence(std::declval<TProcesses>()...))>> make_sequence(TProcess1&& vA, TProcesses&&... vBs) { @@ -237,9 +237,9 @@ namespace corsika { * \param vB needs to derive BaseProcess or ProcessSequence **/ template <typename TProcess1, typename TProcess2> - inline typename std::enable_if_t<is_process_v<typename std::decay_t<TProcess1>> && - is_process_v<typename std::decay_t<TProcess2>>, - ProcessSequence<TProcess1, TProcess2>> + typename std::enable_if_t<is_process_v<typename std::decay_t<TProcess1>> && + is_process_v<typename std::decay_t<TProcess2>>, + ProcessSequence<TProcess1, TProcess2>> make_sequence(TProcess1&& vA, TProcess2&& vB) { return ProcessSequence<TProcess1, TProcess2>(vA, vB); } @@ -253,8 +253,8 @@ namespace corsika { * \param vA needs to derive from BaseProcess or ProcessSequence **/ template <typename TProcess> - inline typename std::enable_if_t<is_process_v<typename std::decay_t<TProcess>>, - ProcessSequence<TProcess, NullModel>> + typename std::enable_if_t<is_process_v<typename std::decay_t<TProcess>>, + ProcessSequence<TProcess, NullModel>> make_sequence(TProcess&& vA) { return ProcessSequence<TProcess, NullModel>(vA, NullModel()); } diff --git a/corsika/framework/process/SecondariesProcess.hpp b/corsika/framework/process/SecondariesProcess.hpp index 0d6db4783e48e6f6485f42a8e7b62e0fb285f8cf..daa45cc396f817e623ef107c9fdffd24099b8cbe 100644 --- a/corsika/framework/process/SecondariesProcess.hpp +++ b/corsika/framework/process/SecondariesProcess.hpp @@ -28,7 +28,7 @@ namespace corsika { /// here starts the interface-definition part // -> enforce TDerived to implement DoSecondaries... template <typename TSecondaries> - inline void doSecondaries(TSecondaries&); + void doSecondaries(TSecondaries&); }; } // namespace corsika diff --git a/corsika/framework/process/StackProcess.hpp b/corsika/framework/process/StackProcess.hpp index 77ca2a479cbc3404d372db701526a91895e6f2b6..7bf23c82c4b5e5a380e64ee8a3eb8632c0d2be2b 100644 --- a/corsika/framework/process/StackProcess.hpp +++ b/corsika/framework/process/StackProcess.hpp @@ -34,7 +34,7 @@ namespace corsika { /// here starts the interface-definition part // -> enforce TDerived to implement DoStack... template <typename TStack> - inline void doStack(TStack&); + void doStack(TStack&); int getStep() const { return iStep_; } bool checkStep() { return !((++iStep_) % nStep_); } diff --git a/corsika/framework/process/SwitchProcessSequence.hpp b/corsika/framework/process/SwitchProcessSequence.hpp index dcf4b214ec84f58bd69a44cf9cd47c2ae3f02a36..22da0facc5c5df27f38e03fadf02db014138cd60 100644 --- a/corsika/framework/process/SwitchProcessSequence.hpp +++ b/corsika/framework/process/SwitchProcessSequence.hpp @@ -132,41 +132,40 @@ namespace corsika { TVTNType const& to); template <typename TParticle, typename TTrack> - inline ProcessReturn doContinuous(TParticle& particle, TTrack& vT, - ContinuousProcessIndex const limitId); + ProcessReturn doContinuous(TParticle& particle, TTrack& vT, + ContinuousProcessIndex const limitId); template <typename TSecondaries> - inline void doSecondaries(TSecondaries& vS); + void doSecondaries(TSecondaries& vS); template <typename TParticle, typename TTrack> - inline ContinuousProcessStepLength getMaxStepLength(TParticle& particle, - TTrack& vTrack); + ContinuousProcessStepLength getMaxStepLength(TParticle& particle, TTrack& vTrack); template <typename TParticle> - inline GrammageType getInteractionLength(TParticle&& particle) { + GrammageType getInteractionLength(TParticle&& particle) { return 1. / getInverseInteractionLength(particle); } template <typename TParticle> - inline InverseGrammageType getInverseInteractionLength(TParticle&& particle); + InverseGrammageType getInverseInteractionLength(TParticle&& particle); template <typename TSecondaryView> - inline ProcessReturn selectInteraction( + ProcessReturn selectInteraction( TSecondaryView& view, [[maybe_unused]] InverseGrammageType lambda_inv_select, [[maybe_unused]] InverseGrammageType lambda_inv_sum = InverseGrammageType::zero()); template <typename TParticle> - inline TimeType getLifetime(TParticle&& particle) { + TimeType getLifetime(TParticle&& particle) { return 1. / getInverseLifetime(particle); } template <typename TParticle> - inline InverseTimeType getInverseLifetime(TParticle&& particle); + InverseTimeType getInverseLifetime(TParticle&& particle); // select decay process template <typename TSecondaryView> - inline ProcessReturn selectDecay( + ProcessReturn selectDecay( TSecondaryView& view, [[maybe_unused]] InverseTimeType decay_inv_select, [[maybe_unused]] InverseTimeType decay_inv_sum = InverseTimeType::zero()); @@ -197,9 +196,9 @@ namespace corsika { **/ template <typename TProcess1, typename TProcess2, typename TSelect> - inline typename std::enable_if_t<is_process_v<typename std::decay_t<TProcess1>> && - is_process_v<typename std::decay_t<TProcess2>>, - SwitchProcessSequence<TProcess1, TProcess2, TSelect>> + typename std::enable_if_t<is_process_v<typename std::decay_t<TProcess1>> && + is_process_v<typename std::decay_t<TProcess2>>, + SwitchProcessSequence<TProcess1, TProcess2, TSelect>> make_select(TProcess1&& vA, TProcess2&& vB, TSelect selector) { return SwitchProcessSequence<TProcess1, TProcess2, TSelect>(vA, vB, selector); } diff --git a/corsika/framework/random/RNGManager.hpp b/corsika/framework/random/RNGManager.hpp index 2dd6160e993d5a39b2aeb35f62be874047372cf3..0e687adf45d3a93dca4f2e0975d0b9b7d5b82c0d 100644 --- a/corsika/framework/random/RNGManager.hpp +++ b/corsika/framework/random/RNGManager.hpp @@ -43,36 +43,35 @@ namespace corsika { * * \throws sth. when stream \a pModuleName is already registered */ - inline void registerRandomStream(string_type const& streamName); + void registerRandomStream(string_type const& streamName); /*! * returns the pre-stored stream of given name \a pStreamName if * available */ - inline prng_type& getRandomStream(string_type const& streamName); + prng_type& getRandomStream(string_type const& streamName); /*! * Check whether a stream has been registered. */ - inline bool isRegistered(string_type const& streamName) const; + bool isRegistered(string_type const& streamName) const; /*! * dumps the names and states of all registered random-number streams * into a std::stringstream. */ - inline std::stringstream dumpState() const; + std::stringstream dumpState() const; /** * Set explicit seeds for all currently registered streams. The actual seed values * are incremented from \a vSeed. */ - inline void seedAll(seed_type seed); + void seedAll(seed_type seed); /** * Set seeds for all currently registered streams. */ - inline void seedAll( - void); //!< seed all currently registered streams with "real" randomness + void seedAll(void); //!< seed all currently registered streams with "real" randomness /** * @fn const streams_type getRngs&()const @@ -82,7 +81,7 @@ namespace corsika { * @post * @return RNGManager::streams_type */ - inline const streams_type& getRngs() const { return rngs_; } + const streams_type& getRngs() const { return rngs_; } /** * @fn const seeds_type getSeeds&()const @@ -92,7 +91,7 @@ namespace corsika { * @post * @return RNGManager::seeds_type */ - inline const seeds_type& getSeeds() const { return seeds_; } + const seeds_type& getSeeds() const { return seeds_; } /** * @fn streams_type Rngs() @@ -102,7 +101,7 @@ namespace corsika { * @post * @return RNGManager::streams_type& */ - inline streams_type Rngs() { return rngs_; } + streams_type Rngs() { return rngs_; } /** * @fn seeds_type Seeds&() @@ -112,7 +111,7 @@ namespace corsika { * @post * @return RNGManager::seeds_type& */ - inline seeds_type& Seeds() { return seeds_; } + seeds_type& getSeeds() { return seeds_; } protected: RNGManager() = default; diff --git a/corsika/framework/random/UniformRealDistribution.hpp b/corsika/framework/random/UniformRealDistribution.hpp index 781a23717a6fef420ee8ed3a8e8d658fa4c5e768..76f147de53008e534c76da5c1157d319c0c35e52 100644 --- a/corsika/framework/random/UniformRealDistribution.hpp +++ b/corsika/framework/random/UniformRealDistribution.hpp @@ -36,7 +36,7 @@ namespace corsika { : min_(other.getMin()) , max_(other.getMax()) {} - inline UniformRealDistribution<value_type>& operator=( + UniformRealDistribution<value_type>& operator=( UniformRealDistribution<value_type> const& other) { if (this == &other) return *this; min_ = other.getMin(); @@ -52,7 +52,7 @@ namespace corsika { * @post * @return quantity_type */ - inline value_type getMax() const { return max_; } + value_type getMax() const { return max_; } /** * @fn void setMax(quantity_type) @@ -62,7 +62,7 @@ namespace corsika { * @post * @param vMax */ - inline void setMax(value_type const& pmax) { max_ = pmax; } + void setMax(value_type const& pmax) { max_ = pmax; } /** * @fn quantity_type getMin()const @@ -72,7 +72,7 @@ namespace corsika { * @post * @return */ - inline value_type getMin() const { return min_; } + value_type getMin() const { return min_; } /** * @fn void setMin(quantity_type) @@ -82,7 +82,7 @@ namespace corsika { * @post * @param vMin */ - inline void setMin(value_type const& pmin) { min_ = pmin; } + void setMin(value_type const& pmin) { min_ = pmin; } /** * @fn quantity_type operator ()(Generator&) @@ -95,7 +95,7 @@ namespace corsika { * @return quantity_type */ template <class Generator> - inline value_type operator()(Generator& g) { + value_type operator()(Generator& g) { return min_ + dist_(g) * (max_ - min_); } diff --git a/corsika/framework/stack/CombinedStack.hpp b/corsika/framework/stack/CombinedStack.hpp index d452d8f8b469f7a79317036331d3c345f4d2b15e..e83e33a2f07e7a6f86de83bd516141ee8f77d398 100644 --- a/corsika/framework/stack/CombinedStack.hpp +++ b/corsika/framework/stack/CombinedStack.hpp @@ -67,21 +67,20 @@ namespace corsika { */ template <typename... TArgs1> - inline void setParticleData(std::tuple<TArgs1...> const vA); + void setParticleData(std::tuple<TArgs1...> const vA); template <typename... TArgs1, typename... TArgs2> - inline void setParticleData(std::tuple<TArgs1...> const vA, - std::tuple<TArgs2...> const vB); + void setParticleData(std::tuple<TArgs1...> const vA, std::tuple<TArgs2...> const vB); template <typename... TArgs1> - inline void setParticleData(pi_a_type& p, std::tuple<TArgs1...> const vA); + void setParticleData(pi_a_type& p, std::tuple<TArgs1...> const vA); template <typename... TArgs1, typename... TArgs2> - inline void setParticleData(pi_c_type& p, std::tuple<TArgs1...> const vA, - std::tuple<TArgs2...> const vB); + void setParticleData(pi_c_type& p, std::tuple<TArgs1...> const vA, + std::tuple<TArgs2...> const vB); ///@} - inline std::string asString() const; + std::string asString() const; protected: }; @@ -99,24 +98,24 @@ namespace corsika { struct CombinedStackImpl : public Stack1Impl, public Stack2Impl { public: - inline void clear(); + void clear(); - inline unsigned int getSize() const { return Stack1Impl::getSize(); } - inline unsigned int getCapacity() const { return Stack1Impl::getCapacity(); } + unsigned int getSize() const { return Stack1Impl::getSize(); } + unsigned int getCapacity() const { return Stack1Impl::getCapacity(); } /** * Function to copy particle at location i1 in stack to i2 */ - inline void copy(const unsigned int i1, const unsigned int i2); + void copy(const unsigned int i1, const unsigned int i2); /** * Function to copy particle at location i2 in stack to i1 */ - inline void swap(const unsigned int i1, const unsigned int i2); + void swap(const unsigned int i1, const unsigned int i2); - inline void incrementSize(); + void incrementSize(); - inline void decrementSize(); + void decrementSize(); }; // end class CombinedStackImpl diff --git a/corsika/framework/stack/ParticleBase.hpp b/corsika/framework/stack/ParticleBase.hpp index c7b086c5cdfe3eb612049e73da194b0e1b4431bc..2c62285d5fbcd26d4b06841809cd2a0f8bf8a602 100644 --- a/corsika/framework/stack/ParticleBase.hpp +++ b/corsika/framework/stack/ParticleBase.hpp @@ -58,13 +58,13 @@ namespace corsika { * Delete this particle on the stack. The corresponding iterator * will be invalidated by this operation */ - inline void erase() { this->getIterator().getStack().erase(this->getIterator()); } + void erase() { this->getIterator().getStack().erase(this->getIterator()); } /** * Method to retrieve the status of the Particle. Is it already deleted? Or not. */ - inline bool isErased() const { + bool isErased() const { return this->getIterator().getStack().isErased(this->getIterator()); } @@ -74,7 +74,7 @@ namespace corsika { * function description in the user defined ParticleInterface::AddSecondary(...) */ template <typename... TArgs> - inline stack_iterator_type addSecondary(const TArgs... args) { + stack_iterator_type addSecondary(const TArgs... args) { return this->getStack().addSecondary(this->getIterator(), args...); } @@ -84,11 +84,11 @@ namespace corsika { /** * return the corresponding StackIterator for this particle */ - inline stack_iterator_type& getIterator() { + stack_iterator_type& getIterator() { return static_cast<stack_iterator_type&>(*this); } - inline const stack_iterator_type& getIterator() const { + const stack_iterator_type& getIterator() const { return static_cast<const stack_iterator_type&>(*this); } @@ -99,21 +99,19 @@ namespace corsika { and getStackData to retrieve data @{ */ - inline auto& getStackData() { return this->getIterator().getStackData(); } + auto& getStackData() { return this->getIterator().getStackData(); } - inline const auto& getStackData() const { return this->getIterator().getStackData(); } + const auto& getStackData() const { return this->getIterator().getStackData(); } - inline auto& getStack() { return this->getIterator().getStack(); } + auto& getStack() { return this->getIterator().getStack(); } - inline const auto& getStack() const { return this->getIterator().getStack(); } + const auto& getStack() const { return this->getIterator().getStack(); } /** * return the index number of the underlying iterator object */ - inline std::size_t getIndex() const { - return this->getIterator().getIndexFromIterator(); - } + std::size_t getIndex() const { return this->getIterator().getIndexFromIterator(); } ///@} }; diff --git a/corsika/framework/stack/SecondaryView.hpp b/corsika/framework/stack/SecondaryView.hpp index e18531b3154e250ab44c33014a92355e0b9a877a..9e5f60324c17f7a4feb144a5a8b638b74fd88a8c 100644 --- a/corsika/framework/stack/SecondaryView.hpp +++ b/corsika/framework/stack/SecondaryView.hpp @@ -167,7 +167,7 @@ namespace corsika { * SecondaryView is derived from. This projectile should not be * used to modify the Stack! */ - inline stack_value_iterator parent() + stack_value_iterator parent() const { // todo: check if this can't be Conststack_value_iterator return stack_value_iterator(inner_stack_, projectile_index_); } @@ -177,7 +177,7 @@ namespace corsika { * SecondaryView is derived from. This projectile should not be * used to modify the Stack! */ - inline stack_value_iterator asNewParent() const { + stack_value_iterator asNewParent() const { return stack_value_iterator(inner_stack_, projectile_index_); } @@ -185,26 +185,36 @@ namespace corsika { * This return a projectile of this SecondaryView, which can be * used to modify the SecondaryView */ - inline stack_view_iterator getProjectile() { + stack_view_iterator getProjectile() { // NOTE: 0 is special marker here for PROJECTILE, see getIndexFromIterator return stack_view_iterator(*this, 0); } + + /** + * This return a projectile of this SecondaryView, which can be + * used to modify the SecondaryView + */ + const_stack_view_iterator getProjectile() const { + // NOTE: 0 is special marker here for PROJECTILE, see getIndexFromIterator + return const_stack_view_iterator(*this, 0); + } + /** * Method to add a new secondary particle on this SecondaryView */ template <typename... Args> - inline stack_view_iterator addSecondary(const Args... v); + stack_view_iterator addSecondary(const Args... v); /** * overwrite Stack::getSize to return actual number of secondaries */ - inline unsigned int getSize() const { return indices_.size(); } + unsigned int getSize() const { return indices_.size(); } - inline unsigned int getEntries() const { + unsigned int getEntries() const { return getSize() - inner_stack_reference_type::getErased(); } - inline bool isEmpty() const { return getEntries() == 0; } + bool isEmpty() const { return getEntries() == 0; } /** * @name These are functions required by std containers and std loops @@ -214,48 +224,46 @@ namespace corsika { */ // NOTE: the "+1" is since "0" is special marker here for PROJECTILE, see // getIndexFromIterator - inline stack_view_iterator begin(); + stack_view_iterator begin(); - inline stack_view_iterator end() { return stack_view_iterator(*this, getSize() + 1); } + stack_view_iterator end() { return stack_view_iterator(*this, getSize() + 1); } - inline stack_view_iterator last(); + stack_view_iterator last(); - inline const_stack_view_iterator begin() const; + const_stack_view_iterator begin() const; - inline const_stack_view_iterator end() const { + const_stack_view_iterator end() const { return const_stack_view_iterator(*this, getSize() + 1); } - inline const_stack_view_iterator last() const; + const_stack_view_iterator last() const; - inline const_stack_view_iterator cbegin() const; + const_stack_view_iterator cbegin() const; - inline const_stack_view_iterator cend() const { + const_stack_view_iterator cend() const { return const_stack_view_iterator(*this, getSize()); } - inline const_stack_view_iterator clast() const; + const_stack_view_iterator clast() const; - inline stack_view_iterator at(unsigned int i) { - return stack_view_iterator(*this, i); - } + stack_view_iterator at(unsigned int i) { return stack_view_iterator(*this, i); } - inline const_stack_view_iterator at(unsigned int i) const { + const_stack_view_iterator at(unsigned int i) const { return const_stack_view_iterator(*this, i); } - inline stack_view_iterator first() { return stack_view_iterator{*this, 0}; } + stack_view_iterator first() { return stack_view_iterator{*this, 0}; } - inline const_stack_view_iterator cfirst() const { + const_stack_view_iterator cfirst() const { return const_stack_view_iterator{*this, 0}; } /// @} - inline void swap(stack_view_iterator a, stack_view_iterator b); + void swap(stack_view_iterator a, stack_view_iterator b); - inline void copy(stack_view_iterator a, stack_view_iterator b); + void copy(stack_view_iterator a, stack_view_iterator b); - inline void copy(const_stack_view_iterator a, stack_view_iterator b); + void copy(const_stack_view_iterator a, stack_view_iterator b); /** * need overwrite Stack::Delete, since we want to call @@ -269,13 +277,13 @@ namespace corsika { * remove the last particle. * */ - inline void erase(stack_view_iterator p); + void erase(stack_view_iterator p); /** * return next particle from stack, need to overwrtie Stack::getNextParticle to get * right reference */ - inline stack_view_iterator getNextParticle() { + stack_view_iterator getNextParticle() { while (purgeLastIfDeleted()) {} return last(); } @@ -286,21 +294,21 @@ namespace corsika { * need to re-implement for SecondaryView since stack_view_iterator types are a bit * different */ - inline bool isErased(const stack_view_iterator& p) const { + bool isErased(const stack_view_iterator& p) const { return isErased(p.getIndex() - 1); } - inline bool isErased(const const_stack_view_iterator& p) const { + bool isErased(const const_stack_view_iterator& p) const { return isErased(p.getIndex() - 1); } /** * delete this particle */ - inline bool isErased(const ParticleInterfaceType& p) const { + bool isErased(const ParticleInterfaceType& p) const { return isErased(p.getIterator()); } - inline bool isDeleted(const const_stack_view_iterator& p) const { + bool isDeleted(const const_stack_view_iterator& p) const { return isDeleted(p.getIndex() - 1); } /** @@ -308,7 +316,7 @@ namespace corsika { * if it was marked as deleted before. If this is not the case, * the function will just return false and do nothing. */ - inline bool purgeLastIfDeleted(); + bool purgeLastIfDeleted(); /** * Function to ultimatively remove all entries from the stack @@ -318,9 +326,9 @@ namespace corsika { * "gaps" in the stack are filled with entries from the back * (copied). */ - inline void purge(); + void purge(); - inline std::string asString() const; + std::string asString() const; protected: friend class StackIteratorInterface< @@ -343,11 +351,11 @@ namespace corsika { * stack_view_iterator::addSecondary via ParticleBase */ template <typename... Args> - inline stack_view_iterator addSecondary(stack_view_iterator& proj, const Args... v); + stack_view_iterator addSecondary(stack_view_iterator& proj, const Args... v); // forward to inner stack // this also checks the allowed bounds of 'i' - inline bool isErased(unsigned int i) const { + bool isErased(unsigned int i) const { if (i >= indices_.size()) return false; return inner_stack_.isErased(getIndexFromIterator(i + 1)); } @@ -357,7 +365,7 @@ namespace corsika { * function the conversion form iterator-index to stack-index is * performed. */ - inline unsigned int getIndexFromIterator(const unsigned int vI) const { + unsigned int getIndexFromIterator(const unsigned int vI) const { // this is too much: CORSIKA_LOG_TRACE("SecondaryView::getIndexFromIterator({})={}", // vI, (vI?indices_[vI-1]:projectile_index_)); if (vI == 0) return projectile_index_; @@ -389,7 +397,7 @@ namespace corsika { * is of course a reference into the SecondaryView itself. */ template <typename Particle> - inline void new_secondary(Particle&&) const { + void new_secondary(Particle&&) const { CORSIKA_LOG_TRACE("DefaultSecondaryProducer::new_secondary(Particle&&)"); } @@ -402,7 +410,7 @@ namespace corsika { * itself. */ template <typename Particle> - inline DefaultSecondaryProducer(Particle const&) { + DefaultSecondaryProducer(Particle const&) { CORSIKA_LOG_TRACE("DefaultSecondaryProducer::DefaultSecondaryProducer(Particle&)"); } diff --git a/corsika/framework/stack/Stack.hpp b/corsika/framework/stack/Stack.hpp index e72dc94dbeb304258aab5206fb7e4552474725d4..2ff173fb3ccabcd8d5944ce4dc7452cd96314f80 100644 --- a/corsika/framework/stack/Stack.hpp +++ b/corsika/framework/stack/Stack.hpp @@ -152,89 +152,89 @@ namespace corsika { * @name Most generic proxy methods for StackData data_ * @{ */ - inline unsigned int getCapacity() const { return data_.getCapacity(); } + unsigned int getCapacity() const { return data_.getCapacity(); } - inline unsigned int getErased() const { return nDeleted_; } + unsigned int getErased() const { return nDeleted_; } - inline unsigned int getEntries() const { return getSize() - getErased(); } + unsigned int getEntries() const { return getSize() - getErased(); } template <typename... TArgs> - inline void clear(TArgs... args); + void clear(TArgs... args); ///@} /** * @name These are functions required by std containers and std loops * @{ */ - inline stack_iterator_type begin(); + stack_iterator_type begin(); - inline stack_iterator_type end(); + stack_iterator_type end(); - inline stack_iterator_type last(); + stack_iterator_type last(); - inline const_stack_iterator_type begin() const; + const_stack_iterator_type begin() const; - inline const_stack_iterator_type end() const; + const_stack_iterator_type end() const; - inline const_stack_iterator_type last() const; + const_stack_iterator_type last() const; - inline const_stack_iterator_type cbegin() const; + const_stack_iterator_type cbegin() const; - inline const_stack_iterator_type cend() const; + const_stack_iterator_type cend() const; - inline const_stack_iterator_type clast() const; + const_stack_iterator_type clast() const; - inline stack_iterator_type at(unsigned int i); + stack_iterator_type at(unsigned int i); - inline const_stack_iterator_type at(unsigned int i) const; + const_stack_iterator_type at(unsigned int i) const; - inline stack_iterator_type first(); + stack_iterator_type first(); - inline const_stack_iterator_type cfirst() const; + const_stack_iterator_type cfirst() const; - inline stack_iterator_type getNextParticle(); + stack_iterator_type getNextParticle(); /** * increase stack size, create new particle at end of stack */ template <typename... TArgs> - inline stack_iterator_type addParticle(const TArgs... v); + stack_iterator_type addParticle(const TArgs... v); - inline void swap(stack_iterator_type a, stack_iterator_type b); + void swap(stack_iterator_type a, stack_iterator_type b); - inline void copy(stack_iterator_type a, stack_iterator_type b); + void copy(stack_iterator_type a, stack_iterator_type b); - inline void copy(const_stack_iterator_type a, stack_iterator_type b); + void copy(const_stack_iterator_type a, stack_iterator_type b); - inline void erase(stack_iterator_type p); + void erase(stack_iterator_type p); /** * delete this particle */ - inline void erase(particle_interface_type p); + void erase(particle_interface_type p); /** * check if there are no further non-deleted particles on stack */ - - inline bool isEmpty(); + bool isEmpty(); /** * check if this particle was already deleted */ - inline bool isErased(const stack_iterator_type& p) const; + bool isErased(const stack_iterator_type& p) const; - inline bool isErased(const const_stack_iterator_type& p) const; + bool isErased(const const_stack_iterator_type& p) const; - inline bool isErased(const particle_interface_type& p) const; + bool isErased(const particle_interface_type& p) const; /** * Function to ultimatively remove the last entry from the stack, * if it was marked as deleted before. If this is not the case, * the function will just return false and do nothing. */ - inline bool purgeLastIfDeleted(); + bool purgeLastIfDeleted(); + /** * Function to ultimatively remove all entries from the stack * marked as deleted. @@ -243,11 +243,11 @@ namespace corsika { * "gaps" in the stack are filled with entries from the back * (copied). */ - inline void purge(); + void purge(); - inline unsigned int getSize() const; + unsigned int getSize() const; - inline std::string asString() const; + std::string asString() const; protected: /** @@ -258,22 +258,21 @@ namespace corsika { * StackIterator::AddSecondary via ParticleBase */ template <typename... TArgs> - inline stack_iterator_type addSecondary(stack_iterator_type& parent, - const TArgs... v); + stack_iterator_type addSecondary(stack_iterator_type& parent, const TArgs... v); - inline void swap(unsigned int const a, unsigned int const b); + void swap(unsigned int const a, unsigned int const b); - inline void copy(unsigned int const a, unsigned int const b); + void copy(unsigned int const a, unsigned int const b); - inline bool isErased(unsigned int const i) const; + bool isErased(unsigned int const i) const; - inline void erase(unsigned int const i); + void erase(unsigned int const i); /** * will remove from storage the element i. This is a helper * function for SecondaryView. */ - inline void purge(unsigned int i); + void purge(unsigned int i); /** * Function to perform eventual transformation from @@ -281,15 +280,15 @@ namespace corsika { * StackData data_. By default (and in almost all cases) this * should just be identiy. See class SecondaryView for an alternative implementation. */ - inline unsigned int getIndexFromIterator(const unsigned int vI) const; + unsigned int getIndexFromIterator(const unsigned int vI) const; /** * @name Return reference to StackData object data_ for data access * @{ */ - inline value_type& getStackData(); + value_type& getStackData(); - inline const value_type& getStackData() const; + const value_type& getStackData() const; friend class StackIteratorInterface<value_type, MParticleInterface, Stack>; friend class ConstStackIteratorInterface<value_type, MParticleInterface, Stack>; diff --git a/corsika/framework/stack/StackIteratorInterface.hpp b/corsika/framework/stack/StackIteratorInterface.hpp index f6240e87800d9232bb100587d68dde50850cb2a5..76815746af5ab15ce5aa61fc48c2f2249f987b32 100644 --- a/corsika/framework/stack/StackIteratorInterface.hpp +++ b/corsika/framework/stack/StackIteratorInterface.hpp @@ -146,14 +146,14 @@ namespace corsika { /** @name Iterator interface @{ **/ - inline StackIteratorInterface& operator++() { + StackIteratorInterface& operator++() { do { ++index_; } while ( getStack().isErased(*this)); // this also check the allowed bounds of index_ return *this; } - inline StackIteratorInterface operator++(int) { + StackIteratorInterface operator++(int) { StackIteratorInterface tmp(*this); do { ++index_; @@ -161,19 +161,19 @@ namespace corsika { getStack().isErased(*this)); // this also check the allowed bounds of index_ return tmp; } - inline StackIteratorInterface operator+(int delta) const { + StackIteratorInterface operator+(int delta) const { return StackIteratorInterface(*data_, index_ + delta); } - inline bool operator==(StackIteratorInterface const& rhs) const { + bool operator==(StackIteratorInterface const& rhs) const { return index_ == rhs.index_; } - inline bool operator!=(StackIteratorInterface const& rhs) const { + bool operator!=(StackIteratorInterface const& rhs) const { return index_ != rhs.index_; } - inline bool operator==( + bool operator==( const ConstStackIteratorInterface<TStackData, TParticleInterface, TStackType>& rhs) const; // implemented below - inline bool operator!=( + bool operator!=( const ConstStackIteratorInterface<TStackData, TParticleInterface, TStackType>& rhs) const; // implemented below @@ -181,7 +181,7 @@ namespace corsika { * Convert iterator to value type, where value type is the user-provided particle * readout class **/ - inline particle_interface_type& operator*() { + particle_interface_type& operator*() { return static_cast<particle_interface_type&>(*this); } @@ -189,7 +189,7 @@ namespace corsika { * Convert iterator to const value type, where value type is the user-provided * particle readout class **/ - inline particle_interface_type const& operator*() const { + particle_interface_type const& operator*() const { return static_cast<particle_interface_type const&>(*this); } ///@} @@ -200,17 +200,17 @@ namespace corsika { * @{ **/ /// Get current particle index - inline unsigned int getIndex() const { return index_; } + unsigned int getIndex() const { return index_; } /// Get current particle Stack object - inline TStackType& getStack() { return *data_; } + TStackType& getStack() { return *data_; } /// Get current particle const Stack object - inline TStackType const& getStack() const { return *data_; } + TStackType const& getStack() const { return *data_; } /// Get current user particle TStackData object - inline TStackData& getStackData() { return data_->getStackData(); } + TStackData& getStackData() { return data_->getStackData(); } /// Get current const user particle TStackData object - inline TStackData const& getStackData() const { return data_->getStackData(); } + TStackData const& getStackData() const { return data_->getStackData(); } /// Get data index as mapped in Stack class - inline unsigned int getIndexFromIterator() const { + unsigned int getIndexFromIterator() const { return data_->getIndexFromIterator(index_); } ///@} @@ -326,11 +326,11 @@ namespace corsika { Only the const versions for read-only access @{ */ - inline unsigned int getIndex() const { return index_; } - inline TStackType const& getStack() const { return *data_; } - inline TStackData const& getStackData() const { return data_->getStackData(); } + unsigned int getIndex() const { return index_; } + TStackType const& getStack() const { return *data_; } + TStackData const& getStackData() const { return data_->getStackData(); } /// Get data index as mapped in Stack class - inline unsigned int getIndexFromIterator() const { + unsigned int getIndexFromIterator() const { return data_->getIndexFromIterator(index_); } ///@} diff --git a/corsika/framework/utility/COMBoost.hpp b/corsika/framework/utility/COMBoost.hpp index 63b8f0a4420f258569bebcc44a2e3f361f6ba6fe..befd3025035105a184f33c1c2a872c750364665e 100644 --- a/corsika/framework/utility/COMBoost.hpp +++ b/corsika/framework/utility/COMBoost.hpp @@ -35,16 +35,16 @@ namespace corsika { //! transforms a 4-momentum from lab frame to the center-of-mass frame template <typename FourVector> - inline FourVector toCoM(FourVector const& p) const; + FourVector toCoM(FourVector const& p) const; //! transforms a 4-momentum from the center-of-mass frame back to lab frame template <typename FourVector> - inline FourVector fromCoM(FourVector const& p) const; + FourVector fromCoM(FourVector const& p) const; - inline CoordinateSystemPtr getRotatedCS() const; + CoordinateSystemPtr getRotatedCS() const; protected: - inline void setBoost(double coshEta, double sinhEta); + void setBoost(double coshEta, double sinhEta); private: Eigen::Matrix2d boost_; diff --git a/corsika/framework/utility/SaveBoostHistogram.hpp b/corsika/framework/utility/SaveBoostHistogram.hpp index 90a5621bd54715964a117b041380d20470cf4af3..14e0379966c447cd0c2f8cfa7ccffcf3c29a0478 100644 --- a/corsika/framework/utility/SaveBoostHistogram.hpp +++ b/corsika/framework/utility/SaveBoostHistogram.hpp @@ -24,8 +24,8 @@ namespace corsika { * runtime_error */ template <class Axes, class Storage> - inline void save_hist(boost::histogram::histogram<Axes, Storage> const& h, - std::string const& filename, bool overwrite = true); + void save_hist(boost::histogram::histogram<Axes, Storage> const& h, + std::string const& filename, bool overwrite = true); } // namespace corsika #include <corsika/detail/framework/utility/SaveBoostHistogram.inl> diff --git a/corsika/framework/utility/Singleton.hpp b/corsika/framework/utility/Singleton.hpp index 78a7df97b6c0aa3c221a5404eaa68dcfde6afce6..d67fca048ab759523e65ff5dbb5298732380cb4e 100644 --- a/corsika/framework/utility/Singleton.hpp +++ b/corsika/framework/utility/Singleton.hpp @@ -8,8 +8,6 @@ #pragma once -//#define OFFLINE_USE_GAMMA_SINGLETON - namespace corsika { /** * \class Singleton Singleton.h utl/Singleton.h diff --git a/corsika/media/NameModel.hpp b/corsika/media/NameModel.hpp index 8fe9698ed0bf9ca9684e03491b5ecb9d5122c5d9..f046809c3efe08bc8b97568b854251a904f402d4 100644 --- a/corsika/media/NameModel.hpp +++ b/corsika/media/NameModel.hpp @@ -9,7 +9,6 @@ #pragma once #include <string> -//#include <utility> namespace corsika { diff --git a/corsika/media/NuclearComposition.hpp b/corsika/media/NuclearComposition.hpp index f8f08704d3bc1f97deba819c886d6d2abd4b5ca9..5341554cd3f132d7c6415112a6eca72058de025b 100644 --- a/corsika/media/NuclearComposition.hpp +++ b/corsika/media/NuclearComposition.hpp @@ -33,8 +33,8 @@ namespace corsika { * @param pFractions List of fractions how much each particle contributes. The sum * needs to add up to 1 **/ - inline NuclearComposition(std::vector<Code> const& pComponents, - std::vector<float> const& pFractions); + NuclearComposition(std::vector<Code> const& pComponents, + std::vector<float> const& pFractions); /** Sum all all relative composition weighted by func(element) * This function sums all relative compositions given during this classes @@ -46,29 +46,29 @@ namespace corsika { * @retval returns the weighted sum with the type defined by the return type of func **/ template <typename TFunction> - inline auto getWeightedSum(TFunction const& func) const; + auto getWeightedSum(TFunction const& func) const; /** Number of elements in the composition array * @retval returns the number of elements in the composition array **/ - inline size_t getSize() const; + size_t getSize() const; /// Returns a const reference to the fraction - inline std::vector<float> const& getFractions() const; + std::vector<float> const& getFractions() const; /// Returns a const reference to the fraction - inline std::vector<Code> const& getComponents() const; - inline double const getAverageMassNumber() const; + std::vector<Code> const& getComponents() const; + double const getAverageMassNumber() const; template <class TRNG> - inline Code sampleTarget(std::vector<CrossSectionType> const& sigma, - TRNG& randomStream) const; + Code sampleTarget(std::vector<CrossSectionType> const& sigma, + TRNG& randomStream) const; // Note: when this class ever modifies its internal data, the hash // must be updated, too! - inline size_t getHash() const; + size_t getHash() const; private: - inline void updateHash(); + void updateHash(); std::vector<float> const numberFractions_; //!< relative fractions of number density std::vector<Code> const components_; //!< particle codes of consitutents diff --git a/corsika/media/Universe.hpp b/corsika/media/Universe.hpp index cdd5c2bd297d5bc39ac27f91e8eeecf7b9b7bf95..e481052d985f87397381f9a1bc554fbfe292159f 100644 --- a/corsika/media/Universe.hpp +++ b/corsika/media/Universe.hpp @@ -14,8 +14,8 @@ namespace corsika { struct Universe : public corsika::Sphere { - inline Universe(corsika::CoordinateSystemPtr const& pCS); - inline bool contains(corsika::Point const&) const override; + Universe(corsika::CoordinateSystemPtr const& pCS); + bool contains(corsika::Point const&) const override; }; } // namespace corsika diff --git a/corsika/media/VolumeTreeNode.hpp b/corsika/media/VolumeTreeNode.hpp index fba07bc585043bf592bd7cfdfe1b41cddb10332a..dd4b11c34ac8a45f91ed32ff1319ab3f2cf4cbbd 100644 --- a/corsika/media/VolumeTreeNode.hpp +++ b/corsika/media/VolumeTreeNode.hpp @@ -29,15 +29,14 @@ namespace corsika { : geoVolume_(std::move(pVolume)) {} //! convenience function equivalent to Volume::isInside - inline bool contains(Point const& p) const; + bool contains(Point const& p) const; - inline VolumeTreeNode<IModelProperties> const* excludes(Point const& p) const; + VolumeTreeNode<IModelProperties> const* excludes(Point const& p) const; /** returns a pointer to the sub-VolumeTreeNode which is "responsible" for the given * \class Point \p p, or nullptr iff \p p is not contained in this volume. */ - inline VolumeTreeNode<IModelProperties> const* getContainingNode( - Point const& p) const; + VolumeTreeNode<IModelProperties> const* getContainingNode(Point const& p) const; /** * Traverses the VolumeTree pre- or post-order and calls the functor \p func for each @@ -45,33 +44,33 @@ namespace corsika { * func is ignored. */ template <typename TCallable, bool preorder = true> - inline void walk(TCallable func); + void walk(TCallable func); - inline void addChild(VTNUPtr pChild); + void addChild(VTNUPtr pChild); - inline void excludeOverlapWith(VTNUPtr const& pNode); + void excludeOverlapWith(VTNUPtr const& pNode); - inline VTN_type const* getParent() const { return parentNode_; }; + VTN_type const* getParent() const { return parentNode_; }; - inline auto const& getChildNodes() const { return childNodes_; } + auto const& getChildNodes() const { return childNodes_; } - inline auto const& getExcludedNodes() const { return excludedNodes_; } + auto const& getExcludedNodes() const { return excludedNodes_; } - inline auto const& getVolume() const { return *geoVolume_; } + auto const& getVolume() const { return *geoVolume_; } - inline auto const& getModelProperties() const { return *modelProperties_; } + auto const& getModelProperties() const { return *modelProperties_; } - inline bool hasModelProperties() const { return modelProperties_.get() != nullptr; } + bool hasModelProperties() const { return modelProperties_.get() != nullptr; } template <typename ModelProperties, typename... Args> - inline auto setModelProperties(Args&&... args) { + auto setModelProperties(Args&&... args) { // static_assert(std::is_base_of_v<IModelProperties, ModelProperties>, // "unusable type provided"); modelProperties_ = std::make_shared<ModelProperties>(std::forward<Args>(args)...); return modelProperties_; } - inline void setModelProperties(IMPSharedPtr ptr) { modelProperties_ = ptr; } + void setModelProperties(IMPSharedPtr ptr) { modelProperties_ = ptr; } // template <class MediumType, typename... Args> // static auto createMedium(Args&&... args); diff --git a/corsika/modules/qgsjetII/Interaction.hpp b/corsika/modules/qgsjetII/Interaction.hpp index 004788f138980e9a07ffe2c1fe8d86444970180c..a45282f58ae3073237adf19a3c0c739d6153047c 100644 --- a/corsika/modules/qgsjetII/Interaction.hpp +++ b/corsika/modules/qgsjetII/Interaction.hpp @@ -12,9 +12,6 @@ #include <corsika/framework/core/PhysicalUnits.hpp> #include <corsika/framework/random/RNGManager.hpp> #include <corsika/framework/process/InteractionProcess.hpp> - -#include <corsika/modules/qgsjetII/Random.hpp> - #include <corsika/modules/qgsjetII/ParticleConversion.hpp> #include <qgsjet-II-04.hpp> diff --git a/corsika/modules/tracking/TrackingLeapFrogCurved.hpp b/corsika/modules/tracking/TrackingLeapFrogCurved.hpp index dff4bc18ea42ee6ab0d399ad1b2dc7d3b9e185aa..5eb28160818abf42f7a4a743165515f2254d89dc 100644 --- a/corsika/modules/tracking/TrackingLeapFrogCurved.hpp +++ b/corsika/modules/tracking/TrackingLeapFrogCurved.hpp @@ -60,13 +60,18 @@ namespace corsika { template <typename TParticle> auto getTrack(TParticle const& particle); - template <typename TParticle, typename TMedium> - static Intersections intersect(const TParticle& particle, const Sphere& sphere, - const TMedium& medium); + //! find intersection of Sphere with Track + template <typename TParticle> + static Intersections intersect(TParticle const& particle, Sphere const& sphere); + //! find intersection of Volume node with Track of particle template <typename TParticle, typename TBaseNodeType> - static Intersections intersect(const TParticle& particle, - const TBaseNodeType& volumeNode); + static Intersections intersect(TParticle const& particle, + TBaseNodeType const& node); + + //! find intersection of Plane with Track + template <typename TParticle> + static Intersections intersect(TParticle const& particle, Plane const& plane); protected: /** diff --git a/corsika/modules/tracking/TrackingStraight.hpp b/corsika/modules/tracking/TrackingStraight.hpp index b77f8fd211b6c2459e012389b6fa6939088494da..4b498bfa522d5856b2251435a437c7ec42681687 100644 --- a/corsika/modules/tracking/TrackingStraight.hpp +++ b/corsika/modules/tracking/TrackingStraight.hpp @@ -41,19 +41,16 @@ namespace corsika::tracking_line { auto getTrack(TParticle const& particle); //! find intersection of Sphere with Track - template <typename TParticle, typename TMedium> - static Intersections intersect(TParticle const& particle, Sphere const& sphere, - TMedium const&); + template <typename TParticle> + static Intersections intersect(TParticle const& particle, Sphere const& sphere); - //! find intersection of Volume with Track + //! find intersection of Volume node with Track of particle template <typename TParticle, typename TBaseNodeType> - static Intersections intersect(TParticle const& particle, - TBaseNodeType const& volumeNode); + static Intersections intersect(TParticle const& particle, TBaseNodeType const& node); //! find intersection of Plane with Track - template <typename TParticle, typename TMedium> - static Intersections intersect(TParticle const& particle, Plane const& plane, - TMedium const&); + template <typename TParticle> + static Intersections intersect(TParticle const& particle, Plane const& plane); }; } // namespace corsika::tracking_line diff --git a/corsika/setup/SetupTrajectory.hpp b/corsika/setup/SetupTrajectory.hpp index fdbfcbeaa4d0a678a15583c5ceef93d3b5d3c31f..95a91115b0aa422c860448fa8057d70c35f95456 100644 --- a/corsika/setup/SetupTrajectory.hpp +++ b/corsika/setup/SetupTrajectory.hpp @@ -38,15 +38,15 @@ namespace corsika::setup { The default tracking algorithm. */ - // typedef corsika::process::tracking_leapfrog_curved::Tracking Tracking; - // typedef corsika::process::tracking_leapfrog_straight::Tracking Tracking; - typedef corsika::tracking_line::Tracking Tracking; + typedef corsika::tracking_leapfrog_curved::Tracking Tracking; + // typedef corsika::tracking_leapfrog_straight::Tracking Tracking; + // typedef corsika::tracking_line::Tracking Tracking; /** The default trajectory. */ /// definition of Trajectory base class, to be used in tracking and cascades - typedef StraightTrajectory Trajectory; - // typedef corsika::geometry::LeapFrogTrajectory Trajectory; + // typedef StraightTrajectory Trajectory; + typedef corsika::LeapFrogTrajectory Trajectory; } // namespace corsika::setup diff --git a/corsika/stack/DummyStack.hpp b/corsika/stack/DummyStack.hpp index bbbfff91a46e1c2a3348040105f0e0afdb0a5855..9bbd51403f98fd53b9d64c92460bcbaeafece400 100644 --- a/corsika/stack/DummyStack.hpp +++ b/corsika/stack/DummyStack.hpp @@ -61,21 +61,21 @@ namespace corsika::dummy_stack { void init() { entries_ = 0; } - inline void clear() { entries_ = 0; } + void clear() { entries_ = 0; } - inline int getSize() const { return entries_; } - inline int getCapacity() const { return entries_; } + int getSize() const { return entries_; } + int getCapacity() const { return entries_; } /** * Function to copy particle at location i2 in stack to i1 */ - inline void copy(const int /*i1*/, const int /*i2*/) {} + void copy(const int /*i1*/, const int /*i2*/) {} - inline void incrementSize() { entries_++; } - inline void decrementSize() { entries_--; } + void incrementSize() { entries_++; } + void decrementSize() { entries_--; } - inline int getEntries() const { return entries_; } - inline void setEntries(int entries = 0) { entries_ = entries; } + int getEntries() const { return entries_; } + void setEntries(int entries = 0) { entries_ = entries; } private: int entries_ = 0; diff --git a/corsika/stack/GeometryNodeStackExtension.hpp b/corsika/stack/GeometryNodeStackExtension.hpp index b3a15854f58af04c8bae6ceecb0ba9e25644343e..e7298bea4bc4b04d5869ee70f440c3398b90d52a 100644 --- a/corsika/stack/GeometryNodeStackExtension.hpp +++ b/corsika/stack/GeometryNodeStackExtension.hpp @@ -38,28 +38,26 @@ namespace corsika::node { typedef typename TEnvType::BaseNodeType node_type; // default version for particle-creation from input data - inline void setParticleData(const std::tuple<node_type const*> v) { + void setParticleData(const std::tuple<node_type const*> v) { setNode(std::get<0>(v)); } - inline void setParticleData(GeometryDataInterface& parent, - const std::tuple<node_type const*>) { + void setParticleData(GeometryDataInterface& parent, + const std::tuple<node_type const*>) { setNode(parent.getNode()); // copy Node from parent particle! } - inline void setParticleData() { setNode(nullptr); } - inline void setParticleData(GeometryDataInterface& parent) { + void setParticleData() { setNode(nullptr); } + void setParticleData(GeometryDataInterface& parent) { setNode(parent.getNode()); // copy Node from parent particle! } - inline std::string asString() const { - return fmt::format("node={}", fmt::ptr(getNode())); - } + std::string asString() const { return fmt::format("node={}", fmt::ptr(getNode())); } - inline void setNode(node_type const* v) { + void setNode(node_type const* v) { super_type::getStackData().setNode(super_type::getIndex(), v); } - inline node_type const* getNode() const { + node_type const* getNode() const { return super_type::getStackData().getNode(super_type::getIndex()); } }; @@ -89,27 +87,27 @@ namespace corsika::node { GeometryData<TEnvType>& operator=(GeometryData<TEnvType>&&) = default; // these functions are needed for the Stack interface - inline void clear() { node_vector_.clear(); } + void clear() { node_vector_.clear(); } - inline unsigned int getSize() const { return node_vector_.size(); } + unsigned int getSize() const { return node_vector_.size(); } - inline unsigned int getCapacity() const { return node_vector_.size(); } + unsigned int getCapacity() const { return node_vector_.size(); } - inline void copy(const int i1, const int i2) { node_vector_[i2] = node_vector_[i1]; } + void copy(const int i1, const int i2) { node_vector_[i2] = node_vector_[i1]; } - inline void swap(const int i1, const int i2) { + void swap(const int i1, const int i2) { std::swap(node_vector_[i1], node_vector_[i2]); } // custom data access function - inline void setNode(const int i, node_type const* v) { node_vector_[i] = v; } + void setNode(const int i, node_type const* v) { node_vector_[i] = v; } - inline node_type const* getNode(const int i) const { return node_vector_[i]; } + node_type const* getNode(const int i) const { return node_vector_[i]; } // these functions are also needed by the Stack interface - inline void incrementSize() { node_vector_.push_back(nullptr); } + void incrementSize() { node_vector_.push_back(nullptr); } - inline void decrementSize() { + void decrementSize() { if (node_vector_.size() > 0) { node_vector_.pop_back(); } } diff --git a/corsika/stack/NuclearStackExtension.hpp b/corsika/stack/NuclearStackExtension.hpp index 5d8d573ed35b35b79fa6770461c922c61150a1ea..34bd1377d99a5167b2ac406e506a4c8492173bc3 100644 --- a/corsika/stack/NuclearStackExtension.hpp +++ b/corsika/stack/NuclearStackExtension.hpp @@ -54,24 +54,24 @@ namespace corsika::nuclear_stack { unsigned short, unsigned short> altenative_particle_data_type; - inline void setParticleData(particle_data_type const& v); + void setParticleData(particle_data_type const& v); - inline void setParticleData(altenative_particle_data_type const& v); + void setParticleData(altenative_particle_data_type const& v); - inline void setParticleData(super_type& p, particle_data_type const& v); + void setParticleData(super_type& p, particle_data_type const& v); - inline void setParticleData(super_type& p, altenative_particle_data_type const& v); + void setParticleData(super_type& p, altenative_particle_data_type const& v); - inline std::string asString() const; + std::string asString() const; /** * @name individual setters * @{ */ - inline void setNuclearA(const unsigned short vA) { + void setNuclearA(const unsigned short vA) { super_type::getStackData().setNuclearA(super_type::getIndex(), vA); } - inline void setNuclearZ(const unsigned short vZ) { + void setNuclearZ(const unsigned short vZ) { super_type::getStackData().setNuclearZ(super_type::getIndex(), vZ); } /// @} @@ -80,10 +80,10 @@ namespace corsika::nuclear_stack { * @name individual getters * @{ */ - inline int getNuclearA() const { + int getNuclearA() const { return super_type::getStackData().getNuclearA(super_type::getIndex()); } - inline int getNuclearZ() const { + int getNuclearZ() const { return super_type::getStackData().getNuclearZ(super_type::getIndex()); } /// @} @@ -91,22 +91,22 @@ namespace corsika::nuclear_stack { /** * Overwrite normal getParticleMass function with nuclear version */ - inline HEPMassType getMass() const; + HEPMassType getMass() const; /** * Overwirte normal getChargeNumber function with nuclear version **/ - inline int16_t getChargeNumber() const; + int16_t getChargeNumber() const; - inline int getNucleusRef() const { + int getNucleusRef() const { return super_type::getStackData().getNucleusRef(super_type::getIndex()); } // LCOV_EXCL_LINE protected: - inline void setNucleusRef(const int vR) { + void setNucleusRef(const int vR) { super_type::getStackData().setNucleusRef(super_type::getIndex(), vR); } - inline bool isNucleus() const { + bool isNucleus() const { return super_type::getStackData().isNucleus(super_type::getIndex()); } }; @@ -149,49 +149,45 @@ namespace corsika::nuclear_stack { void dump() { super_type::dump(); } - inline void clear(); + void clear(); unsigned int getSize() const { return nucleusRef_.size(); } unsigned int getCapacity() const { return nucleusRef_.capacity(); } - inline void setNuclearA(const unsigned int i, const unsigned short vA) { + void setNuclearA(const unsigned int i, const unsigned short vA) { nuclearA_[getNucleusRef(i)] = vA; } - inline void setNuclearZ(const unsigned int i, const unsigned short vZ) { + void setNuclearZ(const unsigned int i, const unsigned short vZ) { nuclearZ_[getNucleusRef(i)] = vZ; } - inline void setNucleusRef(const unsigned int i, const int v) { nucleusRef_[i] = v; } + void setNucleusRef(const unsigned int i, const int v) { nucleusRef_[i] = v; } - inline int getNuclearA(const unsigned int i) const { - return nuclearA_[getNucleusRef(i)]; - } + int getNuclearA(const unsigned int i) const { return nuclearA_[getNucleusRef(i)]; } - inline int getNuclearZ(const unsigned int i) const { - return nuclearZ_[getNucleusRef(i)]; - } + int getNuclearZ(const unsigned int i) const { return nuclearZ_[getNucleusRef(i)]; } // this function will create new storage for Nuclear Properties, and return the // reference to it - inline int getNucleusNextRef(); + int getNucleusNextRef(); - inline int getNucleusRef(const unsigned int i) const; + int getNucleusRef(const unsigned int i) const; - inline bool isNucleus(const unsigned int i) const { return nucleusRef_[i] >= 0; } + bool isNucleus(const unsigned int i) const { return nucleusRef_[i] >= 0; } /** * Function to copy particle at location i1 in stack to i2 */ - inline void copy(const unsigned int i1, const unsigned int i2); + void copy(const unsigned int i1, const unsigned int i2); /** * Function to copy particle at location i2 in stack to i1 */ - inline void swap(const unsigned int i1, const unsigned int i2); + void swap(const unsigned int i1, const unsigned int i2); - inline void incrementSize(); + void incrementSize(); - inline void decrementSize(); + void decrementSize(); private: /// the actual memory to store particle data diff --git a/corsika/stack/VectorStack.hpp b/corsika/stack/VectorStack.hpp index 7877469ee39fa4d3f8f3326bd56c112e61da0267..adaae996b63a5b69efa85dc8ad8956e253de44b9 100644 --- a/corsika/stack/VectorStack.hpp +++ b/corsika/stack/VectorStack.hpp @@ -119,7 +119,7 @@ namespace corsika { void dump() const {} - inline void clear(); + void clear(); unsigned int getSize() const { return dataPID_.size(); } unsigned int getCapacity() const { return dataPID_.size(); } @@ -149,15 +149,15 @@ namespace corsika { /** * Function to copy particle at location i2 in stack to i1 */ - inline void copy(size_t i1, size_t i2); + void copy(size_t i1, size_t i2); /** * Function to copy particle at location i2 in stack to i1 */ - inline void swap(size_t i1, size_t i2); + void swap(size_t i1, size_t i2); - inline void incrementSize(); - inline void decrementSize(); + void incrementSize(); + void decrementSize(); private: /// the actual memory to store particle data diff --git a/do-clang-format.py b/do-clang-format.py index 24973f6690e84137227763187cd3101dc56e4ac1..3bff0e619a14137fb9441b394a985875d0bbe7b2 100755 --- a/do-clang-format.py +++ b/do-clang-format.py @@ -83,6 +83,7 @@ cmd += " -style=file" version = subp.check_output(cmd.split() + ["--version"]).decode("utf-8") print (version) +print ("Note: the clang-format version has an impact on the result. Make sure you are consistent with current CI. Consider \'--docker\' option.") if args.apply: for filename in filelist: diff --git a/examples/vertical_EAS.cpp b/examples/vertical_EAS.cpp index 04ddbb2221c9c753e7dbe9550dc07b9a3e45a77e..c04ae2c4c6933d16259851a24afe49dbdc299d51 100644 --- a/examples/vertical_EAS.cpp +++ b/examples/vertical_EAS.cpp @@ -47,6 +47,7 @@ #include <corsika/modules/Sibyll.hpp> #include <corsika/modules/UrQMD.hpp> #include <corsika/modules/PROPOSAL.hpp> +#include <corsika/modules/QGSJetII.hpp> #include <corsika/setup/SetupStack.hpp> #include <corsika/setup/SetupTrajectory.hpp> @@ -66,6 +67,7 @@ */ #include <corsika/modules/sibyll/Random.hpp> #include <corsika/modules/urqmd/Random.hpp> +#include <corsika/modules/qgsjetII/Random.hpp> using namespace corsika; using namespace std; @@ -190,6 +192,8 @@ int main(int argc, char** argv) { // setup processes, decays and interactions + corsika::qgsjetII::Interaction qgsjet; + corsika::sibyll::Interaction sibyll; InteractionCounter sibyllCounted(sibyll); diff --git a/src/framework/core/ParticleData.xml b/src/framework/core/ParticleData.xml index 40cd64c8a4e9b5dc03a8f87e32e308f16e3a3b94..db89d04628abe4613e0c4a673575bddb550aed9e 100644 --- a/src/framework/core/ParticleData.xml +++ b/src/framework/core/ParticleData.xml @@ -166,7 +166,7 @@ <channel onMode="1" bRatio="0.1081660" products="-13 14"/> <channel onMode="1" bRatio="0.1080870" products="-15 16"/> </particle> - + --> <particle id="25" name="h0" spinType="1" chargeType="0" colType="0" m0="125.00000" mWidth="0.00374" mMin="50.00000" mMax="0.00000"> <channel onMode="1" bRatio="0.0000009" products="1 -1"/> @@ -246,7 +246,7 @@ <channel onMode="1" bRatio="0.0000000" meMode="103" products="1000016 -2000016"/> <channel onMode="1" bRatio="0.0000000" meMode="103" products="-1000016 2000016"/> </particle> - +<!-- <particle id="32" name="Z'0" spinType="3" chargeType="0" colType="0" m0="500.00000" mWidth="14.54029" mMin="10.00000" mMax="0.00000"> <channel onMode="1" bRatio="0.1458350" products="1 -1"/> diff --git a/src/modules/qgsjetII/code_generator.py b/src/modules/qgsjetII/code_generator.py index ce7fcae263f6e2b9a64b08c5ef56fc85aa99e9b7..8321aad19ab1ae30252b930800a62aa7f0fd7b6b 100755 --- a/src/modules/qgsjetII/code_generator.py +++ b/src/modules/qgsjetII/code_generator.py @@ -93,7 +93,7 @@ def read_qgsjetII_codes(filename, particle_db): if len(line)==0 or line[0] == '#': continue line = line.split('#')[0] - print (line) + print ('QGSJetII codes: ', line) identifier, model_code, xsType = line.split() try: particle_db[identifier]["qgsjetII_code"] = int(model_code) @@ -202,7 +202,7 @@ if __name__ == "__main__": particle_db = load_particledb(sys.argv[1]) read_qgsjetII_codes(sys.argv[2], particle_db) set_default_qgsjetII_definition(particle_db) - + with open("Generated.inc", "w") as f: print("// this file is automatically generated\n// edit at your own risk!\n", file=f) print(generate_qgsjetII_start(), file=f) diff --git a/tests/common/SetupTestTrajectory.hpp b/tests/common/SetupTestTrajectory.hpp index 0c06d7f39aea76fd2b466ca1974d95a616bcfefb..8272317193a1d1864b5c7928c22947dcc7243e2f 100644 --- a/tests/common/SetupTestTrajectory.hpp +++ b/tests/common/SetupTestTrajectory.hpp @@ -13,33 +13,34 @@ #include <corsika/framework/geometry/Helix.hpp> #include <corsika/framework/geometry/StraightTrajectory.hpp> -// #include <corsika/framework/geometry/LeapFrogTrajectory.hpp> -// #include <corsika/modules/TrackingLine.hpp> -// #include <corsika/modules/TrackingCurved.hpp> // simple leap-frog implementation -// #include <corsika/modules/TrackingLeapFrog.hpp> // more complete leap-frog +#include <corsika/framework/geometry/LeapFrogTrajectory.hpp> +//#include <corsika/modules/TrackingLine.hpp> +//#include <corsika/modules/TrackingCurved.hpp> // simple leap-frog implementation +//#include <corsika/modules/TrackingLeapFrog.hpp> // more complete leap-frog // implementation namespace corsika::setup::testing { template <typename TTrack> - TTrack make_track(Line const& line, TimeType const tEnd); + TTrack make_track( + Line const line, + TimeType const tEnd = std::numeric_limits<TimeType::value_type>::infinity() * 1_s); template <> - inline StraightTrajectory make_track<StraightTrajectory>(Line const& line, + inline StraightTrajectory make_track<StraightTrajectory>(Line const line, TimeType const tEnd) { return StraightTrajectory(line, tEnd); } - /* - template <> - inline LeapFrogTrajectory make_track<LeapFrogTrajectory>(Line const& line, - TimeType const tEnd) { - - auto const k = square(0_m) / (square(1_s) * 1_V); - return LeapFrogTrajectory( - line.getStartPoint(), line.getVelocity(), - MagneticFieldVector{line.getStartPoint().getCoordinateSystem(), 0_T, 0_T, 0_T}, - k, tEnd); - } - */ + template <> + inline LeapFrogTrajectory make_track<LeapFrogTrajectory>(Line const line, + TimeType const tEnd) { + + auto const k = square(0_m) / (square(1_s) * 1_V); + return LeapFrogTrajectory( + line.getStartPoint(), line.getVelocity(), + MagneticFieldVector{line.getStartPoint().getCoordinateSystem(), 0_T, 0_T, 0_T}, k, + tEnd); + } + } // namespace corsika::setup::testing diff --git a/tests/framework/testCascade.cpp b/tests/framework/testCascade.cpp index 8a7978b8446677132529b41c2c905abe7dab9cef..633f30f47328970be8374552ecbb86411aaa6936 100644 --- a/tests/framework/testCascade.cpp +++ b/tests/framework/testCascade.cpp @@ -24,6 +24,8 @@ #include <corsika/media/HomogeneousMedium.hpp> #include <corsika/media/NuclearComposition.hpp> +#include <SetupTestTrajectory.hpp> + #include <catch2/catch.hpp> using namespace corsika; @@ -68,14 +70,11 @@ public: auto getTrack(TParticle const& particle) { VelocityVector const initialVelocity = particle.getMomentum() / particle.getEnergy() * constants::c; + Line const theLine = Line(particle.getPosition(), initialVelocity); + TimeType const tEnd = std::numeric_limits<TimeType::value_type>::infinity() * 1_s; return std::make_tuple( - StraightTrajectory( - Line(particle.getPosition(), initialVelocity), - std::numeric_limits<TimeType::value_type>::infinity() * 1_s), // trajectory, - // just - // go - // ahead - // forever + corsika::setup::testing::make_track<setup::Trajectory>(theLine, tEnd), + // trajectory: just go ahead forever particle.getNode()); // next volume node } }; diff --git a/tests/framework/testProcessSequence.cpp b/tests/framework/testProcessSequence.cpp index 3d60d2de15a57a54a0e0565ad4b568f2a63a944c..efdaa2fc45fe55945b331d6dd741cfaf294dee09 100644 --- a/tests/framework/testProcessSequence.cpp +++ b/tests/framework/testProcessSequence.cpp @@ -49,7 +49,7 @@ public: void setStep(LengthType const v) { step_ = v; } template <typename D, typename T> - inline ProcessReturn doContinuous(D& d, T&, bool const flag) const { + ProcessReturn doContinuous(D& d, T&, bool const flag) const { flag_ = flag; CORSIKA_LOG_TRACE("ContinuousProcess1::DoContinuous"); checkCont |= 1; @@ -58,7 +58,7 @@ public: } template <typename TParticle, typename TTrack> - inline LengthType getMaxStepLength(TParticle&, TTrack&) { + LengthType getMaxStepLength(TParticle&, TTrack&) { return step_; } @@ -86,7 +86,7 @@ public: void setStep(LengthType const v) { step_ = v; } template <typename D, typename T> - inline ProcessReturn doContinuous(D& d, T&, bool const flag) const { + ProcessReturn doContinuous(D& d, T&, bool const flag) const { flag_ = flag; CORSIKA_LOG_DEBUG("ContinuousProcess2::DoContinuous"); checkCont |= 2; @@ -95,7 +95,7 @@ public: } template <typename TParticle, typename TTrack> - inline LengthType getMaxStepLength(TParticle&, TTrack&) { + LengthType getMaxStepLength(TParticle&, TTrack&) { return step_; } @@ -123,7 +123,7 @@ public: void setStep(LengthType const v) { step_ = v; } template <typename D, typename T> - inline ProcessReturn doContinuous(D& d, T&, bool const flag) const { + ProcessReturn doContinuous(D& d, T&, bool const flag) const { flag_ = flag; CORSIKA_LOG_DEBUG("ContinuousProcess3::DoContinuous"); checkCont |= 4; @@ -132,7 +132,7 @@ public: } template <typename TParticle, typename TTrack> - inline LengthType getMaxStepLength(TParticle&, TTrack&) { + LengthType getMaxStepLength(TParticle&, TTrack&) { return step_; } @@ -158,7 +158,7 @@ public: } template <typename TView> - inline void doInteraction(TView& v) const { + void doInteraction(TView& v) const { checkInteract |= 1; for (int i = 0; i < nData; ++i) v.parent().data_[i] += 1 + i; } @@ -184,7 +184,7 @@ public: } template <typename TView> - inline void doInteraction(TView& v) const { + void doInteraction(TView& v) const { checkInteract |= 2; for (int i = 0; i < nData; ++i) v.parent().data_[i] /= 1.1; CORSIKA_LOG_DEBUG("Process2::doInteraction"); @@ -211,7 +211,7 @@ public: } template <typename TView> - inline void doInteraction(TView& v) const { + void doInteraction(TView& v) const { checkInteract |= 4; for (int i = 0; i < nData; ++i) v.parent().data_[i] *= 1.01; CORSIKA_LOG_DEBUG("Process3::doInteraction"); @@ -238,7 +238,7 @@ public: } template <typename D, typename T> - inline ProcessReturn doContinuous(D& d, T&, bool const) const { + ProcessReturn doContinuous(D& d, T&, bool const) const { CORSIKA_LOG_DEBUG("Base::doContinuous"); checkCont |= 8; for (int i = 0; i < nData; ++i) { d.data_[i] /= 1.2; } diff --git a/tests/media/testMedium.cpp b/tests/media/testMedium.cpp index 670c25d9246e3f1ffacef09cde5275f85500242d..edcba45fc6fe01a3b5554878fcca735627b7a9d7 100644 --- a/tests/media/testMedium.cpp +++ b/tests/media/testMedium.cpp @@ -101,7 +101,8 @@ TEST_CASE("MediumPropertyModel w/ Homogeneous") { auto const tEnd = 1_s; // and the associated trajectory - setup::Trajectory const trajectory(line, tEnd); + setup::Trajectory const trajectory = + corsika::setup::testing::make_track<setup::Trajectory>(line, tEnd); // and check the integrated grammage CHECK((medium.getIntegratedGrammage(trajectory, 3_m) / (density * 3_m)) == Approx(1)); diff --git a/tests/modules/testQGSJetII.cpp b/tests/modules/testQGSJetII.cpp index 86bb8fce99a1cbed5a57d0eb2018e56278b5c065..8b039f87ca2979ebdef9831b287c73ef8a2c0478 100644 --- a/tests/modules/testQGSJetII.cpp +++ b/tests/modules/testQGSJetII.cpp @@ -20,6 +20,16 @@ #include <cstdlib> #include <experimental/filesystem> +/* + NOTE, WARNING, ATTENTION + + The sibyll/Random.hpp implements the hook of sibyll to the C8 random + number generator. It has to occur excatly ONCE per linked + executable. If you include the header below in multiple "tests" and + link them togehter, it will fail. + */ +#include <corsika/modules/qgsjetII/Random.hpp> + using namespace corsika; template <typename TStackView>