From 35ba96f4ee344e828e0f54db6a46c93b388bb54d Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Wed, 14 Jan 2015 19:55:00 +0000
Subject: [PATCH] Start the Python interpreter at the beginning of the program

[[Imported from SVN: r10004]]
---
 src/Makefile.am     |  7 +++++--
 src/harmonicmaps.cc | 12 ++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 22912c6c..da531dfb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,9 +18,12 @@ cosserat_continuum_LDFLAGS  = $(UG_LDFLAGS) $(IPOPT_LDFLAGS) \
                               $(ADOLC_LDFLAGS) $(PYTHON_LDFLAGS)
 
 harmonicmaps_SOURCES = harmonicmaps.cc
-harmonicmaps_CXXFLAGS = $(UG_CPPFLAGS) $(AMIRAMESH_CPPFLAGS) $(IPOPT_CPPFLAGS) $(PSURFACE_CPPFLAGS)
+harmonicmaps_CXXFLAGS = $(UG_CPPFLAGS) $(AMIRAMESH_CPPFLAGS) $(IPOPT_CPPFLAGS) $(PSURFACE_CPPFLAGS) \
+                        $(ADOLC_CPPFLAGS) $(PYTHON_CPPFLAGS)
 harmonicmaps_LDADD    = $(UG_LDFLAGS) $(AMIRAMESH_LDFLAGS) $(UG_LIBS) $(AMIRAMESH_LIBS) \
-                          $(IPOPT_LDFLAGS) $(IPOPT_LIBS) $(PSURFACE_LDFLAGS) $(PSURFACE_LIBS)
+                        $(IPOPT_LDFLAGS) $(IPOPT_LIBS) $(PSURFACE_LDFLAGS) $(PSURFACE_LIBS) \
+                        $(ADOLC_LIBS) $(PYTHON_LIBS) $(ADOLC_LDFLAGS) $(PYTHON_LDFLAGS)
+
 
 rod3d_SOURCES = rod3d.cc
 rod3d_CXXFLAGS = $(IPOPT_CPPFLAGS)
diff --git a/src/harmonicmaps.cc b/src/harmonicmaps.cc
index 19147ba6..9f089b8b 100644
--- a/src/harmonicmaps.cc
+++ b/src/harmonicmaps.cc
@@ -25,6 +25,7 @@
 
 #include <dune/fufem/boundarypatch.hh>
 #include <dune/fufem/functions/vtkbasisgridfunction.hh>
+#include <dune/fufem/dunepython.hh>
 
 #include <dune/solvers/solvers/iterativesolver.hh>
 #include <dune/solvers/norms/energynorm.hh>
@@ -81,6 +82,17 @@ computeEmbeddedDifference(const std::vector<TargetSpace>& a, const std::vector<T
 int main (int argc, char *argv[]) try
 {
     //feenableexcept(FE_INVALID);
+    // Start Python interpreter
+    Python::start();
+    Python::Reference main = Python::import("__main__");
+    Python::run("import math");
+
+    //feenableexcept(FE_INVALID);
+    Python::runStream()
+        << std::endl << "import sys"
+        << std::endl << "sys.path.append('/home/sander/dune/dune-gfe/src')"
+        << std::endl;
+
 
     typedef std::vector<TargetSpace> SolutionType;
 
-- 
GitLab