LCOV - code coverage report
Current view: top level - src/ics - FunctionIC.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 14 17 82.4 %
Date: 2025-07-17 01:28:37 Functions: 4 5 80.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 "FunctionIC.h"
      11             : #include "Function.h"
      12             : 
      13             : registerMooseObject("MooseApp", FunctionIC);
      14             : 
      15             : InputParameters
      16       53021 : FunctionIC::validParams()
      17             : {
      18       53021 :   InputParameters params = InitialCondition::validParams();
      19       53021 :   params.addRequiredParam<FunctionName>("function", "The initial condition function.");
      20             : 
      21       53021 :   params.addClassDescription("An initial condition that uses a normal function of x, y, z to "
      22             :                              "produce values (and optionally gradients) for a field variable.");
      23       53021 :   params.addParam<Real>("scaling_factor", 1, "Scaling factor to apply on the function");
      24             : 
      25       53021 :   return params;
      26           0 : }
      27             : 
      28       12666 : FunctionIC::FunctionIC(const InputParameters & parameters)
      29             :   : InitialCondition(parameters),
      30       12666 :     _func(getFunction("function")),
      31       25328 :     _scaling(getParam<Real>("scaling_factor"))
      32             : {
      33       12662 : }
      34             : 
      35             : Real
      36     5958870 : FunctionIC::value(const Point & p)
      37             : {
      38     5958870 :   return _scaling * _func.value(_t, p);
      39             : }
      40             : 
      41             : RealGradient
      42       31380 : FunctionIC::gradient(const Point & p)
      43             : {
      44       31380 :   return _scaling * _func.gradient(_t, p);
      45             : }
      46             : 
      47             : const FunctionName
      48           0 : FunctionIC::functionName() const
      49             : {
      50           0 :   return _func.name();
      51             : }

Generated by: LCOV version 1.14