LCOV - code coverage report
Current view: top level - src/kernels - FunctorKernel.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 13 14 92.9 %
Date: 2025-07-17 01:28:37 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             : #include "FunctorKernel.h"
      11             : 
      12             : registerMooseObject("MooseApp", FunctorKernel);
      13             : 
      14             : InputParameters
      15       14399 : FunctorKernel::validParams()
      16             : {
      17       14399 :   InputParameters params = ADKernelValue::validParams();
      18             : 
      19       14399 :   params.addClassDescription("Adds a term from a functor.");
      20             : 
      21       14399 :   params.addRequiredParam<MooseFunctorName>("functor", "Functor to add");
      22       14399 :   params.addRequiredParam<bool>(
      23             :       "functor_on_rhs",
      24             :       "If true, the functor to add is on the right hand side of the equation. By convention, all "
      25             :       "terms are moved to the left hand side, so if true, a factor of -1 is applied.");
      26             : 
      27       14399 :   return params;
      28           0 : }
      29             : 
      30          70 : FunctorKernel::FunctorKernel(const InputParameters & parameters)
      31             :   : ADKernelValue(parameters),
      32          70 :     _functor(getFunctor<ADReal>("functor")),
      33         140 :     _sign(getParam<bool>("functor_on_rhs") ? -1.0 : 1.0)
      34             : {
      35          70 : }
      36             : 
      37             : ADReal
      38       66760 : FunctorKernel::precomputeQpResidual()
      39             : {
      40       66760 :   const Moose::ElemQpArg space_arg = {_current_elem, _qp, _qrule, _q_point[_qp]};
      41      133520 :   return _sign * _functor(space_arg, Moose::currentState());
      42             : }

Generated by: LCOV version 1.14