Reference documentation for deal.II version 9.6.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
SymmetricTensor< rank_, dim, Number > Class Template Reference

#include <deal.II/base/symmetric_tensor.h>

Inheritance diagram for SymmetricTensor< rank_, dim, Number >:

Public Member Functions

DEAL_II_HOST constexpr SymmetricTensor ()=default
 
template<typename OtherNumber >
 SymmetricTensor (const Tensor< 2, dim, OtherNumber > &t)
 
DEAL_II_HOST constexpr SymmetricTensor (const Number(&array)[n_independent_components])
 
template<typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor (const SymmetricTensor< rank_, dim, OtherNumber > &initializer)
 
Number * begin_raw ()
 
const Number * begin_raw () const
 
Number * end_raw ()
 
const Number * end_raw () const
 
template<typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensoroperator= (const SymmetricTensor< rank_, dim, OtherNumber > &rhs)
 
DEAL_II_HOST constexpr SymmetricTensoroperator= (const Number &d)
 
DEAL_II_HOST constexpr operator Tensor< rank_, dim, Number > () const
 
DEAL_II_HOST constexpr bool operator== (const SymmetricTensor &) const
 
DEAL_II_HOST constexpr bool operator!= (const SymmetricTensor &) const
 
template<typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensoroperator+= (const SymmetricTensor< rank_, dim, OtherNumber > &)
 
template<typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensoroperator-= (const SymmetricTensor< rank_, dim, OtherNumber > &)
 
template<typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensoroperator*= (const OtherNumber &factor)
 
template<typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensoroperator/= (const OtherNumber &factor)
 
DEAL_II_HOST constexpr SymmetricTensor operator- () const
 
template<typename OtherNumber >
DEAL_II_HOST constexpr internal::SymmetricTensorAccessors::double_contraction_result< rank_, 2, dim, Number, OtherNumber >::type operator* (const SymmetricTensor< 2, dim, OtherNumber > &s) const
 
template<typename OtherNumber >
DEAL_II_HOST constexpr internal::SymmetricTensorAccessors::double_contraction_result< rank_, 4, dim, Number, OtherNumber >::type operator* (const SymmetricTensor< 4, dim, OtherNumber > &s) const
 
DEAL_II_HOST constexpr Number & operator() (const TableIndices< rank_ > &indices)
 
DEAL_II_HOST constexpr const Number & operator() (const TableIndices< rank_ > &indices) const
 
DEAL_II_HOST constexpr internal::SymmetricTensorAccessors::Accessor< rank_, dim, true, rank_ - 1, Number > operator[] (const unsigned int row) const
 
DEAL_II_HOST constexpr internal::SymmetricTensorAccessors::Accessor< rank_, dim, false, rank_ - 1, Number > operator[] (const unsigned int row)
 
DEAL_II_HOST constexpr const Number & operator[] (const TableIndices< rank_ > &indices) const
 
DEAL_II_HOST constexpr Number & operator[] (const TableIndices< rank_ > &indices)
 
DEAL_II_HOST constexpr const Number & access_raw_entry (const unsigned int unrolled_index) const
 
DEAL_II_HOST constexpr Number & access_raw_entry (const unsigned int unrolled_index)
 
DEAL_II_HOST constexpr numbers::NumberTraits< Number >::real_type norm () const
 
DEAL_II_HOST constexpr void clear ()
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Static Public Member Functions

static DEAL_II_HOST constexpr unsigned int component_to_unrolled_index (const TableIndices< rank_ > &indices)
 
static DEAL_II_HOST constexpr TableIndices< rank_ > unrolled_to_component_indices (const unsigned int i)
 
static DEAL_II_HOST constexpr std::size_t memory_consumption ()
 

Static Public Attributes

static constexpr unsigned int dimension = dim
 
static const unsigned int rank = rank_
 
static constexpr unsigned int n_independent_components
 

Private Types

using base_tensor_descriptor
 
using base_tensor_type = typename base_tensor_descriptor::base_tensor_type
 

Private Attributes

base_tensor_type data
 

Related Symbols

(Note that these are not member symbols.)

template<int rank, int dim, typename Number >
SymmetricTensor< rank, dim, Number > sum (const SymmetricTensor< rank, dim, Number > &local, const MPI_Comm mpi_communicator)
 
template<int dim, typename Number = double>
DEAL_II_HOST constexpr SymmetricTensor< 2, dim, Number > unit_symmetric_tensor ()
 
template<int dim, typename Number = double>
DEAL_II_HOST constexpr SymmetricTensor< 4, dim, Number > deviator_tensor ()
 
template<int dim, typename Number = double>
DEAL_II_HOST constexpr SymmetricTensor< 4, dim, Number > identity_tensor ()
 
template<int dim2, typename Number >
DEAL_II_HOST constexpr Number trace (const SymmetricTensor< 2, dim2, Number > &)
 
template<int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< 2, dim, Number > deviator (const SymmetricTensor< 2, dim, Number > &)
 
template<int dim, typename Number >
DEAL_II_HOST constexpr Number determinant (const SymmetricTensor< 2, dim, Number > &)
 
template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator+ (const SymmetricTensor< rank_, dim, Number > &left, const SymmetricTensor< rank_, dim, OtherNumber > &right)
 
template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator- (const SymmetricTensor< rank_, dim, Number > &left, const SymmetricTensor< rank_, dim, OtherNumber > &right)
 
template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator+ (const SymmetricTensor< rank_, dim, Number > &left, const Tensor< rank_, dim, OtherNumber > &right)
 
template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator+ (const Tensor< rank_, dim, Number > &left, const SymmetricTensor< rank_, dim, OtherNumber > &right)
 
template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator- (const SymmetricTensor< rank_, dim, Number > &left, const Tensor< rank_, dim, OtherNumber > &right)
 
template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator- (const Tensor< rank_, dim, Number > &left, const SymmetricTensor< rank_, dim, OtherNumber > &right)
 
template<int dim, typename Number >
DEAL_II_HOST constexpr Number third_invariant (const SymmetricTensor< 2, dim, Number > &t)
 
template<int dim, typename Number >
DEAL_II_HOST constexpr Number first_invariant (const SymmetricTensor< 2, dim, Number > &t)
 
template<typename Number >
DEAL_II_HOST constexpr Number second_invariant (const SymmetricTensor< 2, 1, Number > &)
 
template<typename Number >
DEAL_II_HOST constexpr Number second_invariant (const SymmetricTensor< 2, 2, Number > &t)
 
template<typename Number >
DEAL_II_HOST constexpr Number second_invariant (const SymmetricTensor< 2, 3, Number > &t)
 
template<typename Number >
std::array< Number, 1 > eigenvalues (const SymmetricTensor< 2, 1, Number > &T)
 
template<typename Number >
std::array< Number, 2 > eigenvalues (const SymmetricTensor< 2, 2, Number > &T)
 
template<typename Number >
std::array< Number, 3 > eigenvalues (const SymmetricTensor< 2, 3, Number > &T)
 
template<int dim, typename Number >
std::array< std::pair< Number, Tensor< 1, dim, Number > >, std::integral_constant< int, dim >::value > eigenvectors (const SymmetricTensor< 2, dim, Number > &T, const SymmetricTensorEigenvectorMethod method=SymmetricTensorEigenvectorMethod::ql_implicit_shifts)
 
template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, Number > transpose (const SymmetricTensor< rank_, dim, Number > &t)
 
template<int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< 2, dim, Number > invert (const SymmetricTensor< 2, dim, Number > &t)
 
template<int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< 4, dim, Number > invert (const SymmetricTensor< 4, dim, Number > &t)
 
template<int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< 4, dim, Number > outer_product (const SymmetricTensor< 2, dim, Number > &t1, const SymmetricTensor< 2, dim, Number > &t2)
 
template<int dim, typename Number >
std::pair< SymmetricTensor< 2, dim, Number >, SymmetricTensor< 2, dim, Number > > positive_negative_split (const SymmetricTensor< 2, dim, Number > &original_tensor)
 
template<int dim, typename Number >
std::tuple< SymmetricTensor< 2, dim, Number >, SymmetricTensor< 2, dim, Number >, SymmetricTensor< 4, dim, Number >, SymmetricTensor< 4, dim, Number > > positive_negative_projectors (const SymmetricTensor< 2, dim, Number > &original_tensor)
 
template<int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< 2, dim, Number > symmetrize (const Tensor< 2, dim, Number > &t)
 
template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, Number > operator* (const SymmetricTensor< rank_, dim, Number > &t, const Number &factor)
 
template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, Number > operator* (const Number &factor, const SymmetricTensor< rank_, dim, Number > &t)
 
