35 |
|
* |
36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
38 |
< |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
39 |
< |
* [4] Vardeman & Gezelter, in progress (2009). |
38 |
> |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). |
39 |
> |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
40 |
> |
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
41 |
|
*/ |
42 |
|
|
43 |
|
#ifndef MATH_CUBICSPLINE_HPP |
54 |
|
public: |
55 |
|
CubicSpline(); |
56 |
|
virtual ~CubicSpline() {} |
57 |
< |
void addPoint(RealType xp, RealType yp); |
57 |
> |
void addPoint(const RealType xp, const RealType yp); |
58 |
|
void addPoints(const vector<RealType>& xps, const vector<RealType>& yps); |
59 |
< |
RealType getValueAt(RealType t); |
60 |
< |
pair<RealType, RealType> getValueAndDerivativeAt(RealType t); |
59 |
> |
RealType getValueAt(const RealType& t); |
60 |
> |
pair<RealType, RealType> getLimits(); |
61 |
> |
void getValueAt(const RealType& t, RealType& v); |
62 |
> |
void getValueAndDerivativeAt(const RealType& t, RealType& v, RealType& d); |
63 |
|
|
64 |
|
private: |
65 |
|
void generate(); |
66 |
+ |
std::vector<int> sort_permutation(std::vector<RealType>& v); |
67 |
+ |
std::vector<RealType> apply_permutation(std::vector<RealType> const& v, |
68 |
+ |
std::vector<int> const& p); |
69 |
+ |
|
70 |
|
bool isUniform; |
71 |
|
bool generated; |
72 |
< |
RealType dx; |
73 |
< |
int n; |
74 |
< |
vector<pair<RealType, RealType> > data; |
72 |
> |
RealType dx, dt, yval, dydx; |
73 |
> |
int n, j; |
74 |
> |
vector<RealType> x_; |
75 |
> |
vector<RealType> y_; |
76 |
|
vector<RealType> b; |
77 |
|
vector<RealType> c; |
78 |
|
vector<RealType> d; |
79 |
|
}; |
80 |
+ |
|
81 |
+ |
class Comparator{ |
82 |
+ |
std::vector<RealType>& _v; |
83 |
+ |
public: |
84 |
+ |
Comparator(std::vector<RealType>& v) : _v(v) {} |
85 |
+ |
bool operator()(size_t i, size_t j){ |
86 |
+ |
return _v[i] < _v[j]; |
87 |
+ |
} |
88 |
+ |
}; |
89 |
|
} |
90 |
|
|
91 |
|
#endif |