1 #ifndef DUNE_PYTHON_LOCALFUNCTIONS_LOCALFINITEELEMENT_HH
2 #define DUNE_PYTHON_LOCALFUNCTIONS_LOCALFINITEELEMENT_HH
4 #include <dune/python/pybind11/pybind11.h>
6 #include <dune/common/visibility.hh>
15 template<
typename LocalBasis>
16 DUNE_EXPORT
auto registerLocalBasis(pybind11::handle scope)
18 static auto cls = pybind11::class_<LocalBasis>(scope,
"LocalBasis");
20 cls.def(
"__len__", [](
const LocalBasis& basis) {
return basis.size(); });
21 cls.def_property_readonly(
"order", [](
const LocalBasis& basis) {
return basis.order(); });
22 cls.def(
"evaluateFunction",
23 [](
const LocalBasis& basis,
const typename LocalBasis::Traits::DomainType& in) {
24 std::vector<typename LocalBasis::Traits::RangeType> out;
25 basis.evaluateFunction(in, out);
28 cls.def(
"evaluateJacobian",
29 [](
const LocalBasis& basis,
const typename LocalBasis::Traits::DomainType& in) {
30 std::vector<typename LocalBasis::Traits::JacobianType> out;
31 basis.evaluateJacobian(in, out);
37 DUNE_EXPORT
auto registerLocalKey(pybind11::handle scope)
39 static auto cls = pybind11::class_<LocalKey>(scope,
"LocalKey");
43 cls.def_property(
"index",
46 cls.def(
"__lt__", &LocalKey::operator<);
53 template<
typename LocalFiniteElement>
56 static auto cls = pybind11::class_<LocalFiniteElement>(scope, name);
58 detail::registerLocalBasis<typename LocalFiniteElement::Traits::LocalBasisType>(cls);
60 cls.def_property_readonly(
"localBasis", &LocalFiniteElement::localBasis, pybind11::return_value_policy::reference_internal);
63 cls.def(
"__len__", &LocalFiniteElement::size);
64 cls.def_property_readonly(
"type", &LocalFiniteElement::type);
Definition: bdfmcube.hh:16
DUNE_EXPORT auto registerLocalFiniteElement(pybind11::handle scope, const char *name="LocalFiniteElement")
Definition: python/localfunctions/localfiniteelement.hh:54
Describe position of one degree of freedom.
Definition: localkey.hh:21
unsigned int index() const
Return offset within subentity.
Definition: localkey.hh:66
unsigned int codim() const
Return codim of associated entity.
Definition: localkey.hh:60
unsigned int subEntity() const
Return number of associated subentity.
Definition: localkey.hh:54