LCOV - code coverage report
Current view: top level - src/kernels - CoefReaction.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 12 13 92.3 %
Date: 2025-07-17 01:28:37 Functions: 7 8 87.5 %
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             : #include "CoefReaction.h"
      11             : 
      12             : registerMooseObject("MooseApp", CoefReaction);
      13             : registerMooseObject("MooseApp", ADCoefReaction);
      14             : 
      15             : template <bool is_ad>
      16             : InputParameters
      17       30013 : CoefReactionTempl<is_ad>::validParams()
      18             : {
      19       30013 :   InputParameters params = ReactionTempl<is_ad>::validParams();
      20       30013 :   params.addClassDescription("Implements the residual term (p*u, test)");
      21       30013 :   params.addParam<Real>("coefficient", 1.0, "Coefficient of the term");
      22       30013 :   return params;
      23           0 : }
      24             : 
      25             : template <bool is_ad>
      26         763 : CoefReactionTempl<is_ad>::CoefReactionTempl(const InputParameters & parameters)
      27         763 :   : ReactionTempl<is_ad>(parameters), _coef(this->template getParam<Real>("coefficient"))
      28             : {
      29         763 : }
      30             : 
      31             : template <bool is_ad>
      32             : GenericReal<is_ad>
      33    26126864 : CoefReactionTempl<is_ad>::computeQpResidual()
      34             : {
      35    26126864 :   return _coef * ReactionTempl<is_ad>::computeQpResidual();
      36             : }
      37             : 
      38             : template <bool is_ad>
      39             : Real
      40    18353024 : CoefReactionTempl<is_ad>::computeQpJacobian()
      41             : {
      42             :   // This function will never be called for the AD version. But because C++ does
      43             :   // not support an optional function declaration based on a template parameter,
      44             :   // we must keep this template for all cases.
      45             :   mooseAssert(!is_ad,
      46             :               "In ADCoefReaction, computeQpJacobian should not be called. Check computeJacobian "
      47             :               "implementation.");
      48    18353024 :   return _coef * ReactionTempl<is_ad>::computeQpJacobian();
      49             : }
      50             : 
      51             : template class CoefReactionTempl<false>;
      52             : template class CoefReactionTempl<true>;

Generated by: LCOV version 1.14