LCOV - code coverage report
Current view: top level - src/functions - Grad2ParsedFunction.C (source / functions) Hit Total Coverage
Test: idaholab/moose richards: #31405 (292dce) with base fef103 Lines: 16 17 94.1 %
Date: 2025-09-04 07:56:35 Functions: 3 3 100.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 "Grad2ParsedFunction.h"
      11             : #include "MooseParsedFunctionWrapper.h"
      12             : 
      13             : registerMooseObject("RichardsApp", Grad2ParsedFunction);
      14             : 
      15             : InputParameters
      16         178 : Grad2ParsedFunction::validParams()
      17             : {
      18         178 :   InputParameters params = MooseParsedFunction::validParams();
      19         178 :   params += MooseParsedFunction::validParams();
      20         356 :   params.addRequiredParam<RealVectorValue>(
      21             :       "direction",
      22             :       "The direction in which to take the derivative.  This must not be a zero-length "
      23             :       "vector.  This function returned a finite-difference approx to "
      24             :       "(direction.nabla)^2 function");
      25         178 :   return params;
      26           0 : }
      27             : 
      28          81 : Grad2ParsedFunction::Grad2ParsedFunction(const InputParameters & parameters)
      29         162 :   : MooseParsedFunction(parameters), _direction(getParam<RealVectorValue>("direction"))
      30             : {
      31          81 :   _len2 = _direction * _direction;
      32          81 :   if (_len2 == 0)
      33           1 :     mooseError("The direction in the Grad2ParsedFunction must have positive length.");
      34          80 : }
      35             : 
      36             : Real
      37        7575 : Grad2ParsedFunction::value(Real t, const Point & p) const
      38             : {
      39        7575 :   return (_function_ptr->evaluate<Real>(t, p + _direction) -
      40        7575 :           2 * _function_ptr->evaluate<Real>(t, p) +
      41        7575 :           _function_ptr->evaluate<Real>(t, p - _direction)) /
      42        7575 :          _len2;
      43             : }

Generated by: LCOV version 1.14