www.mooseframework.org
SplineInterpolationBase.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 SPLINEINTERPOLATIONBASE_H
16 #define SPLINEINTERPOLATIONBASE_H
17 
18 #include <vector>
19 #include "libmesh/libmesh_common.h"
20 using libMesh::Real;
21 
23 {
24 public:
26 
27  virtual ~SplineInterpolationBase() = default;
28 
29  Real sample(const std::vector<Real> & x,
30  const std::vector<Real> & y,
31  const std::vector<Real> & y2,
32  Real x_int) const;
33  Real sampleDerivative(const std::vector<Real> & x,
34  const std::vector<Real> & y,
35  const std::vector<Real> & y2,
36  Real x_int) const;
37  Real sample2ndDerivative(const std::vector<Real> & x,
38  const std::vector<Real> & y,
39  const std::vector<Real> & y2,
40  Real x_int) const;
41 
42 protected:
46  void spline(const std::vector<Real> & x,
47  const std::vector<Real> & y,
48  std::vector<Real> & y2,
49  Real yp1 = _deriv_bound,
50  Real ypn = _deriv_bound);
51 
52  void findInterval(const std::vector<Real> & x,
53  Real x_int,
54  unsigned int & klo,
55  unsigned int & khi) const;
56  void computeCoeffs(const std::vector<Real> & x,
57  unsigned int klo,
58  unsigned int khi,
59  Real x_int,
60  Real & h,
61  Real & a,
62  Real & b) const;
63 
64  static const Real _deriv_bound;
65 };
66 
67 #endif
void findInterval(const std::vector< Real > &x, Real x_int, unsigned int &klo, unsigned int &khi) const
Real sample2ndDerivative(const std::vector< Real > &x, const std::vector< Real > &y, const std::vector< Real > &y2, Real x_int) const
Real sample(const std::vector< Real > &x, const std::vector< Real > &y, const std::vector< Real > &y2, Real x_int) const
static PetscErrorCode Vec x
virtual ~SplineInterpolationBase()=default
void spline(const std::vector< Real > &x, const std::vector< Real > &y, std::vector< Real > &y2, Real yp1=_deriv_bound, Real ypn=_deriv_bound)
This function calculates the second derivatives based on supplied x and y-vectors.
Real sampleDerivative(const std::vector< Real > &x, const std::vector< Real > &y, const std::vector< Real > &y2, Real x_int) const
void computeCoeffs(const std::vector< Real > &x, unsigned int klo, unsigned int khi, Real x_int, Real &h, Real &a, Real &b) const