https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MonotoneCubicInterpolation Class Reference

This class interpolates values given a set of data pairs and an abscissa. More...

#include <MonotoneCubicInterpolation.h>

Public Member Functions

 MonotoneCubicInterpolation ()
 Empty constructor.
 
 MonotoneCubicInterpolation (const std::vector< Real > &x, const std::vector< Real > &y)
 Constructor, Takes two vectors of points for which to apply the fit.
 
virtual ~MonotoneCubicInterpolation ()=default
 
virtual void setData (const std::vector< Real > &x, const std::vector< Real > &y)
 Method generally used when MonotoneCubicInterpolation object was created using the empty constructor.
 
virtual Real sample (const Real &x) const
 This function will take an independent variable input and will return the dependent variable based on the generated fit.
 
virtual Real sampleDerivative (const Real &x) const
 This function will take an independent variable input and will return the derivative of the dependent variable with respect to the independent variable based on the generated fit.
 
virtual Real sample2ndDerivative (const Real &x) const
 This function will take an independent variable input and will return the second derivative of the dependent variable with respect to the independent variable based on the generated fit.
 
virtual void dumpCSV (std::string filename, const std::vector< Real > &xnew)
 This function takes an array of independent variable values and writes a CSV file with values corresponding to y, y', and y''.
 
virtual unsigned int getSampleSize ()
 This method returns the length of the independent variable vector.
 

Protected Member Functions

virtual void errorCheck ()
 
Real sign (const Real &x) const
 
Real phi (const Real &t) const
 
Real psi (const Real &t) const
 
Real phiPrime (const Real &t) const
 
Real psiPrime (const Real &t) const
 
Real phiDoublePrime (const Real &t) const
 
Real psiDoublePrime (const Real &t) const
 
Real h1 (const Real &xhi, const Real &xlo, const Real &x) const
 
Real h2 (const Real &xhi, const Real &xlo, const Real &x) const
 
Real h3 (const Real &xhi, const Real &xlo, const Real &x) const
 
Real h4 (const Real &xhi, const Real &xlo, const Real &x) const
 
Real h1Prime (const Real &xhi, const Real &xlo, const Real &x) const
 
Real h2Prime (const Real &xhi, const Real &xlo, const Real &x) const
 
Real h3Prime (const Real &xhi, const Real &xlo, const Real &x) const
 
Real h4Prime (const Real &xhi, const Real &xlo, const Real &x) const
 
Real h1DoublePrime (const Real &xhi, const Real &xlo, const Real &x) const
 
Real h2DoublePrime (const Real &xhi, const Real &xlo, const Real &x) const
 
Real h3DoublePrime (const Real &xhi, const Real &xlo, const Real &x) const
 
Real h4DoublePrime (const Real &xhi, const Real &xlo, const Real &x) const
 
virtual Real p (const Real &xhi, const Real &xlo, const Real &fhi, const Real &flo, const Real &dhi, const Real &dlo, const Real &x) const
 
virtual Real pPrime (const Real &xhi, const Real &xlo, const Real &fhi, const Real &flo, const Real &dhi, const Real &dlo, const Real &x) const
 
virtual Real pDoublePrime (const Real &xhi, const Real &xlo, const Real &fhi, const Real &flo, const Real &dhi, const Real &dlo, const Real &x) const
 
virtual void initialize_derivs ()
 
virtual void modify_derivs (const Real &alpha, const Real &beta, const Real &delta, Real &yp_lo, Real &yp_hi)
 
virtual void solve ()
 
virtual void findInterval (const Real &x, unsigned int &klo, unsigned int &khi) const
 

Protected Attributes

std::vector< Real > _x
 
std::vector< Real > _y
 
std::vector< Real > _h
 
std::vector< Real > _yp
 
std::vector< Real > _delta
 
std::vector< Real > _alpha
 
std::vector< Real > _beta
 
unsigned int _n_knots
 
unsigned int _n_intervals
 
unsigned int _internal_knots
 

Detailed Description

