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 14346 : FunctionArrayAux::validParams() 17 : { 18 14346 : InputParameters params = ArrayAuxKernel::validParams(); 19 14346 : params.addClassDescription("Auxiliary Kernel that creates and updates an array field variable by " 20 : "sampling functions through space and time."); 21 14346 : params.addRequiredParam<std::vector<FunctionName>>("functions", 22 : "The functions to use as the value"); 23 14346 : return params; 24 0 : } 25 : 26 42 : FunctionArrayAux::FunctionArrayAux(const InputParameters & parameters) : ArrayAuxKernel(parameters) 27 : { 28 42 : auto & func_names = getParam<std::vector<FunctionName>>("functions"); 29 42 : 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 140 : for (auto & fname : func_names) 35 98 : _funcs.push_back(&getFunctionByName(fname)); 36 42 : } 37 : 38 : RealEigenVector 39 6199290 : FunctionArrayAux::computeValue() 40 : { 41 6199290 : RealEigenVector v(_var.count()); 42 6199290 : const Point & p = isNodal() ? *_current_node : _q_point[_qp]; 43 24771870 : for (unsigned int i = 0; i < _var.count(); ++i) 44 18572580 : v(i) = _funcs[i]->value(_t, p); 45 6199290 : return v; 46 0 : }