LCOV - code coverage report
Current view: top level - src/auxscalarkernels - FunctionScalarAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 14 16 87.5 %
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 "FunctionScalarAux.h"
      11             : #include "Function.h"
      12             : 
      13             : registerMooseObject("MooseApp", FunctionScalarAux);
      14             : 
      15             : InputParameters
      16       14937 : FunctionScalarAux::validParams()
      17             : {
      18       14937 :   InputParameters params = AuxScalarKernel::validParams();
      19       14937 :   params.addClassDescription("Sets a value of a scalar variable based on a function.");
      20       14937 :   params.addRequiredParam<std::vector<FunctionName>>(
      21             :       "function", "The functions to set the scalar variable components.");
      22             : 
      23       14937 :   return params;
      24           0 : }
      25             : 
      26         345 : FunctionScalarAux::FunctionScalarAux(const InputParameters & parameters)
      27         345 :   : AuxScalarKernel(parameters)
      28             : {
      29         345 :   std::vector<FunctionName> funcs = getParam<std::vector<FunctionName>>("function");
      30         345 :   if (funcs.size() != _var.order())
      31           0 :     mooseError("number of functions is not equal to the number of scalar variable components");
      32             : 
      33         862 :   for (const auto & func : funcs)
      34         517 :     _functions.push_back(&getFunctionByName(func));
      35         345 : }
      36             : 
      37             : Real
      38        9176 : FunctionScalarAux::computeValue()
      39             : {
      40        9176 :   return _functions[_i]->value(_t, _point_zero);
      41             : }

Generated by: LCOV version 1.14