funcy  1.6.1
Namespaces | Classes | Typedefs | Functions | Variables
funcy Namespace Reference

Main namespace of the funcy library. More...

Namespaces

 linalg
 Functionality from linear algebra such as (modified) principal and mixed matrix invariants.
 
 mathop
 Mathematical operations and corresponding differentation rules.
 

Classes

struct  ACos
 Arc cosine function (based on acos(double) in <cmath>). More...
 
struct  ASin
 Arc sine function (based on asin(double) in <cmath>). More...
 
struct  Constant
 Wrap a constant. More...
 
struct  Cos
 Cosine function (based on cos(double) in <cmath>). More...
 
struct  CumulativeNormalDistribution
 Cumulative standard normal distribution. More...
 
struct  Decay
 Identity, i.e. Decay<F>::type == F More...
 
struct  Decay< F, std::void_t< static_check::test::nested_type::PlainObject< F > > >
 Underlying type for expression templates of the Eigen library. More...
 
struct  Erf
 Error function. More...
 
struct  Exp
 Exponential function. More...
 
struct  Exp2
 Function \(2^x\). More...
 
struct  Identity
 Identity mapping \( f(x)=x \). More...
 
struct  IndexedType
 
struct  is_arithmetic
 Specialize this template class to register arithmetic types that are not built-in. More...
 
struct  LN
 Natural logarithm. More...
 
struct  Log10
 Common (base 10) logarithm. More...
 
struct  Log2
 Base 2 logarithm. More...
 
class  NonSymmetricMatrixException
 Exception for non-symmetric matrices if symmetric matrices are required. More...
 
class  OutOfDomainException
 Exception for scalar function arguments that are outside the domain of the function. More...
 
struct  Pow
 Power function with rational exponent \( k = \frac{dividend}{divisor} \) including first three derivatives. More...
 
struct  Sin
 Sine function (based on sin(double) in <cmath>). More...
 
struct  Tan
 Tangent function. More...
 
struct  Variable
 Independent variable. Can be uniquely identified by its id. More...
 

Typedefs

using Sqrt = Pow< 1, 2 >
 Square root (based on sqrt(double) in <cmath>).
 
using Cbrt = Pow< 1, 3 >
 Third root (based on sqrt(double) in <cmath>).
 
using Cbrt2 = Pow< 2, 3 >
 Third root squared (based on sqrt(double) in <cmath>).
 
template<class F >
using decay_t = typename Decay< std::decay_t< F > >::type
 Access underlying type (if it is hidden by expression templates).
 
template<class F >
using remove_reference_t = typename Decay< std::remove_reference_t< F > >::type
 Access underlying type (if it is hidden by expression templates).
 
template<class F , int id>
using Variable_t = typename detail::VariableT< F, id >::type
 Get underlying type of variable with index id.
 

Functions

template<Function F>
auto acos (const F &f)
 Generate \( \arccos\circ f \). More...
 
template<Function F>
auto asin (const F &f)
 Generate \( \arcsin\circ f \). More...
 
auto cnd (double x)
 
template<Function F>
auto cnd (const F &f)
 Generate \( \mathrm{cnd}\circ f \). More...
 
template<Function F>
auto cos (const F &f)
 Generate \( \cos\circ f \). More...
 
template<Function F>
auto erf (const F &f)
 Generate \( \mathrm{erf}\circ f \). More...
 
template<Function F>
auto exp (const F &f)
 Generate \( \exp(f) \). More...
 
template<Function F>
auto exp2 (const F &f)
 Generate \(2^f\). More...
 
auto ln (double x)
 
template<Function F>
auto ln (const F &f)
 Generate \( \mathrm{ln}\circ f \). More...
 
template<Function F>
auto log10 (const F &f)
 Generate \( \mathrm{log}_{10}\circ f \). More...
 
template<Function F>
auto log2 (const F &f)
 Generate \( \mathrm{log}_{2}\circ f \). More...
 
