LCOV - code coverage report
Current view: top level - src/ics - FunctionIC.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 14 17 82.4 %
Date: 2025-08-08 20:01:16 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       54861 : FunctionIC::validParams()
      17             : {
      18       54861 :   InputParameters params = InitialCondition::validParams();
      19       54861 :   params.addRequiredParam<FunctionName>("function", "The initial condition function.");
      20             : 
      21       54861 :   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       54861 :   params.addParam<Real>("scaling_factor", 1, "Scaling factor to apply on the function");
      24             : 
      25       54861 :   return params;
      26           0 : }
      27             : 
      28       13578 : FunctionIC::FunctionIC(const InputParameters & parameters)
      29             :   : InitialCondition(parameters),
      30       13578 :     _func(getFunction("function")),
      31       27152 :     _scaling(getParam<Real>("scaling_factor"))
      32             : {
      33       13574 : }
      34             : 
      35             : Real
      36     6625903 : FunctionIC::value(const Point & p)
      37             : {
      38     6625903 :   return _scaling * _func.value(_t, p);
      39             : }
      40             : 
      41             : RealGradient
      42       35520 : FunctionIC::gradient(const Point & p)
      43             : {
      44       35520 :   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