Dune-Fufem 2.11-git
Loading...
Searching...
No Matches
SymmetricTensor< dim, field_type > Class Template Reference

A class implementing a 2nd order symmetric tensor. More...

#include <dune/fufem/symmetrictensor.hh>

Inheritance diagram for SymmetricTensor< dim, field_type >:
Inheritance graph

Public Types

enum  { dimension = dim }
 dimension of Tensor More...
 
enum  { rows = dim }
 
enum  { cols = dim }
 
typedef typename Base::size_type size_type
 
typedef typename Base::value_type value_type
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef Traits::derived_type derived_type
 
typedef FieldTraits< value_type >::field_type field_type
 
typedef Traits::value_type block_type
 
typedef DenseIterator< DenseVector, value_typeIterator
 
typedef Iterator iterator
 
typedef DenseIterator< const DenseVector, const value_typeConstIterator
 
typedef ConstIterator const_iterator
 

Public Member Functions

 SymmetricTensor (bool eye=false)
 Default constructor.
 
 SymmetricTensor (field_type a)
 Constructor for tensor with all entries being the same.
 
 SymmetricTensor (const Dune::FieldVector< field_type, dim *(dim+1)/2 > fvector)
 Construct from FieldVector of correct dimension.
 
field_type operator* (const SymmetricTensor< dim, field_type > &B) const
 This is the contraction product of two tensors of 2nd stage \( E*F := E:F = \sum_{ij}(E_{ij}\cdot F_{ij}) \).
 
void umv (const Dune::FieldVector< field_type, dim > &x, Dune::FieldVector< field_type, dim > &y) const
 Matrix-Vector product.
 
void mv (const Dune::FieldVector< field_type, dim > &x, Dune::FieldVector< field_type, dim > &y) const
 Matrix-Vector product.
 
field_typeoperator() (int i, int j)
 Matrix style random read/write access to components.
 
const field_typeoperator() (int i, int j) const
 Matrix style random read access to components.
 
field_type trace () const
 
void addToDiag (field_type x)
 add constant value to the diagonal, leaving off-diagonal entries unaffected.
 
void setDiag (field_type diagValue)
 set diagonal to "constant" value and zero non-diagonal entries
 
void setDiag (const Dune::FieldVector< field_type, dim > &diagVector)
 set diagonal according to vector entries and zero non-diagonal entries
 
Dune::FieldMatrix< field_type, dim, dimmatrix () const
 Return the FieldMatrix representation of the symmetric tensor.
 
 explicit (SIZE !=1) const expr FieldVector(const value_type &value) noexcept
 
 explicit (SIZE !=1) const expr FieldVector(const S &scalar) noexcept(std::is_nothrow_constructible_v< K, S >)
 
constexpr value_typefront ()
 
constexpr const value_typefront () const
 
constexpr value_typeback ()
 
constexpr const value_typeback () const
 
constexpr bool empty () const
 
constexpr size_type size () const
 
constexpr Iterator begin ()
 
constexpr ConstIterator begin () const
 
constexpr Iterator end ()
 
constexpr ConstIterator end () const
 
constexpr Iterator beforeEnd ()
 
constexpr ConstIterator beforeEnd () const
 
constexpr Iterator beforeBegin ()
 
constexpr ConstIterator beforeBegin () const
 
constexpr Iterator find (size_type i)
 
constexpr ConstIterator find (size_type i) const
 
constexpr Iterator find (size_type i)
 
constexpr ConstIterator find (size_type i) const
 
constexpr derived_typeoperator+= (const DenseVector< Other > &x)
 
constexpr std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & operator+= (const ValueType &kk)
 
constexpr derived_typeoperator-= (const DenseVector< Other > &x)
 
constexpr std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & operator-= (const ValueType &kk)
 
constexpr derived_type operator+ (const DenseVector< Other > &b) const
 
constexpr derived_type operator- (const DenseVector< Other > &b) const
 
constexpr derived_type operator- () const
 
constexpr std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & operator*= (const FieldType &kk)
 
constexpr std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & operator/= (const FieldType &kk)
 
constexpr bool operator== (const DenseVector< Other > &x) const
 
constexpr bool operator!= (const DenseVector< Other > &x) const
 
constexpr derived_typeaxpy (const field_type &a, const DenseVector< Other > &x)
 
constexpr PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType operator* (const DenseVector< Other > &x) const
 
constexpr PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType dot (const DenseVector< Other > &x) const
 
constexpr FieldTraits< value_type >::real_type one_norm () const
 
constexpr FieldTraits< value_type >::real_type one_norm_real () const
 
constexpr FieldTraits< value_type >::real_type two_norm () const
 
constexpr FieldTraits< value_type >::real_type two_norm2 () const
 
constexpr FieldTraits< vt >::real_type infinity_norm () const
 
constexpr FieldTraits< vt >::real_type infinity_norm () const
 
constexpr FieldTraits< vt >::real_type infinity_norm_real () const
 
constexpr FieldTraits< vt >::real_type infinity_norm_real () const
 
constexpr size_type N () const
 
constexpr size_type dim () const
 
constexpr reference operator[] (size_type i)
 
constexpr const_reference operator[] (size_type i) const
 
constexpr reference operator[] (size_type i)
 
constexpr const_reference operator[] (size_type i) const
 
constexpr value_typeoperator[] (size_type i)
 
constexpr const value_typeoperator[] (size_type i) const
 
constexpr K * data () noexcept
 
constexpr const K * data () const noexcept
 
constexpr K * data () noexcept
 