template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator* (const SymmetricTensor< rank_, dim, Number > &t, const OtherNumber &factor)
 
template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, typename ProductType< OtherNumber, typename EnableIfScalar< Number >::type >::type > operator* (const Number &factor, const SymmetricTensor< rank_, dim, OtherNumber > &t)
 
template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator/ (const SymmetricTensor< rank_, dim, Number > &t, const OtherNumber &factor)
 
template<int rank_, int dim>
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim > operator* (const SymmetricTensor< rank_, dim > &t, const double factor)
 
template<int rank_, int dim>
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim > operator* (const double factor, const SymmetricTensor< rank_, dim > &t)
 
template<int rank_, int dim>
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim > operator/ (const SymmetricTensor< rank_, dim > &t, const double factor)
 
template<int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr ProductType< Number, OtherNumber >::type scalar_product (const SymmetricTensor< 2, dim, Number > &t1, const SymmetricTensor< 2, dim, OtherNumber > &t2)
 
template<int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr ProductType< Number, OtherNumber >::type scalar_product (const SymmetricTensor< 2, dim, Number > &t1, const Tensor< 2, dim, OtherNumber > &t2)
 
template<int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr ProductType< Number, OtherNumber >::type scalar_product (const Tensor< 2, dim, Number > &t1, const SymmetricTensor< 2, dim, OtherNumber > &t2)
 
template<typename Number , typename OtherNumber >
DEAL_II_HOST constexpr void double_contract (SymmetricTensor< 2, 1, typename ProductType< Number, OtherNumber >::type > &tmp, const SymmetricTensor< 4, 1, Number > &t, const SymmetricTensor< 2, 1, OtherNumber > &s)
 
template<typename Number , typename OtherNumber >
DEAL_II_HOST constexpr void double_contract (SymmetricTensor< 2, 1, typename ProductType< Number, OtherNumber >::type > &tmp, const SymmetricTensor< 2, 1, Number > &s, const SymmetricTensor< 4, 1, OtherNumber > &t)
 
template<typename Number , typename OtherNumber >
DEAL_II_HOST constexpr void double_contract (SymmetricTensor< 2, 2, typename ProductType< Number, OtherNumber >::type > &tmp, const SymmetricTensor< 4, 2, Number > &t, const SymmetricTensor< 2, 2, OtherNumber > &s)
 
template<typename Number , typename OtherNumber >
DEAL_II_HOST constexpr void double_contract (SymmetricTensor< 2, 2, typename ProductType< Number, OtherNumber >::type > &tmp, const SymmetricTensor< 2, 2, Number > &s, const SymmetricTensor< 4, 2, OtherNumber > &t)
 
template<typename Number , typename OtherNumber >
DEAL_II_HOST constexpr void double_contract (SymmetricTensor< 2, 3, typename ProductType< Number, OtherNumber >::type > &tmp, const SymmetricTensor< 4, 3, Number > &t, const SymmetricTensor< 2, 3, OtherNumber > &s)
 
template<typename Number , typename OtherNumber >
DEAL_II_HOST constexpr void double_contract (SymmetricTensor< 2, 3, typename ProductType< Number, OtherNumber >::type > &tmp, const SymmetricTensor< 2, 3, Number > &s, const SymmetricTensor< 4, 3, OtherNumber > &t)
 
template<int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< 1, dim, typename ProductType< Number, OtherNumber >::type > operator* (const SymmetricTensor< 2, dim, Number > &src1, const Tensor< 1, dim, OtherNumber > &src2)
 
template<int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< 1, dim, typename ProductType< Number, OtherNumber >::type > operator* (const Tensor< 1, dim, Number > &src1, const SymmetricTensor< 2, dim, OtherNumber > &src2)
 
template<int rank_1, int rank_2, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< rank_1+rank_2-2, dim, typenameProductType< Number, OtherNumber >::type >::tensor_type operator* (const Tensor< rank_1, dim, Number > &src1, const SymmetricTensor< rank_2, dim, OtherNumber > &src2)
 
template<int rank_1, int rank_2, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< rank_1+rank_2-2, dim, typenameProductType< Number, OtherNumber >::type >::tensor_type operator* (const SymmetricTensor< rank_1, dim, Number > &src1, const Tensor< rank_2, dim, OtherNumber > &src2)
 
template<int dim, typename Number >
std::ostream & operator<< (std::ostream &out, const SymmetricTensor< 2, dim, Number > &t)
 
template<int dim, typename Number >
std::ostream & operator<< (std::ostream &out, const SymmetricTensor< 4, dim, Number > &t)
 

Detailed Description

template<int rank_, int dim, typename Number>
class SymmetricTensor< rank_, dim, Number >

Provide a class that stores symmetric tensors of rank 2,4,... efficiently, i.e. only store those off-diagonal elements of the full tensor that are not redundant. For example, for symmetric \(2\times 2\) tensors, this would be the elements 11, 22, and 12, while the element 21 is equal to the 12 element. Within this documentation, second order symmetric tensors are denoted as bold-faced upper-case Latin letters such as \(\mathbf A, \mathbf B, \dots\) or bold-faced Greek letters such as \(\boldsymbol{\varepsilon}\), \(\boldsymbol{\sigma}\). The Cartesian coordinates of a second-order tensor such as \(\mathbf A\) are represented as \(A_{ij}\) where \(i,j\) are indices ranging from 0 to dim-1.

Using this class for symmetric tensors of rank 2 has advantages over matrices in many cases since the dimension is known to the compiler as well as the location of the data. It is therefore possible to produce far more efficient code than for matrices with runtime-dependent dimension. It is also more efficient than using the more general Tensor class, since fewer elements are stored, and the class automatically makes sure that the tensor represents a symmetric object.

For tensors of higher rank, the savings in storage are even higher. For example for the \(3 \times 3 \times 3 \times 3\) tensors of rank 4, only 36 instead of the full 81 entries have to be stored. These rank 4 tensors are denoted by blackboard-style upper-case Latin letters such as \(\mathbb A\) with components \(\mathcal{A}_{ijkl}\).

While the definition of a symmetric rank-2 tensor is obvious, tensors of rank 4 are considered symmetric if they are operators mapping symmetric rank-2 tensors onto symmetric rank-2 tensors. This so-called minor symmetry of the rank 4 tensor requires that for every set of four indices \(i, j, k, l\), the identity \(\mathcal{C}_{ijkl} = \mathcal{C}_{jikl} = \mathcal{C}_{ijlk}\) holds. However, it does not imply the relation \(\mathcal{C}_{ijkl} = \mathcal{C}_{klij}\). Consequently, symmetric tensors of rank 4 as understood here are only tensors that map symmetric tensors onto symmetric tensors, but they do not necessarily induce a symmetric scalar product \(\mathbf A : \mathbb C : \mathbf B = \mathbf B : \mathbb C : \mathbf A\) or even a positive (semi-)definite form \(\mathbf A : \mathbb C : \mathbf A\), where \(\mathbf A, \mathbf B\) are symmetric rank-2 tensors and the colon indicates the common double-index contraction that acts as a scalar product for symmetric tensors.

Symmetric tensors are most often used in structural and fluid mechanics, where strains and stresses are usually symmetric tensors, and the stress-strain relationship is given by a symmetric rank-4 tensor.

Note
Symmetric tensors only exist with even numbers of indices. In other words, the only objects that you can use are SymmetricTensor<2,dim>, SymmetricTensor<4,dim>, etc, but SymmetricTensor<1,dim> and SymmetricTensor<3,dim> do not exist and their use will most likely lead to compiler errors.

Accessing elements

The elements of a tensor \(\mathbb C\) can be accessed using the bracket operator, i.e. for a tensor of rank 4, C[0][1][0][1] accesses the element \(\mathcal{C}_{0101}\). This access can be used for both reading and writing (if the tensor is non-constant at least). You may also perform other operations on it, although that may lead to confusing situations because several elements of the tensor are stored at the same location. For example, for a rank-2 tensor that is assumed to be zero at the beginning, writing A[0][1]+=1; A[1][0]+=1; will lead to the same element being increased by one twice, because even though the accesses use different indices, the elements that are accessed are symmetric and therefore stored at the same location. It may therefore be useful in application programs to restrict operations on individual elements to simple reads or writes.

Definition at line 718 of file symmetric_tensor.h.

Member Typedef Documentation

◆ base_tensor_descriptor

template<int rank_, int dim, typename Number >
using SymmetricTensor< rank_, dim, Number >::base_tensor_descriptor
private
Initial value:

A structure that describes properties of the base tensor.

Definition at line 1126 of file symmetric_tensor.h.

◆ base_tensor_type