This class interpolates values given a set of data pairs and an abscissa.

The interpolation is cubic with at least C1 continuity; C2 continuity can be violated in favor of ensuring the interpolation is monotonic. The algorithm used is laid out in Fritsch and Carlson, SIAM J. Numer. Anal. Vol. 17(2) April 1980

Definition at line 25 of file MonotoneCubicInterpolation.h.

Constructor & Destructor Documentation

◆ MonotoneCubicInterpolation() [1/2]

MonotoneCubicInterpolation::MonotoneCubicInterpolation ( )

Empty constructor.

Definition at line 20 of file MonotoneCubicInterpolation.C.

20{}

◆ MonotoneCubicInterpolation() [2/2]

MonotoneCubicInterpolation::MonotoneCubicInterpolation ( const std::vector< Real > &  x,
const std::vector< Real > &  y 
)

Constructor, Takes two vectors of points for which to apply the fit.

One should be of the independent variable while the other should be of the dependent variable. These values should have a one-to-one correspondence, e.g. the vectors must be of the same size.

Definition at line 22 of file MonotoneCubicInterpolation.C.

◆ ~MonotoneCubicInterpolation()

virtual MonotoneCubicInterpolation::~MonotoneCubicInterpolation ( )
virtualdefault

Member Function Documentation

◆ dumpCSV()

void MonotoneCubicInterpolation::dumpCSV ( std::string  filename,
const std::vector< Real > &  xnew 
)
virtual

This function takes an array of independent variable values and writes a CSV file with values corresponding to y, y', and y''.

This can be used for sanity checks of the interpolation curve.

Definition at line 375 of file MonotoneCubicInterpolation.C.

376{
377 unsigned int n = xnew.size();
378 std::vector<Real> ynew(n), ypnew(n), yppnew(n);
379
380 std::ofstream out(filename.c_str());
381 for (unsigned int i = 0; i < n; ++i)
382 {
383 ynew[i] = sample(xnew[i]);
384 ypnew[i] = sampleDerivative(xnew[i]);
385 yppnew[i] = sample2ndDerivative(xnew[i]);
386 out << xnew[i] << ", " << ynew[i] << ", " << ypnew[i] << ", " << yppnew[i] << "\n";
387 }
388
389 out << std::flush;
390 out.close();
391}
virtual Real sample(const Real &x) const
This function will take an independent variable input and will return the dependent variable based on...
virtual Real sample2ndDerivative(const Real &x) const
This function will take an independent variable input and will return the second derivative of the de...
virtual Real sampleDerivative(const Real &x) const
This function will take an independent variable input and will return the derivative of the dependent...
OStreamProxy out(std::cout)

◆ errorCheck()

void MonotoneCubicInterpolation::errorCheck ( )
protectedvirtual

Definition at line 40 of file MonotoneCubicInterpolation.C.

41{
42 if (_x.size() != _y.size())
43 throw std::domain_error("MonotoneCubicInterpolation: x and y vectors are not the same length");
44
45 if (_x.size() < 3)
46 throw std::domain_error("MonotoneCubicInterpolation: " + Moose::stringify(_x.size()) +
47 " points is not enough data for a cubic interpolation");
48
49 bool error = false;
50 for (unsigned i = 0; !error && i + 1 < _x.size(); ++i)
51 if (_x[i] >= _x[i + 1])
52 error = true;
53
54 if (error)
55 throw std::domain_error("x-values are not strictly increasing");
56}
std::string stringify(const T &t)
conversion to string
Definition Conversion.h:64

Referenced by MonotoneCubicInterpolation(), and setData().

◆ findInterval()

void MonotoneCubicInterpolation::findInterval ( const Real &  x,
unsigned int klo,
unsigned int khi 
) const
protectedvirtual

Definition at line 330 of file MonotoneCubicInterpolation.C.

333{
334 klo = 0;
335 khi = _n_knots - 1;
336 while (khi - klo > 1)
337 {
338 unsigned int k = (khi + klo) >> 1;
339 if (_x[k] > x)
340 khi = k;
341 else
342 klo = k;
343 }
344}

