18 const std::vector<Real> & x2,
19 const std::vector<std::vector<Real>> & y,
20 const std::vector<Real> & yx11,
21 const std::vector<Real> & yx1n,
22 const std::vector<Real> & yx21,
23 const std::vector<Real> & yx2n)
47 const std::vector<Real> & x2,
48 const std::vector<std::vector<Real>> & y,
49 const std::vector<Real> & yx11,
50 const std::vector<Real> & yx1n,
51 const std::vector<Real> & yx21,
52 const std::vector<Real> & yx2n)
77 auto m =
_x1.size(), n =
_x2.size();
80 mooseError(
"y row dimension does not match the size of x1.");
82 for (
decltype(m) i = 0; i <
_y.size(); ++i)
83 if (
_y[i].size() != n)
84 mooseError(
"y column dimension does not match the size of x2.");
88 else if (
_yx11.size() != n)
89 mooseError(
"The length of the vectors holding the first derivatives of y with respect to x1 "
90 "must match the length of x2.");
94 else if (
_yx1n.size() != n)
95 mooseError(
"The length of the vectors holding the first derivatives of y with respect to x1 "
96 "must match the length of x2.");
100 else if (
_yx21.size() != m)
101 mooseError(
"The length of the vectors holding the first derivatives of y with respect to x2 "
102 "must match the length of x1.");
106 else if (
_yx2n.size() != m)
107 mooseError(
"The length of the vectors holding the first derivatives of y with respect to x2 "
108 "must match the length of x1.");
118 for (
decltype(m) j = 0; j < m; ++j)
122 for (
decltype(m) j = 0; j < m; ++j)
134 for (
decltype(n) j = 0; j < n; ++j)
138 for (
decltype(n) i = 0; i <
_y.size(); ++i)
139 for (
decltype(n) j = 0; j <
_y[0].size(); ++j)
143 for (
decltype(n) j = 0; j < n; ++j)
147 for (
decltype(n) j = 0; j < n; ++j)
173 unsigned int deriv_var,
188 else if (deriv_var == 2)
198 mooseError(
"deriv_var must be either 1 or 2 in BicubicSplineInterpolation");
204 unsigned int deriv_var,
219 else if (deriv_var == 2)
229 mooseError(
"deriv_var must be either 1 or 2 in BicubicSplineInterpolation");
255 std::vector<Real> & column_spline_eval,
256 std::vector<Real> & row_spline_second_derivs,
263 unsigned int klo, khi;
268 for (
decltype(n) j = 0; j < n; ++j)
274 spline(
_x2, column_spline_eval, row_spline_second_derivs, yx11, yx1n);
279 std::vector<Real> & row_spline_eval,
280 std::vector<Real> & column_spline_second_derivs,
287 unsigned int klo, khi;
292 for (
decltype(m) j = 0; j < m; ++j)
297 spline(
_x1, row_spline_eval, column_spline_second_derivs, yx21, yx2n);
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
void setData(const std::vector< Real > &x1, const std::vector< Real > &x2, const std::vector< std::vector< Real > > &y, const std::vector< Real > &yx11=std::vector< Real >(), const std::vector< Real > &yx1n=std::vector< Real >(), const std::vector< Real > &yx21=std::vector< Real >(), const std::vector< Real > &yx2n=std::vector< Real >())
Set the x1, x2 and y values, and first derivatives at the edges.
std::vector< std::vector< Real > > _y_trans
Transpose of _y.
std::vector< std::vector< Real > > _y2_rows
Second derivatives.
Real sample2ndDerivative(Real x1, Real x2, unsigned int deriv_var, Real yp1=_deriv_bound, Real ypn=_deriv_bound)
Samples second derivative at point (x1, x2)
std::vector< Real > _column_spline_second_derivs
void sampleValueAndDerivatives(Real x1, Real x2, Real &y, Real &dy1, Real &dy2, Real yx11=_deriv_bound, Real yx1n=_deriv_bound, Real yx21=_deriv_bound, Real yx2n=_deriv_bound)
Samples value and first derivatives at point (x1, x2) Use this function for speed when computing both...
void constructColumnSpline(Real x2, std::vector< Real > &spline_eval, std::vector< Real > &spline_second_derivs, Real yx21=_deriv_bound, Real yx2n=_deriv_bound)
Helper functions to evaluate row splines and construct column spline for the given point.
BicubicSplineInterpolation()
Real sampleDerivative(Real x1, Real x2, unsigned int deriv_var, Real yp1=_deriv_bound, Real ypn=_deriv_bound)
Samples first derivative at point (x1, x2)
static int _file_number
File number for data dump.
std::vector< Real > _yx1n
Real sample(Real x1, Real x2, Real yx11=_deriv_bound, Real yx1n=_deriv_bound)
Samples value at point (x1, x2)
std::vector< Real > _yx21
void errorCheck()
Sanity checks on input data.
std::vector< Real > _column_spline_eval
std::vector< std::vector< Real > > _y2_columns
std::vector< Real > _x1
Independent values in the x1 direction.
void solve()
Calculates the tables of second derivatives.
std::vector< Real > _yx2n
std::vector< Real > _row_spline_second_derivs
Vectors used during sampling.
std::vector< Real > _yx11
Boundary conditions.
std::vector< Real > _x2
Independent values in the x2 direction.
std::vector< Real > _row_spline_eval
std::vector< std::vector< Real > > _y
The dependent values at (x1, x2) points.
void constructRowSplineSecondDerivativeTable()
Precompute tables of row (column) spline second derivatives and store them to reduce computational de...
void constructRowSpline(Real x1, std::vector< Real > &spline_eval, std::vector< Real > &spline_second_derivs, Real yx11=_deriv_bound, Real yx1n=_deriv_bound)
Helper functions to evaluate column splines and construct row spline for the given point.
void constructColumnSplineSecondDerivativeTable()
Real sampleDerivative(const std::vector< Real > &x, const std::vector< Real > &y, const std::vector< Real > &y2, Real x_int) 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
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.
void findInterval(const std::vector< Real > &x, Real x_int, unsigned int &klo, unsigned int &khi) const
static const Real _deriv_bound