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 "ConstantFunction.h" 11 : 12 : registerMooseObject("MooseApp", ConstantFunction); 13 : 14 : InputParameters 15 27221 : ConstantFunction::validParams() 16 : { 17 27221 : InputParameters params = Function::validParams(); 18 27221 : params.addClassDescription( 19 : "A function that returns a constant value as defined by an input parameter."); 20 27221 : params.addParam<Real>("value", 0.0, "The constant value"); 21 27221 : params.declareControllable("value"); 22 27221 : return params; 23 0 : } 24 : 25 6762 : ConstantFunction::ConstantFunction(const InputParameters & parameters) 26 6762 : : Function(parameters), _value(getParam<Real>("value")) 27 : { 28 6762 : } 29 : 30 : Real 31 913411336 : ConstantFunction::value(Real, const Point &) const 32 : { 33 913411336 : return _value; 34 : } 35 : 36 : ADReal 37 0 : ConstantFunction::value(const ADReal &, const ADPoint &) const 38 : { 39 0 : return _value; 40 : } 41 : 42 : Real 43 128 : ConstantFunction::timeDerivative(Real /*t*/, const Point & /*p*/) const 44 : { 45 128 : return 0; 46 : } 47 : 48 : RealVectorValue 49 0 : ConstantFunction::gradient(Real /*t*/, const Point & /*p*/) const 50 : { 51 0 : return RealVectorValue(0); 52 : } 53 : 54 : Real 55 1 : ConstantFunction::timeIntegral(Real t1, Real t2, const Point & /*p*/) const 56 : { 57 1 : return _value * (t2 - t1); 58 : }