version 0.3.7
python/finiteelements/kirchhoffloveshell.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
9#pragma once
10
11#include "registerelement.hh"
12
13#include <dune/fufem/boundarypatch.hh>
14#include <dune/functions/functionspacebases/lagrangebasis.hh>
15#include <dune/functions/functionspacebases/powerbasis.hh>
16#include <dune/grid/yaspgrid.hh>
17#include <dune/python/common/typeregistry.hh>
18#include <dune/python/functions/globalbasis.hh>
19#include <dune/python/pybind11/eigen.h>
20#include <dune/python/pybind11/functional.h>
21#include <dune/python/pybind11/pybind11.h>
22#include <dune/python/pybind11/stl.h>
23
26#include <ikarus/utils/basis.hh>
27
28namespace Ikarus::Python {
29
44 template <class KirchhoffLoveShell, class... options>
45 void registerKirchhoffLoveShell(pybind11::handle scope, pybind11::class_<KirchhoffLoveShell, options...> cls) {
46 registerElement<false, KirchhoffLoveShell, options...>(scope, cls);
47 using GlobalBasis = typename KirchhoffLoveShell::Basis;
48 using FlatBasis = typename KirchhoffLoveShell::FlatBasis;
49 using GridView = typename GlobalBasis::GridView;
50 using Element = typename KirchhoffLoveShell::Element;
51 using Traits = typename KirchhoffLoveShell::Traits;
53
54 using LoadFunction = std::function<Eigen::Vector<double, Traits::worlddim>(
56 cls.def(pybind11::init([](const GlobalBasis& basis, const Element& element, double emod, double nu,
57 double thickness, const LoadFunction volumeLoad) {
58 return new KirchhoffLoveShell(basis, element, emod, nu, thickness, volumeLoad);
59 }),
60 pybind11::keep_alive<1, 2>(), pybind11::keep_alive<1, 3>());
61
62 cls.def(
63 pybind11::init([](const GlobalBasis& basis, const Element& element, double emod, double nu, double thickness) {
64 return new KirchhoffLoveShell(basis, element, emod, nu, thickness);
65 }),
66 pybind11::keep_alive<1, 2>(), pybind11::keep_alive<1, 3>());
67
68 cls.def(pybind11::init([](const GlobalBasis& basis, const Element& element, double emod, double nu,
69 double thickness, const LoadFunction volumeLoad, const BoundaryPatch<GridView>& bp,
70 const LoadFunction neumannBoundaryLoad) {
71 return new KirchhoffLoveShell(basis, element, emod, nu, thickness, volumeLoad, &bp, neumannBoundaryLoad);
72 }),
73 pybind11::keep_alive<1, 2>(), pybind11::keep_alive<1, 3>(), pybind11::keep_alive<1, 8>());
74 }
75
76} // namespace Ikarus::Python
Definition of the LinearElastic class for finite element mechanics computations.
Python bindings for a generic finite element.
void registerKirchhoffLoveShell(pybind11::handle scope, pybind11::class_< KirchhoffLoveShell, options... > cls)
Register Python bindings for a KirchhoffLoveShell class.
Definition: python/finiteelements/kirchhoffloveshell.hh:45
void registerElement(pybind11::handle scope, pybind11::class_< FE, options... > cls)
Register Python bindings for a generic finite element class.
Definition: registerelement.hh:45
void init(int argc, char **argv, bool enableFileLogger=true)
Initializes the Ikarus framework.
Definition: init.hh:81
Definition: flatassembler.hh:20
def basis(gv, tree)
Definition: basis.py:10
def KirchhoffLoveShell(basis, element, youngsMod, nu, thickness, volumeLoad=None, bp=None, neumannBoundaryLoad=None)
Definition: finite_elements/__init__.py:102
Class representing the requirements for finite element calculations.
Definition: ferequirements.hh:170
typename Basis::FlatBasis FlatBasis
Definition: finiteelements/mechanics/kirchhoffloveshell.hh:41
TraitsFromLocalView< LocalView, useEigenRef > Traits
Definition: finiteelements/mechanics/kirchhoffloveshell.hh:49
typename LocalView::Element Element
Definition: finiteelements/mechanics/kirchhoffloveshell.hh:46
FERequirements_ FERequirementType
Definition: finiteelements/mechanics/kirchhoffloveshell.hh:43
Basis_ Basis
Definition: finiteelements/mechanics/kirchhoffloveshell.hh:40
Definition: resultevaluators.hh:20
Definition of the KirchhoffLoveShell class for Kirchhoff-Love shell elements in Ikarus.
Wrapper around Dune-functions global basis.