diff --git a/corsika/detail/framework/geometry/LeapFrogTrajectory.inl b/corsika/detail/framework/geometry/LeapFrogTrajectory.inl index af31f8209eedad47bd9de9cbf1344c17c9ef758e..48ec83a24ee18b7ed51aa26809011be9a600197c 100644 --- a/corsika/detail/framework/geometry/LeapFrogTrajectory.inl +++ b/corsika/detail/framework/geometry/LeapFrogTrajectory.inl @@ -54,6 +54,11 @@ namespace corsika { return step / 2 * (correction + 1); } + template <typename Particle> + inline TimeType LeapFrogTrajectory::getTime(Particle& particle, double const u) const { + return particle.getTime() + getDuration(u); + } + inline LengthType LeapFrogTrajectory::getLength(double const u) const { return getDuration(u) * initialVelocity_.getNorm(); } diff --git a/corsika/detail/framework/geometry/StraightTrajectory.inl b/corsika/detail/framework/geometry/StraightTrajectory.inl index a8fef9b035a38745095976a17f6a0644b720a2a5..9e54467b5aa92588371aa427751dc3405c3a9e1e 100644 --- a/corsika/detail/framework/geometry/StraightTrajectory.inl +++ b/corsika/detail/framework/geometry/StraightTrajectory.inl @@ -23,6 +23,11 @@ namespace corsika { return u * timeStep_; } + template <typename Particle> + inline TimeType StraightTrajectory::getTime(Particle& particle, double const u) const { + return particle.getTime() + getDuration(u);//timeStep_ * u; + } + inline LengthType StraightTrajectory::getLength(double const u) const { if (timeLength_ == 0_s) return 0_m; if (timeStep_ == std::numeric_limits<TimeType::value_type>::infinity() * 1_s) diff --git a/corsika/framework/geometry/LeapFrogTrajectory.hpp b/corsika/framework/geometry/LeapFrogTrajectory.hpp index 64bd5015916a9d953d0a689f1ba22ceef667d603..2db3233b8c60a91e9a1e5e29c8e626134476a7b9 100644 --- a/corsika/framework/geometry/LeapFrogTrajectory.hpp +++ b/corsika/framework/geometry/LeapFrogTrajectory.hpp @@ -72,6 +72,10 @@ namespace corsika { ///! duration along potentially bend trajectory TimeType getDuration(double const u = 1) const; + ///! time at the start (u=0) or at the end (u=1) of the track of a particle + template <typename Particle> + TimeType getTime(Particle& particle, double const u) const; + ///! total length along potentially bend trajectory LengthType getLength(double const u = 1) const; diff --git a/corsika/framework/geometry/StraightTrajectory.hpp b/corsika/framework/geometry/StraightTrajectory.hpp index 4bed6b7f6ead06789a5712b11148f509b7eb5e9c..40057258853b1809e6450c196d78cc39c2e826b2 100644 --- a/corsika/framework/geometry/StraightTrajectory.hpp +++ b/corsika/framework/geometry/StraightTrajectory.hpp @@ -84,6 +84,10 @@ namespace corsika { ///! duration along potentially bend trajectory TimeType getDuration(double const u = 1) const; + ///! time at the start (u=0) or at the end (u=1) of the track of a particle + template <typename Particle> + TimeType getTime(Particle& particle, double const u) const; + ///! total length along potentially bend trajectory LengthType getLength(double const u = 1) const;