LCOV - code coverage report
Current view: top level - src/materials - InterpolatedStatefulMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 23 25 92.0 %
Date: 2025-07-17 01:28:37 Functions: 12 12 100.0 %
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 "InterpolatedStatefulMaterial.h"
      11             : #include "SerialAccess.h"
      12             : 
      13             : registerMooseObject("MooseApp", InterpolatedStatefulMaterialReal);
      14             : registerMooseObject("MooseApp", InterpolatedStatefulMaterialRealVectorValue);
      15             : registerMooseObject("MooseApp", InterpolatedStatefulMaterialRankTwoTensor);
      16             : registerMooseObject("MooseApp", InterpolatedStatefulMaterialRankFourTensor);
      17             : 
      18             : template <typename T>
      19             : InputParameters
      20       57672 : InterpolatedStatefulMaterialTempl<T>::validParams()
      21             : {
      22       57672 :   InputParameters params = Material::validParams();
      23       57672 :   params.addClassDescription("Access old state from projected data.");
      24       57672 :   params.addRequiredCoupledVar("old_state", "The AuxVars for the coupled components");
      25       57672 :   params.addRequiredParam<MaterialPropertyName>("prop_name", "Name to emit");
      26       57672 :   return params;
      27           0 : }
      28             : 
      29             : template <typename T>
      30         468 : InterpolatedStatefulMaterialTempl<T>::InterpolatedStatefulMaterialTempl(
      31             :     const InputParameters & parameters)
      32             :   : Material(parameters),
      33         468 :     _old_state(coupledValuesOld("old_state")),
      34         468 :     _older_state(coupledValuesOlder("old_state")),
      35         468 :     _size(Moose::SerialAccess<T>::size()),
      36         468 :     _prop_name(getParam<MaterialPropertyName>("prop_name")),
      37         468 :     _prop_old(declareProperty<T>(_prop_name + _interpolated_old)),
      38         936 :     _prop_older(declareProperty<T>(_prop_name + _interpolated_older))
      39             : {
      40         468 :   if (_old_state.size() != _size)
      41           0 :     paramError("old_state", "Wrong number of component AuxVariables passed in.");
      42             :   mooseAssert(_old_state.size() == _older_state.size(),
      43             :               "Internal error. Old and older coupled variable vectors should have the same size.");
      44         468 : }
      45             : 
      46             : template <typename T>
      47             : void
      48       79872 : InterpolatedStatefulMaterialTempl<T>::computeQpProperties()
      49             : {
      50       79872 :   std::size_t index = 0;
      51     1956864 :   for (auto & v : Moose::serialAccess(_prop_old[_qp]))
      52     1876992 :     v = (*_old_state[index++])[_qp];
      53             : 
      54       79872 :   index = 0;
      55     1956864 :   for (auto & v : Moose::serialAccess(_prop_older[_qp]))
      56     1876992 :     v = (*_older_state[index++])[_qp];
      57       79872 : }
      58             : 
      59             : template class InterpolatedStatefulMaterialTempl<Real>;
      60             : template class InterpolatedStatefulMaterialTempl<RealVectorValue>;
      61             : template class InterpolatedStatefulMaterialTempl<RankTwoTensor>;
      62             : template class InterpolatedStatefulMaterialTempl<RankFourTensor>;

Generated by: LCOV version 1.14