From 412b99cf4d55c87da742ffdb403c7386b8a2b057 Mon Sep 17 00:00:00 2001
From: Vakho Tsulaia <tsulaia@cern.ch>
Date: Wed, 8 Jan 2025 11:22:39 -0800
Subject: [PATCH] GeoPcon and GeoPgon: extended the interface to allow const
 access to memory buffers of the member vectors

This change was implemented to simplify Geo2G4 translation. In particula, it should allow
passing the buffers held by GeoPcon and GeoPgon to the constructors of G4Polycone and
G4Polyhedra respectively (see the discussion on https://gitlab.cern.ch/atlas/athena/-/merge_requests/74223)
---
 .../GeoModelKernel/GeoModelKernel/GeoPcon.h       | 15 +++++++++++++++
 .../GeoModelKernel/GeoModelKernel/GeoPgon.h       | 15 +++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPcon.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPcon.h
index 080fd1ecf..8c986a3ef 100644
--- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPcon.h
+++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPcon.h
@@ -70,16 +70,31 @@ class GeoPcon : public GeoShape {
       return m_zPlane[i];
   }
 
+  // Get a pointer to the memory buffer with Z Positions
+  const double* getZPlaneBuff() const {
+    return m_zPlane.data();
+  }
+
   //    Get the RMin of the specified plane.
   double getRMinPlane(unsigned int i) const {
       return m_rMinPlane[i];
   }
 
+  // Get a pointer to the memory buffer with RMin-s
+  const double* getRMinBuff() const {
+    return m_rMinPlane.data();
+  }
+
   //    Get the Z Position of the specified plane.
   double getRMaxPlane(unsigned int i) const {
       return m_rMaxPlane[i];
   }
 
+  // Get a pointer to the memory buffer with RMax-s
+  const double* getRMaxBuff() const {
+    return m_rMaxPlane.data();
+  }
+
   //    Executes a GeoShapeAction
   virtual void exec (GeoShapeAction *action) const;
 
diff --git a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPgon.h b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPgon.h
index cfca2b3b0..5e23ca87a 100644
--- a/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPgon.h
+++ b/GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPgon.h
@@ -62,16 +62,31 @@ class GeoPgon : public GeoShape
     return m_zPlane[i];
   }
 
+  // Get a pointer to the memory buffer with Z Positions
+  const double* getZPlaneBuff() const {
+    return m_zPlane.data();
+  }
+
   //    Get the RMin of the specified plane.
   double getRMinPlane (unsigned int i) const {
      return m_rMinPlane[i];
   }
 
+  // Get a pointer to the memory buffer with RMin-s
+  const double* getRMinBuff() const {
+    return m_rMinPlane.data();
+  }
+
   //    Get the Z Position of the specified plane.
   double getRMaxPlane (unsigned int i) const {
      return m_rMaxPlane[i];
   }
 
+  // Get a pointer to the memory buffer with RMax-s
+  const double* getRMaxBuff() const {
+    return m_rMaxPlane.data();
+  }
+
   //    Executes a GeoShapeAction
   virtual void exec (GeoShapeAction *action) const;
 
-- 
GitLab