Qucs-core  0.0.18
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
interpolator.h
Go to the documentation of this file.
1 /*
2  * interpolator.h - interpolator class definitions
3  *
4  * Copyright (C) 2009 Stefan Jahn <stefan@lkcc.org>
5  *
6  * This is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this package; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  * $Id$
22  *
23  */
24 
25 #ifndef __INTERPOLATOR_H__
26 #define __INTERPOLATOR_H__
27 
28 // Type of data and interpolators.
29 #define INTERPOL_LINEAR 1
30 #define INTERPOL_CUBIC 2
31 #define INTERPOL_HOLD 4
32 
33 #define REPEAT_NO 1
34 #define REPEAT_YES 2
35 
36 #define DATA_RECTANGULAR 0x0100
37 #define DATA_POLAR 0x0200
38 #define DATA_MASK_DOMAIN 0xFF00
39 #define DATA_COMPLEX 0x0001
40 #define DATA_REAL 0x0002
41 #define DATA_MASK_TYPE 0x00FF
42 
43 namespace qucs {
44 
46 {
47  public:
48  interpolator ();
49  ~interpolator ();
50 
51  void vectors (nr_double_t *, nr_double_t *, int);
52  void vectors (nr_complex_t *, nr_double_t *, int);
55  void prepare (int, int, int domain = DATA_RECTANGULAR);
56  nr_double_t rinterpolate (nr_double_t);
57  nr_complex_t cinterpolate (nr_double_t);
58 
59 private:
60  int findIndex (nr_double_t);
61  int findIndex_old (nr_double_t);
62  nr_double_t linear (nr_double_t,
63  nr_double_t, nr_double_t, nr_double_t, nr_double_t);
64  nr_double_t rlinear (nr_double_t, int);
65  nr_complex_t clinear (nr_double_t, int);
66  void cleanup (void);
67 
68 private:
69  int dataType;
71  int repeat;
72  int length;
73  nr_double_t * rx;
74  nr_double_t * ry;
75  nr_double_t duration;
76  spline * rsp, * isp;
78 };
79 
80 } // namespace qucs
81 
82 #endif /* __INTERPOLATOR_H__ */
std::complex< nr_double_t > nr_complex_t
Definition: complex.h:31
nr_complex_t clinear(nr_double_t, int)
void prepare(int, int, int domain=DATA_RECTANGULAR)
nr_double_t rinterpolate(nr_double_t)
#define DATA_RECTANGULAR
Definition: interpolator.h:36
nr_double_t * rx
Definition: interpolator.h:73
nr_double_t linear(nr_double_t, nr_double_t, nr_double_t, nr_double_t, nr_double_t)
void cvectors(qucs::vector *, qucs::vector *)
nr_double_t * ry
Definition: interpolator.h:74
nr_double_t rlinear(nr_double_t, int)
nr_complex_t * cy
Definition: interpolator.h:77
void vectors(nr_double_t *, nr_double_t *, int)
nr_complex_t cinterpolate(nr_double_t)
int findIndex_old(nr_double_t)
int findIndex(nr_double_t)
nr_double_t duration
Definition: interpolator.h:75
void rvectors(qucs::vector *, qucs::vector *)