source: trunk/src/CubicSplineInterpolator1D.h@ 2896

Last change on this file since 2896 was 2736, checked in by Takeshi Nakazato, 12 years ago

New Development: No

JIRA Issue: Yes CAS-4770

Ready for Test: Yes

Interface Changes: Yes/No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Bug fix on reusable_ attribute.


File size: 1.9 KB
RevLine 
[2727]1//
2// C++ Interface: CubicSplineInterpolator1D
3//
4// Description:
5//
6//
7// Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp>, (C) 2012
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12#ifndef ASAP_CUBIC_SPLINE_INTERPOLATOR_1D_H
13#define ASAP_CUBIC_SPLINE_INTERPOLATOR_1D_H
14
15#include "Interpolator1D.h"
16
17namespace asap {
18
19/**
[2730]20 * Implementation of (natural) cubic spline interpolation.
[2727]21 * @author TakeshiNakazato
22 */
[2733]23template <class T, class U>
24class CubicSplineInterpolator1D : public Interpolator1D<T, U> {
[2727]25public:
[2730]26 // Default constructor.
[2727]27 CubicSplineInterpolator1D();
28
[2730]29 // Destructor.
[2727]30 virtual ~CubicSplineInterpolator1D();
31
[2730]32 // Override Interpolator1D::setData.
33 // @see Interpolator1D::setData
[2733]34 void setData(T *x, U *y, unsigned int n);
[2730]35
[2736]36 // Override Interpolate1D::setX.
37 // @see Interpolate1D::setX()
38 void setX(T *x, unsigned int n);
39
[2730]40 // Override Interpolator1D::setY.
41 // @see Interpolator1D::setY()
[2733]42 void setY(U *y, unsigned int n);
[2730]43
44 // Perform interpolation.
45 // @param[in] x horizontal location where the value is evaluated
46 // by interpolation.
47 // @return interpolated value at x.
[2733]48 U interpolate(T x);
[2727]49private:
[2730]50 // Determine second derivatives of each point based on
51 // natural cubic spline condition (second derivative at each
52 // end is zero).
53 void evaly2();
[2727]54
[2730]55 // Do interpolation using second derivatives determined by evaly2().
56 // @param[in] x horizontal location where the value is evaluated
57 // by interpolation.
58 // @param[in] i location index for x.
59 // @return interpolated value at x.
[2733]60 U dospline(T x, unsigned int i);
[2727]61
[2730]62 // Array to store second derivatives on the data points.
[2733]63 U *y2_;
[2730]64
65 // number of data points for second derivatives
[2727]66 unsigned int ny2_;
[2730]67
68 // Boolean parameter whether buffered values are effective or not.
[2727]69 bool reusable_;
70};
71
72}
[2733]73
74#include "CubicSplineInterpolator1D.tcc"
75
[2727]76#endif
Note: See TracBrowser for help on using the repository browser.