Referenced by sample(), sample2ndDerivative(), and sampleDerivative().

◆ getSampleSize()

unsigned int MonotoneCubicInterpolation::getSampleSize ( )
virtual

This method returns the length of the independent variable vector.

Definition at line 394 of file MonotoneCubicInterpolation.C.

395{
396 return _x.size();
397}

◆ h1()

Real MonotoneCubicInterpolation::h1 ( const Real &  xhi,
const Real &  xlo,
const Real &  x 
) const
protected

Definition at line 106 of file MonotoneCubicInterpolation.C.

107{
108 Real h = xhi - xlo;
109 Real t = (xhi - x) / h;
110 return phi(t);
111}
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Referenced by p().

◆ h1DoublePrime()

Real MonotoneCubicInterpolation::h1DoublePrime ( const Real &  xhi,
const Real &  xlo,
const Real &  x 
) const
protected

Definition at line 123 of file MonotoneCubicInterpolation.C.

124{
125 Real h = xhi - xlo;
126 Real t = (xhi - x) / h;
127 Real tPrime = -1. / h;
128 return phiDoublePrime(t) * tPrime * tPrime;
129}
Real phiDoublePrime(const Real &t) const

Referenced by pDoublePrime().

◆ h1Prime()

Real MonotoneCubicInterpolation::h1Prime ( const Real &  xhi,
const Real &  xlo,
const Real &  x 
) const
protected

Definition at line 114 of file MonotoneCubicInterpolation.C.

115{
116 Real h = xhi - xlo;
117 Real t = (xhi - x) / h;
118 Real tPrime = -1. / h;
119 return phiPrime(t) * tPrime;
120}
Real phiPrime(const Real &t) const

Referenced by pPrime().

◆ h2()

Real MonotoneCubicInterpolation::h2 ( const Real &  xhi,
const Real &  xlo,
const Real &  x 
) const
protected

Definition at line 132 of file MonotoneCubicInterpolation.C.

133{
134 Real h = xhi - xlo;
135 Real t = (x - xlo) / h;
136 return phi(t);
137}

Referenced by p().

◆ h2DoublePrime()

Real MonotoneCubicInterpolation::h2DoublePrime ( const Real &  xhi,
const Real &  xlo,
const Real &  x 
) const
protected

Definition at line 149 of file MonotoneCubicInterpolation.C.

150{
151 Real h = xhi - xlo;
152 Real t = (x - xlo) / h;
153 Real tPrime = 1. / h;
154 return phiDoublePrime(t) * tPrime * tPrime;
155}

Referenced by pDoublePrime().

◆ h2Prime()

Real MonotoneCubicInterpolation::h2Prime ( const Real &  xhi,
const Real &  xlo,
const Real &  x 
) const
protected

Definition at line 140 of file MonotoneCubicInterpolation.C.

141{
142 Real h = xhi - xlo;
143 Real t = (x - xlo) / h;
144 Real tPrime = 1. / h;
145 return phiPrime(t) * tPrime;
146}

Referenced by pPrime().

◆ h3()

Real MonotoneCubicInterpolation::h3 ( const Real &  xhi,
const Real &  xlo,
const Real &  x 
) const
protected

Definition at line 158 of file MonotoneCubicInterpolation.C.

159{
160 Real h = xhi - xlo;
161 Real t = (xhi - x) / h;
162 return -h * psi(t);
163}

Referenced by p().

◆ h3DoublePrime()

Real MonotoneCubicInterpolation::h3DoublePrime ( const Real &  xhi,
const Real &  xlo,
const Real &  x 
) const
protected

Definition at line 175 of file MonotoneCubicInterpolation.C.

176{
177 Real h = xhi - xlo;
178 Real t = (xhi - x) / h;
179 Real tPrime = -1. / h;
180 return psiDoublePrime(t) * tPrime;
181}
Real psiDoublePrime(const Real &t) const

