From 05b195a5e635b6c6b53dd022e8d002d79d6b2aad Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Fri, 17 Apr 2020 08:36:35 +0200
Subject: [PATCH] [python][gg] Use std::shared_ptr as holder type

---
 dumux/python/discretization/gridgeometry.hh | 3 +--
 python/dumux/discretization/__init__.py     | 3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dumux/python/discretization/gridgeometry.hh b/dumux/python/discretization/gridgeometry.hh
index c2f26f29dc..fa003be217 100644
--- a/dumux/python/discretization/gridgeometry.hh
+++ b/dumux/python/discretization/gridgeometry.hh
@@ -98,12 +98,11 @@ template <class GG, class... Options>
 void registerGridGeometry(pybind11::handle scope, pybind11::class_<GG, Options...> cls)
 {
     using pybind11::operator""_a;
-    using namespace Dune::Python;
 
     using GridView = typename GG::GridView;
 
     cls.def(pybind11::init([](GridView gridView){
-        return std::make_unique<GG>(gridView);
+        return std::make_shared<GG>(gridView);
     }), "gridView"_a);
 
     cls.def("update", &GG::update);
diff --git a/python/dumux/discretization/__init__.py b/python/dumux/discretization/__init__.py
index e4d73fb277..238240b2ac 100644
--- a/python/dumux/discretization/__init__.py
+++ b/python/dumux/discretization/__init__.py
@@ -16,6 +16,7 @@ def GridGeometry(gridView, discMethod="cctpfa"):
         raise ValueError("Unknown discMethod {}".format(discMethod))
 
     moduleName = "gridgeometry_" + hashIt(typeName)
+    holderType = "std::shared_ptr<{}>".format(typeName)
     generator = SimpleGenerator("GridGeometry", "Dumux::Python")
-    module = generator.load(includes, typeName, moduleName)
+    module = generator.load(includes, typeName, moduleName, options=[holderType])
     return module.GridGeometry(gridView)
-- 
GitLab