www.mooseframework.org
PiecewiseBase.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "PiecewiseBase.h"
11 #include "DelimitedFileReader.h"
12 
15 {
16  return Function::validParams();
17 }
18 
19 PiecewiseBase::PiecewiseBase(const InputParameters & parameters) : Function(parameters) {}
20 
21 Real
23 {
24  return _raw_x.size();
25 }
26 
27 Real
28 PiecewiseBase::domain(const int i) const
29 {
30  return _raw_x[i];
31 }
32 
33 Real
34 PiecewiseBase::range(const int i) const
35 {
36  return _raw_y[i];
37 }
38 
39 void
40 PiecewiseBase::setData(const std::vector<Real> & x, const std::vector<Real> & y)
41 {
42  _raw_x = x;
43  _raw_y = y;
44  if (_raw_x.size() != _raw_y.size())
45  mooseError("In PiecewiseBase ", _name, ": Lengths of x and y data do not match.");
46 }
Base class for function objects.
Definition: Function.h:37
static InputParameters validParams()
Definition: PiecewiseBase.C:14
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual void setData(const std::vector< Real > &x, const std::vector< Real > &y)
Provides a means for explicitly setting the x and y data.
Definition: PiecewiseBase.C:40
virtual Real domain(const int i) const
Definition: PiecewiseBase.C:28
virtual Real range(const int i) const
Definition: PiecewiseBase.C:34
std::vector< Real > _raw_x
raw function data as read
Definition: PiecewiseBase.h:39
virtual Real functionSize() const
Definition: PiecewiseBase.C:22
const std::string _name
The name of this class.
Definition: MooseBase.h:90
PiecewiseBase(const InputParameters &parameters)
Definition: PiecewiseBase.C:19
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
std::vector< Real > _raw_y
Definition: PiecewiseBase.h:40
static InputParameters validParams()
Class constructor.
Definition: Function.C:15