Referenced by pDoublePrime().

◆ h3Prime()

Real MonotoneCubicInterpolation::h3Prime ( const Real &  xhi,
const Real &  xlo,
const Real &  x 
) const
protected

Definition at line 166 of file MonotoneCubicInterpolation.C.

167{
168 Real h = xhi - xlo;
169 Real t = (xhi - x) / h;
170 Real tPrime = -1. / h;
171 return -h * psiPrime(t) * tPrime; // psiPrime(t)
172}
Real psiPrime(const Real &t) const

Referenced by pPrime().

◆ h4()

Real MonotoneCubicInterpolation::h4 ( const Real &  xhi,
const Real &  xlo,
const Real &  x 
) const
protected

Definition at line 184 of file MonotoneCubicInterpolation.C.

185{
186 Real h = xhi - xlo;
187 Real t = (x - xlo) / h;
188 return h * psi(t);
189}

Referenced by p().

◆ h4DoublePrime()

Real MonotoneCubicInterpolation::h4DoublePrime ( const Real &  xhi,
const Real &  xlo,
const Real &  x 
) const
protected

Definition at line 201 of file MonotoneCubicInterpolation.C.

202{
203 Real h = xhi - xlo;
204 Real t = (x - xlo) / h;
205 Real tPrime = 1. / h;
206 return psiDoublePrime(t) * tPrime;
207}

Referenced by pDoublePrime().

◆ h4Prime()

Real MonotoneCubicInterpolation::h4Prime ( const Real &  xhi,
const Real &  xlo,
const Real &  x 
) const
protected

Definition at line 192 of file MonotoneCubicInterpolation.C.

193{
194 Real h = xhi - xlo;
195 Real t = (x - xlo) / h;
196 Real tPrime = 1. / h;
197 return h * psiPrime(t) * tPrime; // psiPrime(t)
198}

Referenced by pPrime().

◆ initialize_derivs()

void MonotoneCubicInterpolation::initialize_derivs ( )
protectedvirtual

Definition at line 249 of file MonotoneCubicInterpolation.C.

250{
251 for (unsigned int i = 1; i < _n_knots - 1; ++i)
252 _yp[i] = (std::pow(_h[i - 1], 2) * _y[i + 1] - std::pow(_h[i], 2) * _y[i - 1] -
253 _y[i] * (_h[i - 1] - _h[i]) * (_h[i - 1] + _h[i])) /
254 (_h[i - 1] * _h[i] * (_h[i - 1] * _h[i]));
255
256 _yp[0] = (-std::pow(_h[0], 2) * _y[2] - _h[1] * _y[0] * (2 * _h[0] + _h[1]) +
257 _y[1] * std::pow(_h[0] + _h[1], 2)) /
258 (_h[0] * _h[1] * (_h[0] + _h[1]));
259
260 Real hlast = _h[_n_intervals - 1];
261 Real hsecond = _h[_n_intervals - 2];
262 Real ylast = _y[_n_knots - 1];
263 Real ysecond = _y[_n_knots - 2];
264 Real ythird = _y[_n_knots - 3];
265 _yp[_n_knots - 1] = (hsecond * ylast * (hsecond + 2 * hlast) + std::pow(hlast, 2) * ythird -
266 ysecond * std::pow(hsecond + hlast, 2)) /
267 (hsecond * hlast * (hsecond + hlast));
268}
MooseUnits pow(const MooseUnits &, int)
Definition Units.C:537

Referenced by solve().

◆ modify_derivs()

void MonotoneCubicInterpolation::modify_derivs ( const Real &  alpha,
const Real &  beta,
const Real &  delta,
Real &  yp_lo,
Real &  yp_hi 
)
protectedvirtual

Definition at line 271 of file MonotoneCubicInterpolation.C.

273{
274 Real tau = 3. / std::sqrt(std::pow(alpha, 2) + std::pow(beta, 2));
275 Real alpha_star = alpha * tau;
276 Real beta_star = beta * tau;
277 yp_lo = alpha_star * delta;
278 yp_hi = beta_star * delta;
279}

