diff --git a/dumux/python/common/fvproblem.hh b/dumux/python/common/fvproblem.hh index 1b634b519a8eccc9d280e4fde022b3610ffeac02..5da2a9f348ab750cba1d01c75827f90ba0f35802 100644 --- a/dumux/python/common/fvproblem.hh +++ b/dumux/python/common/fvproblem.hh @@ -62,7 +62,7 @@ public: using BoundaryTypes = Dumux::BoundaryTypes<PrimaryVariables::dimension>; FVProblem(std::shared_ptr<const GridGeometry> gridGeometry, - std::shared_ptr<SpatialParams> spatialParams, + std::shared_ptr<const SpatialParams> spatialParams, pybind11::object pyProblem) : gridGeometry_(gridGeometry) , pyProblem_(pyProblem) @@ -237,16 +237,12 @@ public: const SpatialParams& spatialParams() const { return *spatialParams_; } - //! Return a reference to the underlying spatial parameters - SpatialParams& spatialParams() - { return *spatialParams_; } - private: std::shared_ptr<const GridGeometry> gridGeometry_; pybind11::object pyProblem_; std::string name_; std::string paramGroup_; - std::shared_ptr<SpatialParams> spatialParams_; + std::shared_ptr<const SpatialParams> spatialParams_; }; // Python wrapper for the above FVProblem C++ class @@ -259,7 +255,7 @@ void registerFVProblem(pybind11::handle scope, pybind11::class_<Problem, options using GridGeometry = typename Problem::GridGeometry; using SpatialParams = typename Problem::SpatialParams; cls.def(pybind11::init([](std::shared_ptr<const GridGeometry> gridGeometry, - std::shared_ptr<SpatialParams> spatialParams, + std::shared_ptr<const SpatialParams> spatialParams, pybind11::object p){ return std::make_shared<Problem>(gridGeometry, spatialParams, p); })); diff --git a/dumux/python/porousmediumflow/problem.hh b/dumux/python/porousmediumflow/problem.hh index ebe049093b8fab004e9e7e29dbc731b71a7558f6..d97b8a28eb7e2fa9b041438456c0ea32fd6227f1 100644 --- a/dumux/python/porousmediumflow/problem.hh +++ b/dumux/python/porousmediumflow/problem.hh @@ -56,7 +56,7 @@ public: using BoundaryTypes = Dumux::BoundaryTypes<PrimaryVariables::dimension>; PorousMediumFlowProblem(std::shared_ptr<const GridGeometry> gridGeometry, - std::shared_ptr<SpatialParams> spatialParams, + std::shared_ptr<const SpatialParams> spatialParams, pybind11::object pyProblem) : ParentType(gridGeometry, spatialParams, pyProblem) , spatialParams_(spatialParams) @@ -110,6 +110,7 @@ void registerPorousMediumFlowProblem(pybind11::handle scope, pybind11::class_<Pr cls.def("initial", &Problem::template initial<Element>); cls.def("initial", &Problem::template initial<Vertex>); cls.def("gridGeometry", &Problem::gridGeometry); + cls.def("spatialParams", &Problem::spatialParams); } } // end namespace Dumux::Python