LCOV - code coverage report
Current view: top level - src/kokkos/base - KokkosResidualObject.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 6f668f Lines: 58 59 98.3 %
Date: 2025-09-22 20:01:15 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      270134 : ResidualObject::validParams()
      21             : {
      22      270134 :   auto params = ::ResidualObject::validParams();
      23             : 
      24      811792 :   params.addParam<bool>("use_displaced_mesh",
      25      537488 :                         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     1080536 :   params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
      33      810402 :   params.addCoupledVar("displacements", "The displacements");
      34             : 
      35      270134 :   params.addPrivateParam<bool>(MooseBase::kokkos_object_param, true);
      36             : 
      37      270134 :   return params;
      38           0 : }
      39             : 
      40        2973 : ResidualObject::ResidualObject(const InputParameters & parameters,
      41             :                                Moose::VarFieldType field_type,
      42        4363 :                                bool nodal)
      43             :   : ::ResidualObject(parameters, nodal),
      44        2278 :     MeshHolder(*_fe_problem.mesh().getKokkosMesh()),
      45        2278 :     AssemblyHolder(_fe_problem.kokkosAssembly()),
      46        2278 :     SystemHolder(_fe_problem.getKokkosSystems()),
      47        6834 :     _var(_subproblem.getVariable(_tid,
      48        2278 :                                  getParam<NonlinearVariableName>("variable"),
      49             :                                  Moose::VarKindType::VAR_SOLVER,
      50             :                                  field_type)),
      51        2278 :     _t(TransientInterface::_t),
      52        2278 :     _t_old(TransientInterface::_t_old),
      53        2278 :     _t_step(TransientInterface::_t_step),
      54        2278 :     _dt(TransientInterface::_dt),
      55        9112 :     _dt_old(TransientInterface::_dt_old)
      56             : {
      57        2973 :   _vector_tags = getVectorTags(VectorTagsKey());
      58        2973 :   _matrix_tags = getMatrixTags(MatrixTagsKey());
      59             : 
      60        2973 :   _is_extra_vector_tag.create(_vector_tags.size());
      61        2973 :   _is_extra_matrix_tag.create(_matrix_tags.size());
      62             : 
      63        2973 :   _is_extra_vector_tag = false;
      64        2973 :   _is_extra_matrix_tag = false;
      65             : 
      66        8919 :   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        8919 :   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        2973 :   _is_extra_vector_tag.copyToDevice();
      89        2973 :   _is_extra_matrix_tag.copyToDevice();
      90             : 
      91        2973 :   _kokkos_var.init(_var);
      92        2973 : }
      93             : 
      94      157072 : ResidualObject::ResidualObject(const ResidualObject & object)
      95             :   : ::ResidualObject(object, {}),
      96             :     MeshHolder(object),
      97             :     AssemblyHolder(object),
      98             :     SystemHolder(object),
      99      128107 :     _var(object._var),
     100      128107 :     _kokkos_var(object._kokkos_var),
     101      128107 :     _thread(object._thread),
     102      128107 :     _t(object._t),
     103      128107 :     _t_old(object._t_old),
     104      128107 :     _t_step(object._t_step),
     105      128107 :     _dt(object._dt),
     106      128107 :     _dt_old(object._dt_old),
     107      128107 :     _vector_tags(object._vector_tags),
     108      128107 :     _matrix_tags(object._matrix_tags),
     109      128107 :     _is_extra_vector_tag(object._is_extra_vector_tag),
     110      256214 :     _is_extra_matrix_tag(object._is_extra_matrix_tag)
     111             : {
     112      157072 : }
     113             : 
     114             : } // namespace Kokkos
     115             : } // namespace Moose

Generated by: LCOV version 1.14