Referenced by solve().

◆ p()

Real MonotoneCubicInterpolation::p ( const Real &  xhi,
const Real &  xlo,
const Real &  fhi,
const Real &  flo,
const Real &  dhi,
const Real &  dlo,
const Real &  x 
) const
protectedvirtual

Definition at line 210 of file MonotoneCubicInterpolation.C.

217{
218 return flo * h1(xhi, xlo, x) + fhi * h2(xhi, xlo, x) + dlo * h3(xhi, xlo, x) +
219 dhi * h4(xhi, xlo, x);
220}
Real h3(const Real &xhi, const Real &xlo, const Real &x) const
Real h4(const Real &xhi, const Real &xlo, const Real &x) const
Real h1(const Real &xhi, const Real &xlo, const Real &x) const
Real h2(const Real &xhi, const Real &xlo, const Real &x) const

Referenced by sample().

◆ pDoublePrime()

Real MonotoneCubicInterpolation::pDoublePrime ( const Real &  xhi,
const Real &  xlo,
const Real &  fhi,
const Real &  flo,
const Real &  dhi,
const Real &  dlo,
const Real &  x 
) const
protectedvirtual

Definition at line 236 of file MonotoneCubicInterpolation.C.

243{
244 return flo * h1DoublePrime(xhi, xlo, x) + fhi * h2DoublePrime(xhi, xlo, x) +
245 dlo * h3DoublePrime(xhi, xlo, x) + dhi * h4DoublePrime(xhi, xlo, x);
246}
Real h4DoublePrime(const Real &xhi, const Real &xlo, const Real &x) const
Real h3DoublePrime(const Real &xhi, const Real &xlo, const Real &x) const
Real h2DoublePrime(const Real &xhi, const Real &xlo, const Real &x) const
Real h1DoublePrime(const Real &xhi, const Real &xlo, const Real &x) const

Referenced by sample2ndDerivative().

◆ phi()

Real MonotoneCubicInterpolation::phi ( const Real &  t) const
protected

Definition at line 70 of file MonotoneCubicInterpolation.C.

71{
72 return 3. * t * t - 2. * t * t * t;
73}

Referenced by h1(), and h2().

◆ phiDoublePrime()

Real MonotoneCubicInterpolation::phiDoublePrime ( const Real &  t) const
protected

Definition at line 82 of file MonotoneCubicInterpolation.C.

83{
84 return 6. - 12. * t;
85}

Referenced by h1DoublePrime(), and h2DoublePrime().

◆ phiPrime()

Real MonotoneCubicInterpolation::phiPrime ( const Real &  t) const
protected

Definition at line 76 of file MonotoneCubicInterpolation.C.

77{
78 return 6. * t - 6. * t * t;
79}

Referenced by h1Prime(), and h2Prime().

◆ pPrime()

Real MonotoneCubicInterpolation::pPrime ( const Real &  xhi,
const Real &  xlo,
const Real &  fhi,
const Real &  flo,
const Real &  dhi,
const Real &  dlo,
const Real &  x 
) const
protectedvirtual

Definition at line 223 of file MonotoneCubicInterpolation.C.

230{
231 return flo * h1Prime(xhi, xlo, x) + fhi * h2Prime(xhi, xlo, x) + dlo * h3Prime(xhi, xlo, x) +
232 dhi * h4Prime(xhi, xlo, x);
233}
Real h2Prime(const Real &xhi, const Real &xlo, const Real &x) const
Real h1Prime(const Real &xhi, const Real &xlo, const Real &x) const
Real h4Prime(const Real &xhi, const Real &xlo, const Real &x) const
Real h3Prime(const Real &xhi, const Real &xlo, const Real &x) const

Referenced by sampleDerivative().

◆ psi()

Real MonotoneCubicInterpolation::psi ( const Real &  t) const
protected

Definition at line 88 of file MonotoneCubicInterpolation.C.

89{
90 return t * t * t - t * t;
91}

