https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PiecewiseBase.C
Go to the documentation of this file.
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 "PiecewiseBase.h"
11#include "DelimitedFileReader.h"
12
18
19PiecewiseBase::PiecewiseBase(const InputParameters & parameters) : Function(parameters) {}
20
21Real
23{
24 return _raw_x.size();
25}
26
27Real
28PiecewiseBase::domain(const int i) const
29{
30 return _raw_x[i];
31}
32
33Real
34PiecewiseBase::range(const int i) const
35{
36 return _raw_y[i];
37}
38
39void
40PiecewiseBase::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}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
Base class for function objects.
Definition Function.h:30
static InputParameters validParams()
Class constructor.
Definition Function.C:16
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const std::string & _name
The name of this class.
Definition MooseBase.h:381
virtual Real functionSize() const
static InputParameters validParams()
PiecewiseBase(const InputParameters &parameters)
virtual void setData(const std::vector< Real > &x, const std::vector< Real > &y)
Provides a means for explicitly setting the x and y data.
virtual Real domain(const int i) const
virtual Real range(const int i) const
std::vector< Real > _raw_x
raw function data as read
std::vector< Real > _raw_y