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>
22#define MAKE_ASSEMBLER_REGISTERY_FUNCTION(name) \
46 template <class Assembler, class... options> \
47 void register##name(pybind11::handle scope, pybind11::class_<Assembler, options...> cls) { \
48 using pybind11::operator""_a; \
49 using FEContainer = typename Assembler::FEContainer; \
50 using Basis = typename Assembler::Basis; \
51 using DirichletValuesType = typename Assembler::DirichletValuesType; \
52 using FERequirementType = typename Assembler::FERequirementType; \
53 pybind11::module m = pybind11::module::import("ikarus"); \
54 cls.def(pybind11::init([](const pybind11::list& fes, const DirichletValuesType& dirichletValues) { \
58 FEContainer fesV = fes.template cast<FEContainer>(); \
59 return new Assembler(std::move(fesV), dirichletValues); \
61 pybind11::keep_alive<1, 3>()); \
68 [](Assembler& self, const FERequirementType& req) -> std::remove_cvref_t<decltype(self.getMatrix(req))> { \
69 return self.getMatrix(req); \
71 pybind11::return_value_policy::copy); \
74 [](Assembler& self, const FERequirementType& req) \
75 -> std::remove_cvref_t<decltype(self.getReducedMatrix(req))> { return self.getReducedMatrix(req); }, \
76 pybind11::return_value_policy::copy); \
78 "getVector", [](Assembler& self, const FERequirementType& req) { return self.getVector(req); }, \
79 pybind11::return_value_policy::reference); \
81 "getScalar", [](Assembler& self, const FERequirementType& req) { return self.getScalar(req); }, \
82 pybind11::return_value_policy::copy); \
84 "getReducedVector", [](Assembler& self, const FERequirementType& req) { return self.getReducedVector(req); }, \
85 pybind11::return_value_policy::reference); \
88 [](Assembler& self, Eigen::Ref<const Eigen::VectorXd> redVec) { return self.createFullVector(redVec); }, \
89 pybind11::return_value_policy::move); \
91 "reducedSize", [](Assembler& self) { return self.reducedSize(); }, pybind11::return_value_policy::copy); \
Definition of the LinearElastic class for finite element mechanics computations.
#define MAKE_ASSEMBLER_REGISTERY_FUNCTION(name)
Definition: flatassembler.hh:22
Definition: flatassembler.hh:20
SparseFlatAssembler assembles matrix quantities using a flat basis Indexing strategy....
Definition: simpleassemblers.hh:271
DenseFlatAssembler assembles matrix quantities using a flat basis Indexing strategy....
Definition: simpleassemblers.hh:379
Wrapper around Dune-functions global basis.