MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / Parallel_InitPython

Function Parallel_InitPython

solve/ngsolve.cpp:840–867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

838
839#ifdef NGS_PYTHON
840void Parallel_InitPython ()
841{
842 static bool python_initialized = false;
843 if (!python_initialized)
844 {
845 cout << "ini (parallel) python" << endl;
846 Py_Initialize();
847#if PY_VERSION_HEX < 0x03090000
848 PyEval_InitThreads();
849#endif
850
851
852 py::module m = py::module::import("__main__");
853 // pyenv = PythonEnvironment (m);
854 {
855 m.def ("Redraw",
856 []() {Ng_Redraw();});
857 }
858
859 // cout << "ini python complete" << endl;
860
861 pyenv.exec("from ngsolve import *");
862 //PyEval_ReleaseLock();
863 PyEval_SaveThread();
864
865 python_initialized = true;
866 }
867}
868#endif
869
870

Callers 1

NGS_ParallelRunFunction · 0.85

Calls 1

execMethod · 0.80

Tested by

no test coverage detected