OGS
PythonSourceTermModule.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
5
6#include <algorithm>
7#include <pybind11/pybind11.h>
8#include <pybind11/stl.h>
9
11
12namespace ProcessLib
13{
14namespace SourceTerms
15{
16namespace Python
17{
23{
24public:
26 PythonSourceTermPythonSideInterface;
27
28 std::pair<double, std::vector<double>> getFlux(
29 double t, std::array<double, 3> const& x,
30 std::vector<double> const& primary_variables) const override
31 {
32 using Ret = std::pair<double, std::vector<double>>;
33 PYBIND11_OVERLOAD_PURE(Ret, PythonSourceTermPythonSideInterface,
34 getFlux, t, x, primary_variables);
35 }
36};
37
38void pythonBindSourceTerm(pybind11::module& m)
39{
40 namespace py = pybind11;
41
44 pybc(m, "SourceTerm");
45
46 pybc.def(py::init());
47
49}
50
51} // namespace Python
52} // namespace SourceTerms
53} // namespace ProcessLib
std::pair< double, std::vector< double > > getFlux(double t, std::array< double, 3 > const &x, std::vector< double > const &primary_variables) const override
virtual std::pair< double, std::vector< double > > getFlux(double, std::array< double, 3 > const &, std::vector< double > const &) const =0
void pythonBindSourceTerm(pybind11::module &m)
Creates Python bindings for the Python source term class.