Flow123d  jenkins-Flow123d-windows32-release-multijob-51
adaptivesimpson.hh
Go to the documentation of this file.
1 #ifndef ADAPTIVESIMPSON_H
2 #define ADAPTIVESIMPSON_H
3 
4 #include "functors.hh"
5 
6 #define MAX_RECURSION 1e+7
7 
8 
9 ///Static class implementing integration using Simpson's rule.
10 /** Uses 3-point Simpson's rule to evaluate an intergral on interval a,b.
11  * Divides interval in halves in recusion until the difference
12  * between values of Simpson's rule before and after division is
13  * smaller then \f$ 15\epsilon \f$.
14  */
16 {
17  private:
18  ///Evaluates the Simpson's rule.
19  static double Simpson ( const double& h, const double &fa, const double &fc, const double &fb );
20 
21  ///the recursive method
22  static double SimpsonAd( FunctorBase<double> &func,
23  const double& h, const double &a, const double &c, const double &b,
24  const double &fa, const double &fc, const double &fb,
25  const double &sx, const double &tol, long &recursion );
26 
27  public:
28 
29  ///main method that starts the evaluation and calls the recursion
30  static double AdaptSimpson( FunctorBase<double> &func,
31  const double& a, const double& b,
32  const double& tol );
33 };
34 
35 
36 
37 #endif //ADAPTIVESIMPSON_H
static double SimpsonAd(FunctorBase< double > &func, const double &h, const double &a, const double &c, const double &b, const double &fa, const double &fc, const double &fb, const double &sx, const double &tol, long &recursion)
the recursive method
Static class implementing integration using Simpson's rule.
static double AdaptSimpson(FunctorBase< double > &func, const double &a, const double &b, const double &tol)
main method that starts the evaluation and calls the recursion
static double Simpson(const double &h, const double &fa, const double &fc, const double &fb)
Evaluates the Simpson's rule.