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 : #pragma once 11 : 12 : #include "MooseObject.h" 13 : #include "InputParameters.h" 14 : 15 : class JSONFileReader; 16 : 17 : class PiecewiseTabularInterface 18 : { 19 : public: 20 : static InputParameters validParams(); 21 : 22 : PiecewiseTabularInterface(const MooseObject & object, 23 : std::vector<Real> & data_x, 24 : std::vector<Real> & data_y); 25 : 26 : protected: 27 : /// Returns whether the raw data has been loaded already 28 4845 : bool isRawDataLoaded() const { return _raw_data_loaded; } 29 : 30 : /// Reads data from supplied CSV file. 31 : void buildFromFile(const libMesh::Parallel::Communicator & comm); 32 : 33 : /// Reads data from supplied JSON reader. 34 : void buildFromJSON(const JSONFileReader & json_uo); 35 : 36 : /// Builds data from 'x' and 'y' parameters. 37 : void buildFromXandY(); 38 : 39 : /// Builds data from 'xy_data' parameter. 40 : void buildFromXY(); 41 : 42 : ///@{ if _has_axis is true point component to use as function argument, otherwise use t 43 : unsigned int _axis; 44 : const bool _has_axis; 45 : ///@} 46 : 47 : private: 48 : /// The object 49 : const MooseObject & _object; 50 : 51 : /// Parameters supplied to the object 52 : const InputParameters & _parameters; 53 : 54 : /// Boolean to keep track of whether the data has been loaded 55 : bool _raw_data_loaded = false; 56 : 57 : ///@{ raw function data as read 58 : std::vector<Real> & _data_x; 59 : std::vector<Real> & _data_y; 60 : ///@} 61 : };