LCOV - code coverage report
Current view: top level - include/kokkos/kernels - KokkosVectorTimeDerivative.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 329044 Lines: 23 23 100.0 %
Date: 2026-08-03 21:12:22 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://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 "KokkosVectorTimeKernelValue.h"
      13             : 
      14             : class KokkosVectorTimeDerivative : public Moose::Kokkos::VectorTimeKernelValue
      15             : {
      16             : public:
      17             :   static InputParameters validParams();
      18             : 
      19             :   KokkosVectorTimeDerivative(const InputParameters & parameters);
      20             : 
      21             :   template <typename Derived>
      22             :   KOKKOS_FUNCTION void computeJacobianInternal(const Derived & kernel, AssemblyDatum & datum) const;
      23             : 
      24             :   template <typename Derived>
      25             :   KOKKOS_FUNCTION Moose::Kokkos::Real3 precomputeQpResidual(const unsigned int qp,
      26             :                                                             AssemblyDatum & datum) const;
      27             :   template <typename Derived>
      28             :   KOKKOS_FUNCTION Moose::Kokkos::Real3
      29             :   precomputeQpJacobian(const unsigned int j, const unsigned int qp, AssemblyDatum & datum) const;
      30             : 
      31             : protected:
      32             :   const bool _lumping;
      33             : };
      34             : 
      35             : template <typename Derived>
      36             : KOKKOS_FUNCTION void
      37       24584 : KokkosVectorTimeDerivative::computeJacobianInternal(const Derived & kernel,
      38             :                                                     AssemblyDatum & datum) const
      39             : {
      40             :   using Moose::Kokkos::MAX_CACHED_DOF;
      41             : 
      42             :   Real local_ke[MAX_CACHED_DOF];
      43             : 
      44      221256 :   for (unsigned int j = datum.local_thread_id(); j < datum.n_jdofs();
      45      196672 :        j += datum.num_local_threads())
      46             :   {
      47      196672 :     unsigned int num_batches = datum.n_idofs() / MAX_CACHED_DOF;
      48             : 
      49      196672 :     if (datum.n_idofs() % MAX_CACHED_DOF)
      50      196672 :       ++num_batches;
      51             : 
      52      393344 :     for (unsigned int batch = 0; batch < num_batches; ++batch)
      53             :     {
      54      196672 :       unsigned int ib = batch * MAX_CACHED_DOF;
      55      196672 :       unsigned int ie = ::Kokkos::min(ib + MAX_CACHED_DOF, datum.n_idofs());
      56             : 
      57     1770048 :       for (unsigned int i = ib; i < ie; ++i)
      58     1573376 :         local_ke[i - ib] = 0;
      59             : 
      60      983360 :       for (unsigned int qp = 0; qp < datum.n_qps(); ++qp)
      61             :       {
      62             :         Moose::Kokkos::Real3 value =
      63      786688 :             datum.JxW(qp) * kernel.template precomputeQpJacobian<Derived>(j, qp, datum);
      64             : 
      65     7080192 :         for (unsigned int i = ib; i < ie; ++i)
      66     6293504 :           local_ke[i - ib] += value * _test(datum, i, qp);
      67             :       }
      68             : 
      69     1770048 :       for (unsigned int i = ib; i < ie; ++i)
      70     3146752 :         accumulateTaggedElementalMatrix(
      71     3146752 :             local_ke[i - ib], datum.elem().id, i, _lumping ? i : j, datum.jvar());
      72             :     }
      73             :   }
      74       24584 : }
      75             : 
      76             : template <typename Derived>
      77             : KOKKOS_FUNCTION Moose::Kokkos::Real3
      78      227376 : KokkosVectorTimeDerivative::precomputeQpResidual(const unsigned int qp, AssemblyDatum & datum) const
      79             : {
      80      227376 :   return _u_dot(datum, qp);
      81             : }
      82             : 
      83             : template <typename Derived>
      84             : KOKKOS_FUNCTION Moose::Kokkos::Real3
      85      786688 : KokkosVectorTimeDerivative::precomputeQpJacobian(const unsigned int j,
      86             :                                                  const unsigned int qp,
      87             :                                                  AssemblyDatum & datum) const
      88             : {
      89     1573376 :   return _phi(datum, j, qp) * _du_dot_du;
      90             : }

Generated by: LCOV version 1.14