LCOV - code coverage report
Current view: top level - src/ics - CoupledValueFunctionIC.C (source / functions) Hit Total Coverage
Test: idaholab/moose phase_field: #31405 (292dce) with base fef103 Lines: 18 20 90.0 %
Date: 2025-09-04 07:55:36 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 "CoupledValueFunctionIC.h"
      11             : #include "Function.h"
      12             : 
      13             : registerMooseObject("PhaseFieldApp", CoupledValueFunctionIC);
      14             : 
      15             : InputParameters
      16          97 : CoupledValueFunctionIC::validParams()
      17             : {
      18          97 :   InputParameters params = InitialCondition::validParams();
      19          97 :   params.addClassDescription("Initialize the variable from a lookup function");
      20         194 :   params.addRequiredParam<FunctionName>("function",
      21             :                                         "Coupled function to evaluate with values from v");
      22         194 :   params.addCoupledVar("v",
      23             :                        "List of up to four coupled variables that are substituted for x,y,z, and t "
      24             :                        "in the coupled function");
      25          97 :   return params;
      26           0 : }
      27             : 
      28          51 : CoupledValueFunctionIC::CoupledValueFunctionIC(const InputParameters & parameters)
      29             :   : InitialCondition(parameters),
      30          51 :     _func(getFunction("function")),
      31          51 :     _var_num(coupledComponents("v")),
      32         102 :     _vals(coupledValues("v"))
      33             : {
      34          51 :   if (_var_num > 4)
      35           0 :     paramError("v", "You can couple at most four variables.");
      36          51 : }
      37             : 
      38             : Real
      39        4800 : CoupledValueFunctionIC::value(const Point & /*p*/)
      40             : {
      41             :   Point p;
      42             :   Real t = 0.0;
      43             : 
      44       19200 :   for (unsigned int i = 0; i < 3 && i < _var_num; ++i)
      45       14400 :     p(i) = (*_vals[i])[_qp];
      46        4800 :   if (_var_num == 4)
      47        2400 :     t = (*_vals[3])[_qp];
      48             : 
      49        4800 :   return _func.value(t, p);
      50             : }

Generated by: LCOV version 1.14