From 6fb102bada21c0d521e518beb6f08b1c41c49f6a Mon Sep 17 00:00:00 2001
From: Riccardo Maria Bianchi <riccardo.maria.bianchi@cern.ch>
Date: Wed, 12 Jun 2024 10:09:20 +0200
Subject: [PATCH] move Elements to REAL DB records

---
 .../GeoModelWrite/GeoModelWrite/WriteGeoModel.h  |  4 +++-
 GeoModelIO/GeoModelWrite/src/WriteGeoModel.cpp   | 16 ++++++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/GeoModelIO/GeoModelWrite/GeoModelWrite/WriteGeoModel.h b/GeoModelIO/GeoModelWrite/GeoModelWrite/WriteGeoModel.h
index 1e58bbe23..4577344aa 100644
--- a/GeoModelIO/GeoModelWrite/GeoModelWrite/WriteGeoModel.h
+++ b/GeoModelIO/GeoModelWrite/GeoModelWrite/WriteGeoModel.h
@@ -351,7 +351,7 @@ class WriteGeoModel : public GeoNodeAction {
     std::vector<std::vector<std::string>> m_physVols;
     std::vector<std::vector<std::string>> m_fullPhysVols;
     std::vector<std::vector<std::string>> m_materials;
-    std::vector<std::vector<std::string>> m_elements;
+    // std::vector<std::vector<std::string>> m_elements;
     std::vector<std::vector<std::string>> m_transforms;
     std::vector<std::vector<std::string>> m_alignableTransforms;
     std::vector<std::vector<std::string>> m_serialDenominators;
@@ -361,6 +361,8 @@ class WriteGeoModel : public GeoNodeAction {
     std::vector<std::vector<std::string>> m_nameTags;
     std::vector<std::vector<std::string>> m_shapes;
 
+    DBRowsList m_elements;
+
     DBRowsList m_shapes_Box;
     DBRowsList m_shapes_Tube;
     DBRowsList m_shapes_Cons;
diff --git a/GeoModelIO/GeoModelWrite/src/WriteGeoModel.cpp b/GeoModelIO/GeoModelWrite/src/WriteGeoModel.cpp
index a3e881852..4d96e1c05 100644
--- a/GeoModelIO/GeoModelWrite/src/WriteGeoModel.cpp
+++ b/GeoModelIO/GeoModelWrite/src/WriteGeoModel.cpp
@@ -2041,10 +2041,18 @@ unsigned int WriteGeoModel::addMaterial(const std::string& name,
 unsigned int WriteGeoModel::addElement(const std::string& name,
                                        const std::string& symbol,
                                        const double& elZ, const double& elA) {
-    std::vector<std::vector<std::string>>* container = &m_elements;
-    std::vector<std::string> values;
-    values.insert(values.begin(), {name, symbol, CppHelper::to_string_with_precision(elZ),
-                                   CppHelper::to_string_with_precision(elA)});
+    // std::vector<std::vector<std::string>>* container = &m_elements;
+    // std::vector<std::string> values;
+    // values.insert(values.begin(), {name, symbol, CppHelper::to_string_with_precision(elZ),
+    //                                CppHelper::to_string_with_precision(elA)});
+    
+    DBRowsList* container = &m_elements;
+    DBRowEntry values;
+    values.push_back(name);
+    values.push_back(symbol);
+    values.push_back(elZ);
+    values.push_back(elA);
+    
     return addRecord(container, values);
 }
 
-- 
GitLab