Skip to content
Snippets Groups Projects
Commit 1ef643a9 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Move python initialisation to a separate function

parent 97303e05
Branches
No related tags found
No related merge requests found
...@@ -176,20 +176,23 @@ initStateUpdater(Config::state_model model, ...@@ -176,20 +176,23 @@ initStateUpdater(Config::state_model model,
} }
} }
template <class FunctionMap> void initPython(FunctionMap &functions) {
Python::start();
Python::run("import sys");
Python::run("sys.path.append('" srcdir "')");
Python::import("one-body-sample")
.get("Functions")
.toC<typename FunctionMap::Base>(functions);
}
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
try { try {
typedef SharedPointerMap<std::string, Dune::VirtualFunction<double, double>> typedef SharedPointerMap<std::string, Dune::VirtualFunction<double, double>>
FunctionMap; FunctionMap;
FunctionMap functions; FunctionMap functions;
{ initPython(functions);
Python::start();
Python::run("import sys");
Python::run("sys.path.append('" srcdir "')");
Python::import("one-body-sample").get("Functions").toC<FunctionMap::Base>(
functions);
}
Dune::ParameterTree parset; Dune::ParameterTree parset;
Dune::ParameterTreeParser::readINITree(srcdir "/one-body-sample.parset", Dune::ParameterTreeParser::readINITree(srcdir "/one-body-sample.parset",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment