LCOV - code coverage report
Current view: top level - src/kokkos/functions - KokkosPiecewiseTabularBase.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31782 (615931) with base 7edd10 Lines: 23 25 92.0 %
Date: 2025-11-11 23:21:15 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 "KokkosPiecewiseTabularBase.h"
      11             : 
      12             : #include "JSONFileReader.h"
      13             : 
      14             : InputParameters
      15        8948 : KokkosPiecewiseTabularBase::validParams()
      16             : {
      17        8948 :   InputParameters params = KokkosPiecewiseBase::validParams();
      18        8948 :   params += PiecewiseTabularInterface::validParams();
      19             : 
      20       26844 :   params.addParam<Real>("scale_factor", 1.0, "Scale factor to be applied to the output values");
      21       26844 :   params.declareControllable("scale_factor");
      22             : 
      23        8948 :   return params;
      24           0 : }
      25             : 
      26         164 : KokkosPiecewiseTabularBase::KokkosPiecewiseTabularBase(const InputParameters & parameters)
      27             :   : KokkosPiecewiseBase(parameters),
      28         155 :     PiecewiseTabularInterface(*this, _data_x, _data_y),
      29         465 :     _scale_factor(getParam<Real>("scale_factor"))
      30             : {
      31             :   // load the data
      32         474 :   if (isParamValid("data_file"))
      33          36 :     buildFromFile(_communicator);
      34         466 :   else if (isParamValid("x") && isParamValid("y"))
      35          50 :     buildFromXandY();
      36         216 :   else if (isParamValid("xy_data"))
      37          36 :     buildFromXY();
      38         108 :   else if (!isParamValid("json_uo"))
      39           0 :     mooseError("Unknown X-Y data source. Are you missing a parameter? Did you misspell one?");
      40             :   // JSON data is not available at construction as we rely on a user object
      41         158 : }
      42             : 
      43             : void
      44         156 : KokkosPiecewiseTabularBase::initialSetup()
      45             : {
      46             :   // For JSON UO input, we need to wait for initialSetup to load the data
      47         468 :   if (isParamValid("json_uo"))
      48         108 :     buildFromJSON(getUserObject<JSONFileReader>("json_uo"));
      49             : 
      50             :   // Copy data to GPU
      51         156 :   _raw_x = _data_x;
      52         156 :   _raw_y = _data_y;
      53         156 : }

Generated by: LCOV version 1.14