LCOV - code coverage report
Current view: top level - src/auxkernels - ProjectedStatefulMaterialAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 20 21 95.2 %
Date: 2026-05-29 20:35:17 Functions: 20 32 62.5 %
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 "ProjectedStatefulMaterialAux.h"
      11             : #include "NodalPatchRecoveryBase.h"
      12             : #include "SerialAccess.h"
      13             : #include "MaterialBase.h"
      14             : #include "Assembly.h"
      15             : 
      16             : registerMooseObject("MooseApp", ProjectedStatefulMaterialRealAux);
      17             : registerMooseObject("MooseApp", ADProjectedStatefulMaterialRealAux);
      18             : registerMooseObject("MooseApp", ProjectedStatefulMaterialRealVectorValueAux);
      19             : registerMooseObject("MooseApp", ADProjectedStatefulMaterialRealVectorValueAux);
      20             : registerMooseObject("MooseApp", ProjectedStatefulMaterialRankTwoTensorAux);
      21             : registerMooseObject("MooseApp", ADProjectedStatefulMaterialRankTwoTensorAux);
      22             : registerMooseObject("MooseApp", ProjectedStatefulMaterialRankFourTensorAux);
      23             : registerMooseObject("MooseApp", ADProjectedStatefulMaterialRankFourTensorAux);
      24             : 
      25             : template <typename T, bool is_ad>
      26             : InputParameters
      27       29188 : ProjectedStatefulMaterialAuxTempl<T, is_ad>::validParams()
      28             : {
      29       29188 :   auto params = AuxKernel::validParams();
      30       58376 :   params.addClassDescription(
      31             :       "Picks a component of an indexable material property to get projected on an elemental "
      32             :       "Auxvariable. For use by ProjectedStatefulMaterialStorageAction.");
      33      116752 :   params.addRequiredParam<MaterialPropertyName>(
      34             :       "prop", "material property to project onto an elemental aux variable");
      35       87564 :   params.addRequiredParam<unsigned int>("component", "scalar component of the property to fetch");
      36       29188 :   return params;
      37           0 : }
      38             : 
      39             : template <typename T, bool is_ad>
      40        2444 : ProjectedStatefulMaterialAuxTempl<T, is_ad>::ProjectedStatefulMaterialAuxTempl(
      41             :     const InputParameters & parameters)
      42             :   : AuxKernel(parameters),
      43        4888 :     _current_subdomain_id(_assembly.currentSubdomainID()),
      44        4888 :     _prop(getGenericMaterialProperty<T, is_ad>("prop")),
      45        7332 :     _component(getParam<unsigned int>("component"))
      46             : {
      47        2444 : }
      48             : 
      49             : template <typename T, bool is_ad>
      50             : void
      51        2444 : ProjectedStatefulMaterialAuxTempl<T, is_ad>::initialSetup()
      52             : {
      53        2444 :   AuxKernel::initialSetup();
      54             : 
      55             :   // get all material classes that provide properties for this object
      56        2444 :   _required_materials = buildRequiredMaterials();
      57        2444 : }
      58             : 
      59             : template <typename T, bool is_ad>
      60             : Real
      61      986624 : ProjectedStatefulMaterialAuxTempl<T, is_ad>::computeValue()
      62             : {
      63      986624 :   if (_t_step == 0)
      64      385024 :     for (const auto & mat : _required_materials[_current_subdomain_id])
      65      192512 :       mat->initStatefulProperties(_qrule->size());
      66             : 
      67      986624 :   return MetaPhysicL::raw_value(Moose::serialAccess(_prop[_qp])[_component]);
      68             : }
      69             : 
      70             : template class ProjectedStatefulMaterialAuxTempl<Real, false>;
      71             : template class ProjectedStatefulMaterialAuxTempl<Real, true>;
      72             : template class ProjectedStatefulMaterialAuxTempl<RealVectorValue, false>;
      73             : template class ProjectedStatefulMaterialAuxTempl<RealVectorValue, true>;
      74             : template class ProjectedStatefulMaterialAuxTempl<RankTwoTensor, false>;
      75             : template class ProjectedStatefulMaterialAuxTempl<RankTwoTensor, true>;
      76             : template class ProjectedStatefulMaterialAuxTempl<RankFourTensor, false>;
      77             : template class ProjectedStatefulMaterialAuxTempl<RankFourTensor, true>;

Generated by: LCOV version 1.14