MGIS 3.1.0
Loading...
Searching...
No Matches
Tensors.hxx File Reference

File which defines the modifiers turning scalar valued functions and evaluators into tensor valued ones (as_stensor, as_tensor, ...) together with the tensorial operations which can be applied to evaluators (trace, det, eigen_values, rotate, logarithmic_strain, ...) and the concepts characterising evaluators returning the various kinds of tensorial objects. More...

Classes

struct  mgis::function::internals::FunctionResultTypeTraits< TensorType & >
 partial specialization stating that a mutable reference to a tensorial object is a valid result type for a function More...
struct  mgis::function::internals::FunctionResultTypeTraits< tfel::math::View< TensorType > >
 partial specialization stating that a view on a tensorial object is a valid result type for a function More...
struct  mgis::function::internals::tensor_modifier< TensorType >
 modifier exposing the values computed by an evaluator, or the values of a function, as a tensorial object of type TensorType More...
struct  mgis::function::internals::RotateModifier
 modifier changing the basis of the tensorial values computed by an evaluator, in the direction for which the given rotation matrix is defined More...
struct  mgis::function::internals::RotateBackwardsModifier
 modifier changing the basis of the tensorial values computed by an evaluator in the backwards direction, i.e. using the transpose of the given rotation matrix More...

Namespaces

namespace  mgis
 the namespace mgis encloses all the MGIS project.

Concepts

concept  mgis::function::Stensor1DEvaluatorConcept
 concept satisfied by evaluators returning a symmetric tensor of dimension 1 whose base numeric type is real
concept  mgis::function::Stensor2DEvaluatorConcept
 concept satisfied by evaluators returning a symmetric tensor of dimension 2 whose base numeric type is real
concept  mgis::function::Stensor3DEvaluatorConcept
 concept satisfied by evaluators returning a symmetric tensor of dimension 3 whose base numeric type is real
concept  mgis::function::StensorEvaluatorConcept
 concept satisfied by evaluators returning a symmetric tensor of any dimension whose base numeric type is real
concept  mgis::function::Tensor1DEvaluatorConcept
 concept satisfied by evaluators returning an unsymmetric tensor of dimension 1 whose base numeric type is real
concept  mgis::function::Tensor2DEvaluatorConcept
 concept satisfied by evaluators returning an unsymmetric tensor of dimension 2 whose base numeric type is real
concept  mgis::function::Tensor3DEvaluatorConcept
 concept satisfied by evaluators returning an unsymmetric tensor of dimension 3 whose base numeric type is real
concept  mgis::function::TensorEvaluatorConcept
 concept satisfied by evaluators returning an unsymmetric tensor of any dimension whose base numeric type is real
concept  mgis::function::ST2toST21DEvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping symmetric tensors to symmetric tensors, of dimension 1, whose base numeric type is real
concept  mgis::function::ST2toST22DEvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping symmetric tensors to symmetric tensors, of dimension 2, whose base numeric type is real
concept  mgis::function::ST2toST23DEvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping symmetric tensors to symmetric tensors, of dimension 3, whose base numeric type is real
concept  mgis::function::ST2toST2EvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping symmetric tensors to symmetric tensors, of any dimension, whose base numeric type is real
concept  mgis::function::ST2toT21DEvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping symmetric tensors to unsymmetric tensors, of dimension 1, whose base numeric type is real
concept  mgis::function::ST2toT22DEvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping symmetric tensors to unsymmetric tensors, of dimension 2, whose base numeric type is real
concept  mgis::function::ST2toT23DEvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping symmetric tensors to unsymmetric tensors, of dimension 3, whose base numeric type is real
concept  mgis::function::ST2toT2EvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping symmetric tensors to unsymmetric tensors, of any dimension, whose base numeric type is real
concept  mgis::function::T2toST21DEvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping unsymmetric tensors to symmetric tensors, of dimension 1, whose base numeric type is real
concept  mgis::function::T2toST22DEvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping unsymmetric tensors to symmetric tensors, of dimension 2, whose base numeric type is real
concept  mgis::function::T2toST23DEvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping unsymmetric tensors to symmetric tensors, of dimension 3, whose base numeric type is real
concept  mgis::function::T2toST2EvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping unsymmetric tensors to symmetric tensors, of any dimension, whose base numeric type is real
concept  mgis::function::T2toT21DEvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping unsymmetric tensors to unsymmetric tensors, of dimension 1, whose base numeric type is real
concept  mgis::function::T2toT22DEvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping unsymmetric tensors to unsymmetric tensors, of dimension 2, whose base numeric type is real
concept  mgis::function::T2toT23DEvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping unsymmetric tensors to unsymmetric tensors, of dimension 3, whose base numeric type is real
concept  mgis::function::T2toT2EvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor mapping unsymmetric tensors to unsymmetric tensors, of any dimension, whose base numeric type is real
concept  mgis::function::FourthOrderTensorEvaluatorConcept
 concept satisfied by evaluators returning a fourth order tensor of any kind, i.e. matching one of the ST2toST2EvaluatorConcept, T2toST2EvaluatorConcept, ST2toT2EvaluatorConcept or T2toT2EvaluatorConcept concepts

Functions

template<ViewableFunctionArgumentConcept QualifiedFunctionArgumentType, TensorConcept TensorType>
requires (internals::checkNumberOfComponentsCompatibility< QualifiedFunctionArgumentType, compile_time_size<TensorType>>())
constexpr auto mgis::function::operator| (QualifiedFunctionArgumentType &&, const internals::tensor_modifier< TensorType > &)
 expose the values of a function argument as a tensorial object

Variables

template<unsigned short N, TensorValueConcept ValueType = real>
constexpr auto mgis::function::as_stensor
 modifier exposing the values of a function or of an evaluator as symmetric tensors of dimension N
template<unsigned short N, TensorValueConcept ValueType = real>
constexpr auto mgis::function::as_tensor
 modifier exposing the values of a function or of an evaluator as unsymmetric tensors of dimension N
template<unsigned short N, TensorValueConcept ValueType = real>
constexpr auto mgis::function::as_fsarray
 modifier exposing the values of a function or of an evaluator as finite size arrays of N values
template<unsigned short N, TensorValueConcept ValueType = real>
constexpr auto mgis::function::as_tvector
 modifier exposing the values of a function or of an evaluator as tiny vectors of N components
template<unsigned short N, unsigned short M, TensorValueConcept ValueType = real>
constexpr auto mgis::function::as_tmatrix
 modifier exposing the values of a function or of an evaluator as tiny matrices with N rows and M columns
template<unsigned short N, TensorValueConcept ValueType = real>
constexpr auto mgis::function::as_st2tost2
 modifier exposing the values of a function or of an evaluator as fourth order tensors mapping symmetric tensors to symmetric tensors, of dimension N
template<unsigned short N, TensorValueConcept ValueType = real>
constexpr auto mgis::function::as_t2tost2
 modifier exposing the values of a function or of an evaluator as fourth order tensors mapping unsymmetric tensors to symmetric tensors, of dimension N
template<unsigned short N, TensorValueConcept ValueType = real>
constexpr auto mgis::function::as_st2tot2
 modifier exposing the values of a function or of an evaluator as fourth order tensors mapping symmetric tensors to unsymmetric tensors, of dimension N
template<unsigned short N, TensorValueConcept ValueType = real>
constexpr auto mgis::function::as_t2tot2
 modifier exposing the values of a function or of an evaluator as fourth order tensors mapping unsymmetric tensors to unsymmetric tensors, of dimension N
constexpr auto mgis::function::trace
 modifier computing the trace of the tensorial values computed by an evaluator
constexpr auto mgis::function::det
 modifier computing the determinant of the tensorial values computed by an evaluator
template<tfel::math::stensor_common::EigenSolver esolver = tfel::math::stensor_common::TFELEIGENSOLVER>
constexpr auto mgis::function::eigen_values
 modifier computing the eigen values of the symmetric tensorial values computed by an evaluator
constexpr auto mgis::function::rotate = internals::RotateModifier{}
 modifier changing the basis of the tensorial values of an evaluator
constexpr auto mgis::function::rotate_backwards = internals::RotateBackwardsModifier{}
 counterpart of rotate, using the transpose of the rotation matrix
template<tfel::math::stensor_common::EigenSolver esolver = tfel::math::stensor_common::TFELEIGENSOLVER>
constexpr auto mgis::function::logarithmic_strain
 modifier computing the logarithmic strain from the deformation gradients computed by an evaluator

Detailed Description

File which defines the modifiers turning scalar valued functions and evaluators into tensor valued ones (as_stensor, as_tensor, ...) together with the tensorial operations which can be applied to evaluators (trace, det, eigen_values, rotate, logarithmic_strain, ...) and the concepts characterising evaluators returning the various kinds of tensorial objects.

