LCOV - code coverage report
Current view: top level - include/kokkos/kernels - KokkosDiffusion.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 6f668f Lines: 10 10 100.0 %
Date: 2025-09-22 20:01:15 Functions: 8 8 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             : #pragma once
      11             : 
      12             : #include "KokkosKernel.h"
      13             : 
      14             : /**
      15             :  * This kernel implements the Laplacian operator:
      16             :  * $\nabla u \cdot \nabla \phi_i$
      17             :  */
      18             : template <typename Derived>
      19             : class KokkosDiffusion : public Moose::Kokkos::Kernel<Derived>
      20             : {
      21             :   usingKokkosKernelMembers(Derived);
      22             : 
      23             : public:
      24             :   static InputParameters validParams();
      25             : 
      26             :   KokkosDiffusion(const InputParameters & parameters);
      27             : 
      28             :   KOKKOS_FUNCTION Real computeQpResidual(const unsigned int i,
      29             :                                          const unsigned int qp,
      30             :                                          ResidualDatum & datum) const;
      31             :   KOKKOS_FUNCTION Real computeQpJacobian(const unsigned int i,
      32             :                                          const unsigned int j,
      33             :                                          const unsigned int qp,
      34             :                                          ResidualDatum & datum) const;
      35             : };
      36             : 
      37             : template <typename Derived>
      38             : InputParameters
      39       19288 : KokkosDiffusion<Derived>::validParams()
      40             : {
      41       19288 :   InputParameters params = Moose::Kokkos::Kernel<Derived>::validParams();
      42       19288 :   return params;
      43             : }
      44             : 
      45             : template <typename Derived>
      46         532 : KokkosDiffusion<Derived>::KokkosDiffusion(const InputParameters & parameters)
      47         401 :   : Moose::Kokkos::Kernel<Derived>(parameters)
      48             : {
      49         532 : }
      50             : 
      51             : template <typename Derived>
      52             : KOKKOS_FUNCTION Real
      53     6989984 : KokkosDiffusion<Derived>::computeQpResidual(const unsigned int i,
      54             :                                             const unsigned int qp,
      55             :                                             ResidualDatum & datum) const
      56             : {
      57     6989984 :   return _grad_u(datum, qp) * _grad_test(datum, i, qp);
      58             : }
      59             : 
      60             : template <typename Derived>
      61             : KOKKOS_FUNCTION Real
      62     3983552 : KokkosDiffusion<Derived>::computeQpJacobian(const unsigned int i,
      63             :                                             const unsigned int j,
      64             :                                             const unsigned int qp,
      65             :                                             ResidualDatum & datum) const
      66             : {
      67     3983552 :   return _grad_phi(datum, j, qp) * _grad_test(datum, i, qp);
      68             : }
      69             : 
      70             : class KokkosDiffusionKernel final : public KokkosDiffusion<KokkosDiffusionKernel>
      71             : {
      72             : public:
      73             :   static InputParameters validParams();
      74             : 
      75             :   KokkosDiffusionKernel(const InputParameters & parameters);
      76             : };

Generated by: LCOV version 1.14