|
constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE | Tensor () |
|
constexpr | Tensor (const array_type &initializer) |
|
template<typename ElementType , typename MemorySpace > |
constexpr | Tensor (const ArrayView< ElementType, MemorySpace > &initializer) |
|
template<typename OtherNumber > |
constexpr | Tensor (const Tensor< rank_, dim, OtherNumber > &initializer) |
|
template<typename OtherNumber > |
constexpr | Tensor (const Tensor< 1, dim, Tensor< rank_ - 1, dim, OtherNumber > > &initializer) |
|
template<typename OtherNumber > |
constexpr | operator Tensor< 1, dim, Tensor< rank_ - 1, dim, OtherNumber > > () const |
|
constexpr value_type & | operator[] (const unsigned int i) |
|
constexpr const value_type & | operator[] (const unsigned int i) const |
|
constexpr const Number & | operator[] (const TableIndices< rank_ > &indices) const |
|
constexpr Number & | operator[] (const TableIndices< rank_ > &indices) |
|
Number * | begin_raw () |
|
const Number * | begin_raw () const |
|
Number * | end_raw () |
|
const Number * | end_raw () const |
|
template<typename OtherNumber > |
constexpr Tensor & | operator= (const Tensor< rank_, dim, OtherNumber > &rhs) |
|
constexpr Tensor & | operator= (const Number &d) & |
|
constexpr Tensor & | operator= (const Number &d) &&=delete |
|
template<typename OtherNumber > |
constexpr bool | operator== (const Tensor< rank_, dim, OtherNumber > &) const |
|
template<typename OtherNumber > |
constexpr bool | operator!= (const Tensor< rank_, dim, OtherNumber > &) const |
|
template<typename OtherNumber > |
constexpr Tensor & | operator+= (const Tensor< rank_, dim, OtherNumber > &) |
|
template<typename OtherNumber > |
constexpr Tensor & | operator-= (const Tensor< rank_, dim, OtherNumber > &) |
|
template<typename OtherNumber > |
constexpr Tensor & | operator*= (const OtherNumber &factor) |
|
template<typename OtherNumber > |
constexpr Tensor & | operator/= (const OtherNumber &factor) |
|
constexpr Tensor | operator- () const |
|
constexpr void | clear () |
|
numbers::NumberTraits< Number >::real_type | norm () const |
|
constexpr numbers::NumberTraits< Number >::real_type | norm_square () const |
|
template<typename OtherNumber > |
void | unroll (Vector< OtherNumber > &result) const |
|
template<class Iterator > |
void | unroll (const Iterator begin, const Iterator end) const |
|
template<class Archive > |
void | serialize (Archive &ar, const unsigned int version) |
|
|
(Note that these are not member symbols.)
|
template<int rank, int dim, typename Number > |
Tensor< rank, dim, Number > | sum (const Tensor< rank, dim, Number > &local, const MPI_Comm mpi_communicator) |
|
|
template<int rank_, int dim, typename Number > |
std::ostream & | operator<< (std::ostream &out, const Tensor< rank_, dim, Number > &p) |
|
template<int dim, typename Number > |
std::ostream & | operator<< (std::ostream &out, const Tensor< 0, dim, Number > &p) |
|
|
template<int dim, typename Number , typename Other > |
constexpr ProductType< Other, Number >::type | operator* (const Other &object, const Tensor< 0, dim, Number > &t) |
|
template<int dim, typename Number , typename Other > |
constexpr ProductType< Number, Other >::type | operator* (const Tensor< 0, dim, Number > &t, const Other &object) |
|
template<int dim, typename Number , typename OtherNumber > |
constexpr ProductType< Number, OtherNumber >::type | operator* (const Tensor< 0, dim, Number > &src1, const Tensor< 0, dim, OtherNumber > &src2) |
|
template<int dim, typename Number , typename OtherNumber > |
constexpr Tensor< 0, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > | operator/ (const Tensor< 0, dim, Number > &t, const OtherNumber &factor) |
|
template<int dim, typename Number , typename OtherNumber > |
constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > | operator+ (const Tensor< 0, dim, Number > &p, const Tensor< 0, dim, OtherNumber > &q) |
|
template<int dim, typename Number , typename OtherNumber > |
constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > | operator- (const Tensor< 0, dim, Number > &p, const Tensor< 0, dim, OtherNumber > &q) |
|
template<int rank, int dim, typename Number , typename OtherNumber > |
constexpr Tensor< rank, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > | operator* (const Tensor< rank, dim, Number > &t, const OtherNumber &factor) |
|
template<int rank, int dim, typename Number , typename OtherNumber > |
constexpr Tensor< rank, dim, typename ProductType< typename EnableIfScalar< Number >::type, OtherNumber >::type > | operator* (const Number &factor, const Tensor< rank, dim, OtherNumber > &t) |
|
template<int rank, int dim, typename Number , typename OtherNumber > |
constexpr Tensor< rank, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > | operator/ (const Tensor< rank, dim, Number > &t, const OtherNumber &factor) |
|
template<int rank, int dim, typename Number , typename OtherNumber > |
constexpr Tensor< rank, dim, typename ProductType< Number, OtherNumber >::type > | operator+ (const Tensor< rank, dim, Number > &p, const Tensor< rank, dim, OtherNumber > &q) |
|
template<int rank, int dim, typename Number , typename OtherNumber > |
constexpr Tensor< rank, dim, typename ProductType< Number, OtherNumber >::type > | operator- (const Tensor< rank, dim, Number > &p, const Tensor< rank, dim, OtherNumber > &q) |
|
template<int dim, typename Number , typename OtherNumber > |
constexpr Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > | schur_product (const Tensor< 0, dim, Number > &src1, const Tensor< 0, dim, OtherNumber > &src2) |
|
template<int rank, int dim, typename Number , typename OtherNumber > |
constexpr Tensor< rank, dim, typename ProductType< Number, OtherNumber >::type > | schur_product (const Tensor< rank, dim, Number > &src1, const Tensor< rank, dim, OtherNumber > &src2) |
|
|
template<int dim, typename Number > |
Number | l1_norm (const Tensor< 2, dim, Number > &t) |
|
template<int dim, typename Number > |
Number | linfty_norm (const Tensor< 2, dim, Number > &t) |
|
template<
int rank_,
int dim, typename Number>
class Tensor< rank_, dim, Number >
A general tensor class with an arbitrary rank, i.e. with an arbitrary number of indices. The Tensor class provides an indexing operator and a bit of infrastructure, but most functionality is recursively handed down to tensors of rank 1 or put into external templated functions, e.g. the contract
family.
The rank of a tensor specifies which types of physical quantities it can represent:
-
A rank-0 tensor is a scalar that can store quantities such as temperature or pressure. These scalar quantities are shown in this documentation as simple lower-case Latin letters e.g. \(a, b, c, \dots\).
-
A rank-1 tensor is a vector with
dim
components and it can represent vector quantities such as velocity, displacement, electric field, etc. They can also describe the gradient of a scalar field. The notation used for rank-1 tensors is bold-faced lower-case Latin letters e.g. \(\mathbf a, \mathbf b, \mathbf c, \dots\). The components of a rank-1 tensor such as \(\mathbf a\) are represented as \(a_i\) where \(i\) is an index between 0 and dim-1
.
-
A rank-2 tensor is a linear operator that can transform a vector into another vector. These tensors are similar to matrices with \(\text{dim} \times \text{dim}\) components. There is a related class SymmetricTensor<2,dim> for tensors of rank 2 whose elements are symmetric. Rank-2 tensors are usually denoted by bold-faced upper-case Latin letters such as \(\mathbf A, \mathbf B, \dots\) or bold-faced Greek letters for example \(\boldsymbol{\varepsilon}, \boldsymbol{\sigma}\). The components of a rank 2 tensor such as \(\mathbf A\) are shown with two indices \((i,j)\) as \(A_{ij}\). These tensors usually describe the gradients of vector fields (deformation gradient, velocity gradient, etc.) or Hessians of scalar fields. Additionally, mechanical stress tensors are rank-2 tensors that map the unit normal vectors of internal surfaces into local traction (force per unit area) vectors.
-
Tensors with ranks higher than 2 are similarly defined in a consistent manner. They have \(\text{dim}^{\text{rank}}\) components and the number of indices required to identify a component equals
rank
. For rank-4 tensors, a symmetric variant called SymmetricTensor<4,dim> exists.
Using this tensor class for objects 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 also makes the code easier to read because of the semantic difference between a tensor (an object that relates to a coordinate system and has transformation properties with regard to coordinate rotations and transforms) and matrices (which we consider as operators on arbitrary vector spaces related to linear algebra things).
- Template Parameters
-
rank_ | An integer that denotes the rank of this tensor. A specialization of this class exists for rank-0 tensors. |
dim | An integer that denotes the dimension of the space in which this tensor operates. This of course equals the number of coordinates that identify a point and rank-1 tensor. |
Number | The data type in which the tensor elements are to be stored. This will, in almost all cases, simply be the default double , but there are cases where one may want to store elements in a different (and always scalar) type. It can be used to base tensors on float or complex numbers or any other data type that implements basic arithmetic operations. Another example would be a type that allows for Automatic Differentiation (see, for example, the Sacado type used in step-33) and thereby can generate analytic (spatial) derivatives of a function that takes a tensor as argument. |
Definition at line 470 of file tensor.h.