Referenced by h3(), and h4().

◆ psiDoublePrime()

Real MonotoneCubicInterpolation::psiDoublePrime ( const Real &  t) const
protected

Definition at line 100 of file MonotoneCubicInterpolation.C.

101{
102 return 6. * t - 2.;
103}

Referenced by h3DoublePrime(), and h4DoublePrime().

◆ psiPrime()

Real MonotoneCubicInterpolation::psiPrime ( const Real &  t) const
protected

Definition at line 94 of file MonotoneCubicInterpolation.C.

95{
96 return 3. * t * t - 2. * t;
97}

Referenced by h3Prime(), and h4Prime().

◆ sample()

Real MonotoneCubicInterpolation::sample ( const Real &  x) const
virtual

This function will take an independent variable input and will return the dependent variable based on the generated fit.

Definition at line 347 of file MonotoneCubicInterpolation.C.

348{
349 // sanity check (empty MontoneCubicInterpolations are constructable
350 // so we cannot put this into the errorCheck)
351 assert(_x.size() > 0);
352
353 unsigned int klo, khi;
354 findInterval(x, klo, khi);
355 return p(_x[khi], _x[klo], _y[khi], _y[klo], _yp[khi], _yp[klo], x);
356}
virtual Real p(const Real &xhi, const Real &xlo, const Real &fhi, const Real &flo, const Real &dhi, const Real &dlo, const Real &x) const
virtual void findInterval(const Real &x, unsigned int &klo, unsigned int &khi) const

Referenced by dumpCSV().

◆ sample2ndDerivative()

Real MonotoneCubicInterpolation::sample2ndDerivative ( const Real &  x) const
virtual

This function will take an independent variable input and will return the second derivative of the dependent variable with respect to the independent variable based on the generated fit.

Note that this can be discontinous at the knots.

Definition at line 367 of file MonotoneCubicInterpolation.C.

368{
369 unsigned int klo, khi;
370 findInterval(x, klo, khi);
371 return pDoublePrime(_x[khi], _x[klo], _y[khi], _y[klo], _yp[khi], _yp[klo], x);
372}
virtual Real pDoublePrime(const Real &xhi, const Real &xlo, const Real &fhi, const Real &flo, const Real &dhi, const Real &dlo, const Real &x) const

Referenced by dumpCSV().

◆ sampleDerivative()

Real MonotoneCubicInterpolation::sampleDerivative ( const Real &  x) const
virtual

This function will take an independent variable input and will return the derivative of the dependent variable with respect to the independent variable based on the generated fit.

Definition at line 359 of file MonotoneCubicInterpolation.C.

360{
361 unsigned int klo, khi;
362 findInterval(x, klo, khi);
363 return pPrime(_x[khi], _x[klo], _y[khi], _y[klo], _yp[khi], _yp[klo], x);
364}
virtual Real pPrime(const Real &xhi, const Real &xlo, const Real &fhi, const Real &flo, const Real &dhi, const Real &dlo, const Real &x) const

Referenced by dumpCSV().

◆ setData()

void MonotoneCubicInterpolation::setData ( const std::vector< Real > &  x,
const std::vector< Real > &  y 
)
virtual

Method generally used when MonotoneCubicInterpolation object was created using the empty constructor.

Takes two vectors of points for which to apply the fit. One should be of the independent variable while the other should be of the dependent variable. These values should have a one-to-one correspondence, e.g. the vectors must be of the same size.

Definition at line 31 of file MonotoneCubicInterpolation.C.

32{
33 _x = x;
34 _y = y;
35 errorCheck();
36 solve();
37}

◆ sign()

Real MonotoneCubicInterpolation::sign ( const Real &  x) const
protected

Definition at line 59 of file MonotoneCubicInterpolation.C.

60{
61 if (x < 0)
62 return -1;
63 else if (x > 0)
64 return 1;
65 else
66 return 0;
67}

Referenced by solve().

◆ solve()

void MonotoneCubicInterpolation::solve ( )
protectedvirtual

