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 "Function.h" 13 : #include "PropertyReadFile.h" 14 : 15 : /** 16 : * Function which provides a piecewise constant, in space, field from a CSV file 17 : */ 18 : class PiecewiseConstantFromCSV : public Function 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : PiecewiseConstantFromCSV(const InputParameters & parameters); 24 : 25 : /** 26 : * Get the value of the function based on the data in the CSV file 27 : * \param t The time (unused) 28 : * \param pt The point in space (x,y,z) 29 : * \return The value of the function 30 : */ 31 : virtual Real value(Real t, const Point & pt) const override; 32 : using Function::value; 33 : 34 0 : virtual Real timeDerivative(Real, const Point &) const override { return 0; }; 35 : 36 : protected: 37 : void initialSetup() override; 38 : 39 : /// A user object that takes care of reading the CSV file 40 : const PropertyReadFile * _read_prop_user_object; 41 : 42 : /// The column number of interest in the CSV file 43 : const unsigned int _column_number; 44 : 45 : /// Type of read - element, grain, or block 46 : const PropertyReadFile::ReadTypeEnum _read_type; 47 : 48 : /// The point locator is used when values are sorted by elements or blocks in the CSV 49 : std::unique_ptr<libMesh::PointLocatorBase> _point_locator; 50 : };