source: trunk/src/CubicSplineInterpolator1D.h@ 2732

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

New Development: No

JIRA Issue: Yes CAS-4770

Ready for Test: Yes

Interface Changes: 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...

Rewrite implementations for locator and interpolator.
Documentation (doxygen format) is added to header files.


File size: 1.7 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 */
23class CubicSplineInterpolator1D : public Interpolator1D {
24public:
[2730]25 // Default constructor.
[2727]26 CubicSplineInterpolator1D();
27
[2730]28 // Destructor.
[2727]29 virtual ~CubicSplineInterpolator1D();
30
[2730]31 // Override Interpolator1D::setData.
32 // @see Interpolator1D::setData
33 void setData(double *x, float *y, unsigned int n);
34
35 // Override Interpolator1D::setY.
36 // @see Interpolator1D::setY()
[2727]37 void setY(float *y, unsigned int n);
[2730]38
39 // Perform interpolation.
40 // @param[in] x horizontal location where the value is evaluated
41 // by interpolation.
42 // @return interpolated value at x.
[2727]43 float interpolate(double x);
44private:
[2730]45 // Determine second derivatives of each point based on
46 // natural cubic spline condition (second derivative at each
47 // end is zero).
48 void evaly2();
[2727]49
[2730]50 // Do interpolation using second derivatives determined by evaly2().
51 // @param[in] x horizontal location where the value is evaluated
52 // by interpolation.
53 // @param[in] i location index for x.
54 // @return interpolated value at x.
55 float dospline(double x, unsigned int i);
[2727]56
[2730]57 // Array to store second derivatives on the data points.
[2727]58 float *y2_;
[2730]59
60 // number of data points for second derivatives
[2727]61 unsigned int ny2_;
[2730]62
63 // Boolean parameter whether buffered values are effective or not.
[2727]64 bool reusable_;
65};
66
67}
68#endif
Note: See TracBrowser for help on using the repository browser.