LCOV - code coverage report
Current view: top level - src/kokkos/materials - KokkosGenericConstantMaterial.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 6f668f Lines: 18 20 90.0 %
Date: 2025-09-22 20:01:15 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       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 "KokkosGenericConstantMaterial.h"
      11             : 
      12             : registerMooseObject("MooseApp", KokkosGenericConstantMaterial);
      13             : 
      14             : InputParameters
      15        9234 : KokkosGenericConstantMaterial::validParams()
      16             : {
      17        9234 :   InputParameters params = Material::validParams();
      18       18468 :   params.addClassDescription(
      19             :       "Declares material properties based on names and values prescribed by input parameters.");
      20       36936 :   params.addRequiredParam<std::vector<std::string>>(
      21             :       "prop_names", "The names of the properties this material will have");
      22       27702 :   params.addRequiredParam<std::vector<Real>>("prop_values",
      23             :                                              "The values associated with the named properties");
      24       27702 :   params.declareControllable("prop_values");
      25             : 
      26        9234 :   return params;
      27           0 : }
      28             : 
      29         168 : KokkosGenericConstantMaterial::KokkosGenericConstantMaterial(const InputParameters & parameters)
      30             :   : Material(parameters),
      31          78 :     _prop_names(getParam<std::vector<std::string>>("prop_names")),
      32         156 :     _prop_values(getParam<std::vector<Real>>("prop_values")),
      33         156 :     _num_props(_prop_names.size())
      34             : {
      35          96 :   unsigned int num_names = _prop_names.size();
      36          96 :   unsigned int num_values = _prop_values.size();
      37             : 
      38          96 :   if (num_names != num_values)
      39           0 :     paramError("prop_names", "Size must match the number of prop_values.");
      40             : 
      41          96 :   _props.create(_num_props);
      42             : 
      43         267 :   for (unsigned int i = 0; i < _num_props; ++i)
      44         171 :     _props[i] = declareKokkosProperty<Real>(_prop_names[i]);
      45          96 : }

Generated by: LCOV version 1.14