Newer
Older

HBShaoUFZ
committed
* \file
* Copyright (c) 2012-2020, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include "BHEInflowPythonBoundaryConditionModule.h"
#include <pybind11/stl.h>
#include "BHEInflowPythonBoundaryConditionPythonSideInterface.h"
namespace ProcessLib
{
//! Trampoline class allowing methods of class
//! PythonBoundaryConditionPythonSideInterface to be overridden on the Python
//! side. Cf. https://pybind11.readthedocs.io/en/stable/advanced/classes.html
class BHEInflowPythonBoundaryConditionPythonSideInterfaceTrampoline
: public BHEInflowPythonBoundaryConditionPythonSideInterface
{
public:
using BHEInflowPythonBoundaryConditionPythonSideInterface::
BHEInflowPythonBoundaryConditionPythonSideInterface;
std::tuple<double, std::vector<double>, std::vector<double>,
std::vector<int>, std::vector<double>>
initializeDataContainer() const override
{
using Ret = std::tuple<double, std::vector<double>, std::vector<double>,
std::vector<int>, std::vector<double>>;
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
PYBIND11_OVERLOAD(Ret,
BHEInflowPythonBoundaryConditionPythonSideInterface,
initializeDataContainer);
}
std::tuple<bool, bool, std::vector<double>> tespyThermalSolver(
double t,
std::vector<double> const& Tin_val,
std::vector<double> const& Tout_val) const override
{
using Ret = std::tuple<bool, bool, std::vector<double>>;
PYBIND11_OVERLOAD(Ret,
BHEInflowPythonBoundaryConditionPythonSideInterface,
tespyThermalSolver, t, Tin_val, Tout_val);
}
std::tuple<bool, std::vector<double>> tespyHydroSolver(
double t) const override
{
using Ret = std::tuple<bool, std::vector<double>>;
PYBIND11_OVERLOAD(Ret,
BHEInflowPythonBoundaryConditionPythonSideInterface,
tespyHydroSolver, t);
}
};
void bheInflowpythonBindBoundaryCondition(pybind11::module& m)
{
namespace py = pybind11;
py::class_<BHEInflowPythonBoundaryConditionPythonSideInterface,
BHEInflowPythonBoundaryConditionPythonSideInterfaceTrampoline>
pybc(m, "BHENetwork");
pybc.def(py::init());
pybc.def("initializeDataContainer",
&BHEInflowPythonBoundaryConditionPythonSideInterface::
initializeDataContainer);
pybc.def("tespyThermalSolver",
&BHEInflowPythonBoundaryConditionPythonSideInterface::
tespyThermalSolver);
pybc.def(
"tespyHydroSolver",
&BHEInflowPythonBoundaryConditionPythonSideInterface::tespyHydroSolver);
}
} // namespace ProcessLib