LCOV - code coverage report
Current view: top level - src/kernels - FunctorKernel.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 13 14 92.9 %
Date: 2025-08-08 20:01:16 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       14616 : FunctorKernel::validParams()
      16             : {
      17       14616 :   InputParameters params = ADKernelValue::validParams();
      18             : 
      19       14616 :   params.addClassDescription("Adds a term from a functor.");
      20             : 
      21       14616 :   params.addRequiredParam<MooseFunctorName>("functor", "Functor to add");
      22       14616 :   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       14616 :   return params;
      28           0 : }
      29             : 
      30         184 : FunctorKernel::FunctorKernel(const InputParameters & parameters)
      31             :   : ADKernelValue(parameters),
      32         184 :     _functor(getFunctor<ADReal>("functor")),
      33         368 :     _sign(getParam<bool>("functor_on_rhs") ? -1.0 : 1.0)
      34             : {
      35         184 : }
      36             : 
      37             : ADReal
      38       96096 : FunctorKernel::precomputeQpResidual()
      39             : {
      40       96096 :   const Moose::ElemQpArg space_arg = {_current_elem, _qp, _qrule, _q_point[_qp]};
      41      192192 :   return _sign * _functor(space_arg, Moose::currentState());
      42             : }

Generated by: LCOV version 1.14