From ccb8db9c66bc850332e1ec408bc9a07cdd5b6832 Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@tu-dortmund.de>
Date: Thu, 27 Jan 2022 11:32:30 +0100
Subject: [PATCH] comparisons of CS via pointers

---
 corsika/detail/framework/geometry/Point.inl  | 36 ++++----------------
 corsika/detail/framework/geometry/Vector.inl |  2 +-
 2 files changed, 7 insertions(+), 31 deletions(-)

diff --git a/corsika/detail/framework/geometry/Point.inl b/corsika/detail/framework/geometry/Point.inl
index fe6e8b162..156723dd1 100644
--- a/corsika/detail/framework/geometry/Point.inl
+++ b/corsika/detail/framework/geometry/Point.inl
@@ -24,46 +24,22 @@ namespace corsika {
   }
 
   inline LengthType Point::getX(CoordinateSystemPtr const& pCS) const {
-    CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
-    if (*pCS == *cs) {
-      return BaseVector<length_d>::getQuantityVector().getX();
-    } else {
-      return QuantityVector<length_d>(
-                 get_transformation(*cs.get(), *pCS.get()) *
-                 BaseVector<length_d>::getQuantityVector().eigenVector_)
-          .getX();
-    }
+    return getCoordinates(pCS).getX();
   }
 
   inline LengthType Point::getY(CoordinateSystemPtr const& pCS) const {
-    CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
-    if (*pCS == *cs) {
-      return BaseVector<length_d>::getQuantityVector().getY();
-    } else {
-      return QuantityVector<length_d>(
-                 get_transformation(*cs.get(), *pCS.get()) *
-                 BaseVector<length_d>::getQuantityVector().eigenVector_)
-          .getY();
-    }
+    return getCoordinates(pCS).getY();
   }
 
   inline LengthType Point::getZ(CoordinateSystemPtr const& pCS) const {
-    CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
-    if (*pCS == *cs) {
-      return BaseVector<length_d>::getQuantityVector().getZ();
-    } else {
-      return QuantityVector<length_d>(
-                 get_transformation(*cs.get(), *pCS.get()) *
-                 BaseVector<length_d>::getQuantityVector().eigenVector_)
-          .getZ();
-    }
+    return getCoordinates(pCS).getZ();
   }
 
   /// this always returns a QuantityVector as triple
   inline QuantityVector<length_d> Point::getCoordinates(
       CoordinateSystemPtr const& pCS) const {
     CoordinateSystemPtr const& cs = BaseVector<length_d>::getCoordinateSystem();
-    if (*pCS == *cs) {
+    if (pCS == cs) {
       return BaseVector<length_d>::getQuantityVector();
     } else {
       return QuantityVector<length_d>(
@@ -74,7 +50,7 @@ namespace corsika {
 
   /// this always returns a QuantityVector as triple
   inline QuantityVector<length_d>& Point::getCoordinates(CoordinateSystemPtr const& pCS) {
-    if (*pCS != *BaseVector<length_d>::getCoordinateSystem()) { rebase(pCS); }
+    if (pCS != BaseVector<length_d>::getCoordinateSystem()) { rebase(pCS); }
     return BaseVector<length_d>::getQuantityVector();
   }
 
@@ -106,4 +82,4 @@ namespace corsika {
     return (p1 - p2).getNorm();
   }
 
-} // namespace corsika
\ No newline at end of file
+} // namespace corsika
diff --git a/corsika/detail/framework/geometry/Vector.inl b/corsika/detail/framework/geometry/Vector.inl
index 0e2cfdd61..687b93eeb 100644
--- a/corsika/detail/framework/geometry/Vector.inl
+++ b/corsika/detail/framework/geometry/Vector.inl
@@ -27,7 +27,7 @@ namespace corsika {
   template <typename TDimension>
   inline QuantityVector<TDimension> Vector<TDimension>::getComponents(
       CoordinateSystemPtr const& pCS) const {
-    if (*pCS == *BaseVector<TDimension>::getCoordinateSystem()) {
+    if (pCS == BaseVector<TDimension>::getCoordinateSystem()) {
       return BaseVector<TDimension>::getQuantityVector();
     } else {
       return QuantityVector<TDimension>(
-- 
GitLab