3 #include <boost/foreach.hpp> 16 w = gsl_integration_workspace_alloc(Max_intervals);
21 gsl_integration_workspace_free(w);
36 (
const boost::function<
double (
double)>& F,
double xmin,
double xmax,
37 double eps_abs,
double eps_rel,
int key)
const 39 double res, error_est;
55 (
const boost::function<
double (
double)>& F,
double xmin,
double xmax,
56 const std::vector<double>& breakpoints,
57 double eps_abs,
double eps_rel,
int key)
const 59 double res, error_est;
61 eps_abs, eps_rel, key);
71 const boost::function<double (double)>* f =
72 (
const boost::function<double (double)>*) params;
89 (
const boost::function<
double (
double)>& F,
90 double xmin,
double xmax,
double &Res,
double& Error_est,
91 double eps_abs,
double eps_rel,
96 gf.params = (
void *) &F;
97 int status = gsl_integration_qags(&gf, xmin, xmax, eps_abs, eps_rel,
98 max_ninterval, w, &Res, &Error_est);
113 (
const boost::function<
double (
double)>& F,
114 double xmin,
double xmax,
const std::vector<double>& breakpoints,
115 double &Res,
double& Error_est,
116 double eps_abs,
double eps_rel,
121 gf.params = (
void *) &F;
122 std::vector<double> bp;
124 BOOST_FOREACH(
double x, breakpoints)
125 if(x > xmin && x < xmax)
128 std::sort(bp.begin(), bp.end());
129 int status = gsl_integration_qagp(&gf, &bp[0], bp.size(),
131 max_ninterval, w, &Res, &Error_est);
GslIntegrate(int Max_intervals=1000)
This sets up the workspace need by GSL for integration.
double gsl_integrate_integrand_wrapper(double x, void *params)
Wrapper used by integrate.
void integrate_err_est(const boost::function< double(double)> &F, double xmin, double xmax, double &Res, double &Error_est, double eps_abs=0.0, double eps_rel=1e-8, int key=GSL_INTEG_GAUSS15) const
Calculate the definite integral of F from xmin to xmax.
#define gsl_check(status)
GSL check.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
double integrate(const boost::function< double(double)> &F, double xmin, double xmax, double eps_abs=0.0, double eps_rel=1e-8, int key=GSL_INTEG_GAUSS15) const
Version of integrate that only returns the results, without the error estimate.