LCOV - code coverage report
Current view: top level - src/materials - RankTwoCartesianComponent.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: #32971 (54bef8) with base c6cf66 Lines: 20 21 95.2 %
Date: 2026-05-29 20:40:07 Functions: 7 8 87.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 "RankTwoCartesianComponent.h"
      11             : #include "RankTwoScalarTools.h"
      12             : 
      13             : #include "metaphysicl/raw_type.h"
      14             : 
      15             : registerMooseObject("SolidMechanicsApp", RankTwoCartesianComponent);
      16             : registerMooseObject("SolidMechanicsApp", ADRankTwoCartesianComponent);
      17             : 
      18             : template <bool is_ad>
      19             : InputParameters
      20       38228 : RankTwoCartesianComponentTempl<is_ad>::validParams()
      21             : {
      22       38228 :   InputParameters params = Material::validParams();
      23       38228 :   params.addClassDescription("Access a component of a RankTwoTensor");
      24       76456 :   params.addRequiredParam<MaterialPropertyName>("rank_two_tensor",
      25             :                                                 "The rank two material property tensor name");
      26       76456 :   params.addRequiredParam<MaterialPropertyName>(
      27             :       "property_name", "Name of the material property computed by this model");
      28       76456 :   params.addRequiredRangeCheckedParam<unsigned int>(
      29             :       "index_i",
      30             :       "index_i >= 0 & index_i <= 2",
      31             :       "The index i of ij for the tensor to output (0, 1, 2)");
      32       76456 :   params.addRequiredRangeCheckedParam<unsigned int>(
      33             :       "index_j",
      34             :       "index_j >= 0 & index_j <= 2",
      35             :       "The index j of ij for the tensor to output (0, 1, 2)");
      36       38228 :   return params;
      37           0 : }
      38             : 
      39             : template <bool is_ad>
      40       28671 : RankTwoCartesianComponentTempl<is_ad>::RankTwoCartesianComponentTempl(
      41             :     const InputParameters & parameters)
      42             :   : Material(parameters),
      43       28671 :     _tensor(getGenericMaterialProperty<RankTwoTensor, is_ad>("rank_two_tensor")),
      44       57342 :     _property(declareGenericProperty<Real, is_ad>("property_name")),
      45       57342 :     _i(getParam<unsigned int>("index_i")),
      46       86013 :     _j(getParam<unsigned int>("index_j"))
      47             : {
      48       28671 : }
      49             : 
      50             : template <bool is_ad>
      51             : void
      52          96 : RankTwoCartesianComponentTempl<is_ad>::initQpStatefulProperties()
      53             : {
      54          96 :   _property[_qp] = 0.0;
      55          96 : }
      56             : 
      57             : template <bool is_ad>
      58             : void
      59   136104036 : RankTwoCartesianComponentTempl<is_ad>::computeQpProperties()
      60             : {
      61   136104036 :   _property[_qp] = RankTwoScalarTools::component(MetaPhysicL::raw_value(_tensor[_qp]), _i, _j);
      62   136104036 : }
      63             : 
      64             : template class RankTwoCartesianComponentTempl<false>;
      65             : template class RankTwoCartesianComponentTempl<true>;

Generated by: LCOV version 1.14