LCOV - code coverage report
Current view: top level - src/functions - ConstantFunction.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 15 20 75.0 %
Date: 2025-08-08 20:01:16 Functions: 5 8 62.5 %
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 "ConstantFunction.h"
      11             : 
      12             : registerMooseObject("MooseApp", ConstantFunction);
      13             : 
      14             : InputParameters
      15       28308 : ConstantFunction::validParams()
      16             : {
      17       28308 :   InputParameters params = Function::validParams();
      18       28308 :   params.addClassDescription(
      19             :       "A function that returns a constant value as defined by an input parameter.");
      20       28308 :   params.addParam<Real>("value", 0.0, "The constant value");
      21       28308 :   params.declareControllable("value");
      22       28308 :   return params;
      23           0 : }
      24             : 
      25        7311 : ConstantFunction::ConstantFunction(const InputParameters & parameters)
      26        7311 :   : Function(parameters), _value(getParam<Real>("value"))
      27             : {
      28        7311 : }
      29             : 
      30             : Real
      31  1018702830 : ConstantFunction::value(Real, const Point &) const
      32             : {
      33  1018702830 :   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         144 : ConstantFunction::timeDerivative(Real /*t*/, const Point & /*p*/) const
      44             : {
      45         144 :   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             : }

Generated by: LCOV version 1.14