00001
00002 #ifndef series_coef_h
00003 #define series_coef_h
00004
00005
00006
00007 #include "sxy_vector.h"
00008 #include "sxy_series.h"
00009
00010
00011
00016 class SXYCoeficientsAproximationSeries : public SXYSeries {
00017
00019 SXYVector<SXYSeries*> *parameters_vector;
00020
00025 unsigned int max_index;
00026
00028 unsigned int num_coeficients;
00029
00031 unsigned int num_points;
00032
00036 double* buffer_x;
00037
00041 double* buffer_y;
00042
00044 double* coeficients;
00045
00047 double lxmin;
00048
00050 double lxmax;
00051
00053 double lymin;
00054
00056 double lymax;
00057
00059 unsigned int has_manual_limit;
00060
00061
00062 void resetCoeficients(void);
00063 unsigned int fillBuffer(void);
00064
00065 protected:
00066
00067
00068 virtual unsigned int calculateCoeficients(unsigned int n,
00069 double* x, double* y) = 0;
00070 void setCoeficient(unsigned int c, double coef);
00071
00072 public:
00073
00074
00075 void resetLimits(void);
00076 void setLimits(double xmin, double xmax, double ymin, double ymax);
00077 void getLimits(double& xmin, double& xmax, double& ymin, double& ymax);
00078 unsigned int getNumCoeficients(void) const;
00079 unsigned int getBufferSize(void) const;
00080
00081
00082 virtual unsigned int isLogXCallback(void) { return 0; }
00083 virtual unsigned int isLogYCallback(void) { return 0; }
00084 virtual unsigned int aproxFunctionCallback(double x, double& y) = 0;
00085
00086
00087 void getLog( unsigned int& logx, unsigned int& logy );
00088 unsigned int getCoeficient(unsigned int c, double& coef) const;
00089
00090
00091 unsigned int getNumPoints(void);
00092 unsigned int getPoint(unsigned int n, double& x, double& y);
00093
00094
00095 unsigned int getNumParameters(void) const;
00096 void insertParameter(SXYSeries* param);
00097 SXYSeries* getParameter(int i) const;
00098
00099
00100 virtual ~SXYCoeficientsAproximationSeries();
00101 SXYCoeficientsAproximationSeries(unsigned int num_variables,
00102 unsigned int buffer_size=200, unsigned int resolution=100);
00103 };
00104
00105 #endif
00106