LCOV - code coverage report
Current view: top level - include/kokkos/kernels - KokkosCoupledForce.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 6f668f Lines: 2 2 100.0 %
Date: 2025-09-22 20:01:15 Functions: 1 1 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             :  * Implements a source term proportional to the value of a coupled variable. Weak form: $(\\psi_i,
      16             :  * -\\sigma v)$.
      17             :  */
      18             : class KokkosCoupledForce final : public Moose::Kokkos::Kernel<KokkosCoupledForce>
      19             : {
      20             : public:
      21             :   static InputParameters validParams();
      22             : 
      23             :   KokkosCoupledForce(const InputParameters & parameters);
      24             : 
      25             :   KOKKOS_FUNCTION Real computeQpResidual(const unsigned int i,
      26             :                                          const unsigned int qp,
      27             :                                          ResidualDatum & datum) const;
      28             : 
      29             : private:
      30             :   /// Coupled variable number
      31             :   const unsigned int _v_var;
      32             :   /// Coupled variable
      33             :   const Moose::Kokkos::VariableValue _v;
      34             :   /// Multiplier for the coupled force term
      35             :   const Real _coef;
      36             : };
      37             : 
      38             : KOKKOS_FUNCTION inline Real
      39      157920 : KokkosCoupledForce::computeQpResidual(const unsigned int i,
      40             :                                       const unsigned int qp,
      41             :                                       ResidualDatum & datum) const
      42             : {
      43      157920 :   return -_coef * _v(datum, qp) * _test(datum, i, qp);
      44             : }

Generated by: LCOV version 1.14