00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef INTEGRATION_H
00019 #define INTEGRATION_H
00020
00021 #include <odindata/data.h>
00022
00023
00034 class Integrand {
00035
00036 public:
00037
00041 virtual double evaluate(double x) const = 0;
00042
00048 double get_integral(double xmin, double xmax, unsigned int max_subintervals=1000, double error_limit=1e-7) const;
00049
00050
00051 protected:
00052 Integrand() {}
00053 virtual ~Integrand() {}
00054 };
00055
00057
00058 class GslData4Integr;
00059
00063 class FunctionIntegral {
00064
00065 public:
00066
00072 FunctionIntegral(const Integrand& func, unsigned int max_subintervals=1000, double error_limit=1e-7);
00073
00077 ~FunctionIntegral();
00078
00082 double get_integral(double xmin, double xmax) const;
00083
00084
00085 private:
00086 static double integrand(double x, void *params);
00087
00088 const Integrand& f;
00089 unsigned int n_intervals;
00090 double errlimit;
00091 GslData4Integr* gsldata;
00092
00093 };
00094
00099 #endif
00100