template<Function F>
auto sqrt (const F &f)
 Generate \( \sqrt{f} \). More...
 
template<Function F>
auto cbrt (const F &f)
 Generate \( \sqrt[3]{f} \). More...
 
template<Function F>
auto cbrt2 (const F &f)
 Generate \( \sqrt[3]{f^2}\). More...
 
template<int k, int l, Function F>
auto pow (const F &f)
 Generate \( f^{k/l}\). More...
 
template<int k, Function F>
auto pow (const F &f)
 Generate \( f^k,\ k \in \mathbb{N}\). More...
 
template<Function F>
auto sin (const F &f)
 Generate \( \sin\circ f \). More...
 
template<Function F>
auto tan (const F &f)
 Generate \( \tan\circ f \). More...
 
template<class Arg >
auto const_ref (const Arg &x) noexcept(std::is_nothrow_copy_constructible_v< Arg >)
 Generate a constant function that stores its argument as constant reference. More...
 
template<class Arg >
constexpr auto constant (Arg &&x) noexcept((std::is_rvalue_reference_v< Arg > &&std::is_nothrow_move_constructible_v< Arg >)||(std::is_lvalue_reference_v< Arg > &&std::is_nothrow_copy_constructible_v< Arg >))
 Wrap a constant. More...
 
template<linalg::Matrix Mat, int offset = linalg::dim< Mat >()>
auto incompressible_adipose_tissue_sommer_holzapfel (double cCells, double k1, double k2, double kappa, const Mat &A, const Mat &F)
 Model for adipose tissue of [Sommer2013]. More...
 
template<linalg::Matrix Mat, int offset = linalg::dim< Mat >()>
auto incompressible_adipose_tissue_sommer_holzapfel (const Mat &A, const Mat &F)
 Model for adipose tissue of [Sommer2013]. More...
 
template<class Inflation , class Compression , linalg::Matrix Mat, int offset = linalg::dim< Mat >()>
auto compressible_adipose_tissue_sommer_holzapfel (double cCells, double k1, double k2, double kappa, double d0, double d1, const Mat &M, const Mat &F)
 Compressible version of the model for adipose tissue of [Sommer2013]. More...
 
template<class Inflation , class Compression , linalg::Matrix Mat, int offset = linalg::dim< Mat >()>
auto compressible_adipose_tissue_sommer_holzapfel (double d0, double d1, const Mat &M, const Mat &F)
 Compressible version of the model for adipose tissue of [Sommer2013]. Material parameters are taken from the same publication, Table 2, i.e. \(c_\mathrm{Cells}=0.15 (\,\mathrm{kPa})\), \(k_1=0.8 (\,\mathrm{kPa})\), \(k_2=47.3\) and \(\kappa=0.09\). More...
 
template<linalg::Matrix Mat, int offset = linalg::dim< Mat >()>
auto incompressible_muscle_tissue_martins (double c, double b, double d, double e, const Mat &A, const Mat &F)
 Incompressible version of the model for muscle tissue of [Martins1998]. More...
 
template<linalg::Matrix Mat, int offset = linalg::dim< Mat >()>
auto incompressible_muscle_tissue_martins (const Mat &A, const Mat &F)
 Incompressible version of the model for muscle tissue of [Martins1998]. More...
 
template<class Inflation , class Compression , linalg::Matrix Mat, int offset = linalg::dim< Mat >()>
auto compressible_muscle_tissue_martins (double c, double b, double A, double a, double d0, double d1, const Mat &M, const Mat &F)
 Compressible version of the model for muscle tissue of [Martins1998]. More...
 
template<class Inflation , class Compression , linalg::Matrix Mat, int offset = linalg::dim< Mat >()>
auto compressible_muscle_tissue_martins (double d0, double d1, const Mat &M, const Mat &F)
 Compressible version of the model for muscle tissue of [Martins1998]. More...
 
template<linalg::Matrix Mat, int n = linalg::dim< Mat >()>
auto incompressible_skin_hendriks (double c0, double c1, const Mat &F)
 Model for skin tissue of [Hendriks2005]. More...
 
template<linalg::Matrix Mat, int n = linalg::dim< Mat >()>
auto incompressible_skin_hendriks (const Mat &F)
 Model for skin tissue of [Hendriks2005]. More...
 
template<class InflationPenalty , class CompressionPenalty , linalg::Matrix Mat, int n = linalg::dim< Mat >()>
auto compressible_skin_hendriks (double c0, double c1, double d0, double d1, const Mat &F)
 Compressible version of the model for skin tissue of [Hendriks2005]. More...
 
template<class InflationPenalty , class CompressionPenalty , linalg::Matrix M, int n = linalg::dim< M >()>
auto compressible_skin_hendriks (double d0, double d1, const M &F)
 Compressible version of the model for skin tissue of [Hendriks2005]. More...
 
template<class Scalar , linalg::Vector Vec, idx = 0>
auto heat_model (double c, double d, Scalar u, const Vec &du)
 Weak model for nonlinear heat transfer \( (c+du^2)\nabla u \). More...
 
template<linalg::Matrix Mat, int n = linalg::dim< Mat >()>
auto incompressible_mooney_rivlin (double c0, double c1, const Mat &F)
 Generate an "incompressible" Mooney-Rivlin material law \( W(F)=c_0\iota_1(F^T F) + c_1\iota_2(F^T F) \), where \(\iota_1\) is the first and \(\iota_2\) the second principal matrix invariant.
 
template<class InflationPenalty , class CompressionPenalty , linalg::Matrix Mat, int n = linalg::dim< Mat >()>
auto compressible_mooney_rivlin (double c0, double c1, double d0, double d1, const Mat &F)
 Generate a compressible Mooney-Rivlin material law \( W(F)=c_0\iota_1(F^T F) + c_1\iota_2(F^T F) + d_0\Gamma_\mathrm{In}(\det(F))+d_1\Gamma_\mathrm{Co}(\det(F)) \), where \(\iota_1\) is the first and \(\iota_2\) the second principal matrix invariant.
 
template<linalg::Matrix Mat, class InflationPenalty , class CompressionPenalty >
auto create_mooney_rivlin_from_lame_constants (double lambda, double mu)
 Generate a compressible Mooney-Rivlin material law \( W(F)=c_0\iota_1(F^T F) + c_1\iota_2(F^T F) + d_0\Gamma_\mathrm{In}(\det(F))+d_1\Gamma_\mathrm{Co}(\det(F)) \), where \(\iota_1\) is the first and \(\iota_2\) the second principal matrix invariant. The parameters \(c_0,c_1,d_0,d_1\) are chosen such that for \(F\rightarrow I\) the model asymptotically yields Hooke's model of linearized elasticity with Lam\'e constants \(\lambda,\mu\). Here \(I\) denotes the unit matrix. More...
 
template<linalg::Matrix Mat, class InflationPenalty , class CompressionPenalty >
auto create_mooney_rivlin_from_material_constants (double E, double nu)
 Generate a compressible Mooney-Rivlin material law \( W(F)=c_0\iota_1(F^T F) + c_1\iota_2(F^T F) + d_0\Gamma_\mathrm{In}(\det(F))+d_1\Gamma_\mathrm{Co}(\det(F)) \), where \(\iota_1\) is the first and \(\iota_2\) the second principal matrix invariant. The parameters \(c_0,c_1,d_0,d_1\) are chosen such that for \(F\rightarrow I\) the model asymptotically yields Hooke's model of linearized elasticity with Young's modulus \(E\) and Poisson ratio \(\nu\). Here \(I\) denotes the unit matrix. More...
 
template<linalg::Matrix M, int n = linalg::dim< M >()>
auto incompressible_neo_hooke (double c, const M &F)
 Generate an "incompressible" neo-Hookean material law \( W(F)=c\iota_1(F^T F) \), where \(\iota_1\) is the first principal matrix invariant .
 
template<linalg::Matrix M, int n = linalg::dim< M >()>
auto modified_incompressible_neo_hooke (double c, const M &F)
 Generate an "incompressible" neo-Hookean material law \( W(F)=c\bar\iota_1(F^T F) \), where \(\bar\iota_1\) is the modified first principal matrix invariant.
 
template<class InflationPenalty , class CompressionPenalty , linalg::Matrix M, int n = linalg::dim< M >()>
auto compressible_neo_hooke (double c, double d0, double d1, const M &F)
 Generate a compressible neo-Hookean material law \( W(F)=c\iota_1(F^T F)+d_0\Gamma_\mathrm{In}(\det(F))+d_1\Gamma_\mathrm{Co}(\det(F)) \), where \(\iota_1\) is the first principal matrix invariant.
 
template<class InflationPenalty , class CompressionPenalty , linalg::Matrix M, int n = linalg::dim< M >()>
auto modified_compressible_neo_hooke (double c, double d0, double d1, const M &F)
 Generate a compressible neo-Hookean material law \( W(F)=c\bar\iota_1(F^T F)+d_0\Gamma_\mathrm{In}(\det(F))+d_1\Gamma_\mathrm{Co}(\det(F)) \), where \(\bar\iota_1\) is the modified first principal matrix invariant.
 
template<class Inflation , class Compression , linalg::Matrix M>
auto volumetric_penalty (double d0, double d1, const M &A)
 
template<linalg::Matrix M>
auto volumetric_quad_and_log (double d0, double d1, const M &A)
 Create the volumetric penalty function \( d_0 j^2 + d_1 \log(j),\ j=\det(A) \).
 
template<linalg::Matrix M>
auto volumetric_hartmann_neff (double d0, double d1, const M &A)
 Create the volumetric penalty function \( d_0 j^5 + d_1 j^{-5},\ j=\det(A) \).
 
template<linalg::Matrix M>
auto yield_surface (double beta, double offset, M sigma=linalg::unit_matrix< M >())
 
