[go: up one dir, main page]

Menu

[r1123]: / trunk / src / Spline.h  Maximize  Restore  History

Download this file

60 lines (40 with data), 1.4 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef GUARD_Spline_h
#define GUARD_Spline_h
//-------------------------------------------------------------------------------------------
//
// Spline.h
//
// Author: Struan Robertson
// Date: 14/May/2012
//
// This header file contains the declaration of the Spline class.
//
//-------------------------------------------------------------------------------------------
#include <vector>
namespace mesmer
{
// Criterion for determining if the spline is natural at the end points.
static const double naturalLimit = 0.99e30 ;
class Spline {
public:
Spline() : m_x(), m_y(), m_d2ydx2(), m_splineDefined(false) {} ;
~Spline() {} ;
bool Initialize(const std::vector<double> &x, const std::vector<double> &y, double lower = naturalLimit, double upper = naturalLimit) ;
bool Initialize(const std::vector<std::pair<double,double> >* data, double lower = naturalLimit, double upper = naturalLimit) ;
double Calculate(double x) const ;
private:
Spline operator=(Spline &spline) ;
Spline(Spline &spline) ;
void Clear() {
m_x.clear();
m_y.clear() ;
m_d2ydx2.clear() ;
m_splineDefined = false ;
} ;
std::vector<double> m_x ;
std::vector<double> m_y ;
std::vector<double> m_d2ydx2 ;
bool m_splineDefined ;
} ;
}//namespacer mesmer
#endif // GUARD_Spline_h