OGS
ogs_embedded_python.cpp File Reference

Detailed Description

Definition in file ogs_embedded_python.cpp.

Include dependency graph for ogs_embedded_python.cpp:

Go to the source code of this file.

Namespaces

namespace  ApplicationsLib
 

Functions

 PYBIND11_EMBEDDED_MODULE (OpenGeoSys, m)
 
template<typename T >
void mark_used (T p)
 
pybind11::scoped_interpreter ApplicationsLib::setupEmbeddedPython ()
 

Function Documentation

◆ mark_used()

template<typename T >
void mark_used ( T p)

Definition at line 49 of file ogs_embedded_python.cpp.

50{
51 volatile T vp = p;
52 vp = vp;
53}

Referenced by ApplicationsLib::setupEmbeddedPython().

◆ PYBIND11_EMBEDDED_MODULE()

PYBIND11_EMBEDDED_MODULE ( OpenGeoSys ,
m  )

Definition at line 22 of file ogs_embedded_python.cpp.

23{
24 DBUG("Binding Python module OpenGeoSys.");
25
29
30 // Check for activated virtual environment and add it to sys.path
31 pybind11::exec(R"(
32 import os
33 import sys
34 if "VIRTUAL_ENV" in os.environ:
35 venv_site_packages_path = f"{os.environ['VIRTUAL_ENV']}/lib/python{sys.version_info.major}.{sys.version_info.minor}/site-packages"
36 if os.path.exists(venv_site_packages_path):
37 print(
38 f"Virtual environment detected, adding {venv_site_packages_path} to sys.path."
39 )
40 sys.path.insert(0, venv_site_packages_path)
41 )");
42}
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
void pythonBindSourceTerm(pybind11::module &m)
Creates Python bindings for the Python source term class.
void pythonBindBoundaryCondition(pybind11::module &m)
Creates Python bindings for the Python BC class.
void bheInflowpythonBindBoundaryCondition(pybind11::module &m)
Creates BHE Inflow Python bindings for the Python BC class.

References ProcessLib::bheInflowpythonBindBoundaryCondition(), DBUG(), ProcessLib::pythonBindBoundaryCondition(), and ProcessLib::SourceTerms::Python::pythonBindSourceTerm().