SERiF 0.0.1a
3+1D Stellar Structure and Evolution
Loading...
Searching...
No Matches
PyCoefficient.cpp
Go to the documentation of this file.
1#include "PyCoefficient.h"
2
3#include <pybind11/pybind11.h>
4#include <pybind11/stl.h>
5#include <pybind11/functional.h> // Needed for std::function
6#include <memory>
7
8#include "mfem.hpp"
9
10namespace py = pybind11;
11using namespace mfem;
12
13namespace serif::pybind {
14 real_t PyCoefficient::Eval(ElementTransformation &T, const IntegrationPoint &ip) {
15 PYBIND11_OVERRIDE_PURE(
16 real_t, /* Return type */
17 Coefficient, /* Base class */
18 Eval, /* Method name */
19 T, ip /* Arguments */
20 );
21 }
22
23 // Override virtual SetTime method
24 void PyCoefficient::SetTime(real_t t) {
25 PYBIND11_OVERRIDE(
26 void,
27 Coefficient,
28 SetTime,
29 t
30 );
31 }
32
33 void PyVectorCoefficient::Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip) {
34 PYBIND11_OVERRIDE_PURE(
35 void, /* Return type */
36 VectorCoefficient, /* Base class */
37 Eval, /* Method name */
38 V, T, ip /* Arguments */
39 );
40 }
41
42 // Override the virtual SetTime method
44 PYBIND11_OVERRIDE(
45 void,
46 VectorCoefficient,
47 SetTime,
48 t
49 );
50 }
51}
Defines pybind11 trampoline classes for mfem::Coefficient and mfem::VectorCoefficient.
void SetTime(mfem::real_t t) override
Set the current time for time-dependent coefficients.
mfem::real_t Eval(mfem::ElementTransformation &T, const mfem::IntegrationPoint &ip) override
Evaluate the coefficient at a given IntegrationPoint in an ElementTransformation.
void Eval(mfem::Vector &V, mfem::ElementTransformation &T, const mfem::IntegrationPoint &ip) override
Evaluate the vector coefficient at a given IntegrationPoint in an ElementTransformation.
void SetTime(mfem::real_t t) override
Set the current time for time-dependent vector coefficients.
Contains pybind11 helper classes and trampoline classes for interfacing C++ with Python.