00001 // QMcBeaver 00002 // 00003 // Constructed by 00004 // 00005 // Michael Todd Feldmann 00006 // and 00007 // David Randall "Chip" Kent IV 00008 // 00009 // Copyright 2000. All rights reserved. 00010 // 00011 // drkent@users.sourceforge.net mtfeldmann@users.sourceforge.net 00012 00013 #ifndef LINEAR_SPLINE_H 00014 #define LINEAR_SPLINE_H 00015 00016 #include <iostream> 00017 #include <string> 00018 #include <math.h> 00019 00020 #include "Array1D.h" 00021 #include "FunctionR1toR1.h" 00022 00023 using namespace std; 00024 00029 class LinearSpline : public FunctionR1toR1 00030 { 00031 public: 00032 LinearSpline(){;} //constructs a Spline_Linear 00033 00034 void operator=( const LinearSpline & rhs ); 00035 00039 void initializeWithFunctionValues(Array1D<double> &x_input, 00040 Array1D<double> &y_input); 00041 00042 void evaluate(double x); 00043 00044 double getFunctionValue(); 00045 00046 double getFirstDerivativeValue(); 00047 00048 double getSecondDerivativeValue(); 00049 00050 00051 private: 00052 Array1D<double> x_list; //domain values 00053 Array1D<double> y_list; //function values for each x 00054 Array1D<double> a0_list; //poly coeff of f at each point 00055 Array1D<double> a1_list; //poly coeff of f at each point 00056 00057 int n; //number of input data points; 00058 00059 double f; 00060 double df; 00061 }; 00062 00063 00064 #endif 00065 00066 00067 00068