LCOV - code coverage report
Current view: top level - include/kokkos/kernels - KokkosReaction.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 6f668f Lines: 4 4 100.0 %
Date: 2025-09-22 20:01:15 Functions: 2 2 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             : #pragma once
      11             : 
      12             : #include "KokkosKernel.h"
      13             : 
      14             : /**
      15             :  *  Implements a simple consuming reaction term with weak form $(\\psi_i, \\lambda u_h)$.
      16             :  */
      17             : class KokkosReaction final : public Moose::Kokkos::Kernel<KokkosReaction>
      18             : {
      19             : public:
      20             :   static InputParameters validParams();
      21             : 
      22             :   KokkosReaction(const InputParameters & parameters);
      23             : 
      24             :   KOKKOS_FUNCTION Real computeQpResidual(const unsigned int i,
      25             :                                          const unsigned int qp,
      26             :                                          ResidualDatum & datum) const;
      27             :   KOKKOS_FUNCTION Real computeQpJacobian(const unsigned int i,
      28             :                                          const unsigned int j,
      29             :                                          const unsigned int qp,
      30             :                                          ResidualDatum & datum) const;
      31             : 
      32             : protected:
      33             :   /// Scalar coefficient representing the relative amount consumed per unit time
      34             :   const Moose::Kokkos::Scalar<const Real> _rate;
      35             : };
      36             : 
      37             : KOKKOS_FUNCTION inline Real
      38       22688 : KokkosReaction::computeQpResidual(const unsigned int i,
      39             :                                   const unsigned int qp,
      40             :                                   ResidualDatum & datum) const
      41             : {
      42       22688 :   return _test(datum, i, qp) * _rate * _u(datum, qp);
      43             : }
      44             : 
      45             : KOKKOS_FUNCTION inline Real
      46       44992 : KokkosReaction::computeQpJacobian(const unsigned int i,
      47             :                                   const unsigned int j,
      48             :                                   const unsigned int qp,
      49             :                                   ResidualDatum & datum) const
      50             : {
      51       44992 :   return _test(datum, i, qp) * _rate * _phi(datum, j, qp);
      52             : }

Generated by: LCOV version 1.14