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

[Cleanup] Rearrange Python initialisation

parent 08860f25
No related branches found
No related tags found
No related merge requests found
...@@ -134,15 +134,11 @@ initStateUpdater(Config::state_model model, ...@@ -134,15 +134,11 @@ initStateUpdater(Config::state_model model,
} }
} }
template <class FunctionMap> void initPython(FunctionMap &functions) { void initPython() {
Python::start(); Python::start();
Python::run("import sys"); Python::run("import sys");
Python::run("sys.path.append('" srcdir "')"); Python::run("sys.path.append('" srcdir "')");
Python::import("one-body-sample")
.get("Functions")
.toC<typename FunctionMap::Base>(functions);
} }
double computeCOF(FrictionData const &fd, double V, double log_state) { double computeCOF(FrictionData const &fd, double V, double log_state) {
...@@ -246,8 +242,14 @@ int main(int argc, char *argv[]) { ...@@ -246,8 +242,14 @@ int main(int argc, char *argv[]) {
// Set up functions for time-dependent boundary conditions // Set up functions for time-dependent boundary conditions
using FunctionType = Dune::VirtualFunction<double, double>; using FunctionType = Dune::VirtualFunction<double, double>;
SharedPointerMap<std::string, FunctionType> functions; using FunctionMap = SharedPointerMap<std::string, FunctionType>;
initPython(functions); FunctionMap functions;
{
initPython();
Python::import("one-body-sample")
.get("Functions")
.toC<typename FunctionMap::Base>(functions);
}
auto const &velocityDirichletFunction = auto const &velocityDirichletFunction =
functions.get("velocityDirichletCondition"); functions.get("velocityDirichletCondition");
auto const &neumannFunction = functions.get("neumannCondition"); auto const &neumannFunction = functions.get("neumannCondition");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment