IAP GITLAB

Commit 896d611b authored by Ralf Ulrich's avatar Ralf Ulrich

fixed a lot of inlines and other details

parent 96339351
...@@ -23,12 +23,13 @@ namespace corsika { ...@@ -23,12 +23,13 @@ namespace corsika {
template <typename TClass, typename TRet, typename... TArgs, template <typename TClass, typename TRet, typename... TArgs,
TRet (TClass::*TFuncPtr)(TArgs...), typename TTimer> 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) {} : ClassTimerImpl<TClass, TTimer>(obj) {}
template <typename TClass, typename TRet, typename... TArgs, template <typename TClass, typename TRet, typename... TArgs,
TRet (TClass::*TFuncPtr)(TArgs...), typename TTimer> 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(); this->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now();
auto tmp = (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...); auto tmp = (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...);
this->timeDiff_ = std::chrono::duration_cast< this->timeDiff_ = std::chrono::duration_cast<
...@@ -41,12 +42,13 @@ namespace corsika { ...@@ -41,12 +42,13 @@ namespace corsika {
template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...), template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...),
typename TTimer> 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) {} : ClassTimerImpl<TClass, TTimer>(obj) {}
template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...), template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...),
typename TTimer> 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->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now();
(this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...); (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...);
this->timeDiff_ = std::chrono::duration_cast< this->timeDiff_ = std::chrono::duration_cast<
...@@ -59,12 +61,13 @@ namespace corsika { ...@@ -59,12 +61,13 @@ namespace corsika {
template <typename TClass, typename TRet, typename... TArgs, template <typename TClass, typename TRet, typename... TArgs,
TRet (TClass::*TFuncPtr)(TArgs...) const, typename TTimer> 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) {} : ClassTimerImpl<TClass, TTimer>(obj) {}
template <typename TClass, typename TRet, typename... TArgs, template <typename TClass, typename TRet, typename... TArgs,
TRet (TClass::*TFuncPtr)(TArgs...) const, typename TTimer> 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) { TArgs... args) {
this->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now(); this->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now();
auto tmp = (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...); auto tmp = (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...);
...@@ -77,12 +80,13 @@ namespace corsika { ...@@ -77,12 +80,13 @@ namespace corsika {
/// Specialisation 3 /// Specialisation 3
template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...) const, template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...) const,
typename TTimer> 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) {} : ClassTimerImpl<TClass, TTimer>(obj) {}
template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...) const, template <typename TClass, typename... TArgs, void (TClass::*TFuncPtr)(TArgs...) const,
typename TTimer> typename TTimer>
void ClassTimer<void (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::call( inline void ClassTimer<void (TClass::*)(TArgs...) const, TFuncPtr, TTimer>::call(
TArgs... args) { TArgs... args) {
this->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now(); this->start_ = ClassTimerImpl<TClass, TTimer>::clock_type::now();
(this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...); (this->obj_.*TFuncPtr)(std::forward<TArgs>(args)...);
......
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
namespace corsika { namespace corsika {
template <typename TFunc, typename TTime> template <typename TFunc, typename TTime>
FunctionTimer<TFunc, TTime>::FunctionTimer(TFunc f) inline FunctionTimer<TFunc, TTime>::FunctionTimer(TFunc f)
: function_(f) {} : function_(f) {}
template <typename TFunc, typename TTime> template <typename TFunc, typename TTime>
template <typename... TArgs> template <typename... TArgs>
auto FunctionTimer<TFunc, TTime>::operator()(TArgs&&... args) inline auto FunctionTimer<TFunc, TTime>::operator()(TArgs&&... args)
-> std::invoke_result_t<TFunc, TArgs...> { -> std::invoke_result_t<TFunc, TArgs...> {
this->startTimer(); this->startTimer();
auto tmp = function_(std::forward<TArgs>(args)...); auto tmp = function_(std::forward<TArgs>(args)...);
......
...@@ -28,7 +28,7 @@ namespace corsika { ...@@ -28,7 +28,7 @@ namespace corsika {
template <typename TTracking, typename TProcessList, typename TStack, template <typename TTracking, typename TProcessList, typename TStack,
typename TStackView> 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 setNodes(); // put each particle on stack in correct environment volume
while (!stack_.isEmpty()) { while (!stack_.isEmpty()) {
...@@ -55,7 +55,7 @@ namespace corsika { ...@@ -55,7 +55,7 @@ namespace corsika {
template <typename TTracking, typename TProcessList, typename TStack, template <typename TTracking, typename TProcessList, typename TStack,
typename TStackView> typename TStackView>
void Cascade<TTracking, TProcessList, TStack, TStackView>::forceInteraction() { inline void Cascade<TTracking, TProcessList, TStack, TStackView>::forceInteraction() {
CORSIKA_LOG_TRACE("forced interaction!"); CORSIKA_LOG_TRACE("forced interaction!");
setNodes(); setNodes();
auto vParticle = stack_.getNextParticle(); auto vParticle = stack_.getNextParticle();
...@@ -67,7 +67,8 @@ namespace corsika { ...@@ -67,7 +67,8 @@ namespace corsika {
template <typename TTracking, typename TProcessList, typename TStack, template <typename TTracking, typename TProcessList, typename TStack,
typename TStackView> 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) // determine combined total interaction length (inverse)
InverseGrammageType const total_inv_lambda = InverseGrammageType const total_inv_lambda =
...@@ -236,7 +237,7 @@ namespace corsika { ...@@ -236,7 +237,7 @@ namespace corsika {
template <typename TTracking, typename TProcessList, typename TStack, template <typename TTracking, typename TProcessList, typename TStack,
typename TStackView> typename TStackView>
ProcessReturn Cascade<TTracking, TProcessList, TStack, TStackView>::decay( inline ProcessReturn Cascade<TTracking, TProcessList, TStack, TStackView>::decay(
TStackView& view) { TStackView& view) {
CORSIKA_LOG_DEBUG("decay"); CORSIKA_LOG_DEBUG("decay");
InverseTimeType const actual_decay_time = sequence_.getInverseLifetime(view.parent()); InverseTimeType const actual_decay_time = sequence_.getInverseLifetime(view.parent());
...@@ -254,7 +255,7 @@ namespace corsika { ...@@ -254,7 +255,7 @@ namespace corsika {
template <typename TTracking, typename TProcessList, typename TStack, template <typename TTracking, typename TProcessList, typename TStack,
typename TStackView> typename TStackView>
ProcessReturn Cascade<TTracking, TProcessList, TStack, TStackView>::interaction( inline ProcessReturn Cascade<TTracking, TProcessList, TStack, TStackView>::interaction(
TStackView& view) { TStackView& view) {
CORSIKA_LOG_DEBUG("collide"); CORSIKA_LOG_DEBUG("collide");
...@@ -274,7 +275,7 @@ namespace corsika { ...@@ -274,7 +275,7 @@ namespace corsika {
template <typename TTracking, typename TProcessList, typename TStack, template <typename TTracking, typename TProcessList, typename TStack,
typename TStackView> 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) { std::for_each(stack_.begin(), stack_.end(), [&](auto& p) {
auto const* numericalNode = auto const* numericalNode =
environment_.getUniverse()->getContainingNode(p.getPosition()); environment_.getUniverse()->getContainingNode(p.getPosition());
...@@ -284,7 +285,7 @@ namespace corsika { ...@@ -284,7 +285,7 @@ namespace corsika {
template <typename TTracking, typename TProcessList, typename TStack, template <typename TTracking, typename TProcessList, typename TStack,
typename TStackView> typename TStackView>
void Cascade<TTracking, TProcessList, TStack, TStackView>::setEventType( inline void Cascade<TTracking, TProcessList, TStack, TStackView>::setEventType(
TStackView& view, [[maybe_unused]] history::EventType eventType) { TStackView& view, [[maybe_unused]] history::EventType eventType) {
if constexpr (TStackView::has_event) { if constexpr (TStackView::has_event) {
for (auto&& sec : view) { sec.getEvent()->setEventType(eventType); } for (auto&& sec : view) { sec.getEvent()->setEventType(eventType); }
......
...@@ -13,72 +13,74 @@ ...@@ -13,72 +13,74 @@
namespace corsika { 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)]; 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; 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) if (p == Code::Nucleus)
throw std::runtime_error("Cannot GetMass() of particle::Nucleus -> unspecified"); throw std::runtime_error("Cannot GetMass() of particle::Nucleus -> unspecified");
return particle::detail::masses[static_cast<CodeIntType>(p)]; 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)]; 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) if (code == Code::Nucleus)
throw std::runtime_error("charge of particle::Nucleus undefined"); throw std::runtime_error("charge of particle::Nucleus undefined");
return particle::detail::electric_charges[static_cast<CodeIntType>(code)]; 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; 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)]; 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; 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)]; 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; 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 || return c == Code::NuE || c == Code::NuMu || c == Code::NuTau || c == Code::NuEBar ||
c == Code::NuMuBar || c == Code::NuTauBar; 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) { if (code == Code::Nucleus) {
throw std::runtime_error("get_nucleus_A(Code::Nucleus) is impossible!"); throw std::runtime_error("get_nucleus_A(Code::Nucleus) is impossible!");
} }
return particle::detail::nucleusA[static_cast<CodeIntType>(code)]; 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) { if (code == Code::Nucleus) {
throw std::runtime_error("get_nucleus_Z(Code::Nucleus) is impossible!"); throw std::runtime_error("get_nucleus_Z(Code::Nucleus) is impossible!");
} }
return particle::detail::nucleusZ[static_cast<CodeIntType>(code)]; 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); return (code == Code::Nucleus) || (get_nucleus_A(code) != 0);
} }
...@@ -102,7 +104,7 @@ namespace corsika { ...@@ -102,7 +104,7 @@ namespace corsika {
return get_mass(Code::Proton) * Z + (A - Z) * get_mass(Code::Neutron); 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; return particle::detail::all_particles;
} }
......
...@@ -14,17 +14,18 @@ ...@@ -14,17 +14,18 @@
namespace corsika { namespace corsika {
template <typename TDimension> template <typename TDimension>
CoordinateSystemPtr BaseVector<TDimension>::getCoordinateSystem() const { inline CoordinateSystemPtr BaseVector<TDimension>::getCoordinateSystem() const {
return cs_; return cs_;
} }
template <typename TDimension> template <typename TDimension>
QuantityVector<TDimension> const& BaseVector<TDimension>::getQuantityVector() const { inline QuantityVector<TDimension> const& BaseVector<TDimension>::getQuantityVector()
const {
return quantityVector_; return quantityVector_;
} }
template <typename TDimension> template <typename TDimension>
QuantityVector<TDimension>& BaseVector<TDimension>::getQuantityVector() { inline QuantityVector<TDimension>& BaseVector<TDimension>::getQuantityVector() {
return quantityVector_; return quantityVector_;
} }
......
...@@ -19,9 +19,11 @@ ...@@ -19,9 +19,11 @@
namespace corsika { 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 { inline bool CoordinateSystem::operator==(CoordinateSystem const& cs) const {
return referenceCS_ == cs.referenceCS_ && transf_.matrix() == cs.transf_.matrix(); return referenceCS_ == cs.referenceCS_ && transf_.matrix() == cs.transf_.matrix();
......
...@@ -15,47 +15,47 @@ ...@@ -15,47 +15,47 @@
namespace corsika { namespace corsika {
template <typename TTimeType, typename TSpaceVecType> template <typename TTimeType, typename TSpaceVecType>
TTimeType FourVector<TTimeType, TSpaceVecType>::getTimeLikeComponent() const { inline TTimeType FourVector<TTimeType, TSpaceVecType>::getTimeLikeComponent() const {
return timeLike_; return timeLike_;
} }
template <typename TTimeType, typename TSpaceVecType> template <typename TTimeType, typename TSpaceVecType>
TSpaceVecType& FourVector<TTimeType, TSpaceVecType>::getSpaceLikeComponents() { inline TSpaceVecType& FourVector<TTimeType, TSpaceVecType>::getSpaceLikeComponents() {
return spaceLike_; return spaceLike_;
} }
template <typename TTimeType, typename TSpaceVecType> template <typename TTimeType, typename TSpaceVecType>
TSpaceVecType const& FourVector<TTimeType, TSpaceVecType>::getSpaceLikeComponents() inline TSpaceVecType const&
const { FourVector<TTimeType, TSpaceVecType>::getSpaceLikeComponents() const {
return spaceLike_; return spaceLike_;
} }
template <typename TTimeType, typename TSpaceVecType> 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 { FourVector<TTimeType, TSpaceVecType>::getNormSqr() const {
return getTimeSquared() - spaceLike_.getSquaredNorm(); return getTimeSquared() - spaceLike_.getSquaredNorm();
} }
template <typename TTimeType, typename TSpaceVecType> template <typename TTimeType, typename TSpaceVecType>
typename FourVector<TTimeType, TSpaceVecType>::norm_type inline typename FourVector<TTimeType, TSpaceVecType>::norm_type
FourVector<TTimeType, TSpaceVecType>::getNorm() const { FourVector<TTimeType, TSpaceVecType>::getNorm() const {
return sqrt(abs(getNormSqr())); return sqrt(abs(getNormSqr()));
} }
template <typename TTimeType, typename TSpaceVecType> template <typename TTimeType, typename TSpaceVecType>
bool FourVector<TTimeType, TSpaceVecType>::isTimelike() const { inline bool FourVector<TTimeType, TSpaceVecType>::isTimelike() const {
return getTimeSquared() < spaceLike_.getSquaredNorm(); return getTimeSquared() < spaceLike_.getSquaredNorm();
} }
template <typename TTimeType, typename TSpaceVecType> template <typename TTimeType, typename TSpaceVecType>
bool FourVector<TTimeType, TSpaceVecType>::isSpacelike() const { inline bool FourVector<TTimeType, TSpaceVecType>::isSpacelike() const {
return getTimeSquared() > spaceLike_.getSquaredNorm(); return getTimeSquared() > spaceLike_.getSquaredNorm();
} }
template <typename TTimeType, typename TSpaceVecType> template <typename TTimeType, typename TSpaceVecType>
FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::operator+=( inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::
FourVector const& b) { operator+=(FourVector const& b) {
timeLike_ += b.timeLike_; timeLike_ += b.timeLike_;
spaceLike_ += b.spaceLike_; spaceLike_ += b.spaceLike_;
...@@ -63,38 +63,38 @@ namespace corsika { ...@@ -63,38 +63,38 @@ namespace corsika {
} }
template <typename TTimeType, typename TSpaceVecType> template <typename TTimeType, typename TSpaceVecType>
FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::operator-=( inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::
FourVector const& b) { operator-=(FourVector const& b) {
timeLike_ -= b.timeLike_; timeLike_ -= b.timeLike_;
spaceLike_ -= b.spaceLike_; spaceLike_ -= b.spaceLike_;
return *this; return *this;
} }
template <typename TTimeType, typename TSpaceVecType> template <typename TTimeType, typename TSpaceVecType>
FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::operator*=( inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::
double const b) { operator*=(double const b) {
timeLike_ *= b; timeLike_ *= b;
spaceLike_ *= b; spaceLike_ *= b;
return *this; return *this;
} }
template <typename TTimeType, typename TSpaceVecType> template <typename TTimeType, typename TSpaceVecType>
FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::operator/=( inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::
double const b) { operator/=(double const b) {
timeLike_ /= b; timeLike_ /= b;
spaceLike_.getComponents() /= b; spaceLike_.getComponents() /= b;
return *this; return *this;
} }
template <typename TTimeType, typename TSpaceVecType> template <typename TTimeType, typename TSpaceVecType>
FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::operator/( inline FourVector<TTimeType, TSpaceVecType>& FourVector<TTimeType, TSpaceVecType>::
double const b) { operator/(double const b) {
*this /= b; *this /= b;
return *this; return *this;
} }
template <typename TTimeType, typename TSpaceVecType> 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) { FourVector<TTimeType, TSpaceVecType>::operator*(FourVector const& b) {
if constexpr (std::is_same<time_type, decltype(std::declval<space_type>() / meter * if constexpr (std::is_same<time_type, decltype(std::declval<space_type>() / meter *
second)>::value) second)>::value)
...@@ -104,7 +104,7 @@ namespace corsika { ...@@ -104,7 +104,7 @@ namespace corsika {
} }
template <typename TTimeType, typename TSpaceVecType> 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 { FourVector<TTimeType, TSpaceVecType>::getTimeSquared() const {
if constexpr (std::is_same<time_type, decltype(std::declval<space_type>() / meter * if constexpr (std::is_same<time_type, decltype(std::declval<space_type>() / meter *
second)>::value) second)>::value)
......
...@@ -15,23 +15,23 @@ ...@@ -15,23 +15,23 @@
namespace corsika { 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 + return r0_ + vPar_ * t +
(vPerp_ * (std::cos(omegaC_ * t) - 1) + uPerp_ * std::sin(omegaC_ * t)) / (vPerp_ * (std::cos(omegaC_ * t) - 1) + uPerp_ * std::sin(omegaC_ * t)) /
omegaC_; omegaC_;
} }
Point Helix::getPositionFromArclength(LengthType const l) const { inline Point Helix::getPositionFromArclength(LengthType const l) const {
return getPosition(getTimeFromArclength(l)); 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); 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();