diff --git a/dumux/python/discretization/gridgeometry.hh b/dumux/python/discretization/gridgeometry.hh index c2f26f29dc693dcd2ffd6b63646b9e4a2e1158a3..fa003be21701af8f9913d8cf4290bf9e3d9160eb 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 e4d73fb27782b9499ce039855f57b08ccc21ff16..238240b2ac2d44089298b8e2d159c266f8ac406d 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)