www.mooseframework.org
SplineInterpolation.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef SPLINEINTERPOLATION_H
16 #define SPLINEINTERPOLATION_H
17 
19 #include <string>
20 
27 {
28 public:
39  SplineInterpolation(const std::vector<Real> & x,
40  const std::vector<Real> & y,
41  Real yp1 = _deriv_bound,
42  Real ypn = _deriv_bound);
43 
44  virtual ~SplineInterpolation() = default;
45 
49  void setData(const std::vector<Real> & x,
50  const std::vector<Real> & y,
51  Real yp1 = _deriv_bound,
52  Real ypn = _deriv_bound);
53 
54  void errorCheck();
55 
60  Real sample(Real x) const;
61 
62  Real sampleDerivative(Real x) const;
63 
64  Real sample2ndDerivative(Real x) const;
65 
70  void dumpSampleFile(std::string base_name,
71  std::string x_label = "X",
72  std::string y_label = "Y",
73  float xmin = 0,
74  float xmax = 0,
75  float ymin = 0,
76  float ymax = 0);
77 
82  unsigned int getSampleSize();
83 
84  Real domain(int i) const;
85  Real range(int i) const;
86 
87 protected:
88  std::vector<Real> _x;
89  std::vector<Real> _y;
91  Real _yp1, _ypn;
93  std::vector<Real> _y2;
94 
95  void solve();
96 
97  static int _file_number;
98 };
99 
100 #endif // LINEARINTERPOLATION_H
Real range(int i) const
Real _yp1
boundary conditions
static PetscErrorCode Vec x
Real domain(int i) const
void setData(const std::vector< Real > &x, const std::vector< Real > &y, Real yp1=_deriv_bound, Real ypn=_deriv_bound)
Set the x-, y- values and first derivatives.
unsigned int getSampleSize()
This function returns the size of the array holding the points, i.e.
std::vector< Real > _y2
Second derivatives.
std::vector< Real > _x
Real sample(Real x) const
This function will take an independent variable input and will return the dependent variable based on...
std::vector< Real > _y
Real sample2ndDerivative(Real x) const
void dumpSampleFile(std::string base_name, std::string x_label="X", std::string y_label="Y", float xmin=0, float xmax=0, float ymin=0, float ymax=0)
This function will dump GNUPLOT input files that can be run to show the data points and function fits...
virtual ~SplineInterpolation()=default
This class interpolates tabulated functions with cubic splines.
Real sampleDerivative(Real x) const