LCOV - code coverage report
Current view: top level - include/kokkos/nodalkernels - KokkosCoupledForceNodalKernel.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 6f668f Lines: 6 6 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 "KokkosNodalKernel.h"
      13             : 
      14             : class KokkosCoupledForceNodalKernel final
      15             :   : public Moose::Kokkos::NodalKernel<KokkosCoupledForceNodalKernel>
      16             : {
      17             : public:
      18             :   static InputParameters validParams();
      19             : 
      20             :   KokkosCoupledForceNodalKernel(const InputParameters & parameters);
      21             : 
      22             :   KOKKOS_FUNCTION Real computeQpResidual(const ContiguousNodeID node) const;
      23             :   KOKKOS_FUNCTION Real computeQpOffDiagJacobian(const unsigned int jvar,
      24             :                                                 const ContiguousNodeID node) const;
      25             : 
      26             : private:
      27             :   /// The number of the coupled variable
      28             :   const unsigned int _v_var;
      29             : 
      30             :   /// The value of the coupled variable
      31             :   const Moose::Kokkos::VariableNodalValue _v;
      32             : 
      33             :   /// A multiplicative factor for computing the coupled force
      34             :   const Real _coef;
      35             : };
      36             : 
      37             : KOKKOS_FUNCTION inline Real
      38      117744 : KokkosCoupledForceNodalKernel::computeQpResidual(const ContiguousNodeID node) const
      39             : {
      40      117744 :   return -_coef * _v(node);
      41             : }
      42             : 
      43             : KOKKOS_FUNCTION inline Real
      44      124550 : KokkosCoupledForceNodalKernel::computeQpOffDiagJacobian(const unsigned int jvar,
      45             :                                                         const ContiguousNodeID /* node */) const
      46             : {
      47      124550 :   if (jvar == _v_var)
      48       91816 :     return -_coef;
      49       32734 :   return 0;
      50             : }

Generated by: LCOV version 1.14