11#include <dune/python/common/typeregistry.hh>
12#include <dune/python/pybind11/eigen.h>
13#include <dune/python/pybind11/pybind11.h>
14#include <dune/python/pybind11/stl.h>
15#include <dune/python/pybind11/stl_bind.h>
40template <
class Assembler,
class... options>
42 using pybind11::operator
""_a;
43 using FEContainer =
typename Assembler::FEContainer;
44 using Basis =
typename Assembler::Basis;
45 using DirichletValuesType =
typename Assembler::DirichletValuesType;
46 using AffordanceCollectionType =
typename Assembler::AffordanceCollectionType;
47 using FERequirementType =
typename Assembler::FERequirement;
48 using SizeType =
typename Assembler::SizeType;
54 FEContainer fesV = fes.template cast<FEContainer>();
57 pybind11::keep_alive<1, 3>());
65 Ikarus::DBCOption dbcOption) -> std::remove_cvref_t<
decltype(self.matrix(req, affordance))> {
66 return self.matrix(req, affordance, dbcOption);
68 pybind11::return_value_policy::copy);
71 "matrix", [](Assembler& self) -> std::remove_cvref_t<
decltype(self.matrix())> {
return self.matrix(); },
72 pybind11::return_value_policy::copy);
76 [](Assembler& self,
Ikarus::DBCOption dbcOption) -> std::remove_cvref_t<
decltype(self.matrix(dbcOption))> {
77 return self.matrix(dbcOption);
79 pybind11::return_value_policy::copy);
85 pybind11::return_value_policy::reference);
87 cls.def(
"vector", [](Assembler& self) {
return self.vector(); }, pybind11::return_value_policy::reference);
90 "vector", [](Assembler& self,
Ikarus::DBCOption dbcOption) {
return self.vector(dbcOption); },
91 pybind11::return_value_policy::reference);
96 return self.scalar(req, affordance);
98 pybind11::return_value_policy::copy);
100 cls.def(
"scalar", [](Assembler& self) {
return self.scalar(); }, pybind11::return_value_policy::copy);
104 [](Assembler& self, Eigen::Ref<const Eigen::VectorXd> redVec) {
return self.createFullVector(redVec); },
105 pybind11::return_value_policy::move);
106 cls.def(
"reducedSize", [](Assembler& self) {
return self.reducedSize(); }, pybind11::return_value_policy::copy);
107 cls.def(
"bind", [](Assembler& self,
const FERequirementType& req, AffordanceCollectionType affordance,
109 cls.def(
"bind", [](Assembler& self,
const FERequirementType& req) {
return self.bind(req); });
110 cls.def(
"bind", [](Assembler& self,
const AffordanceCollectionType affordance) {
return self.bind(affordance); });
111 cls.def(
"bind", [](Assembler& self,
const DBCOption dbcOption) {
return self.bind(dbcOption); });
112 cls.def(
"bound", [](Assembler& self) {
return self.bound(); });
113 cls.def(
"boundToRequirement", [](Assembler& self) {
return self.boundToRequirement(); });
114 cls.def(
"boundToAffordanceCollection", [](Assembler& self) {
return self.boundToAffordanceCollection(); });
115 cls.def(
"boundToDBCOption", [](Assembler& self) {
return self.boundToDBCOption(); });
116 cls.def(
"requirement", [](Assembler& self) {
return self.requirement(); });
117 cls.def(
"affordanceCollection", [](Assembler& self) {
return self.affordanceCollection(); });
118 cls.def(
"dBCOption", [](Assembler& self) {
return self.dBCOption(); });
119 cls.def_property_readonly(
"size", [](Assembler& self) {
return self.size(); });
120 cls.def(
"__len__", [](Assembler& self) {
return self.size(); });
121 cls.def(
"constraintsBelow", [](Assembler& self, SizeType i) {
return self.constraintsBelow(i); });
122 cls.def(
"isConstrained", [](Assembler& self, SizeType i) {
return self.isConstrained(i); });
123 cls.def_property_readonly(
"gridView", [](Assembler& self) {
return self.gridView(); });
126#define MAKE_ASSEMBLER_REGISTERY_FUNCTION(name) \
127 template <class Assembler, class... options> \
128 void register##name(pybind11::handle scope, pybind11::class_<Assembler, options...> cls) { \
129 registerFlatAssembler(scope, cls); \
#define MAKE_ASSEMBLER_REGISTERY_FUNCTION(name)
Definition: flatassembler.hh:126
Definition of the LinearElastic class for finite element mechanics computations.
void registerFlatAssembler(pybind11::handle scope, pybind11::class_< Assembler, options... > cls)
Register Python bindings for a assembler class. .
Definition: flatassembler.hh:41
MatrixAffordance
A strongly typed enum class representing the matrix affordance.
Definition: ferequirements.hh:63
DBCOption
Definition: dirichletbcenforcement.hh:7
VectorAffordance
A strongly typed enum class representing the vector affordance.
Definition: ferequirements.hh:48
void init(int argc, char **argv, bool enableFileLogger=true)
Initializes the Ikarus framework.
Definition: init.hh:82
ScalarAffordance
A strongly typed enum class representing the scalar affordance.
Definition: ferequirements.hh:37
Definition: flatassembler.hh:21
def dirichletValues(basis)
Definition: dirichlet_values.py:38
SparseFlatAssembler assembles matrix quantities using a flat basis Indexing strategy....
Definition: simpleassemblers.hh:111
DenseFlatAssembler assembles matrix quantities using a flat basis Indexing strategy....
Definition: simpleassemblers.hh:191
Wrapper around Dune-functions global basis.