LCOV - code coverage report
Current view: top level - src/kokkos/base - KokkosResidualObject.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31653 (1b668c) with base bb0a08 Lines: 58 59 98.3 %
Date: 2025-11-03 17:02:13 Functions: 3 3 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 "KokkosResidualObject.h"
      11             : 
      12             : #include "FEProblemBase.h"
      13             : 
      14             : namespace Moose
      15             : {
      16             : namespace Kokkos
      17             : {
      18             : 
      19             : InputParameters
      20      296488 : ResidualObject::validParams()
      21             : {
      22      296488 :   auto params = ::ResidualObject::validParams();
      23             : 
      24      890946 :   params.addParam<bool>("use_displaced_mesh",
      25      590012 :                         false,
      26             :                         "Whether or not this object should use the "
      27             :                         "displaced mesh for computation. Note that in "
      28             :                         "the case this is true but no displacements "
      29             :                         "are provided in the Mesh block the "
      30             :                         "undisplaced mesh will still be used.");
      31             : 
      32     1185952 :   params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
      33      889464 :   params.addCoupledVar("displacements", "The displacements");
      34             : 
      35      296488 :   params.addPrivateParam<bool>(MooseBase::kokkos_object_param, true);
      36             : 
      37      296488 :   return params;
      38           0 : }
      39             : 
      40        3303 : ResidualObject::ResidualObject(const InputParameters & parameters,
      41             :                                Moose::VarFieldType field_type,
      42        4747 :                                bool nodal)
      43             :   : ::ResidualObject(parameters, nodal),
      44        2581 :     MeshHolder(*_fe_problem.mesh().getKokkosMesh()),
      45        2581 :     AssemblyHolder(_fe_problem.kokkosAssembly()),
      46        2581 :     SystemHolder(_fe_problem.getKokkosSystems()),
      47        7743 :     _var(_subproblem.getVariable(_tid,
      48        2581 :                                  getParam<NonlinearVariableName>("variable"),
      49             :                                  Moose::VarKindType::VAR_SOLVER,
      50             :                                  field_type)),
      51        2581 :     _t(TransientInterface::_t),
      52        2581 :     _t_old(TransientInterface::_t_old),
      53        2581 :     _t_step(TransientInterface::_t_step),
      54        2581 :     _dt(TransientInterface::_dt),
      55       10324 :     _dt_old(TransientInterface::_dt_old)
      56             : {
      57        3303 :   _vector_tags = getVectorTags(VectorTagsKey());
      58        3303 :   _matrix_tags = getMatrixTags(MatrixTagsKey());
      59             : 
      60        3303 :   _is_extra_vector_tag.create(_vector_tags.size());
      61        3303 :   _is_extra_matrix_tag.create(_matrix_tags.size());
      62             : 
      63        3303 :   _is_extra_vector_tag = false;
      64        3303 :   _is_extra_matrix_tag = false;
      65             : 
      66        9909 :   if (isParamValid("extra_vector_tags"))
      67             :   {
      68         234 :     std::set<TagID> extra_vector_tags;
      69             : 
      70        1014 :     for (auto tag : getParam<std::vector<TagName>>("extra_vector_tags"))
      71         312 :       extra_vector_tags.insert(_fe_problem.getVectorTagID(tag));
      72             : 
      73         780 :     for (unsigned int t = 0; t < _vector_tags.size(); ++t)
      74         546 :       _is_extra_vector_tag[t] = extra_vector_tags.count(_vector_tags[t]);
      75         234 :   }
      76             : 
      77        9909 :   if (isParamValid("extra_matrix_tags"))
      78             :   {
      79         180 :     std::set<TagID> extra_matrix_tags;
      80             : 
      81         840 :     for (auto tag : getParam<std::vector<TagName>>("extra_matrix_tags"))
      82         300 :       extra_matrix_tags.insert(_fe_problem.getMatrixTagID(tag));
      83             : 
      84         684 :     for (unsigned int t = 0; t < _matrix_tags.size(); ++t)
      85         504 :       _is_extra_matrix_tag[t] = extra_matrix_tags.count(_matrix_tags[t]);
      86         180 :   }
      87             : 
      88        3303 :   _is_extra_vector_tag.copyToDevice();
      89        3303 :   _is_extra_matrix_tag.copyToDevice();
      90             : 
      91        3303 :   _kokkos_var.init(_var);
      92        3303 : }
      93             : 
      94      195546 : ResidualObject::ResidualObject(const ResidualObject & object)
      95             :   : ::ResidualObject(object, {}),
      96             :     MeshHolder(object),
      97             :     AssemblyHolder(object),
      98             :     SystemHolder(object),
      99      165956 :     _var(object._var),
     100      165956 :     _kokkos_var(object._kokkos_var),
     101      165956 :     _thread(object._thread),
     102      165956 :     _t(object._t),
     103      165956 :     _t_old(object._t_old),
     104      165956 :     _t_step(object._t_step),
     105      165956 :     _dt(object._dt),
     106      165956 :     _dt_old(object._dt_old),
     107      165956 :     _vector_tags(object._vector_tags),
     108      165956 :     _matrix_tags(object._matrix_tags),
     109      165956 :     _is_extra_vector_tag(object._is_extra_vector_tag),
     110      331912 :     _is_extra_matrix_tag(object._is_extra_matrix_tag)
     111             : {
     112      195546 : }
     113             : 
     114             : } // namespace Kokkos
     115             : } // namespace Moose

Generated by: LCOV version 1.14