From 558894f6e59527bc2f753365551bde5d674d3bb9 Mon Sep 17 00:00:00 2001
From: Nikos Karastathis <n.karastathis@kit.edu>
Date: Thu, 28 Oct 2021 17:04:04 +0200
Subject: [PATCH] Exponential refractive index does not use the getZ() method
 anymore.

---
 corsika/detail/media/ExponentialRefractiveIndex.inl | 8 +++++---
 corsika/media/ExponentialRefractiveIndex.hpp        | 6 ++++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/corsika/detail/media/ExponentialRefractiveIndex.inl b/corsika/detail/media/ExponentialRefractiveIndex.inl
index ac60050c5..675531eb8 100644
--- a/corsika/detail/media/ExponentialRefractiveIndex.inl
+++ b/corsika/detail/media/ExponentialRefractiveIndex.inl
@@ -15,14 +15,16 @@ namespace corsika {
   template <typename T>
   template <typename... Args>
   ExponentialRefractiveIndex<T>::ExponentialRefractiveIndex(
-      double const n0, InverseLengthType const lambda, Args&&... args)
+      double const n0, InverseLengthType const lambda_, Point const center_, LengthType const planetRadius_, Args&&... args)
       : T(std::forward<Args>(args)...)
       , n_0(n0)
-      , lambda_(lambda) {}
+      , lambda(lambda_)
+      , center(center_)
+      , planetRadius(planetRadius_) {}
 
   template <typename T>
   double ExponentialRefractiveIndex<T>::getRefractiveIndex(Point const& point) const {
-    return n_0 * exp((-lambda_) * point.getCoordinates().getZ());
+    return n_0 * exp((-lambda) * (distance(point, center) - planetRadius));
   }
 
 } // namespace corsika
diff --git a/corsika/media/ExponentialRefractiveIndex.hpp b/corsika/media/ExponentialRefractiveIndex.hpp
index 441f7b33f..eb41fde24 100644
--- a/corsika/media/ExponentialRefractiveIndex.hpp
+++ b/corsika/media/ExponentialRefractiveIndex.hpp
@@ -23,7 +23,9 @@ namespace corsika {
   class ExponentialRefractiveIndex : public T {
 
     double n_0;                ///< n0 constant.
-    InverseLengthType lambda_; ///< lambda parameter.
+    InverseLengthType lambda;  ///< lambda parameter.
+    LengthType planetRadius;   ///< the planet radius.
+    Point center;              ///< center of the planet.
 
   public:
     /**
@@ -36,7 +38,7 @@ namespace corsika {
      * @param field    The refractive index to return to a given point.
      */
     template <typename... Args>
-    ExponentialRefractiveIndex(double const n0, InverseLengthType const lambda,
+    ExponentialRefractiveIndex(double const n0, InverseLengthType const lambda_, Point const center_, LengthType const planetRadius_,
                                Args&&... args);
 
     /**
-- 
GitLab