LCOV - code coverage report
Current view: top level - src/kokkos/auxkernels - KokkosAuxKernel.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 52 57 91.2 %
Date: 2026-05-29 20:35:17 Functions: 7 7 100.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 "KokkosAuxKernel.h"
      11             : 
      12             : namespace Moose::Kokkos
      13             : {
      14             : 
      15             : InputParameters
      16       22214 : AuxKernel::validParams()
      17             : {
      18       22214 :   InputParameters params = AuxKernelBase::validParams();
      19       22214 :   params.addPrivateParam<bool>(MooseBase::kokkos_object_param, true);
      20       22214 :   return params;
      21           0 : }
      22             : 
      23         621 : AuxKernel::AuxKernel(const InputParameters & parameters)
      24             :   : ::AuxKernelBase(parameters),
      25         335 :     MeshHolder(*_mesh.getKokkosMesh()),
      26         335 :     AssemblyHolder(_sys.feProblem().kokkosAssembly()),
      27         335 :     SystemHolder(_sys.feProblem().getKokkosSystems()),
      28         670 :     _nodal(_var.isNodal()),
      29             :     _test(),
      30         335 :     _u(_var, Moose::SOLUTION_TAG, _var.isNodal()),
      31         335 :     _t(TransientInterface::_t),
      32         335 :     _t_old(TransientInterface::_t_old),
      33         335 :     _t_step(TransientInterface::_t_step),
      34         335 :     _dt(TransientInterface::_dt),
      35        1005 :     _dt_old(TransientInterface::_dt_old)
      36             : {
      37         621 :   if (!_nodal && _bnd)
      38           0 :     mooseError("Boundary restriction of a Kokkos AuxKernel is only supported for nodal variables.");
      39             : 
      40         621 :   auto tag = _sys.feProblem().addVectorTag("parallel_solution", Moose::VECTOR_TAG_SOLUTION);
      41             : 
      42         621 :   _kokkos_var.init(_var, tag);
      43         621 : }
      44             : 
      45       25510 : AuxKernel::AuxKernel(const AuxKernel & object)
      46             :   : ::AuxKernelBase(object, {}),
      47             :     MeshHolder(object),
      48             :     AssemblyHolder(object),
      49             :     SystemHolder(object),
      50       15756 :     _nodal(object._nodal),
      51       15756 :     _kokkos_var(object._kokkos_var),
      52       15756 :     _test(object._test),
      53       15756 :     _u(object._u),
      54       15756 :     _t(object._t),
      55       15756 :     _t_old(object._t_old),
      56       15756 :     _t_step(object._t_step),
      57       15756 :     _dt(object._dt),
      58       31512 :     _dt_old(object._dt_old)
      59             : {
      60       25510 : }
      61             : 
      62             : void
      63       24928 : AuxKernel::compute()
      64             : {
      65       24928 :   if (_var.isNodal())
      66             :   {
      67       17890 :     Policy policy = _bnd ? Policy(0, numKokkosBoundaryNodes()) : Policy(0, numKokkosBlockNodes());
      68             : 
      69       17890 :     if (!_node_dispatcher)
      70         320 :       _node_dispatcher = DispatcherRegistry::build<NodeLoop>(this, type());
      71             : 
      72       17890 :     _node_dispatcher->parallelFor(policy);
      73       17890 :   }
      74             :   else
      75             :   {
      76        7038 :     Policy policy = Policy(0, numKokkosBlockElements());
      77             : 
      78        7038 :     if (!_element_dispatcher)
      79         262 :       _element_dispatcher = DispatcherRegistry::build<ElementLoop>(this, type());
      80             : 
      81        7038 :     _element_dispatcher->parallelFor(policy);
      82        7038 :   }
      83       24928 : }
      84             : 
      85             : VariableValue
      86          34 : AuxKernel::uOld() const
      87             : {
      88          34 :   _var.sys().needSolutionState(1);
      89             : 
      90          34 :   return VariableValue(_var, Moose::OLD_SOLUTION_TAG, isNodal());
      91             : }
      92             : 
      93             : VariableValue
      94          17 : AuxKernel::uOlder() const
      95             : {
      96          17 :   _var.sys().needSolutionState(2);
      97             : 
      98          17 :   return VariableValue(_var, Moose::OLDER_SOLUTION_TAG, isNodal());
      99             : }
     100             : 
     101             : void
     102         217 : AuxKernel::getKokkosMaterialPropertyHook(const std::string & prop_name_in,
     103             :                                          const unsigned int /* state */)
     104             : {
     105         217 :   if (isNodal())
     106           0 :     mooseError("Nodal KokkosAuxKernel '",
     107           0 :                name(),
     108             :                "' attempted to reference material property '",
     109             :                prop_name_in,
     110             :                "'\nConsider using an elemental auxiliary variable for '",
     111           0 :                _var.name(),
     112             :                "'.");
     113         217 : }
     114             : 
     115             : } // namespace Moose::Kokkos

Generated by: LCOV version 1.14