LCOV - code coverage report
Current view: top level - src/kernels - ArrayBodyForce.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 15 17 88.2 %
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 "ArrayBodyForce.h"
      11             : 
      12             : #include "Function.h"
      13             : 
      14             : registerMooseObject("MooseApp", ArrayBodyForce);
      15             : 
      16             : InputParameters
      17       14373 : ArrayBodyForce::validParams()
      18             : {
      19       14373 :   InputParameters params = ArrayKernel::validParams();
      20       14373 :   params.addRequiredParam<std::vector<FunctionName>>("function", "The body force functions.");
      21       14373 :   params.addClassDescription("Applies body forces specified with functions to an array variable.");
      22       14373 :   return params;
      23           0 : }
      24             : 
      25          52 : ArrayBodyForce::ArrayBodyForce(const InputParameters & parameters) : ArrayKernel(parameters)
      26             : {
      27          52 :   auto & funcs = getParam<std::vector<FunctionName>>("function");
      28          52 :   if (_var.count() != funcs.size())
      29           0 :     paramError("function",
      30             :                "Number of functions must agree with the number of array variable components");
      31         169 :   for (auto & func : funcs)
      32         117 :     _func.push_back(&getFunctionByName(func));
      33          52 : }
      34             : 
      35             : void
      36     4974016 : ArrayBodyForce::computeQpResidual(RealEigenVector & residual)
      37             : {
      38    24520320 :   for (unsigned int p = 0; p < _count; ++p)
      39    19546304 :     residual(p) = -_test[_i][_qp] * _func[p]->value(_t, _q_point[_qp]);
      40     4974016 : }

Generated by: LCOV version 1.14