LCOV - code coverage report
Current view: top level - src/kokkos/kernels - KokkosVectorKernel.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 329044 Lines: 34 35 97.1 %
Date: 2026-08-03 21:12:22 Functions: 4 4 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 "KokkosVectorKernel.h"
      11             : 
      12             : namespace Moose::Kokkos
      13             : {
      14             : 
      15             : InputParameters
      16       11222 : VectorKernel::validParams()
      17             : {
      18       11222 :   InputParameters params = KernelBase::validParams();
      19       11222 :   params.registerBase("VectorKernel");
      20       11222 :   return params;
      21           0 : }
      22             : 
      23         298 : VectorKernel::VectorKernel(const InputParameters & parameters)
      24             :   : KernelBase(parameters, Moose::VarFieldType::VAR_FIELD_VECTOR),
      25             :     _test(),
      26             :     _grad_test(),
      27             :     _phi(),
      28             :     _grad_phi(),
      29         156 :     _u(_var),
      30         156 :     _grad_u(_var)
      31             : {
      32         298 :   addMooseVariableDependency(&_var);
      33         298 : }
      34             : 
      35             : void
      36       13243 : VectorKernel::computeResidual()
      37             : {
      38       13243 :   _thread.resize(_num_local_residual_threads, numKokkosBlockElements());
      39             : 
      40       13243 :   Policy policy(0, _thread.size());
      41             : 
      42       13243 :   if (!_residual_dispatcher)
      43         288 :     _residual_dispatcher = DispatcherRegistry::build<ResidualLoop>(this, type());
      44             : 
      45       13243 :   _residual_dispatcher->parallelFor(policy);
      46       13243 : }
      47             : 
      48             : void
      49        2208 : VectorKernel::computeJacobian()
      50             : {
      51        2208 :   if (DispatcherRegistry::hasUserMethod<JacobianLoop>(type()))
      52             :   {
      53        2136 :     _thread.resize(_num_local_jacobian_threads, numKokkosBlockElements());
      54             : 
      55        2136 :     Policy policy(0, _thread.size());
      56             : 
      57        2136 :     if (!_jacobian_dispatcher)
      58         246 :       _jacobian_dispatcher = DispatcherRegistry::build<JacobianLoop>(this, type());
      59             : 
      60        2136 :     _jacobian_dispatcher->parallelFor(policy);
      61        2136 :   }
      62             : 
      63        2208 :   if (DispatcherRegistry::hasUserMethod<OffDiagJacobianLoop>(type()))
      64             :   {
      65         276 :     auto & sys = kokkosSystem(_kokkos_var.sys());
      66             : 
      67         426 :     _thread.resize(_num_local_jacobian_threads,
      68         150 :                    sys.getCoupling(_kokkos_var.var()).size(),
      69             :                    numKokkosBlockElements());
      70             : 
      71         276 :     Policy policy(0, _thread.size());
      72             : 
      73         276 :     if (!_offdiag_jacobian_dispatcher)
      74          51 :       _offdiag_jacobian_dispatcher = DispatcherRegistry::build<OffDiagJacobianLoop>(this, type());
      75             : 
      76         276 :     _offdiag_jacobian_dispatcher->parallelFor(policy);
      77         276 :   }
      78        2208 : }
      79             : 
      80             : } // namespace Moose::Kokkos

Generated by: LCOV version 1.14