IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 79c21d48 authored by Nikos Karastathis's avatar Nikos Karastathis :ocean: Committed by Ralf Ulrich
Browse files

New getTime() method for start and end of track

parent b856b8b2
No related branches found
No related tags found
No related merge requests found
...@@ -54,6 +54,11 @@ namespace corsika { ...@@ -54,6 +54,11 @@ namespace corsika {
return step / 2 * (correction + 1); 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 { inline LengthType LeapFrogTrajectory::getLength(double const u) const {
return getDuration(u) * initialVelocity_.getNorm(); return getDuration(u) * initialVelocity_.getNorm();
} }
......
...@@ -23,6 +23,11 @@ namespace corsika { ...@@ -23,6 +23,11 @@ namespace corsika {
return u * timeStep_; 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 { inline LengthType StraightTrajectory::getLength(double const u) const {
if (timeLength_ == 0_s) return 0_m; if (timeLength_ == 0_s) return 0_m;
if (timeStep_ == std::numeric_limits<TimeType::value_type>::infinity() * 1_s) if (timeStep_ == std::numeric_limits<TimeType::value_type>::infinity() * 1_s)
......
...@@ -72,6 +72,10 @@ namespace corsika { ...@@ -72,6 +72,10 @@ namespace corsika {
///! duration along potentially bend trajectory ///! duration along potentially bend trajectory
TimeType getDuration(double const u = 1) const; 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 ///! total length along potentially bend trajectory
LengthType getLength(double const u = 1) const; LengthType getLength(double const u = 1) const;
......
...@@ -84,6 +84,10 @@ namespace corsika { ...@@ -84,6 +84,10 @@ namespace corsika {
///! duration along potentially bend trajectory ///! duration along potentially bend trajectory
TimeType getDuration(double const u = 1) const; 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 ///! total length along potentially bend trajectory
LengthType getLength(double const u = 1) const; LengthType getLength(double const u = 1) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment