From c7ae343eab10588b7b83d9377cd6263812499558 Mon Sep 17 00:00:00 2001
From: Oliver Sander <oliver.sander@tu-dresden.de>
Date: Thu, 21 Jan 2021 13:17:48 +0100
Subject: [PATCH] Stop using deprecated class PythonFunction

---
 src/finite-strain-elasticity.cc | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/src/finite-strain-elasticity.cc b/src/finite-strain-elasticity.cc
index 01a0db4..411f905 100644
--- a/src/finite-strain-elasticity.cc
+++ b/src/finite-strain-elasticity.cc
@@ -160,21 +160,16 @@ int main (int argc, char *argv[]) try
   // Make Python function that computes which vertices are on the Dirichlet boundary,
   // based on the vertex positions.
   std::string lambda = std::string("lambda x: (") + parameterSet.get<std::string>("dirichletVerticesPredicate") + std::string(")");
-  PythonFunction<FieldVector<double,dim>, bool> pythonDirichletVertices(Python::evaluate(lambda));
+  auto pythonDirichletVertices = Python::make_function<bool>(Python::evaluate(lambda));
 
   // Same for the Neumann boundary
   lambda = std::string("lambda x: (") + parameterSet.get<std::string>("neumannVerticesPredicate", "0") + std::string(")");
-  PythonFunction<FieldVector<double,dim>, bool> pythonNeumannVertices(Python::evaluate(lambda));
+  auto pythonNeumannVertices = Python::make_function<bool>(Python::evaluate(lambda));
 
   for (auto&& v : vertices(gridView))
   {
-    bool isDirichlet;
-    pythonDirichletVertices.evaluate(v.geometry().corner(0), isDirichlet);
-    dirichletVertices[indexSet.index(v)] = isDirichlet;
-
-    bool isNeumann;
-    pythonNeumannVertices.evaluate(v.geometry().corner(0), isNeumann);
-    neumannVertices[indexSet.index(v)] = isNeumann;
+    dirichletVertices[indexSet.index(v)] = pythonDirichletVertices(v.geometry().corner(0));
+    neumannVertices[indexSet.index(v)] = pythonNeumannVertices(v.geometry().corner(0));
   }
 
   BoundaryPatch<GridView> dirichletBoundary(gridView, dirichletVertices);
@@ -202,7 +197,7 @@ int main (int argc, char *argv[]) try
   SolutionType x(basis.size());
 
   lambda = std::string("lambda x: (") + parameterSet.get<std::string>("initialDeformation") + std::string(")");
-  PythonFunction<FieldVector<double,dim>, FieldVector<double,dim> > pythonInitialDeformation(Python::evaluate(lambda));
+  auto pythonInitialDeformation = Python::make_function<FieldVector<double,dim> >(Python::evaluate(lambda));
 
   Dune::Functions::interpolate(basis, x, pythonInitialDeformation);
 
@@ -328,7 +323,7 @@ int main (int argc, char *argv[]) try
     Python::Reference dirichletValuesPythonObject = C(homotopyParameter);
 
     // Extract object member functions as Dune functions
-    PythonFunction<FieldVector<double,dim>, FieldVector<double,dim> >   dirichletValues(dirichletValuesPythonObject.get("dirichletValues"));
+    auto dirichletValues = Python::make_function<FieldVector<double, dim> >(dirichletValuesPythonObject.get("dirichletValues"));
 
     Dune::Functions::interpolate(basis, x, dirichletValues, dirichletDofs);
 
-- 
GitLab