From b4dffe266ecd85fd550fd22f4817422ce81c95ed Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Sun, 6 Aug 2023 07:14:18 +0200 Subject: [PATCH] c++-Array -> Py-tuple --- libsrc/core/python_ngcore.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libsrc/core/python_ngcore.hpp b/libsrc/core/python_ngcore.hpp index 79c91885..f333071b 100644 --- a/libsrc/core/python_ngcore.hpp +++ b/libsrc/core/python_ngcore.hpp @@ -286,6 +286,15 @@ namespace ngcore return arr; } + template + py::object makePyTuple (FlatArray ar) + { + py::tuple res(ar.Size()); + for (auto i : Range(ar)) + res[i] = py::cast(ar[i]); + return res; + } + template ::index_type> void ExportArray (py::module &m) {