Definition at line 282 of file MonotoneCubicInterpolation.C.

283{
284 _n_knots = _x.size(), _n_intervals = _x.size() - 1, _internal_knots = _x.size() - 2;
285 _h.resize(_n_intervals);
286 _yp.resize(_n_knots);
287 _delta.resize(_n_intervals);
288 _alpha.resize(_n_intervals);
289 _beta.resize(_n_intervals);
290
291 for (unsigned int i = 0; i < _n_intervals; ++i)
292 _h[i] = _x[i + 1] - _x[i];
293
295 for (unsigned int i = 0; i < _n_intervals; ++i)
296 _delta[i] = (_y[i + 1] - _y[i]) / _h[i];
297 if (sign(_delta[0]) != sign(_yp[0]))
298 _yp[0] = 0;
299 if (sign(_delta[_n_intervals - 1]) != sign(_yp[_n_knots - 1]))
300 _yp[_n_knots - 1] = 0;
301 for (unsigned int i = 0; i < _internal_knots; ++i)
302 if (sign(_delta[i + 1]) == 0 || sign(_delta[i]) == 0 || sign(_delta[i + 1]) != sign(_delta[i]))
303 _yp[1 + i] = 0;
304
305 for (unsigned int i = 0; i < _n_intervals; ++i)
306 {
307 // Test for zero slope
308 if (_yp[i] == 0)
309 _alpha[i] = 0;
310 else if (_delta[i] == 0)
311 _alpha[i] = 4;
312 else
313 _alpha[i] = _yp[i] / _delta[i];
314
315 // Test for zero slope
316 if (_yp[i + 1] == 0)
317 _beta[i] = 0;
318 else if (_delta[i] == 0)
319 _beta[i] = 4;
320 else
321 _beta[i] = _yp[i + 1] / _delta[i];
322
323 // check if outside region of monotonicity
324 if (std::pow(_alpha[i], 2) + std::pow(_beta[i], 2) > 9.)
325 modify_derivs(_alpha[i], _beta[i], _delta[i], _yp[i], _yp[i + 1]);
326 }
327}
virtual void modify_derivs(const Real &alpha, const Real &beta, const Real &delta, Real &yp_lo, Real &yp_hi)

Referenced by MonotoneCubicInterpolation(), and setData().

Member Data Documentation

◆ _alpha

std::vector<Real> MonotoneCubicInterpolation::_alpha
protected

Definition at line 146 of file MonotoneCubicInterpolation.h.

Referenced by solve().

◆ _beta

std::vector<Real> MonotoneCubicInterpolation::_beta
protected

Definition at line 147 of file MonotoneCubicInterpolation.h.

Referenced by solve().

◆ _delta

std::vector<Real> MonotoneCubicInterpolation::_delta
protected

Definition at line 145 of file MonotoneCubicInterpolation.h.

Referenced by solve().

◆ _h

std::vector<Real> MonotoneCubicInterpolation::_h
protected

Definition at line 143 of file MonotoneCubicInterpolation.h.

Referenced by initialize_derivs(), and solve().

◆ _internal_knots

unsigned int MonotoneCubicInterpolation::_internal_knots
protected

Definition at line 151 of file MonotoneCubicInterpolation.h.

Referenced by solve().

◆ _n_intervals

unsigned int MonotoneCubicInterpolation::_n_intervals
protected

Definition at line 150 of file MonotoneCubicInterpolation.h.

Referenced by initialize_derivs(), and solve().

◆ _n_knots

unsigned int MonotoneCubicInterpolation::_n_knots
protected

Definition at line 149 of file MonotoneCubicInterpolation.h.

Referenced by findInterval(), initialize_derivs(), and solve().

◆ _x

std::vector<Real> MonotoneCubicInterpolation::_x
protected

◆ _y

std::vector<Real> MonotoneCubicInterpolation::_y
protected

◆ _yp

std::vector<Real> MonotoneCubicInterpolation::_yp
protected

The documentation for this class was generated from the following files: