ug4
Tensor

Classes

class  ug::MathTensor< TRank, N, T >
 a mathematical Tensor of rank TRank and N entries. More...
 
class  ug::MathTensor1< N, T >
 
class  ug::MathTensor2< N1, N2, T >
 
class  ug::MathTensor3< N1, N2, N3, T >
 
class  ug::MathTensor4< N1, N2, N3, N4, T >
 
class  ug::MathTensor< 1, N, T >
 
class  ug::MathTensorX< TEntry, N >
 

Functions

template<std::size_t TDim>
void ug::InvertTensor4 (MathTensor4< TDim, TDim, TDim, TDim > &tens4_out, const MathTensor4< TDim, TDim, TDim, TDim > &tens4)
 
template<std::size_t TDim, std::size_t TDimSQ>
void ug::MatToTens4 (MathTensor4< TDim, TDim, TDim, TDim > &tens4, const DenseMatrixInverse< FixedArray2< number, TDimSQ, TDimSQ > > &mat)
 
template<size_t TRank, size_t N, typename T >
std::ostream & ug::operator<< (std::ostream &outStream, const ug::MathTensor< TRank, N, T > &v)
 
template<typename TEntry >
std::ostream & ug::operator<< (std::ostream &outStream, const ug::MathTensorX< TEntry, 1 > &v)
 
template<typename TEntry , size_t N>
std::ostream & ug::operator<< (std::ostream &outStream, const ug::MathTensorX< TEntry, N > &v)
 
template<std::size_t TDim>
void ug::SolveTensorMatrixEquation (MathMatrix< TDim, TDim > &X, const MathTensor4< TDim, TDim, TDim, TDim > &A, const MathMatrix< TDim, TDim > &rhs)
 
template<std::size_t TDim, std::size_t TDimSQ>
void ug::Tens2ToVec (DenseVector< FixedArray1< number, TDimSQ > > &vec, const MathMatrix< TDim, TDim > &tens2)
 transformation of a tensor of rank 2 (R^dim x R^dim) into a vector (R^(dim^2)) More...
 
template<std::size_t TDim>
void ug::Tens4Add (MathTensor4< TDim, TDim, TDim, TDim > &tens4_out, const MathTensor4< TDim, TDim, TDim, TDim > &tens4a, const MathTensor4< TDim, TDim, TDim, TDim > &tens4b)
 
template<std::size_t TDim>
void ug::Tens4Contract (MathMatrix< TDim, TDim > &tens2_out, const MathTensor4< TDim, TDim, TDim, TDim > &tens4, const MathMatrix< TDim, TDim > &tens2)
 
template<std::size_t TDim>
void ug::Tens4Contract (MathTensor4< TDim, TDim, TDim, TDim > &tens4_out, const MathTensor4< TDim, TDim, TDim, TDim > &tens4a, const MathTensor4< TDim, TDim, TDim, TDim > &tens4b)
 
template<std::size_t TDim>
void ug::Tens4Contract (MathTensor4< TDim, TDim, TDim, TDim > &tens4_out, const MathTensor4< TDim, TDim, TDim, TDim > &tens4a, const MathTensor4< TDim, TDim, TDim, TDim > &tens4b, const MathTensor4< TDim, TDim, TDim, TDim > &tens4c)
 
template<std::size_t TDim>
void ug::Tens4Identity (MathTensor4< TDim, TDim, TDim, TDim > &Ident)
 this function computes the 4th order identity tensor More...
 
template<std::size_t TDim>
void ug::Tens4IdentitySym (MathTensor4< TDim, TDim, TDim, TDim > &Ident)
 this function computes the symmetric 4th order identity tensor More...
 
template<std::size_t TDim>
void ug::Tens4Subtract (MathTensor4< TDim, TDim, TDim, TDim > &tens4_out, const MathTensor4< TDim, TDim, TDim, TDim > &tens4a, const MathTensor4< TDim, TDim, TDim, TDim > &tens4b)
 