template<int rank_, int dim, typename Number >
using SymmetricTensor< rank_, dim, Number >::base_tensor_type = typename base_tensor_descriptor::base_tensor_type
private

Data storage type for a symmetric tensor.

Definition at line 1132 of file symmetric_tensor.h.

Constructor & Destructor Documentation

◆ SymmetricTensor() [1/4]

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, Number >::SymmetricTensor ( )
constexprdefault

Default constructor. Creates a tensor with all entries equal to zero.

◆ SymmetricTensor() [2/4]

template<int rank_, int dim, typename Number >
template<typename OtherNumber >
SymmetricTensor< rank_, dim, Number >::SymmetricTensor ( const Tensor< 2, dim, OtherNumber > & t)
explicit

Constructor. Generate a symmetric tensor from a general one. Assumes that t is already symmetric, and in debug mode this is in fact checked. Note that no provision is made to assure that the tensor is symmetric only up to round-off error: if the incoming tensor is not exactly symmetric, then an exception is thrown. If you know that incoming tensor is symmetric only up to round-off, then you may want to call the symmetrize() function first. If you aren't sure, it is good practice to check before calling symmetrize().

Because we check for symmetry via a non-constexpr function call, you will have to use the symmetrize() function in constexpr contexts instead.

◆ SymmetricTensor() [3/4]

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, Number >::SymmetricTensor ( const Number(&) array[n_independent_components])
constexpr

A constructor that creates a symmetric tensor from an array holding its independent elements. Using this constructor assumes that the caller knows the order in which elements are stored in symmetric tensors; its use is therefore discouraged, but if you think you want to use it anyway you can query the order of elements using the unrolled_index() function.

This constructor is currently only implemented for symmetric tensors of rank 2.

The size of the array passed is equal to SymmetricTensor<rank_,dim>::n_independent_components; the reason for using the object from the internal namespace is to work around bugs in some older compilers.

◆ SymmetricTensor() [4/4]

template<int rank_, int dim, typename Number >
template<typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, Number >::SymmetricTensor ( const SymmetricTensor< rank_, dim, OtherNumber > & initializer)
explicitconstexpr

Copy constructor from tensors with different underlying scalar type. This obviously requires that the OtherNumber type is convertible to Number.

Member Function Documentation

◆ begin_raw() [1/2]

template<int rank_, int dim, typename Number >
Number * SymmetricTensor< rank_, dim, Number >::begin_raw ( )

Return a pointer to the first element of the underlying storage.

Deprecated
This function suggests that the elements of a SymmetricTensor object are stored as a contiguous array, but this is not in fact true and one should not pretend that this so. As a consequence, this function is deprecated.

◆ begin_raw() [2/2]

template<int rank_, int dim, typename Number >
const Number * SymmetricTensor< rank_, dim, Number >::begin_raw ( ) const

Return a const pointer to the first element of the underlying storage.

Deprecated
This function suggests that the elements of a SymmetricTensor object are stored as a contiguous array, but this is not in fact true and one should not pretend that this so. As a consequence, this function is deprecated.

◆ end_raw() [1/2]

template<int rank_, int dim, typename Number >
Number * SymmetricTensor< rank_, dim, Number >::end_raw ( )

Return a pointer to the element past the end of the underlying storage.

Deprecated
This function suggests that the elements of a SymmetricTensor object are stored as a contiguous array, but this is not in fact true and one should not pretend that this so. As a consequence, this function is deprecated.

◆ end_raw() [2/2]

template<int rank_, int dim, typename Number >
const Number * SymmetricTensor< rank_, dim, Number >::end_raw ( ) const

Return a const pointer to the element past the end of the underlying storage.

Deprecated
This function suggests that the elements of a SymmetricTensor object are stored as a contiguous array, but this is not in fact true and one should not pretend that this so. As a consequence, this function is deprecated.

◆ operator=() [1/2]

template<int rank_, int dim, typename Number >
template<typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor & SymmetricTensor< rank_, dim, Number >::operator= ( const SymmetricTensor< rank_, dim, OtherNumber > & rhs)
constexpr

Assignment operator from symmetric tensors with different underlying scalar type. This obviously requires that the OtherNumber type is convertible to Number.

◆ operator=() [2/2]

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor & SymmetricTensor< rank_, dim, Number >::operator= ( const Number & d)
constexpr

This operator assigns a scalar to a tensor. To avoid confusion with what exactly it means to assign a scalar value to a tensor, zero is the only value allowed for d, allowing the intuitive notation \(\mathbf A = 0\) to reset all elements of the tensor to zero.

◆ operator Tensor< rank_, dim, Number >()

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, Number >::operator Tensor< rank_, dim, Number > ( ) const
constexpr

Convert the present symmetric tensor into a full tensor with the same elements, but using the different storage scheme of full tensors.

◆ operator==()

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr bool SymmetricTensor< rank_, dim, Number >::operator== ( const SymmetricTensor< rank_, dim, Number > & ) const
constexpr

Test for equality of two tensors.

◆ operator!=()

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr bool SymmetricTensor< rank_, dim, Number >::operator!= ( const SymmetricTensor< rank_, dim, Number > & ) const
constexpr

Test for inequality of two tensors.

◆ operator+=()

template<int rank_, int dim, typename Number >
template<typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor & SymmetricTensor< rank_, dim, Number >::operator+= ( const SymmetricTensor< rank_, dim, OtherNumber > & )
constexpr

Add another tensor.

◆ operator-=()

template<int rank_, int dim, typename Number >
template<typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor & SymmetricTensor< rank_, dim, Number >::operator-= ( const SymmetricTensor< rank_, dim, OtherNumber > & )
constexpr

Subtract another tensor.

◆ operator*=()

template<int rank_, int dim, typename Number >
template<typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor & SymmetricTensor< rank_, dim, Number >::operator*= ( const OtherNumber & factor)
constexpr

Scale the tensor by factor, i.e. multiply all components by factor.

◆ operator/=()

template<int rank_, int dim, typename Number >
template<typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor & SymmetricTensor< rank_, dim, Number >::operator/= ( const OtherNumber & factor)
constexpr

Scale the tensor by 1/factor.

◆ operator-()

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor SymmetricTensor< rank_, dim, Number >::operator- ( ) const
constexpr

Unary minus operator. Negate all entries of a tensor.

◆ operator*() [1/2]

template<int rank_, int dim, typename Number >
template<typename OtherNumber >
DEAL_II_HOST constexpr internal::SymmetricTensorAccessors::double_contraction_result< rank_, 2, dim, Number, OtherNumber >::type SymmetricTensor< rank_, dim, Number >::operator* ( const SymmetricTensor< 2, dim, OtherNumber > & s) const
constexpr

Double contraction product between the present symmetric tensor and a tensor of rank 2. For example, if the present object is the symmetric rank-2 tensor \(\mathbf{A}\) and it is multiplied by another symmetric rank-2 tensor \(\mathbf{B}\), then the result is the scalar-product double contraction \(\mathbf A : \mathbf B = \sum_{i,j} A_{ij} B_{ij}\). In this case, the return value evaluates to a single scalar. While it is possible to define other scalar products (and associated induced norms), this one seems to be the most appropriate one.

If the present object is a rank-4 tensor such as \(\mathbb A\), then the result is a rank-2 tensor \(\mathbf C = \mathbb A : \mathbf B\), i.e., the operation contracts over the last two indices of the present object and the indices of the argument, and the result is a tensor of rank 2 ( \(C_{ij} = \sum_{k,l} \mathcal{A}_{ijkl} B_{kl}\)).

Note that the multiplication operator for symmetric tensors is defined to be a double contraction over two indices, while it is defined as a single contraction over only one index for regular Tensor objects. For symmetric tensors it therefore acts in a way that is commonly denoted by a "colon multiplication" in the mathematical literature (the two dots of the colon suggesting that it is a contraction over two indices), which corresponds to a scalar product between tensors.

It is worth pointing out that this definition of operator* between symmetric tensors is different to how the (in general non-symmetric) Tensor class defines operator*, namely as the single-contraction product over the last index of the first operand and the first index of the second operand. For the double contraction of Tensor objects, you will need to use the double_contract() function.

To maintain at least a modicum of resemblance between the interfaces of Tensor and SymmetricTensor, there are also global functions double_contract() for symmetric tensors that then do the same work as this operator. However, rather than returning the result as a return value, they write it into the first argument to the function in the same way as the corresponding functions for the Tensor class do things.

