From 8c459e68d0d8d770f1e3a018c5ef8dfdb0023aec Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Thu, 4 Oct 2018 12:36:00 +0200
Subject: [PATCH] [PL/STs/Python] Have to use vector instead of array.

pybind11 could not cast python tuple to C++ pair<double, std::array<double, 3>>
---
 ProcessLib/SourceTerms/Python/PythonSourceTermModule.cpp | 6 +++---
 .../Python/PythonSourceTermPythonSideInterface.h         | 9 ++++++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/ProcessLib/SourceTerms/Python/PythonSourceTermModule.cpp b/ProcessLib/SourceTerms/Python/PythonSourceTermModule.cpp
index 822c48fcb1e..735e9610c95 100644
--- a/ProcessLib/SourceTerms/Python/PythonSourceTermModule.cpp
+++ b/ProcessLib/SourceTerms/Python/PythonSourceTermModule.cpp
@@ -29,11 +29,11 @@ public:
     using PythonSourceTermPythonSideInterface::
         PythonSourceTermPythonSideInterface;
 
-    std::pair<double, std::array<double, 3>> getFlux(
-        double t, std::array<double, 3> x,
+    std::pair<double, std::vector<double>> getFlux(
+        double t, std::array<double, 3> const& x,
         std::vector<double> const& primary_variables) const override
     {
-        using Ret = std::pair<double, std::array<double, 3>>;
+        using Ret = std::pair<double, std::vector<double>>;
         PYBIND11_OVERLOAD(Ret, PythonSourceTermPythonSideInterface,
                           getFlux, t, x, primary_variables);
     }
diff --git a/ProcessLib/SourceTerms/Python/PythonSourceTermPythonSideInterface.h b/ProcessLib/SourceTerms/Python/PythonSourceTermPythonSideInterface.h
index 754dedfe843..e8ba176afc6 100644
--- a/ProcessLib/SourceTerms/Python/PythonSourceTermPythonSideInterface.h
+++ b/ProcessLib/SourceTerms/Python/PythonSourceTermPythonSideInterface.h
@@ -28,11 +28,14 @@ public:
      * \return flux Flux of the source term at that node and derivative of the
      * flux w.r.t. all primary variables.
      */
-    virtual std::pair<double, std::array<double, 3>> getFlux(
-        double /*t*/, std::array<double, 3> /*x*/,
+    virtual std::pair<double, std::vector<double>> getFlux(
+        double /*t*/, std::array<double, 3> const& /*x*/,
         std::vector<double> const& /*primary_variables*/) const
     {
-        return {std::numeric_limits<double>::quiet_NaN(), {}};
+        return {std::numeric_limits<double>::quiet_NaN(),
+                std::vector<double>{std::numeric_limits<double>::quiet_NaN(),
+                                    std::numeric_limits<double>::quiet_NaN(),
+                                    std::numeric_limits<double>::quiet_NaN()}};
     }
 
     //! Tells if getFlux() has been overridden in the derived class in Python.
-- 
GitLab