OGS
ogs_embedded_python.cpp File Reference
#include "ogs_embedded_python.h"
#include <pybind11/embed.h>
#include <charconv>
#include <cstdio>
#include <filesystem>
#include <optional>
#include <string>
#include <string_view>
#include "BaseLib/Error.h"
#include "BaseLib/Logging.h"
#include "ProcessLib/BoundaryConditionAndSourceTerm/Python/BHEInflowPythonBoundaryConditionModule.h"
#include "ProcessLib/BoundaryConditionAndSourceTerm/Python/PythonBoundaryConditionModule.h"
#include "ProcessLib/BoundaryConditionAndSourceTerm/Python/PythonSourceTermModule.h"
Include dependency graph for ogs_embedded_python.cpp:

Go to the source code of this file.

Classes

struct  ApplicationsLib::anonymous_namespace{ogs_embedded_python.cpp}::PipeCloser
 Custom deleter for FILE handles from popen. More...

Namespaces

namespace  ApplicationsLib
namespace  ApplicationsLib::anonymous_namespace{ogs_embedded_python.cpp}

Functions

 PYBIND11_EMBEDDED_MODULE (OpenGeoSys, m)
pybind11::scoped_interpreter ApplicationsLib::setupEmbeddedPython ()
std::optional< std::string > ApplicationsLib::anonymous_namespace{ogs_embedded_python.cpp}::executeCommand (std::string_view command)
 Executes a command and captures its stdout output using popen.
std::optional< std::pair< int, int > > ApplicationsLib::anonymous_namespace{ogs_embedded_python.cpp}::getPythonVersionFromVenv (std::filesystem::path const &venv_path)
 Gets Python version by executing the venv's python executable.
std::filesystem::path ApplicationsLib::anonymous_namespace{ogs_embedded_python.cpp}::findSitePackagesPath (std::filesystem::path const &venv_path)
 Finds site-packages path in the virtual environment.
void ApplicationsLib::setupEmbeddedPythonVenvPaths ()

Function Documentation

◆ PYBIND11_EMBEDDED_MODULE()

PYBIND11_EMBEDDED_MODULE ( OpenGeoSys ,
m  )

Definition at line 21 of file ogs_embedded_python.cpp.

22{
23 DBUG("Binding Python module OpenGeoSys.");
24
28}
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
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().