version 0.4.1
utils.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2021-2025 The Ikarus Developers mueller@ibb.uni-stuttgart.de
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4#include <dune/python/pybind11/eigen.h>
5#include <dune/python/pybind11/operators.h>
6#include <dune/python/pybind11/pybind11.h>
7
9
11 namespace py = pybind11;
12 using namespace pybind11::literals;
13 using namespace Ikarus;
14
15 auto utils = pybind11::module::import("ikarus.utils");
16
31 utils.def(
32 "toVoigt",
33 [](Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> mat, bool isStrain = true) {
34 return toVoigt(mat, isStrain);
35 },
36 py::arg("matrix"), py::arg("isStrain") = true);
37
51 utils.def(
52 "fromVoigt",
53 [](Eigen::Matrix<double, Eigen::Dynamic, 1, 0, 6, 1> vec, bool isStrain = true) {
54 return fromVoigt(vec, isStrain);
55 },
56 py::arg("vector"), py::arg("isStrain") = true);
57}
Helper for the Eigen::Tensor types.
void addBindingsToUtils()
Definition: utils.hh:10
constexpr Eigen::Index toVoigt(Eigen::Index i, Eigen::Index j) noexcept
Converts 2D indices to Voigt notation index.
Definition: tensorutils.hh:166
auto fromVoigt(const Eigen::Matrix< ST, size, 1, Options, maxSize, 1 > &EVoigt, bool isStrain=true)
Converts a vector given in Voigt notation to a matrix.
Definition: tensorutils.hh:271
Definition: assemblermanipulatorbuildingblocks.hh:22