template<std::size_t TDim, std::size_t TDimSQ>
void ug::Tens4ToMat (DenseMatrix< FixedArray2< number, TDimSQ, TDimSQ > > &mat, const MathTensor4< TDim, TDim, TDim, TDim > &tens4)
 
template<std::size_t TDim>
void ug::Tens4Zero (MathTensor4< TDim, TDim, TDim, TDim > &tensOut)
 
template<std::size_t TDim>
void ug::TransTens4 (MathTensor4< TDim, TDim, TDim, TDim > &tens4_out, const MathTensor4< TDim, TDim, TDim, TDim > &tens4)
 
template<std::size_t TDim, std::size_t TDimSQ>
void ug::VecToTens2 (MathMatrix< TDim, TDim > &tens2, const DenseVector< FixedArray1< number, TDimSQ > > &vec)
 transformation of a vector (R^(dim^2)) into a tensor of rank 2 (R^dim x R^dim) More...
 

Detailed Description

Function Documentation

◆ InvertTensor4()

template<std::size_t TDim>
void ug::InvertTensor4 ( MathTensor4< TDim, TDim, TDim, TDim > &  tens4_out,
const MathTensor4< TDim, TDim, TDim, TDim > &  tens4 
)

This function inverts a tensor of order 4 by inverting the associated matrix tens4_out = (tens4)^{-1}

References dim, ug::GetInverse(), ug::MatToTens4(), ug::Tens4ToMat(), and UG_THROW.

◆ MatToTens4()

template<std::size_t TDim, std::size_t TDimSQ>
void ug::MatToTens4 ( MathTensor4< TDim, TDim, TDim, TDim > &  tens4,
const DenseMatrixInverse< FixedArray2< number, TDimSQ, TDimSQ > > &  mat 
)

transformation of a matrix (R^(dim^2) x R^(dim^2)) into a tensor of rank 4 (R^dim x R^dim x R^dim x R^dim)

References dim, and UG_THROW.

Referenced by ug::InvertTensor4().

◆ operator<<() [1/3]

template<size_t TRank, size_t N, typename T >
std::ostream& ug::operator<< ( std::ostream &  outStream,
const ug::MathTensor< TRank, N, T > &  v 
)

◆ operator<<() [2/3]

template<typename TEntry >
std::ostream& ug::operator<< ( std::ostream &  outStream,
const ug::MathTensorX< TEntry, 1 > &  v 
)

◆ operator<<() [3/3]

template<typename TEntry , size_t N>
std::ostream& ug::operator<< ( std::ostream &  outStream,
const ug::MathTensorX< TEntry, N > &  v 
)

◆ SolveTensorMatrixEquation()

template<std::size_t TDim>
void ug::SolveTensorMatrixEquation ( MathMatrix< TDim, TDim > &  X,
const MathTensor4< TDim, TDim, TDim, TDim > &  A,
const MathMatrix< TDim, TDim > &  rhs 
)

This function solves A : X = RHS X, RHS: tensors of second order A: tensor of fourth order

References dim, ug::GetInverse(), ug::MatMult(), ug::Tens2ToVec(), ug::Tens4ToMat(), UG_THROW, and ug::VecToTens2().

◆ Tens2ToVec()

template<std::size_t TDim, std::size_t TDimSQ>
void ug::Tens2ToVec ( DenseVector< FixedArray1< number, TDimSQ > > &  vec,
const MathMatrix< TDim, TDim > &  tens2 
)

transformation of a tensor of rank 2 (R^dim x R^dim) into a vector (R^(dim^2))

References dim, and UG_THROW.

Referenced by ug::SolveTensorMatrixEquation().

◆ Tens4Add()

template<std::size_t TDim>
void ug::Tens4Add ( MathTensor4< TDim, TDim, TDim, TDim > &  tens4_out,
const MathTensor4< TDim, TDim, TDim, TDim > &  tens4a,
const MathTensor4< TDim, TDim, TDim, TDim > &  tens4b 
)

adds a fourth order tensor: tens4_out = tens4a + tens4b

References dim.

◆ Tens4Contract() [1/3]

template<std::size_t TDim>
void ug::Tens4Contract ( MathMatrix< TDim, TDim > &  tens2_out,
const MathTensor4< TDim, TDim, TDim, TDim > &  tens4,
const MathMatrix< TDim, TDim > &  tens2 
)

this function computes the contraction of a 4th order tensor by a second order tensor tens2_out = tens4 : tens2

References dim.

◆ Tens4Contract() [2/3]

template<std::size_t TDim>
void ug::Tens4Contract ( MathTensor4< TDim, TDim, TDim, TDim > &  tens4_out,
const MathTensor4< TDim, TDim, TDim, TDim > &  tens4a,
const MathTensor4< TDim, TDim, TDim, TDim > &  tens4b 
)

this function computes the contraction of a 4th order tensor by a fourth order tensor tens4_out = tens4a : tens4b

References dim.

◆ Tens4Contract() [3/3]

template<std::size_t TDim>
void ug::Tens4Contract ( MathTensor4< TDim, TDim, TDim, TDim > &  tens4_out,
const MathTensor4< TDim, TDim, TDim, TDim > &  tens4a,
const MathTensor4< TDim, TDim, TDim, TDim > &  tens4b,
const MathTensor4< TDim, TDim, TDim, TDim > &  tens4c 
)

this function computes tens4_out = tens4a : tens4b : tens4c

References dim, and s.

◆ Tens4Identity()

template<std::size_t TDim>
void ug::Tens4Identity ( MathTensor4< TDim, TDim, TDim, TDim > &  Ident)

this function computes the 4th order identity tensor

References dim.

◆ Tens4IdentitySym()

template<std::size_t TDim>
void ug::Tens4IdentitySym ( MathTensor4< TDim, TDim, TDim, TDim > &  Ident)

this function computes the symmetric 4th order identity tensor

References dim.

◆ Tens4Subtract()

template<std::size_t TDim>
void ug::Tens4Subtract ( MathTensor4< TDim, TDim, TDim, TDim > &  tens4_out,
const MathTensor4< TDim, TDim, TDim, TDim > &  tens4a,
const MathTensor4< TDim, TDim, TDim, TDim > &  tens4b 
)

subtracts a fourth order tensor: tens4_out = tens4a - tens4b

References dim.

◆ Tens4ToMat()

template<std::size_t TDim, std::size_t TDimSQ>
void ug::Tens4ToMat ( DenseMatrix< FixedArray2< number, TDimSQ, TDimSQ > > &  mat,
const MathTensor4< TDim, TDim, TDim, TDim > &  tens4 
)

transformation of a tensor of rank 4 (R^dim x R^dim x R^dim x R^dim) into a matrix (R^(dim^2) x R^(dim^2))

References dim, and UG_THROW.

Referenced by ug::InvertTensor4(), and ug::SolveTensorMatrixEquation().

◆ Tens4Zero()

template<std::size_t TDim>
void ug::Tens4Zero ( MathTensor4< TDim, TDim, TDim, TDim > &  tensOut)

References dim.

◆ TransTens4()

template<std::size_t TDim>
void ug::TransTens4 ( MathTensor4< TDim, TDim, TDim, TDim > &  tens4_out,
const MathTensor4< TDim, TDim, TDim, TDim > &  tens4 
)

transposes a fourth order tensor: tens4_out = (tens4)^T

References dim.

◆ VecToTens2()

template<std::size_t TDim, std::size_t TDimSQ>
void ug::VecToTens2 ( MathMatrix< TDim, TDim > &  tens2,
const DenseVector< FixedArray1< number, TDimSQ > > &  vec 
)

transformation of a vector (R^(dim^2)) into a tensor of rank 2 (R^dim x R^dim)

References dim, and UG_THROW.

Referenced by ug::SolveTensorMatrixEquation().