LCOV - code coverage report
Current view: top level - src/utils - FactorizedRankTwoTensor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 35 43 81.4 %
Date: 2025-07-17 01:28:37 Functions: 11 78 14.1 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      10             : #include "FactorizedRankTwoTensor.h"
      11             : #include "RankTwoTensorImplementation.h"
      12             : #include "SymmetricRankTwoTensorImplementation.h"
      13             : 
      14             : template <typename T>
      15             : void
      16           0 : FactorizedRankTwoTensorTempl<T>::print(std::ostream & stm) const
      17             : {
      18           0 :   this->get().print(stm);
      19           0 : }
      20             : 
      21             : template <typename T>
      22             : FactorizedRankTwoTensorTempl<T>
      23           1 : FactorizedRankTwoTensorTempl<T>::rotated(const RankTwoTensorTempl<typename T::value_type> & R) const
      24             : {
      25           1 :   return FactorizedRankTwoTensorTempl<T>(_eigvals, R * _eigvecs);
      26             : }
      27             : 
      28             : template <typename T>
      29             : FactorizedRankTwoTensorTempl<T>
      30           1 : FactorizedRankTwoTensorTempl<T>::transpose() const
      31             : {
      32           1 :   return *this;
      33             : }
      34             : 
      35             : template <typename T>
      36             : FactorizedRankTwoTensorTempl<T> &
      37           1 : FactorizedRankTwoTensorTempl<T>::operator=(const FactorizedRankTwoTensorTempl<T> & A)
      38             : {
      39           1 :   _eigvals = A._eigvals;
      40           1 :   _eigvecs = A._eigvecs;
      41           1 :   return *this;
      42             : }
      43             : 
      44             : template <typename T>
      45             : FactorizedRankTwoTensorTempl<T> &
      46           1 : FactorizedRankTwoTensorTempl<T>::operator=(const T & A)
      47             : {
      48           1 :   A.symmetricEigenvaluesEigenvectors(_eigvals, _eigvecs);
      49           1 :   return *this;
      50             : }
      51             : 
      52             : template <typename T>
      53             : FactorizedRankTwoTensorTempl<T> &
      54           1 : FactorizedRankTwoTensorTempl<T>::operator*=(const typename T::value_type & a)
      55             : {
      56           4 :   for (auto & eigval : _eigvals)
      57           3 :     eigval *= a;
      58           1 :   return *this;
      59             : }
      60             : 
      61             : template <typename T>
      62             : FactorizedRankTwoTensorTempl<T> &
      63           1 : FactorizedRankTwoTensorTempl<T>::operator/=(const typename T::value_type & a)
      64             : {
      65           4 :   for (auto & eigval : _eigvals)
      66           3 :     eigval /= a;
      67           1 :   return *this;
      68             : }
      69             : 
      70             : template <typename T>
      71             : bool
      72           0 : FactorizedRankTwoTensorTempl<T>::operator==(const T & A) const
      73             : {
      74           0 :   T me = get();
      75           0 :   return me == A;
      76           0 : }
      77             : 
      78             : template <typename T>
      79             : bool
      80           2 : FactorizedRankTwoTensorTempl<T>::operator==(const FactorizedRankTwoTensorTempl<T> & A) const
      81             : {
      82           2 :   T me = get();
      83           2 :   T you = A.get();
      84           4 :   return me == you;
      85           2 : }
      86             : 
      87             : template <typename T>
      88             : FactorizedRankTwoTensorTempl<T>
      89           1 : FactorizedRankTwoTensorTempl<T>::inverse() const
      90             : {
      91           4 :   return FactorizedRankTwoTensorTempl<T>({1 / _eigvals[0], 1 / _eigvals[1], 1 / _eigvals[2]},
      92           1 :                                          _eigvecs);
      93           0 : }
      94             : 
      95             : template <typename T>
      96             : void
      97           1 : FactorizedRankTwoTensorTempl<T>::addIa(const typename T::value_type & a)
      98             : {
      99           4 :   for (auto & eigval : _eigvals)
     100           3 :     eigval += a;
     101           1 : }
     102             : 
     103             : template <typename T>
     104             : typename T::value_type
     105           1 : FactorizedRankTwoTensorTempl<T>::trace() const
     106             : {
     107           1 :   return _eigvals[0] + _eigvals[1] + _eigvals[2];
     108             : }
     109             : 
     110             : template <typename T>
     111             : typename T::value_type
     112           1 : FactorizedRankTwoTensorTempl<T>::det() const
     113             : {
     114           1 :   return _eigvals[0] * _eigvals[1] * _eigvals[2];
     115             : }
     116             : 
     117             : template class FactorizedRankTwoTensorTempl<RankTwoTensor>;
     118             : template class FactorizedRankTwoTensorTempl<ADRankTwoTensor>;
     119             : template class FactorizedRankTwoTensorTempl<SymmetricRankTwoTensor>;
     120             : template class FactorizedRankTwoTensorTempl<ADSymmetricRankTwoTensor>;

Generated by: LCOV version 1.14