From ff5c8af46b78f0515a77b427c4c386e512cb2db7 Mon Sep 17 00:00:00 2001
From: Christoph Lehmann <christoph.lehmann@ufz.de>
Date: Mon, 19 Sep 2022 16:43:51 +0200
Subject: [PATCH] [PL] Fixed IP data getter

---
 .../Utils/SetOrGetIntegrationPointData.h      | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/ProcessLib/Utils/SetOrGetIntegrationPointData.h b/ProcessLib/Utils/SetOrGetIntegrationPointData.h
index cc355456bb4..3d192c51cf2 100644
--- a/ProcessLib/Utils/SetOrGetIntegrationPointData.h
+++ b/ProcessLib/Utils/SetOrGetIntegrationPointData.h
@@ -16,7 +16,7 @@
 
 #include "BaseLib/DynamicSpan.h"
 #include "MathLib/KelvinVector.h"
-#include "MathLib/LinAlg/Eigen/EigenMapTools.h"
+#include "TransposeInPlace.h"
 
 namespace ProcessLib
 {
@@ -65,17 +65,25 @@ std::vector<double> const& getIntegrationPointKelvinVectorData(
     return cache;
 }
 
+//! Overload without \c cache argument.
+//!
+//! \note This function returns the data in transposed storage order compared to
+//! the overloads that have a \c cache argument.
 template <int DisplacementDim, typename IntegrationPointDataVector,
           typename MemberType>
 std::vector<double> getIntegrationPointKelvinVectorData(
     IntegrationPointDataVector const& ip_data_vector, MemberType member)
 {
-    std::vector<double> ip_kelvin_vector_values;
-
-    getIntegrationPointKelvinVectorData<DisplacementDim>(
-        ip_data_vector, member, ip_kelvin_vector_values);
+    constexpr int kelvin_vector_size =
+        MathLib::KelvinVector::kelvin_vector_dimensions(DisplacementDim);
 
-    return ip_kelvin_vector_values;
+    return transposeInPlace<kelvin_vector_size>(
+        [&](std::vector<double>& values)
+        {
+            return getIntegrationPointKelvinVectorData<DisplacementDim>(
+                ip_data_vector, member, values);
+            ;
+        });
 }
 
 template <int DisplacementDim, typename IntegrationPointDataVector,
-- 
GitLab