source: trunk/src/BufferedLinearInterpolator1D.h@ 2979

Last change on this file since 2979 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
RevLine 
[2727]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/**
[2730]20 * Linear interpolation with some buffers for acceleration.
[2727]21 * @author TakeshiNakazato
22 */
[2733]23template <class T, class U>
24class BufferedLinearInterpolator1D : public Interpolator1D<T, U> {
[2727]25public:
[2730]26 // Default constructor.
[2727]27 BufferedLinearInterpolator1D();
28
[2730]29 // Destructor.
[2727]30 virtual ~BufferedLinearInterpolator1D();
31
[2730]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()
[2733]37 void setData(T *x, U *y, unsigned int n);
[2730]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()
[2733]43 void setX(T *x, unsigned int n);
[2730]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()
[2733]50 U interpolate(T x);
[2727]51
52private:
[2730]53 // Numerical factor for linear interpolation.
[2733]54 T factor_;
[2730]55
56 // Previous location.
[2733]57 T xold_;
[2730]58
59 // Previous location as an index
[2727]60 unsigned int prev_;
[2730]61
62 // Boolean parameter whether buffered values are effective or not.
[2727]63 bool reusable_;
64};
65
66}
[2733]67
68#include "BufferedLinearInterpolator1D.tcc"
69
[2727]70#endif
Note: See TracBrowser for help on using the repository browser.