43 #ifndef SCI_PIECEWISEINTERP_H__
44 #define SCI_PIECEWISEINTERP_H__
53 # define msg(m) std::cout << m << std::endl;
88 if (w < min_bnd || w >= max_bnd) {
89 int lbnd = 0, rbnd = points.size()-1, delta = 0;
91 if (w>=points[lbnd] && w<=points[rbnd]) {
96 if (w >= points[curr_intrv - 1])
101 if (w <= points[curr_intrv+1]) {
107 while ((delta = rbnd - lbnd) != 1){
108 if (w < points[lbnd + delta/2]) {
117 min_bnd = points[curr_intrv];
118 max_bnd = points[curr_intrv+1];
122 curr_intrv = (w < points[lbnd]) ? lbnd : rbnd;
135 for (
int i = 1; i < pts.size(); i++) {
136 if ((pts[i] - pts[i-1]) < 1e-7) {
141 points.resize(pts.size());
149 #endif //SCI_INTERPOLATION_H__
#define msg(m)
Definition: PiecewiseInterp.h:55
virtual ~PiecewiseInterp()
Definition: PiecewiseInterp.h:71
int get_interval(double)
Definition: PiecewiseInterp.h:85
Interface to dynamic 1D array class.
int curr_intrv
Definition: PiecewiseInterp.h:63
double min_bnd
Definition: PiecewiseInterp.h:64
void reset()
Definition: PiecewiseInterp.h:77
Definition: PiecewiseInterp.h:60
PiecewiseInterp()
Definition: PiecewiseInterp.h:70
virtual bool get_value(double, T &)=0
virtual bool set_data(const Array1< double > &pts, const Array1< T > &vals)=0
bool fill_data(const Array1< double > &)
Definition: PiecewiseInterp.h:134
Array1< double > points
Definition: PiecewiseInterp.h:66
double max_bnd
Definition: PiecewiseInterp.h:65
bool data_valid
Definition: PiecewiseInterp.h:62