LCOV - code coverage report
Current view: top level - include/kokkos/kernels - KokkosTimeKernel.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 863ef6 Lines: 11 11 100.0 %
Date: 2025-10-15 18:16: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             : #pragma once
      11             : 
      12             : #include "KokkosKernel.h"
      13             : 
      14             : namespace Moose
      15             : {
      16             : namespace Kokkos
      17             : {
      18             : 
      19             : /**
      20             :  * The base class for Kokkos time-derivative kernels
      21             :  */
      22             : class TimeKernel : public Kernel
      23             : {
      24             : public:
      25             :   static InputParameters validParams();
      26             : 
      27             :   /**
      28             :    * Constructor
      29             :    */
      30             :   TimeKernel(const InputParameters & parameters);
      31             : 
      32             :   /**
      33             :    * Hook for additional computation for residual after the standard calls
      34             :    * @param ib The beginning element-local DOF index
      35             :    * @param ie The end element-local DOF index
      36             :    * @param datum The ResidualDatum object of the current thread
      37             :    * @param local_re The temporary storage storing the residual contribution of each DOF
      38             :    */
      39      994745 :   KOKKOS_FUNCTION void computeResidualAdditional(const unsigned int /* ib */,
      40             :                                                  const unsigned int /* ie */,
      41             :                                                  ResidualDatum & /* datum */,
      42             :                                                  Real * /* local_re */) const
      43             :   {
      44      994745 :   }
      45             : 
      46             :   /**
      47             :    * The parallel computation body that hides the base class method to allow additional computation
      48             :    * for residual through computeResidualAdditional()
      49             :    */
      50             :   template <typename Derived>
      51             :   KOKKOS_FUNCTION void computeResidualInternal(const Derived & kernel, ResidualDatum & datum) const;
      52             : 
      53             : protected:
      54             :   /**
      55             :    * Time derivative of the current solution at quadrature points
      56             :    */
      57             :   const VariableValue _u_dot;
      58             :   /**
      59             :    * Derivative of u_dot with respect to u
      60             :    */
      61             :   const Scalar<const Real> _du_dot_du;
      62             : };
      63             : 
      64             : template <typename Derived>
      65             : KOKKOS_FUNCTION void
      66      994745 : TimeKernel::computeResidualInternal(const Derived & kernel, ResidualDatum & datum) const
      67             : {
      68      994745 :   ResidualObject::computeResidualInternal(
      69             :       datum,
      70     1989490 :       [&](Real * local_re, const unsigned int ib, const unsigned int ie)
      71             :       {
      72     5048173 :         for (unsigned int qp = 0; qp < datum.n_qps(); ++qp)
      73             :         {
      74     4053428 :           datum.reinit();
      75             : 
      76    21987364 :           for (unsigned int i = ib; i < ie; ++i)
      77    17933936 :             local_re[i] += datum.JxW(qp) * kernel.computeQpResidual(i, qp, datum);
      78             :         }
      79             : 
      80      994745 :         kernel.computeResidualAdditional(ib, ie, datum, local_re);
      81             :       });
      82      994745 : }
      83             : 
      84             : } // namespace Kokkos
      85             : } // namespace Moose

Generated by: LCOV version 1.14