https://mooseframework.inl.gov
FactorizedRankTwoTensor.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
13 
14 template <typename T>
15 void
16 FactorizedRankTwoTensorTempl<T>::print(std::ostream & stm) const
17 {
18  this->get().print(stm);
19 }
20 
21 template <typename T>
24 {
25  return FactorizedRankTwoTensorTempl<T>(_eigvals, R * _eigvecs);
26 }
27 
28 template <typename T>
31 {
32  return *this;
33 }
34 
35 template <typename T>
38 {
39  _eigvals = A._eigvals;
40  _eigvecs = A._eigvecs;
41  return *this;
42 }
43 
44 template <typename T>
47 {
48  A.symmetricEigenvaluesEigenvectors(_eigvals, _eigvecs);
49  return *this;
50 }
51 
52 template <typename T>
54 FactorizedRankTwoTensorTempl<T>::operator*=(const typename T::value_type & a)
55 {
56  for (auto & eigval : _eigvals)
57  eigval *= a;
58  return *this;
59 }
60 
61 template <typename T>
63 FactorizedRankTwoTensorTempl<T>::operator/=(const typename T::value_type & a)
64 {
65  for (auto & eigval : _eigvals)
66  eigval /= a;
67  return *this;
68 }
69 
70 template <typename T>
71 bool
73 {
74  T me = get();
75  return me == A;
76 }
77 
78 template <typename T>
79 bool
81 {
82  T me = get();
83  T you = A.get();
84  return me == you;
85 }
86 
87 template <typename T>
90 {
91  return FactorizedRankTwoTensorTempl<T>({1 / _eigvals[0], 1 / _eigvals[1], 1 / _eigvals[2]},
92  _eigvecs);
93 }
94 
95 template <typename T>
96 void
97 FactorizedRankTwoTensorTempl<T>::addIa(const typename T::value_type & a)
98 {
99  for (auto & eigval : _eigvals)
100  eigval += a;
101 }
102 
103 template <typename T>
104 typename T::value_type
106 {
107  return _eigvals[0] + _eigvals[1] + _eigvals[2];
108 }
109 
110 template <typename T>
111 typename T::value_type
113 {
114  return _eigvals[0] * _eigvals[1] * _eigvals[2];
115 }
116 
T::value_type trace() const
trace of _A
FactorizedRankTwoTensorTempl< T > & operator/=(const typename T::value_type &a)
performs _A /= a in place, also updates eigen values
FactorizedRankTwoTensorTempl< T > & operator*=(const typename T::value_type &a)
performs _A *= a in place, also updates eigen values
FactorizedRankTwoTensorTempl< T > rotated(const RankTwoTensorTempl< typename T::value_type > &R) const
T::value_type det() const
determinant of _A
RankTwoTensorTempl< typename T::value_type > _eigvecs
std::vector< typename T::value_type > _eigvals
FactorizedRankTwoTensorTempl< T > transpose() const
Returns the transpose of _A.
FactorizedRankTwoTensorTempl is designed to perform the spectral decomposition of an underlying symme...
void print(std::ostream &stm=Moose::out) const
void addIa(const typename T::value_type &a)
add identity times a to _A
FactorizedRankTwoTensorTempl< T > & operator=(const FactorizedRankTwoTensorTempl< T > &A)
bool operator==(const T &A) const
Defines logical equality with another second order tensor.
FactorizedRankTwoTensorTempl< T > inverse() const
inverse of _A