LCOV - code coverage report
Current view: top level - src/auxkernels - FunctionArrayAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 17 21 81.0 %
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 "FunctionArrayAux.h"
      11             : #include "Function.h"
      12             : 
      13             : registerMooseObject("MooseApp", FunctionArrayAux);
      14             : 
      15             : InputParameters
      16       14340 : FunctionArrayAux::validParams()
      17             : {
      18       14340 :   InputParameters params = ArrayAuxKernel::validParams();
      19       14340 :   params.addClassDescription("Auxiliary Kernel that creates and updates an array field variable by "
      20             :                              "sampling functions through space and time.");
      21       14340 :   params.addRequiredParam<std::vector<FunctionName>>("functions",
      22             :                                                      "The functions to use as the value");
      23       14340 :   return params;
      24           0 : }
      25             : 
      26          39 : FunctionArrayAux::FunctionArrayAux(const InputParameters & parameters) : ArrayAuxKernel(parameters)
      27             : {
      28          39 :   auto & func_names = getParam<std::vector<FunctionName>>("functions");
      29          39 :   if (func_names.size() != _var.count())
      30           0 :     paramError("functions",
      31             :                "Number of functions must be equal to the number of components of array variable ",
      32           0 :                _var.name());
      33             : 
      34         130 :   for (auto & fname : func_names)
      35          91 :     _funcs.push_back(&getFunctionByName(fname));
      36          39 : }
      37             : 
      38             : RealEigenVector
      39     5510480 : FunctionArrayAux::computeValue()
      40             : {
      41     5510480 :   RealEigenVector v(_var.count());
      42     5510480 :   const Point & p = isNodal() ? *_current_node : _q_point[_qp];
      43    22019440 :   for (unsigned int i = 0; i < _var.count(); ++i)
      44    16508960 :     v(i) = _funcs[i]->value(_t, p);
      45     5510480 :   return v;
      46           0 : }

Generated by: LCOV version 1.14