constexpr const K * data () const noexcept
 
constexpr operator const_reference () const noexcept
 
constexpr operator const_reference () const noexcept
 
constexpr operator reference () noexcept
 
constexpr operator reference () noexcept
 
std::istreamoperator>> (std::istream &in, FieldVector< K, SIZE > &v)
 
std::ostreamoperator<< (std::ostream &s, const DenseVector< FieldVector< K, SIZE > > &v)
 
std::ostreamoperator<< (std::ostream &s, const DenseVector< V > &v)
 

Static Public Member Functions

static constexpr size_type size () noexcept
 
static constexpr size_type size () noexcept
 

Static Public Attributes

static constexpr int blocklevel
 

Detailed Description

template<int dim, class field_type = double>
class SymmetricTensor< dim, field_type >

A class implementing a 2nd order symmetric tensor.

A \( dim\times dim \) tensor is stored internally as a Dune::FieldVector<field_type, dim*(dim+1)/2> For a symmetric 3x3-Tensor \( E \) the components are assumed to be stored in the order \( [ E(1,1),\ E(2,2),\ E(3,3),\ E(1,2),\ E(1,3),\ E(2,3) ]\) and analogous for other dimensions

Template Parameters
dimnumber of lines/columns of tensor

Member Enumeration Documentation

◆ anonymous enum

template<int dim, class field_type = double>
anonymous enum

dimension of Tensor

Enumerator
dimension 

◆ anonymous enum

template<int dim, class field_type = double>
anonymous enum
Enumerator
rows 

◆ anonymous enum

template<int dim, class field_type = double>
anonymous enum
Enumerator
cols 

Constructor & Destructor Documentation

◆ SymmetricTensor() [1/3]

template<int dim, class field_type = double>
SymmetricTensor< dim, field_type >::SymmetricTensor ( bool  eye = false)
inline

Default constructor.

Tensor is initialized containing zeros if no argument is given.

Parameters
eyeif true tensor is initialized as identity

◆ SymmetricTensor() [2/3]

template<int dim, class field_type = double>
SymmetricTensor< dim, field_type >::SymmetricTensor ( field_type  a)
inline

Constructor for tensor with all entries being the same.

Parameters
athe value of all entries

◆ SymmetricTensor() [3/3]

template<int dim, class field_type = double>
SymmetricTensor< dim, field_type >::SymmetricTensor ( const Dune::FieldVector< field_type, dim *(dim+1)/2 >  fvector)
inline

Construct from FieldVector of correct dimension.

Parameters
fvectorthe FieldVector of the internal representation of the symmetric tensor, For 3x3 the order in the vector is expected to be \([ E(1,1) E(2,2) E(3,3) E(1,2) E(1,3) E(2,3) ]\).

Member Function Documentation

◆ addToDiag()

template<int dim, class field_type = double>
void SymmetricTensor< dim, field_type >::addToDiag ( field_type  x)
inline

add constant value to the diagonal, leaving off-diagonal entries unaffected.

◆ matrix()

template<int dim, class field_type = double>
Dune::FieldMatrix< field_type, dim, dim > SymmetricTensor< dim, field_type >::matrix ( ) const
inline

Return the FieldMatrix representation of the symmetric tensor.

◆ mv()

template<int dim, class field_type = double>
void SymmetricTensor< dim, field_type >::mv ( const Dune::FieldVector< field_type, dim > &  x,
Dune::FieldVector< field_type, dim > &  y 
) const
inline

Matrix-Vector product.

This computes \( y=Ax \).

Parameters
xthe vector to multiply with
ythe result vector

◆ operator()() [1/2]

template<int dim, class field_type = double>
field_type & SymmetricTensor< dim, field_type >::operator() ( int  i,
int  j 
)
inline

Matrix style random read/write access to components.

Parameters
iline index
jcolumn index

◆ operator()() [2/2]

template<int dim, class field_type = double>
const field_type & SymmetricTensor< dim, field_type >::operator() ( int  i,
int  j 
) const
inline

Matrix style random read access to components.

Parameters
iline index
jcolumn index

◆ operator*()

template<int dim, class field_type = double>
field_type SymmetricTensor< dim, field_type >::operator* ( const SymmetricTensor< dim, field_type > &  B) const
inline

This is the contraction product of two tensors of 2nd stage \( E*F := E:F = \sum_{ij}(E_{ij}\cdot F_{ij}) \).

Parameters
Bthe SymmetricTensor<dim> to contract with

◆ setDiag() [1/2]

template<int dim, class field_type = double>
void SymmetricTensor< dim, field_type >::setDiag ( const Dune::FieldVector< field_type, dim > &  diagVector)
inline

set diagonal according to vector entries and zero non-diagonal entries

Parameters
diagVectorthe vector storing the diagonal entries

◆ setDiag() [2/2]

template<int dim, class field_type = double>
void SymmetricTensor< dim, field_type >::setDiag ( field_type  diagValue)
inline

set diagonal to "constant" value and zero non-diagonal entries

Parameters
diagValuethe value the diagonal entries are to be

◆ trace()

template<int dim, class field_type = double>
field_type SymmetricTensor< dim, field_type >::trace ( ) const
inline

◆ umv()

template<int dim, class field_type = double>
void SymmetricTensor< dim, field_type >::umv ( const Dune::FieldVector< field_type, dim > &  x,
Dune::FieldVector< field_type, dim > &  y 
) const
inline

Matrix-Vector product.

This computes \( y+=Ax \).

Parameters
xthe vector to multiply with
ythe vector \( Ax \) is added to

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