LCOV - code coverage report
Current view: top level - src/functions - ShiftedFunction.C (source / functions) Hit Total Coverage
Test: idaholab/swift: #92 (25e020) with base b3cd84 Lines: 16 25 64.0 %
Date: 2025-09-10 17:10:32 Functions: 3 7 42.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /**********************************************************************/
       2             : /*                    DO NOT MODIFY THIS HEADER                       */
       3             : /*             Swift, a Fourier spectral solver for MOOSE             */
       4             : /*                                                                    */
       5             : /*            Copyright 2024 Battelle Energy Alliance, LLC            */
       6             : /*                        ALL RIGHTS RESERVED                         */
       7             : /**********************************************************************/
       8             : 
       9             : #include "ShiftedFunction.h"
      10             : 
      11             : registerMooseObject("MooseApp", ShiftedFunction);
      12             : 
      13             : InputParameters
      14           5 : ShiftedFunction::validParams()
      15             : {
      16           5 :   InputParameters params = Function::validParams();
      17           5 :   params.addClassDescription(
      18             :       "A function that returns a the value of another function shifted in x, y, z, and t.");
      19          10 :   params.addParam<Point>("shift", Point(), "The shift vector added to the sample location when evaluating the coupled function.");
      20          10 :   params.declareControllable("shift");
      21          10 :   params.addParam<Real>("delta_t", 0, "The time added to the sample time when evaluating the coupled function.");
      22          10 :   params.declareControllable("delta_t");
      23          10 :   params.addRequiredParam<FunctionName>("function", "The function to evaluate at the shifted location and time.");
      24           5 :   return params;
      25           0 : }
      26             : 
      27           3 : ShiftedFunction::ShiftedFunction(const InputParameters & parameters)
      28             :   : Function(parameters),
      29             :     FunctionInterface(this),
      30           3 :     _delta_p(getParam<Point>("shift")),
      31           6 :     _delta_t(getParam<Real>("delta_t")),
      32           6 :     _function(getFunction("function"))
      33             : {
      34           3 : }
      35             : 
      36             : Real
      37        2500 : ShiftedFunction::value(Real t, const Point & p) const
      38             : {
      39        2500 :   return _function.value(t + _delta_t, p + _delta_p);
      40             : }
      41             : 
      42             : ADReal
      43           0 : ShiftedFunction::value(const ADReal & t, const ADPoint & p) const
      44             : {
      45           0 :   return _function.value(t + _delta_t, p + _delta_p);
      46             : }
      47             : 
      48             : Real
      49           0 : ShiftedFunction::timeDerivative(Real t, const Point & p) const
      50             : {
      51           0 :   return _function.timeDerivative(t + _delta_t, p + _delta_p);
      52             : }
      53             : 
      54             : RealVectorValue
      55           0 : ShiftedFunction::gradient(Real t, const Point & p) const
      56             : {
      57           0 :   return _function.gradient(t + _delta_t, p + _delta_p);
      58             : }
      59             : 
      60             : Real
      61           0 : ShiftedFunction::timeIntegral(Real t1, Real t2, const Point & p) const
      62             : {
      63           0 :   return _function.timeIntegral(t1 + _delta_t, t2 + _delta_t, p + _delta_p);
      64             : }

Generated by: LCOV version 1.14