Author
Thomas Helfer
Date
11/05/2025

Function Documentation

◆ operator|()

template<ViewableFunctionArgumentConcept QualifiedFunctionArgumentType, TensorConcept TensorType>
requires (internals::checkNumberOfComponentsCompatibility< QualifiedFunctionArgumentType, compile_time_size<TensorType>>())
auto mgis::function::operator| ( QualifiedFunctionArgumentType && f,
const internals::tensor_modifier< TensorType > & m )
constexpr

expose the values of a function argument as a tensorial object

expose the values of a function argument as a tensorial object, the definition of the operator| used by expressions such as f | as_stensor<3>

This is the entry point used by expressions such as f | as_stensor<3>.

Template Parameters
QualifiedFunctionArgumentTypetype of the function argument, which may be a qualified type
TensorTypetype of the tensorial object to be exposed
Parameters
[in]ffunction argument whose values are exposed
[in]mmodifier stating the type of the tensorial object to be exposed
Returns
a TensorView viewing the values of the function argument as objects of type TensorType
Note
only available if the number of components of the function argument is compatible with that of TensorType
Template Parameters
QualifiedFunctionArgumentTypetype of the function argument, which may be a qualified type
TensorTypetype of the tensorial object to be exposed
Parameters
[in]ffunction argument whose values are exposed
[in]mmodifier stating the type of the tensorial object to be exposed
Returns
a TensorView viewing the values of the function argument

Variable Documentation

◆ as_fsarray

template<unsigned short N, TensorValueConcept ValueType = real>
auto mgis::function::as_fsarray
inlineconstexpr
Initial value:
=
modifier exposing the values computed by an evaluator, or the values of a function,...
Definition Tensors.hxx:78

modifier exposing the values of a function or of an evaluator as finite size arrays of N values

Template Parameters
Nnumber of values stored in the array
ValueTypetype of the values, which must match the TensorValueConcept concept and defaults to real

◆ as_st2tost2

template<unsigned short N, TensorValueConcept ValueType = real>
auto mgis::function::as_st2tost2
inlineconstexpr
Initial value:

modifier exposing the values of a function or of an evaluator as fourth order tensors mapping symmetric tensors to symmetric tensors, of dimension N

Template Parameters
Ndimension of the symmetric tensors mapped, which must be 1, 2 or 3
ValueTypetype of the values, which must match the TensorValueConcept concept and defaults to real

◆ as_st2tot2

template<unsigned short N, TensorValueConcept ValueType = real>
auto mgis::function::as_st2tot2
inlineconstexpr
Initial value:

modifier exposing the values of a function or of an evaluator as fourth order tensors mapping symmetric tensors to unsymmetric tensors, of dimension N

Template Parameters
Ndimension of the tensors mapped, which must be 1, 2 or 3
ValueTypetype of the values, which must match the TensorValueConcept concept and defaults to real

◆ as_stensor

template<unsigned short N, TensorValueConcept ValueType = real>
auto mgis::function::as_stensor
inlineconstexpr
Initial value:

modifier exposing the values of a function or of an evaluator as symmetric tensors of dimension N

Template Parameters
Ndimension of the symmetric tensors, which must be 1, 2 or 3
ValueTypetype of the values, which must match the TensorValueConcept concept and defaults to real

◆ as_t2tost2

template<unsigned short N, TensorValueConcept ValueType = real>
auto mgis::function::as_t2tost2
inlineconstexpr
Initial value:

modifier exposing the values of a function or of an evaluator as fourth order tensors mapping unsymmetric tensors to symmetric tensors, of dimension N

Template Parameters
Ndimension of the tensors mapped, which must be 1, 2 or 3
ValueTypetype of the values, which must match the TensorValueConcept concept and defaults to real

◆ as_t2tot2

template<unsigned short N, TensorValueConcept ValueType = real>
auto mgis::function::as_t2tot2
inlineconstexpr
Initial value:

modifier exposing the values of a function or of an evaluator as fourth order tensors mapping unsymmetric tensors to unsymmetric tensors, of dimension N

Template Parameters
Ndimension of the tensors mapped, which must be 1, 2 or 3
ValueTypetype of the values, which must match the TensorValueConcept concept and defaults to real

◆ as_tensor

template<unsigned short N, TensorValueConcept ValueType = real>
auto mgis::function::as_tensor
inlineconstexpr
Initial value:

