version 0.4.1
boundarypatch.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2021-2024 The Ikarus Developers mueller@ibb.uni-stuttgart.de
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4#pragma once
5
6#include <dune/python/pybind11/eigen.h>
7#include <dune/python/pybind11/functional.h>
8#include <dune/python/pybind11/pybind11.h>
9#include <dune/python/pybind11/stl.h>
10
12
13namespace Ikarus::Python {
14
15// Python wrapper for the FVAssembler C++ class
16template <class BoundaryPatch, class... options>
17void registerBoundaryPatch(pybind11::handle scope, pybind11::class_<BoundaryPatch, options...> cls) {
18 using pybind11::operator""_a;
19
20 using GridView = typename BoundaryPatch::GridView;
21
22 cls.def(pybind11::init([](const GridView& gv, Eigen::Ref<Eigen::VectorX<bool>> vec) {
23 Dune::BitSetVector<1> bitSetVector;
24 bitSetVector.resize(vec.size());
25 for (size_t i = 0; i < vec.size(); ++i)
26 bitSetVector[i] = vec[i];
27 return new BoundaryPatch(gv, bitSetVector);
28 }),
29 pybind11::keep_alive<1, 2>(), pybind11::keep_alive<1, 3>());
30
31 cls.def("gridView", &BoundaryPatch::gridView);
32}
33
34} // namespace Ikarus::Python
Definition of the LinearElastic class for finite element mechanics computations.
void init(int argc, char **argv, bool enableFileLogger=true)
Initializes the Ikarus framework.
Definition: init.hh:82
Definition: flatassembler.hh:20
void registerBoundaryPatch(pybind11::handle scope, pybind11::class_< BoundaryPatch, options... > cls)
Definition: boundarypatch.hh:17