From 792df9d192f896baceb9f7d701937be42ba2d152 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Wed, 30 Sep 2020 15:29:20 +0200
Subject: [PATCH] [python][problem] Add bindings for sourceAtPos

---
 dumux/python/common/fvproblem.hh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dumux/python/common/fvproblem.hh b/dumux/python/common/fvproblem.hh
index 5d4d5db74e..c654b34f0f 100644
--- a/dumux/python/common/fvproblem.hh
+++ b/dumux/python/common/fvproblem.hh
@@ -55,6 +55,7 @@ public:
     using FVElementGeometry = typename GridGeometry::LocalView;
     using SubControlVolume = typename GridGeometry::SubControlVolume;
     using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
+    using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
 
     static constexpr bool isBox = GridGeometry::discMethod == DiscretizationMethod::box;
     static constexpr std::size_t numEq = static_cast<std::size_t>(PrimaryVariables::dimension);
@@ -124,6 +125,11 @@ public:
         return pyProblem_.attr("source")(element, fvGeometry, scv).template cast<NumEqVector>();
     }
 
+    NumEqVector sourceAtPos(const GlobalPosition &globalPos) const
+    {
+        return pyProblem_.attr("sourceAtPos")(globalPos).template cast<NumEqVector>();
+    }
+
     template<class Entity>
     PrimaryVariables initial(const Entity& entity) const
     {
@@ -180,6 +186,7 @@ void registerFVProblem(pybind11::handle scope, pybind11::class_<Problem, options
 
     cls.def("neumann", &Problem::template neumann<decltype(std::ignore), decltype(std::ignore)>);
     cls.def("source", &Problem::template source<decltype(std::ignore)>);
+    cls.def("sourceAtPos", &Problem::sourceAtPos);
     cls.def("initial", &Problem::template initial<Element>);
     cls.def("initial", &Problem::template initial<Vertex>);
     cls.def("extrusionFactor", &Problem::template extrusionFactor<decltype(std::ignore)>);
-- 
GitLab