modifier exposing the values of a function or of an evaluator as unsymmetric tensors of dimension N

Template Parameters
Ndimension of the tensors, which must be 1, 2 or 3
ValueTypetype of the values, which must match the TensorValueConcept concept and defaults to real

◆ as_tmatrix

template<unsigned short N, unsigned short M, TensorValueConcept ValueType = real>
auto mgis::function::as_tmatrix
inlineconstexpr
Initial value:

modifier exposing the values of a function or of an evaluator as tiny matrices with N rows and M columns

Template Parameters
Nnumber of rows of the matrix
Mnumber of columns of the matrix
ValueTypetype of the values, which must match the TensorValueConcept concept and defaults to real

◆ as_tvector

template<unsigned short N, TensorValueConcept ValueType = real>
auto mgis::function::as_tvector
inlineconstexpr
Initial value:

modifier exposing the values of a function or of an evaluator as tiny vectors of N components

Template Parameters
Nnumber of components of the vector
ValueTypetype of the values, which must match the TensorValueConcept concept and defaults to real

◆ det

auto mgis::function::det
inlineconstexpr
Initial value:
[]<typename TensorType>(const TensorType& t) requires(
(tfel::math::TensorConcept<TensorType>) ||
(tfel::math::StensorConcept<TensorType>)) {
return tfel::math::det(t);
})
TensorType
type of tensor that are supported
Definition TensorOperations.hxx:50
MGIS_HOST_DEVICE constexpr auto unary_operation_modifier2(CallableType)
create a modifier from a callable object which is only used to deduce the type of the unary operation
Definition UnaryOperation.ixx:108

modifier computing the determinant of the tensorial values computed by an evaluator

The values must be symmetric or unsymmetric tensors; the modifier returns a scalar valued result.

◆ eigen_values

template<tfel::math::stensor_common::EigenSolver esolver = tfel::math::stensor_common::TFELEIGENSOLVER>
auto mgis::function::eigen_values
inlineconstexpr
Initial value:
[](const tfel::math::StensorConcept auto& s) {
auto s2 = tfel::math::EvaluationResult<decltype(s)>(s);
return s2.template computeEigenValues<esolver>();
})
MGIS_EXPORT std::optional< Function< BasicLinearSpace > > computeEigenValues(Context &, const BasicImmutableFunctionView &) MGIS_NOEXCEPT
compute the eigen values of the symmetric tensorial values of a function

modifier computing the eigen values of the symmetric tensorial values computed by an evaluator

The values must be symmetric tensors; the modifier returns a vector holding as many eigen values as the dimension of the tensors.

Template Parameters
esolvereigen solver used to compute the eigen values, which defaults to tfel::math::stensor_common::TFELEIGENSOLVER

◆ logarithmic_strain

template<tfel::math::stensor_common::EigenSolver esolver = tfel::math::stensor_common::TFELEIGENSOLVER>
auto mgis::function::logarithmic_strain
inlineconstexpr
Initial value:
=
[](const tfel::math::TensorConcept auto& F) {
using namespace tfel::math;
constexpr auto N = getSpaceDimension<decltype(F)>();
const auto e = computeGreenLagrangeTensor(F);
const auto [vp, m] = e.template computeEigenVectors<esolver>();
const auto log_vp =
map([](const real x) { return std::log1p(2 * x) / 2; }, vp);
return stensor<N, real>::computeIsotropicFunction(log_vp, m);
})
mgis_real real
alias to the numeric type used
Definition Config.hxx:140

modifier computing the logarithmic strain from the deformation gradients computed by an evaluator

The values must be unsymmetric tensors, interpreted as deformation gradients F. The logarithmic strain is obtained from the Green-Lagrange strain tensor e = (F^T F - I) / 2: its eigen values vp are transformed into log(1 + 2 vp) / 2 and the result is rebuilt from the transformed eigen values and the eigen vectors of e.

Template Parameters
esolvereigen solver used to compute the eigen vectors, which defaults to tfel::math::stensor_common::TFELEIGENSOLVER

◆ trace

auto mgis::function::trace
inlineconstexpr
Initial value:
[]<typename TensorType>(const TensorType& t) requires(
(tfel::math::TensorConcept<TensorType>) ||
(tfel::math::StensorConcept<TensorType>)) {
return tfel::math::trace(t);
})

modifier computing the trace of the tensorial values computed by an evaluator

The values must be symmetric or unsymmetric tensors; the modifier returns a scalar valued result.