LCOV - code coverage report
Current view: top level - src/materials - GenericConstant2DArray.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 21 25 84.0 %
Date: 2026-05-29 20:35:17 Functions: 6 8 75.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 "GenericConstant2DArray.h"
      11             : 
      12             : registerMooseObject("MooseApp", GenericConstant2DArray);
      13             : registerMooseObject("MooseApp", ADGenericConstant2DArray);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17        6831 : GenericConstant2DArrayTempl<is_ad>::validParams()
      18             : {
      19             : 
      20        6831 :   InputParameters params = Material::validParams();
      21       27324 :   params.addRequiredParam<std::string>("prop_name",
      22             :                                        "The names of the properties this material will have");
      23       20493 :   params.addRequiredParam<RealEigenMatrix>("prop_value",
      24             :                                            "The values associated with the named properties");
      25       20493 :   params.declareControllable("prop_value");
      26       13662 :   params.addClassDescription(
      27             :       "A material evaluating one material property in type of RealEigenMatrix");
      28       20493 :   params.set<MooseEnum>("constant_on") = "SUBDOMAIN";
      29        6831 :   return params;
      30           0 : }
      31             : 
      32             : template <bool is_ad>
      33         543 : GenericConstant2DArrayTempl<is_ad>::GenericConstant2DArrayTempl(const InputParameters & parameters)
      34             :   : Material(parameters),
      35         543 :     _prop_name(getParam<std::string>("prop_name")),
      36        1086 :     _prop_value(getParam<RealEigenMatrix>("prop_value")),
      37        1086 :     _property(declareGenericProperty<RealEigenMatrix, is_ad>(_prop_name))
      38             : {
      39         543 : }
      40             : 
      41             : template <bool is_ad>
      42             : void
      43           0 : GenericConstant2DArrayTempl<is_ad>::initQpStatefulProperties()
      44             : {
      45           0 :   computeQpProperties();
      46           0 : }
      47             : 
      48             : template <bool is_ad>
      49             : void
      50       13928 : GenericConstant2DArrayTempl<is_ad>::computeQpProperties()
      51             : {
      52       13928 :   auto & qp_prop = _property[_qp];
      53       13928 :   const auto m = _prop_value.rows(), n = _prop_value.cols();
      54       13928 :   qp_prop.resize(m, n);
      55       41784 :   for (const auto i : make_range(m))
      56       83568 :     for (const auto j : make_range(n))
      57       55712 :       qp_prop(i, j) = _prop_value(i, j);
      58       13928 : }
      59             : 
      60             : template class GenericConstant2DArrayTempl<false>;
      61             : template class GenericConstant2DArrayTempl<true>;

Generated by: LCOV version 1.14