template<Function F>
auto finalize (F &&f) requires(static_check
 Finish function definition. More...
 
template<Function F, Function G>
auto operator+ (F &&f, G &&g)
 overload of "+"-operator for the generation of functions. More...
 
template<Function F, Function G>
auto operator* (F &&f, G &&g)
 overload of "*"-operator for the generation of functions. More...
 
template<Function F, Function G>
auto dot (F &&f, G &&g)
 overload of "dot"-function for the generation of functions. More...
 
template<Function F>
auto squared (F &&f)
 Generate squared function. More...
 
template<Function F, Function G>
auto operator- (F &&f, G &&g)
 overload of "-"-operator for the generation of functions. More...
 
template<class F , class G >
auto operator/ (F &&f, G &&g) requires(requires(G g)
 overload of "/"-operator for the generation of functions. More...
 
template<class F , Arithmetic G>
auto operator/ (F &&f, G g)
 overload of "/"-operator for the generation of functions. More...
 
template<class Arg >
auto identity (Arg &&x)
 Construct Identity<Arg>(x).
 
template<Function F, Function G>
decltype(auto) max (F &&f, G &&g)
 
template<Function F, Function G>
decltype(auto) min (F &&f, G &&g)
 
template<Function F, class Arg >
void update_if_present (F &&, Arg &&)
 
template<int id, Function F, class Arg >
void update_if_present (F &&, Arg &&)
 
template<Function F, class... IndexedArgs>
void bulk_update_if_present (F &&, IndexedArgs &&...)
 
template<Function F, class IndexedArg , class... IndexedArgs>
void bulk_update_if_present (F &&f, IndexedArg &&x0, IndexedArgs &&... x)
 
template<int id, class T >
Variable< T, id > variable (const T &t)
 Generate variable from input type.
 

Variables

template<class T >
concept Function
 Function concept. More...
 
template<class T >
concept Arithmetic = is_arithmetic< T >::value
 Extensible concept for arithmetic types. More...
 
template<class F >
constexpr bool is_arithmetic_v = is_arithmetic< F >::value
 

Detailed Description

Main namespace of the funcy library.

See also
Mathematical Operations
Common Mathematical Functions
Linear Algebra

Function Documentation

◆ const_ref()

template<class Arg >
auto funcy::const_ref ( const Arg &  x)
noexcept

Generate a constant function that stores its argument as constant reference.

This admits to use variable constant arguments, i.e. parameters that we want to study.

◆ constant()

template<class Arg >
constexpr auto funcy::constant ( Arg &&  x)
noexcept

Wrap a constant.

Returns
Constant<Arg>(x)

◆ dot()

template<Function F, Function G>
auto funcy::dot ( F &&  f,
G &&  g 
)

overload of "dot"-function for the generation of functions.

If the resulting type represents a polynomial of order smaller than two, than you need to wrap it into Finalize to generate missing derivatives.

◆ finalize()

template<Function F>
auto funcy::finalize ( F &&  f)

Finish function definition.

Adds the definition of possibly undefined vanishing higher order derivatives. If the template class Variable is not used, then no ids must be provided for the update-function and derivatives.

◆ heat_model()

template<class Scalar , linalg::Vector Vec, idx = 0>
auto funcy::heat_model ( double  c,
double  d,
Scalar  u,
const Vec &  du 
)

Weak model for nonlinear heat transfer \( (c+du^2)\nabla u \).

Parameters
cweighing of linearity
dweighing of nonlinearity
uheat
duheat gradient

◆ operator*()

template<Function F, Function G>
auto funcy::operator* ( F &&  f,
G &&  g 
)

overload of "*"-operator for the generation of functions.

If the resulting type represents a polynomial of order smaller than two, than you need to wrap it into Finalize to generate missing derivatives.

◆ operator+()

template<Function F, Function G>
auto funcy::operator+ ( F &&  f,
G &&  g 
)

overload of "+"-operator for the generation of functions.

If the resulting type represents a polynomial of order smaller than two, than you need to wrap it into Finalize to generate missing derivatives.

◆ operator-()

template<Function F, Function G>
auto funcy::operator- ( F &&  f,
G &&  g 
)

overload of "-"-operator for the generation of functions.

If the resulting type represents a polynomial of order smaller than two, than you need to wrap it into Finalize to generate missing derivatives.

◆ operator/() [1/2]

template<class F , class G >
auto funcy::operator/ ( F &&  f,
G &&  g 
)

overload of "/"-operator for the generation of functions.

Only for functions that return types that are convertible to double If the resulting type represents a polynomial of order smaller than two, than you need to wrap it into Finalize to generate missing derivatives.

◆ operator/() [2/2]

template<class F , Arithmetic G>
auto funcy::operator/ ( F &&  f,
g 
)

overload of "/"-operator for the generation of functions.

Only for functions that return types that are convertible to double If the resulting type represents a polynomial of order smaller than two, than you need to wrap it into Finalize to generate missing derivatives.

◆ squared()

template<Function F>
auto funcy::squared ( F &&  f)

Generate squared function.

If the resulting type represents a polynomial of order smaller than two, than you need to wrap it into Finalize to generate missing derivatives.

◆ volumetric_penalty()

template<class Inflation , class Compression , linalg::Matrix M>
auto funcy::volumetric_penalty ( double  d0,
double  d1,
const M &  A 
)

Create volumetric penalty function composed of a penalty for inflation and one for compression.

◆ yield_surface()

template<linalg::Matrix M>
auto funcy::yield_surface ( double  beta,
double  offset,
sigma = linalg::unit_matrix< M >() 
)

Yield surface \( \frac{\beta}{3}\iota_1(\sigma) + J_2(\sigma)-offset \), where \(\iota_1\) is the first principal and \(J_2\) is the second deviatoric invariant.