version 0.4.1
tensorutils.hh File Reference

Helper for the Eigen::Tensor types. More...

#include <numeric>
#include <ranges>
#include <unsupported/Eigen/CXX11/Tensor>
#include <dune/common/promotiontraits.hh>
#include <ikarus/utils/concepts.hh>
#include <ikarus/utils/math.hh>

Go to the source code of this file.

Namespaces

namespace  Ikarus
 

Functions

template<typename Derived , typename T , auto rank>
Eigen::Tensor< typename Derived::Scalar, rank > Ikarus::tensorView (const Eigen::EigenBase< Derived > &matrix, const std::array< T, rank > &dims)
 View an Eigen matrix as an Eigen Tensor with specified dimensions. More...
 
auto Ikarus::dyadic (const auto &A_ij, const auto &B_kl)
 Computes the dyadic product of two Eigen tensors. More...
 
template<typename ScalarType = double, int dim = 3>
auto Ikarus::symmetricIdentityFourthOrder ()
 Generates a symmetric identity fourth-order tensor. More...
 
template<typename ScalarType = double, int dim = 3>
auto Ikarus::symmetricFourthOrder (const auto &A, const auto &B)
 Generates a symmetric fourth-order tensor based on two second-order input tensors. More...
 
template<typename ScalarType = double, int dim = 3>
auto Ikarus::identityFourthOrder ()
 Generates an identity fourth-order tensor. More...
 
template<typename AType , typename BType >
auto Ikarus::fourthOrderIKJL (const Eigen::MatrixBase< AType > &A, const Eigen::MatrixBase< BType > &B)
 Computes the IKJL product of two matrices. More...
 
template<typename ScalarType , long int dim>
auto Ikarus::symTwoSlots (const Eigen::TensorFixedSize< ScalarType, Eigen::Sizes< dim, dim, dim, dim > > &t, const std::array< size_t, 2 > &slots)
 Creates a symmetric fourth-order tensor in the two specified slots of the input tensor. More...
 
constexpr Eigen::Index Ikarus::toVoigt (Eigen::Index i, Eigen::Index j) noexcept
 Converts 2D indices to Voigt notation index. More...
 
template<typename ScalarType = double>
Eigen::Matrix< ScalarType, 6, 6 > Ikarus::toVoigt (const Eigen::TensorFixedSize< ScalarType, Eigen::Sizes< 3, 3, 3, 3 > > &ft)
 Converts a fourth-order tensor of fixed size 3x3x3x3 to a Voigt notation matrix of size 6x6. More...
 
template<typename ST , int size, int Options>
requires (size > 0 and size <= 3)
auto Ikarus::toVoigt (const Eigen::Matrix< ST, size, size, Options, size, size > &E, bool isStrain=true)
 Converts a square 2x2 or 3x3 matrix to a Voigt notation vector. More...
 
template<typename ST , int size>
requires (size == 1 or size == 3 or size == 6)
auto Ikarus::fromVoigt (const Eigen::Vector< ST, size > &EVoigt, bool isStrain=true)
 Converts a vector given in Voigt notation to a matrix. More...
 
constexpr std::array< size_t, 2 > Ikarus::fromVoigt (size_t i)
 Converts a Voigt notation index to matrix indices. More...
 
template<typename ScalarType >
auto Ikarus::fromVoigt (const Eigen::Matrix< ScalarType, 6, 6 > &CVoigt)
 Converts a matrix in Voigt notation to a Fourth-order tensor. More...
 
template<typename Geometry >
Eigen::Matrix3d Ikarus::calcTransformationMatrix2D (const Geometry &geometry)
 Calculates the 2D transformation matrix. More...
 
template<typename Geometry >
Eigen::Matrix< double, 6, 6 > Ikarus::calcTransformationMatrix3D (const Geometry &geometry)
 Calculates the 3D transformation matrix. More...