source: branches/plotter2/src/BufferedLinearInterpolator1D.h@ 2887

Last change on this file since 2887 was 2733, 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...

Redefined Interpolator1D and derived classes as template class.


File size: 1.6 KB
Line 
1//
2// C++ Interface: BufferedLinearInterpolator1D
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_BUFFERED_LINEAR_INTERPOLATOR_1D_H
13#define ASAP_BUFFERED_LINEAR_INTERPOLATOR_1D_H
14
15#include "Interpolator1D.h"
16
17namespace asap {
18
19/**
20 * Linear interpolation with some buffers for acceleration.
21 * @author TakeshiNakazato
22 */
23template <class T, class U>
24class BufferedLinearInterpolator1D : public Interpolator1D<T, U> {
25public:
26 // Default constructor.
27 BufferedLinearInterpolator1D();
28
29 // Destructor.
30 virtual ~BufferedLinearInterpolator1D();
31
32 // Set horizontal (x) and vertical (y) data.
33 // @param[in] x pointer to horizontal data.
34 // @param[in] y pointer to vertical data.
35 // @param[in] n number of data.
36 // @see Interpolator1D::setData()
37 void setData(T *x, U *y, unsigned int n);
38
39 // Set horizontal data (x).
40 // @param[in] x pointer to horizontal data.
41 // @param[in] n number of data.
42 // @see Interpolator1D::setX()
43 void setX(T *x, unsigned int n);
44
45 // Perform interpolation.
46 // @param[in] x horizontal location where the value is evaluated
47 // by interpolation.
48 // @return interpolated value at x.
49 // @see Interpolator1D::interpolate()
50 U interpolate(T x);
51
52private:
53 // Numerical factor for linear interpolation.
54 T factor_;
55
56 // Previous location.
57 T xold_;
58
59 // Previous location as an index
60 unsigned int prev_;
61
62 // Boolean parameter whether buffered values are effective or not.
63 bool reusable_;
64};
65
66}
67
68#include "BufferedLinearInterpolator1D.tcc"
69
70#endif
Note: See TracBrowser for help on using the repository browser.