Note
The origin of the difference in how operator*() is implemented between Tensor and SymmetricTensor is that for the former, the product between two Tensor objects of same rank and dimension results in another Tensor object – that it, operator*() corresponds to the multiplicative group action within the group of tensors. On the other hand, there is no corresponding multiplicative group action with the set of symmetric tensors because, in general, the product of two symmetric tensors is a nonsymmetric tensor. As a consequence, for a mathematician, it is clear that operator*() for symmetric tensors must have a different meaning: namely the dot or scalar product that maps two symmetric tensors of rank 2 to a scalar. This corresponds to the double-dot (colon) operator whose meaning is then extended to the product of any two even-ranked symmetric tensors.

◆ operator*() [2/2]

template<int rank_, int dim, typename Number >
template<typename OtherNumber >
DEAL_II_HOST constexpr internal::SymmetricTensorAccessors::double_contraction_result< rank_, 4, dim, Number, OtherNumber >::type SymmetricTensor< rank_, dim, Number >::operator* ( const SymmetricTensor< 4, dim, OtherNumber > & s) const
constexpr

Contraction over the last two indices of the present object with the first two indices of the rank-4 symmetric tensor given as argument.

◆ operator()() [1/2]

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr Number & SymmetricTensor< rank_, dim, Number >::operator() ( const TableIndices< rank_ > & indices)
constexpr

Return a read-write reference to the indicated element.

◆ operator()() [2/2]

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr const Number & SymmetricTensor< rank_, dim, Number >::operator() ( const TableIndices< rank_ > & indices) const
constexpr

Return a const reference to the value referred to by the argument.

◆ operator[]() [1/4]

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr internal::SymmetricTensorAccessors:: Accessor< rank_, dim, true, rank_ - 1, Number > SymmetricTensor< rank_, dim, Number >::operator[] ( const unsigned int row) const
constexpr

Access the elements of a row of this symmetric tensor. This function is called for constant tensors.

◆ operator[]() [2/4]

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr internal::SymmetricTensorAccessors:: Accessor< rank_, dim, false, rank_ - 1, Number > SymmetricTensor< rank_, dim, Number >::operator[] ( const unsigned int row)
constexpr

Access the elements of a row of this symmetric tensor. This function is called for non-constant tensors.

◆ operator[]() [3/4]

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr const Number & SymmetricTensor< rank_, dim, Number >::operator[] ( const TableIndices< rank_ > & indices) const
constexpr

Return a const reference to the value referred to by the argument.

Exactly the same as operator().

◆ operator[]() [4/4]

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr Number & SymmetricTensor< rank_, dim, Number >::operator[] ( const TableIndices< rank_ > & indices)
constexpr

Return a read-write reference to the indicated element.

Exactly the same as operator().

◆ access_raw_entry() [1/2]

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr const Number & SymmetricTensor< rank_, dim, Number >::access_raw_entry ( const unsigned int unrolled_index) const
constexpr

Access to an element according to unrolled index. The function s.access_raw_entry(unrolled_index) does the same as s[s.unrolled_to_component_indices(unrolled_index)], but more efficiently.

◆ access_raw_entry() [2/2]

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr Number & SymmetricTensor< rank_, dim, Number >::access_raw_entry ( const unsigned int unrolled_index)
constexpr

Access to an element according to unrolled index. The function s.access_raw_entry(unrolled_index) does the same as s[s.unrolled_to_component_indices(unrolled_index)], but more efficiently.

◆ norm()

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr numbers::NumberTraits< Number >::real_type SymmetricTensor< rank_, dim, Number >::norm ( ) const
constexpr

Return the Frobenius-norm of a tensor, i.e. the square root of the sum of squares of all entries. This norm is induced by the scalar product defined above for two symmetric tensors. Note that it includes all entries of the tensor, counting symmetry, not only the unique ones (for example, for rank-2 tensors, this norm includes adding up the squares of upper right as well as lower left entries, not just one of them, although they are equal for symmetric tensors).

◆ component_to_unrolled_index()

template<int rank_, int dim, typename Number >
static DEAL_II_HOST constexpr unsigned int SymmetricTensor< rank_, dim, Number >::component_to_unrolled_index ( const TableIndices< rank_ > & indices)
staticconstexpr

Tensor objects can be unrolled by simply pasting all elements into one long vector, but for this an order of elements has to be defined. For symmetric tensors, this function returns which index within the range [0,n_independent_components) the given entry in a symmetric tensor has.

◆ unrolled_to_component_indices()

template<int rank_, int dim, typename Number >
static DEAL_II_HOST constexpr TableIndices< rank_ > SymmetricTensor< rank_, dim, Number >::unrolled_to_component_indices ( const unsigned int i)
staticconstexpr

The opposite of the previous function: given an index \(i\) in the unrolled form of the tensor, return what set of indices \((k,l)\) (for rank-2 tensors) or \((k,l,m,n)\) (for rank-4 tensors) corresponds to it.

◆ clear()

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr void SymmetricTensor< rank_, dim, Number >::clear ( )
constexpr

Reset all values to zero.

Note that this is partly inconsistent with the semantics of the clear() member functions of the standard library containers and of several other classes within deal.II, which not only reset the values of stored elements to zero, but release all memory and return the object into an empty state. However, since the size of objects of the present type is determined by its template parameters, resizing is not an option, and indeed the state where all elements have a zero value is the state right after construction of such an object.

◆ memory_consumption()

template<int rank_, int dim, typename Number >
static DEAL_II_HOST constexpr std::size_t SymmetricTensor< rank_, dim, Number >::memory_consumption ( )
staticconstexpr

Determine an estimate for the memory consumption (in bytes) of this object.

◆ serialize()

template<int rank_, int dim, typename Number >
template<class Archive >
void SymmetricTensor< rank_, dim, Number >::serialize ( Archive & ar,
const unsigned int version )

Read or write the data of this object to or from a stream for the purpose of serialization using the BOOST serialization library.

Friends And Related Symbol Documentation

◆ sum()

template<int rank, int dim, typename Number >
SymmetricTensor< rank, dim, Number > sum ( const SymmetricTensor< rank, dim, Number > & local,
const MPI_Comm mpi_communicator )
related

Perform an MPI sum of the entries of a symmetric tensor.

◆ unit_symmetric_tensor()

template<int dim, typename Number = double>
DEAL_II_HOST constexpr SymmetricTensor< 2, dim, Number > unit_symmetric_tensor ( )
related

Return a unit symmetric tensor of rank 2, i.e., the \(\text{dim}\times\text{dim}\) identity matrix \(\mathbf I\). For example, if dim==2, then this matrix has the form

\[ I_{2\times 2} = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}. \]

Definition at line 3158 of file symmetric_tensor.h.

◆ deviator_tensor()

template<int dim, typename Number = double>
DEAL_II_HOST constexpr SymmetricTensor< 4, dim, Number > deviator_tensor ( )
related

Return the tensor of rank 4 that, when multiplied by a symmetric rank 2 tensor \(\mathbf T\) returns the deviator \(\text{dev}\ \mathbf T\). It is the operator representation of the linear deviator operator \(\mathbb P\), also known as the volumetric projection tensor, calculated as:

\begin{align*} \mathbb{P} &=\mathbb{S} -\frac{1}{\text{dim}} \mathbf I \otimes \mathbf I \\ \mathcal{P}_{ijkl} &= \frac 12 \left(\delta_{ik} \delta_{jl} + \delta_{il} \delta_{jk} \right) - \frac{1}{\text{dim}} \delta_{ij} \delta_{kl} \end{align*}

For every tensor T, there holds the identity deviator<dim,Number>(T) == deviator_tensor<dim,Number>() * T, up to numerical round-off.

\[ \text{dev}\mathbf T = \mathbb P : \mathbf T \]

Note
The reason this operator representation is provided is to simplify taking derivatives of the deviatoric part of tensors:

\[ \frac{\partial \text{dev}\mathbf{T}}{\partial \mathbf T} = \mathbb P. \]

Definition at line 3186 of file symmetric_tensor.h.

◆ identity_tensor()

template<int dim, typename Number = double>
DEAL_II_HOST constexpr SymmetricTensor< 4, dim, Number > identity_tensor ( )
related

Return the fourth-order symmetric identity tensor \(\mathbb S\) which maps symmetric second-order tensors, such as \(\mathbf A\), to themselves.

\[ \mathbb S : \mathbf A = \mathbf A \]

Note that this tensor, even though it is the identity, has a somewhat funny form, and in particular does not only consist of zeros and ones. For example, for dim=2, the identity tensor has all zero entries except for

\[ \mathcal{S}_{0000} = \mathcal{S}_{1111} = 1 \]

\[ \mathcal{S}_{0101} = \mathcal{S}_{0110} = \mathcal{S}_{1001} = \mathcal{S}_{1010} = \frac 12. \]

In index notation, we can write the general form

\[ \mathcal{S}_{ijkl} = \frac 12 \left( \delta_{ik} \delta_{jl} + \delta_{il} \delta_{jk} \right). \]

To see why this factor of \(1 / 2\) is necessary, consider computing \(\mathbf A= \mathbb I : \mathbf B\). For the element \(A_{01}\) we have \(A_{01} = \mathcal{S}_{0100} B_{00} + \mathcal{S}_{0111} B_{11} + \mathcal{S}_{0101} B_{01} + \mathcal{S}_{0110} B_{10}\). On the other hand, we need to have \(A_{01} = B_{01}\), and symmetry implies \(B_{01}=B_{10}\), leading to \(A_{01} = (\mathcal{S}_{0101} + \mathcal{S}_{0110}) B_{01}\), or, again by symmetry, \(\mathcal{S}_{0101} = \mathcal{S}_{0110} = \frac 12\). Similar considerations hold for the three-dimensional case.

This issue is also explained in the introduction to step-44.

Definition at line 3215 of file symmetric_tensor.h.

◆ trace()

template<int dim2, typename Number >
DEAL_II_HOST constexpr Number trace ( const SymmetricTensor< 2, dim2, Number > & )
related

Compute and return the trace of a tensor of rank 2, i.e. the sum of its diagonal entries. The trace is the first invariant of a rank-2 tensor.

\[ \text{tr} \mathbf A = \sum_i A_{ii} \]

◆ deviator()

template<int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< 2, dim, Number > deviator ( const SymmetricTensor< 2, dim, Number > & )
related

Compute the deviator of a symmetric tensor, which is defined as \(\text{dev} \mathbf T = \mathbf T - \frac{1}{\text{dim}} \text{tr}\mathbf T \; \mathbf I\), where \(\mathbf I\) is the identity operator. This quantity equals the original tensor minus its contractive or dilative component and refers to the shear in, for example, elasticity.

Definition at line 3141 of file symmetric_tensor.h.

◆ determinant()

template<int dim, typename Number >
DEAL_II_HOST constexpr Number determinant ( const SymmetricTensor< 2, dim, Number > & )
related

Compute the determinant of a rank 2 symmetric tensor. The determinant is also commonly referred to as the third invariant of rank-2 tensors.

For a one-dimensional tensor, the determinant equals the only element and is therefore equivalent to the trace.

For greater notational simplicity, there is also a third_invariant() function that returns the determinant of a tensor.

Definition at line 2724 of file symmetric_tensor.h.

◆ operator+() [1/3]

template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator+ ( const SymmetricTensor< rank_, dim, Number > & left,
const SymmetricTensor< rank_, dim, OtherNumber > & right )
related

Addition of two symmetric tensors of equal rank. The result is another SymmetricTensor that has a number type that is compatible with the operation.

If possible (e.g. when Number and OtherNumber are of the same type, or if the result of Number() + OtherNumber() is another Number), you should use operator+= instead since this does not require the creation of a temporary variable.

Definition at line 2618 of file symmetric_tensor.h.

◆ operator-() [1/3]

template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator- ( const SymmetricTensor< rank_, dim, Number > & left,
const SymmetricTensor< rank_, dim, OtherNumber > & right )
related

Subtraction of two symmetric tensors of equal rank. The result is another SymmetricTensor that has a number type that is compatible with the operation.

If possible (e.g. when Number and OtherNumber are of the same type, or if the result of Number() - OtherNumber() is another Number), you should use operator-= instead since this does not require the creation of a temporary variable.

Definition at line 2643 of file symmetric_tensor.h.

◆ operator+() [2/3]

template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator+ ( const SymmetricTensor< rank_, dim, Number > & left,
const Tensor< rank_, dim, OtherNumber > & right )
related

Addition of a SymmetricTensor and a general Tensor of equal rank. The result is a general Tensor that has a number type that is compatible with the operation.

Definition at line 2663 of file symmetric_tensor.h.

◆ operator+() [3/3]

template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator+ ( const Tensor< rank_, dim, Number > & left,
const SymmetricTensor< rank_, dim, OtherNumber > & right )
related

Addition of a general Tensor with a SymmetricTensor of equal rank. The result is a general Tensor that has a number type that is compatible with the operation.

Definition at line 2680 of file symmetric_tensor.h.

◆ operator-() [2/3]

template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator- ( const SymmetricTensor< rank_, dim, Number > & left,
const Tensor< rank_, dim, OtherNumber > & right )
related

Subtraction of a general Tensor from a SymmetricTensor of equal rank. The result is a general Tensor that has a number type that is compatible with the operation.

Definition at line 2697 of file symmetric_tensor.h.

◆ operator-() [3/3]

template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< rank_, dim, typename ProductType< Number, OtherNumber >::type > operator- ( const Tensor< rank_, dim, Number > & left,
const SymmetricTensor< rank_, dim, OtherNumber > & right )
related

Subtraction of a SymmetricTensor from a general Tensor of equal rank. The result is a general Tensor that has a number type that is compatible with the operation.

Definition at line 2714 of file symmetric_tensor.h.

◆ third_invariant()

template<int dim, typename Number >
DEAL_II_HOST constexpr Number third_invariant ( const SymmetricTensor< 2, dim, Number > & t)
related

Compute the determinant of a rank 2 symmetric tensor. This function therefore computes the same value as the determinant() functions and is only provided for greater notational simplicity (since there are also functions first_invariant() and second_invariant()).

\[ I_3 (\mathbf A) = III (\mathbf A) = \det (\mathbf A) \]

Definition at line 2764 of file symmetric_tensor.h.

◆ first_invariant()

template<int dim, typename Number >
DEAL_II_HOST constexpr Number first_invariant ( const SymmetricTensor< 2, dim, Number > & t)
related

Compute the trace of a rank 2 symmetric tensor. This function therefore computes the same value as the trace() functions and is only provided for greater notational simplicity (since there are also functions second_invariant() and third_invariant()).

\[ I_1 (\mathbf A) = I (\mathbf A) = \text{tr} \mathbf A = \sum_i A_{ii} \]

Definition at line 2795 of file symmetric_tensor.h.

◆ second_invariant() [1/3]

template<typename Number >
DEAL_II_HOST constexpr Number second_invariant ( const SymmetricTensor< 2, 1, Number > & )
related

Compute the second invariant of a tensor of rank 2. The second invariant of a tensor \(\mathbf A\) is defined as \(I_2 (\mathbf A) = II(\mathbf A) = \frac 12 \left[ (\text{tr} \mathbf A)^2 - \text{tr} (\mathbf{A}^2) \right]\).

For the kind of arguments to this function, i.e., a rank-2 tensor of size 1, the result is simply zero.

Definition at line 2814 of file symmetric_tensor.h.

◆ second_invariant() [2/3]

template<typename Number >
DEAL_II_HOST constexpr Number second_invariant ( const SymmetricTensor< 2, 2, Number > & t)
related

Compute the second invariant of a tensor of rank 2. The second invariant of a tensor \(\mathbf A\) is defined as \(I_2 (\mathbf A) = II(\mathbf A) = \frac 12 \left[ (\text{tr} \mathbf A)^2 - \text{tr} (\mathbf{A}^2) \right]\).

For the kind of arguments to this function, i.e., a symmetric rank-2 tensor of size 2, the result is (counting indices starting at one) \(I_2(\mathbf A) = II(\mathbf A) = \frac 12 \left[ (A_{11} + A_{22})^2 - (A_{11}^2+2 A_{12}^2+ A_{22}^2) \right] = A_{11} A_{22} - A_{12}^2\). As expected, for the \(2\times 2\) symmetric tensors this function handles, this equals the determinant of the tensor. (This is so because for \(2\times 2\) symmetric tensors, there really are only two invariants, so the second and third invariant are the same; the determinant is the third invariant.)

Definition at line 2841 of file symmetric_tensor.h.

◆ second_invariant() [3/3]

template<typename Number >
DEAL_II_HOST constexpr Number second_invariant ( const SymmetricTensor< 2, 3, Number > & t)
related

Compute the second invariant of a tensor of rank 2. The second invariant of a tensor \(\mathbf A\) is defined as \(I_2 (\mathbf A) = II(\mathbf A) = \frac 12 \left[ (\text{tr} \mathbf A)^2 - \text{tr} (\mathbf{A}^2) \right]\).

Definition at line 2858 of file symmetric_tensor.h.

◆ eigenvalues() [1/3]

template<typename Number >
std::array< Number, 1 > eigenvalues ( const SymmetricTensor< 2, 1, Number > & T)
related

Return the eigenvalues of a symmetric \(1 \times 1\) tensor. The (single) entry of the tensor is, of course, equal to the (single) eigenvalue.

◆ eigenvalues() [2/3]

template<typename Number >
std::array< Number, 2 > eigenvalues ( const SymmetricTensor< 2, 2, Number > & T)
related

Return the eigenvalues of a symmetric \(2\times 2\) tensor. The array of eigenvalues is sorted in descending order.

For \(2\times 2\) tensors, the eigenvalues of tensor \(\mathbf T\) are the roots of the characteristic polynomial \(0 = \lambda^2 - \lambda\;\text{tr}\mathbf{T} + \det \mathbf{T}\) as given by \(\lambda_1, \lambda_2 = \frac{1}{2} \left[ \text{tr} \mathbf{T} \pm \sqrt{(\text{tr} \mathbf{T})^2 - 4 \det \mathbf{T}} \right]\).

Warning
The algorithm employed here determines the eigenvalues by computing the roots of the characteristic polynomial. In the case that there exists a common root (the eigenvalues are equal), the computation is subject to round-off errors of order \(\sqrt{\epsilon}\). As an alternative, the eigenvectors() function provides a more robust, but costly, method to compute the eigenvalues of a symmetric tensor.

◆ eigenvalues() [3/3]

template<typename Number >
std::array< Number, 3 > eigenvalues ( const SymmetricTensor< 2, 3, Number > & T)
related

Return the eigenvalues of a symmetric \(3\times 3\) tensor. The array of eigenvalues is sorted in descending order.

For \(3\times 3\) tensors, the eigenvalues of tensor \(\mathbf T\) are the roots of the characteristic polynomial \(0 = \lambda^3 - \lambda^2\;\text{tr}\mathbf T - \frac{1}{2} \lambda \left[\text{tr}(\mathbf{T}^2) - (\text{tr}\mathbf T)^2\right] - \det \mathbf T\).

Warning
The algorithm employed here determines the eigenvalues by computing the roots of the characteristic polynomial. In the case that there exists a common root (the eigenvalues are equal), the computation is subject to round-off errors of order \(\sqrt{\epsilon}\). As an alternative, the eigenvectors() function provides a more robust, but costly, method to compute the eigenvalues of a symmetric tensor.

◆ eigenvectors()

template<int dim, typename Number >
std::array< std::pair< Number, Tensor< 1, dim, Number > >, std::integral_constant< int, dim >::value > eigenvectors ( const SymmetricTensor< 2, dim, Number > & T,
const SymmetricTensorEigenvectorMethod method = SymmetricTensorEigenvectorMethod::ql_implicit_shifts )
related

Return the eigenvalues and eigenvectors of a real-valued rank-2 symmetric tensor \(\mathbf T\). The array of matched eigenvalue and eigenvector pairs is sorted in descending order (determined by the eigenvalues).

The specialized algorithms utilized in computing the eigenvectors are presented in [131].

◆ transpose()

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, Number > transpose ( const SymmetricTensor< rank_, dim, Number > & t)
related

Return the transpose of the given symmetric tensor. Since we are working with symmetric objects, the transpose is of course the same as the original tensor. This function mainly exists for compatibility with the Tensor class.

Definition at line 3131 of file symmetric_tensor.h.

◆ invert() [1/2]

template<int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< 2, dim, Number > invert ( const SymmetricTensor< 2, dim, Number > & t)
related

Invert a symmetric rank-2 tensor.

Note
If a tensor is not invertible, then the result is unspecified, but will likely contain the results of a division by zero or a very small number at the very least.

Definition at line 3250 of file symmetric_tensor.h.

◆ invert() [2/2]

template<int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< 4, dim, Number > invert ( const SymmetricTensor< 4, dim, Number > & t)
related

Invert a symmetric rank-4 tensor. Since symmetric rank-4 tensors are mappings from and to symmetric rank-2 tensors, they can have an inverse.

If a tensor is not invertible, then the result is unspecified, but will likely contain the results of a division by zero or a very small number at the very least.

Definition at line 3270 of file symmetric_tensor.h.

◆ outer_product()

template<int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< 4, dim, Number > outer_product ( const SymmetricTensor< 2, dim, Number > & t1,
const SymmetricTensor< 2, dim, Number > & t2 )
related

Return the tensor of rank 4 that is the outer product of the two tensors given as arguments, i.e. the result \(\mathbb A = \mathbf{T}_1 \otimes \mathbf{T}_2\) satisfies \(\mathbb A : \mathbf B = (\mathbf{T}_2 : \mathbf B) \mathbf{T}_1\) for all symmetric tensors \(\mathbf B\). In index notation

\[ \mathcal{A}_{ijkl} = (T_1)_{ij} (T_2)_{kl} \]

For example, the deviator tensor \(\mathbb P = \mathbb I - \frac{1}{\text{dim}} \mathbf I \otimes \mathbf I\) can be computed as identity_tensor<dim>() - 1/d * outer_product (unit_symmetric_tensor<dim>(), unit_symmetric_tensor<dim>()), since the (double) contraction with the unit tensor yields the trace of a symmetric tensor ( \(\mathbf I : \mathbf B = \text{tr} \mathbf B\)).

Definition at line 3301 of file symmetric_tensor.h.

◆ positive_negative_split()

template<int dim, typename Number >
std::pair< SymmetricTensor< 2, dim, Number >, SymmetricTensor< 2, dim, Number > > positive_negative_split ( const SymmetricTensor< 2, dim, Number > & original_tensor)
related

Perform a spectrum decomposition of a 2nd-order symmetric tensor original_tensor given as the input argument,

\[ \mathrm{original\_tensor} = \sum_i \lambda_i \, \boldsymbol{n}_i \otimes \boldsymbol{n}_i, \]

where \(\lambda_i\) is the eigenvalue, and \(\boldsymbol{n}_i\) is the corresponding eigenvector. The output is a pair of 2nd-order symmetric tensors. The first term in the pair is the positive part of the input tensor, and the second term in the pair is the negative part of the input tensor, that is,

\[ \mathrm{positive\_part\_tensor} = \sum_i \left<\lambda_i\right>_+ \boldsymbol{n}_i \otimes \boldsymbol{n}_i, \quad \mathrm{negative\_part\_tensor} = \sum_i \left<\lambda_i\right>_- \boldsymbol{n}_i \otimes \boldsymbol{n}_i, \]

where \(\left<\lambda_i\right>_+ = \mathrm{max}\{ \lambda_i, 0 \}\) and \(\left<\lambda_i\right>_- = \mathrm{min}\{ \lambda_i, 0 \}\). Obviously,

\[ \mathrm{positive\_part\_tensor} + \mathrm{negative\_part\_tensor} = \mathrm{original\_tensor}. \]

Parameters
[in]original_tensorThe 2nd-order symmetric tensor to be split into the positive and negative parts

Definition at line 3343 of file symmetric_tensor.h.

◆ positive_negative_projectors()

template<int dim, typename Number >
std::tuple< SymmetricTensor< 2, dim, Number >, SymmetricTensor< 2, dim, Number >, SymmetricTensor< 4, dim, Number >, SymmetricTensor< 4, dim, Number > > positive_negative_projectors ( const SymmetricTensor< 2, dim, Number > & original_tensor)
related

This function is similar to the function positive_negative_split(). That is, perform a spectrum decomposition of a 2nd-order symmetric tensor original_tensor given as the input argument, and split it into a positive part and a negative part. Moreover, this function also provides the derivatives. Let \(\mathbf{A}\) represent the input 2nd-order symmetric tensor original_tensor, \(\mathbf{A}^+\) represent the positive part, and \(\mathbf{A}^-\) represent the negative part. Then, two fourth-order tensors are defined as

\[ \mathbb{P}^+ = \frac{\partial \mathbf{A}^+}{\partial \mathbf{A}}, \quad \mathbb{P}^- = \frac{\partial \mathbf{A}^-}{\partial \mathbf{A}}, \]

where \(\mathbb{P}^+\) is the positive projector and \(\mathbb{P}^-\) is the negative projector. These two fourth-order tensors satisfy the following properties:

\[ \mathbb{P}^+ : \mathbf{A} = \mathbf{A}^+, \quad \mathbb{P}^- : \mathbf{A} = \mathbf{A}^-. \]

Since \(\mathbb{P}^+\) and \(\mathbb{P}^-\) are 4th-order projectors,

\[ \mathbb{P}^+ : \mathbf{A}^+ = \mathbf{A}^+, \quad \mathbb{P}^- : \mathbf{A}^- = \mathbf{A}^-, \quad \mathbb{P}^+ : \mathbf{A}^- = \mathbb{P}^- : \mathbf{A}^+ = \mathbf{0}. \]

Lastly,

\[ \mathbb{P}^+ + \mathbb{P}^- = \mathbb{S}, \]

where \(\mathbb{S}\) is the fourth-order symmetric identity tensor Physics::Elasticity::StandardTensors< dim >::S. The output of this function is a tuple containing four terms. The first term is \(\mathbf{A}^+\), the second term is \(\mathbf{A}^-\), the third term is \(\mathbb{P}^+\), and the fourth term is \(\mathbb{P}^-\).

Parameters
[in]original_tensorThe 2nd-order symmetric tensor to be split into the positive and negative parts

Definition at line 3410 of file symmetric_tensor.h.

◆ symmetrize()

template<int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< 2, dim, Number > symmetrize ( const Tensor< 2, dim, Number > & t)
related

Return the symmetrized version of a full rank-2 tensor, i.e. \(\text{sym}\mathbf A = \frac 12 \left(\mathbf A + \mathbf{A}^T\right)\), as a symmetric rank-2 tensor. This is the version for general dimensions.

Definition at line 3534 of file symmetric_tensor.h.

◆ operator*() [1/10]

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, Number > operator* ( const SymmetricTensor< rank_, dim, Number > & t,
const Number & factor )
related

Multiplication of a symmetric tensor of general rank with a scalar from the right. This version of the operator is used if the scalar has the same data type as is used to store the elements of the symmetric tensor.

Definition at line 3559 of file symmetric_tensor.h.

◆ operator*() [2/10]

template<int rank_, int dim, typename Number >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, Number > operator* ( const Number & factor,
const SymmetricTensor< rank_, dim, Number > & t )
related

Multiplication of a symmetric tensor of general rank with a scalar from the left. This version of the operator is used if the scalar has the same data type as is used to store the elements of the symmetric tensor.

Definition at line 3577 of file symmetric_tensor.h.

◆ operator*() [3/10]

template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator* ( const SymmetricTensor< rank_, dim, Number > & t,
const OtherNumber & factor )
related

Multiplication of a symmetric tensor with a scalar number from the right.

The purpose of this operator is to enable only multiplication of a tensor by a scalar number (i.e., a floating point number, a complex floating point number, etc.). The function is written in a way that only allows the compiler to consider the function if the second argument is indeed a scalar number – in other words, OtherNumber will not match, for example std::vector<double> as the product of a tensor and a vector clearly would make no sense. The mechanism by which the compiler is prohibited of considering this operator for multiplication with non-scalar types are explained in the documentation of the EnableIfScalar class.

The return type of the function is chosen so that it matches the types of both the tensor and the scalar argument. For example, if you multiply a SymmetricTensor<2,dim,double> by std::complex<double>, then the result will be a SymmetricTensor<2,dim,std::complex<double>>. In other words, the type with which the returned tensor stores its components equals the type you would get if you multiplied an individual component of the input tensor by the scalar factor.

Definition at line 3615 of file symmetric_tensor.h.

◆ operator*() [4/10]

template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, typename ProductType< OtherNumber, typename EnableIfScalar< Number >::type >::type > operator* ( const Number & factor,
const SymmetricTensor< rank_, dim, OtherNumber > & t )
related

Multiplication of a symmetric tensor with a scalar number from the left. See the discussion with the operator with switched arguments for more information about template arguments and the return type.

Definition at line 3644 of file symmetric_tensor.h.

◆ operator/() [1/2]

template<int rank_, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator/ ( const SymmetricTensor< rank_, dim, Number > & t,
const OtherNumber & factor )
related

Division of a symmetric tensor of general rank by a scalar.

Definition at line 3664 of file symmetric_tensor.h.

◆ operator*() [5/10]

template<int rank_, int dim>
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim > operator* ( const SymmetricTensor< rank_, dim > & t,
const double factor )
related

Multiplication of a symmetric tensor of general rank with a scalar from the right.

Definition at line 3683 of file symmetric_tensor.h.

◆ operator*() [6/10]

template<int rank_, int dim>
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim > operator* ( const double factor,
const SymmetricTensor< rank_, dim > & t )
related

Multiplication of a symmetric tensor of general rank with a scalar from the left.

Definition at line 3700 of file symmetric_tensor.h.

◆ operator/() [2/2]

template<int rank_, int dim>
DEAL_II_HOST constexpr SymmetricTensor< rank_, dim > operator/ ( const SymmetricTensor< rank_, dim > & t,
const double factor )
related

Division of a symmetric tensor of general rank by a scalar.

Definition at line 3716 of file symmetric_tensor.h.

◆ scalar_product() [1/3]

template<int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr ProductType< Number, OtherNumber >::type scalar_product ( const SymmetricTensor< 2, dim, Number > & t1,
const SymmetricTensor< 2, dim, OtherNumber > & t2 )
related

Compute the scalar product \(\mathbf A: \mathbf B=\sum_{i,j} A_{ij}B_{ij}\) between two tensors \(\mathbf A, \mathbf B\) of rank 2. In the current case where both arguments are symmetric tensors, this is equivalent to calling the expression A*B which uses SymmetricTensor::operator*().

Definition at line 3735 of file symmetric_tensor.h.

◆ scalar_product() [2/3]

template<int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr ProductType< Number, OtherNumber >::type scalar_product ( const SymmetricTensor< 2, dim, Number > & t1,
const Tensor< 2, dim, OtherNumber > & t2 )
related

Compute the scalar product \(\mathbf A: \mathbf B=\sum_{i,j} A_{ij}B_{ij}\) between two tensors \(\mathbf A, \mathbf B\) of rank 2. We don't use operator* for this operation since the product between two tensors is usually assumed to be the contraction over the last index of the first tensor and the first index of the second tensor. For example, if B is a Tensor, calling A*B (instead of scalar_product(A,B)) provides \((\mathbf A \cdot\mathbf B)_{ij}=\sum_k A_{ik}B_{kj}\).

Definition at line 3757 of file symmetric_tensor.h.

◆ scalar_product() [3/3]

template<int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr ProductType< Number, OtherNumber >::type scalar_product ( const Tensor< 2, dim, Number > & t1,
const SymmetricTensor< 2, dim, OtherNumber > & t2 )
related

Compute the scalar product \(\mathbf A:\mathbf B=\sum_{i,j} A_{ij}B_{ij}\) between two tensors \(\mathbf A, \mathbf B\) of rank 2. We don't use operator* for this operation since the product between two tensors is usually assumed to be the contraction over the last index of the first tensor and the first index of the second tensor. For example, if A is a Tensor, calling A*B (instead of scalar_product(A,B)) provides \((\mathbf A \cdot\mathbf B)_{ij}=\sum_k A_{ik}B_{kj}\).

Definition at line 3784 of file symmetric_tensor.h.

◆ double_contract() [1/6]

template<typename Number , typename OtherNumber >
DEAL_II_HOST constexpr void double_contract ( SymmetricTensor< 2, 1, typename ProductType< Number, OtherNumber >::type > & tmp,
const SymmetricTensor< 4, 1, Number > & t,
const SymmetricTensor< 2, 1, OtherNumber > & s )
related

Double contraction between a rank-4 and a rank-2 symmetric tensor, resulting in the symmetric tensor of rank 2 that is given as first argument to this function. This operation is the symmetric tensor analogon of a matrix-vector multiplication.

This function does the same as SymmetricTensor::operator*(). It should not be used, however, since the member operator has knowledge of the actual data storage format and is at least 2 orders of magnitude faster. This function mostly exists for compatibility purposes with the general Tensor class.

Definition at line 3807 of file symmetric_tensor.h.

◆ double_contract() [2/6]

template<typename Number , typename OtherNumber >
DEAL_II_HOST constexpr void double_contract ( SymmetricTensor< 2, 1, typename ProductType< Number, OtherNumber >::type > & tmp,
const SymmetricTensor< 2, 1, Number > & s,
const SymmetricTensor< 4, 1, OtherNumber > & t )
related

Double contraction between a rank-4 and a rank-2 symmetric tensor, resulting in the symmetric tensor of rank 2 that is given as first argument to this function. This operation is the symmetric tensor analogon of a matrix-vector multiplication.

This function does the same as SymmetricTensor::operator*(). It should not be used, however, since the member operator has knowledge of the actual data storage format and is at least 2 orders of magnitude faster. This function mostly exists for compatibility purposes with the general Tensor class.

Definition at line 3833 of file symmetric_tensor.h.

◆ double_contract() [3/6]

template<typename Number , typename OtherNumber >
DEAL_II_HOST constexpr void double_contract ( SymmetricTensor< 2, 2, typename ProductType< Number, OtherNumber >::type > & tmp,
const SymmetricTensor< 4, 2, Number > & t,
const SymmetricTensor< 2, 2, OtherNumber > & s )
related

Double contraction between a rank-4 and a rank-2 symmetric tensor, resulting in the symmetric tensor of rank 2 that is given as first argument to this function. This operation is the symmetric tensor analogon of a matrix-vector multiplication.

This function does the same as SymmetricTensor::operator*(). It should not be used, however, since the member operator has knowledge of the actual data storage format and is at least 2 orders of magnitude faster. This function mostly exists for compatibility purposes with the general Tensor class.

Definition at line 3859 of file symmetric_tensor.h.

◆ double_contract() [4/6]

template<typename Number , typename OtherNumber >
DEAL_II_HOST constexpr void double_contract ( SymmetricTensor< 2, 2, typename ProductType< Number, OtherNumber >::type > & tmp,
const SymmetricTensor< 2, 2, Number > & s,
const SymmetricTensor< 4, 2, OtherNumber > & t )
related

Double contraction between a rank-4 and a rank-2 symmetric tensor, resulting in the symmetric tensor of rank 2 that is given as first argument to this function. This operation is the symmetric tensor analogon of a matrix-vector multiplication.

This function does the same as SymmetricTensor::operator*(). It should not be used, however, since the member operator has knowledge of the actual data storage format and is at least 2 orders of magnitude faster. This function mostly exists for compatibility purposes with the general Tensor class.

Definition at line 3890 of file symmetric_tensor.h.

◆ double_contract() [5/6]

template<typename Number , typename OtherNumber >
DEAL_II_HOST constexpr void double_contract ( SymmetricTensor< 2, 3, typename ProductType< Number, OtherNumber >::type > & tmp,
const SymmetricTensor< 4, 3, Number > & t,
const SymmetricTensor< 2, 3, OtherNumber > & s )
related

Double contraction between a rank-4 and a rank-2 symmetric tensor, resulting in the symmetric tensor of rank 2 that is given as first argument to this function. This operation is the symmetric tensor analogon of a matrix-vector multiplication.

This function does the same as SymmetricTensor::operator*(). It should not be used, however, since the member operator has knowledge of the actual data storage format and is at least 2 orders of magnitude faster. This function mostly exists for compatibility purposes with the general Tensor class.

Definition at line 3921 of file symmetric_tensor.h.

◆ double_contract() [6/6]

template<typename Number , typename OtherNumber >
DEAL_II_HOST constexpr void double_contract ( SymmetricTensor< 2, 3, typename ProductType< Number, OtherNumber >::type > & tmp,
const SymmetricTensor< 2, 3, Number > & s,
const SymmetricTensor< 4, 3, OtherNumber > & t )
related

Double contraction between a rank-4 and a rank-2 symmetric tensor, resulting in the symmetric tensor of rank 2 that is given as first argument to this function. This operation is the symmetric tensor analogon of a matrix-vector multiplication.

This function does the same as SymmetricTensor::operator*(). It should not be used, however, since the member operator has knowledge of the actual data storage format and is at least 2 orders of magnitude faster. This function mostly exists for compatibility purposes with the general Tensor class.

Definition at line 3953 of file symmetric_tensor.h.

◆ operator*() [7/10]

template<int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< 1, dim, typename ProductType< Number, OtherNumber >::type > operator* ( const SymmetricTensor< 2, dim, Number > & src1,
const Tensor< 1, dim, OtherNumber > & src2 )
related

Multiply a symmetric rank-2 tensor (i.e., a matrix) by a rank-1 tensor (i.e., a vector). The result is a rank-1 tensor (i.e., a vector).

Definition at line 3979 of file symmetric_tensor.h.

◆ operator*() [8/10]

template<int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< 1, dim, typename ProductType< Number, OtherNumber >::type > operator* ( const Tensor< 1, dim, Number > & src1,
const SymmetricTensor< 2, dim, OtherNumber > & src2 )
related

Multiply a rank-1 tensor (i.e., a vector) by a symmetric rank-2 tensor (i.e., a matrix). The result is a rank-1 tensor (i.e., a vector).

Definition at line 4003 of file symmetric_tensor.h.

◆ operator*() [9/10]

template<int rank_1, int rank_2, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< rank_1+rank_2-2, dim, typenameProductType< Number, OtherNumber >::type >::tensor_type operator* ( const Tensor< rank_1, dim, Number > & src1,
const SymmetricTensor< rank_2, dim, OtherNumber > & src2 )
related

The dot product (single contraction) for tensors: Return a tensor of rank \((\text{rank}_1 + \text{rank}_2 - 2)\) that is the contraction of the last index of a tensor src1 of rank rank_1 with the first index of a tensor src2 of rank rank_2:

\[ \text{result}_{i_1,\ldots,i_{r1},j_1,\ldots,j_{r2}} = \sum_{k} \text{left}_{i_1,\ldots,i_{r1}, k} \text{right}_{k, j_1,\ldots,j_{r2}} \]

Note
As one operand is a Tensor, the multiplication operator only performs a contraction over a single pair of indices. This is in contrast to the multiplication operator for SymmetricTensor, which does the double contraction.

Definition at line 4040 of file symmetric_tensor.h.

◆ operator*() [10/10]

template<int rank_1, int rank_2, int dim, typename Number , typename OtherNumber >
DEAL_II_HOST constexpr Tensor< rank_1+rank_2-2, dim, typenameProductType< Number, OtherNumber >::type >::tensor_type operator* ( const SymmetricTensor< rank_1, dim, Number > & src1,
const Tensor< rank_2, dim, OtherNumber > & src2 )
related

The dot product (single contraction) for tensors: Return a tensor of rank \((\text{rank}_1 + \text{rank}_2 - 2)\) that is the contraction of the last index of a tensor src1 of rank rank_1 with the first index of a tensor src2 of rank rank_2:

\[ \text{result}_{i_1,\ldots,i_{r1},j_1,\ldots,j_{r2}} = \sum_{k} \text{left}_{i_1,\ldots,i_{r1}, k} \text{right}_{k, j_1,\ldots,j_{r2}} \]

Note
As one operand is a Tensor, the multiplication operator only performs a contraction over a single pair of indices. This is in contrast to the multiplication operator for SymmetricTensor, which does the double contraction.

Definition at line 4076 of file symmetric_tensor.h.

◆ operator<<() [1/2]

template<int dim, typename Number >
std::ostream & operator<< ( std::ostream & out,
const SymmetricTensor< 2, dim, Number > & t )
related

Output operator for symmetric tensors of rank 2. Print the elements consecutively, with a space in between, two spaces between rank 1 subtensors, three between rank 2 and so on. No special amends are made to represents the symmetry in the output, for example by outputting only the unique entries.

Definition at line 4094 of file symmetric_tensor.h.

◆ operator<<() [2/2]

template<int dim, typename Number >
std::ostream & operator<< ( std::ostream & out,
const SymmetricTensor< 4, dim, Number > & t )
related

Output operator for symmetric tensors of rank 4. Print the elements consecutively, with a space in between, two spaces between rank 1 subtensors, three between rank 2 and so on. No special amends are made to represents the symmetry in the output, for example by outputting only the unique entries.

Definition at line 4121 of file symmetric_tensor.h.

Member Data Documentation

◆ dimension

template<int rank_, int dim, typename Number >
unsigned int SymmetricTensor< rank_, dim, Number >::dimension = dim
staticconstexpr

Provide a way to get the dimension of an object without explicit knowledge of it's data type. Implementation is this way instead of providing a function dimension() because now it is possible to get the dimension at compile time without the expansion and preevaluation of an inlined function; the compiler may therefore produce more efficient code and you may use this value to declare other data types.

Definition at line 731 of file symmetric_tensor.h.

◆ rank

template<int rank_, int dim, typename Number >
const unsigned int SymmetricTensor< rank_, dim, Number >::rank = rank_
static

Publish the rank of this tensor to the outside world.

Definition at line 736 of file symmetric_tensor.h.

◆ n_independent_components

template<int rank_, int dim, typename Number >
unsigned int SymmetricTensor< rank_, dim, Number >::n_independent_components
staticconstexpr
Initial value:

An integer denoting the number of independent components that fully describe a symmetric tensor. In \(d\) space dimensions, this number equals \(\frac 12 (d^2+d)\) for symmetric tensors of rank 2.

Definition at line 743 of file symmetric_tensor.h.

◆ data

template<int rank_, int dim, typename Number >
base_tensor_type SymmetricTensor< rank_, dim, Number >::data
private

The place where we store the data of the tensor.

Definition at line 1137 of file symmetric_tensor.h.


The documentation for this class was generated from the following files: