|
|
|||
File indexing completed on 2026-06-02 08:17:13
0001 // 0002 // APFEL++ 2017 0003 // 0004 // Author: Valerio Bertone: valerio.bertone@cern.ch 0005 // 0006 0007 #pragma once 0008 0009 #include "apfel/integrator.h" 0010 0011 namespace apfel 0012 { 0013 /** 0014 * @brief The Integrator2D class performs two-dimensional numerical 0015 * integrations using the Guassian quadrature. 0016 */ 0017 class Integrator2D 0018 { 0019 public: 0020 /** 0021 * @name Constructors 0022 * List of constructors. 0023 */ 0024 ///@{ 0025 /** 0026 * @brief The Integrator constructor. 0027 * @param func: The function of two variables to be integrated 0028 * @param method: The integration method to be used (default: GAUSS_KRONROD) 0029 */ 0030 Integrator2D(std::function<double(double const&, double const&)> const& func, Integrator::IntegrationMethod const& method = Integrator::GAUSS_KRONROD); 0031 0032 /** 0033 * @brief Function that integrates the integrand with a given 0034 * relative accuracy using the method defined in the constructor. 0035 * @param xmin: the lower bound integration bound for the first variable 0036 * @param xmax: the upper bound integration bound for the first variable 0037 * @param ymin: the lower bound integration bound for the second variable 0038 * @param ymax: the upper bound integration bound for the second variable 0039 * @param eps: the required relative accuracy 0040 * @return the value of the integral 0041 */ 0042 double integrate(double const& xmin, double const& xmax, double const& ymin, double const& ymax, double const& eps) const; 0043 0044 /** 0045 * @brief Function that integrates the integrand with a using the 0046 * 8x8 and 16x16 Gauss-Legendre method. 0047 * @param xmin: the lower bound integration bound for the first variable 0048 * @param xmax: the upper bound integration bound for the first variable 0049 * @param ymin: the lower bound integration bound for the second variable 0050 * @param ymax: the upper bound integration bound for the second variable 0051 * @return a pair containing the value of the integral computed 0052 * with the 16x16 method and the relative difference w.r.t. the 0053 * 8x8 one. 0054 */ 0055 std::pair<double, double> integrateGL(double const& xmin, double const& xmax, double const& ymin, double const& ymax) const; 0056 0057 /** 0058 * @brief Function that integrates the integrand with a using the 0059 * 7x7 and 15x15 Gauss-Kronrod method. 0060 * @param xmin: the lower bound integration bound for the first variable 0061 * @param xmax: the upper bound integration bound for the first variable 0062 * @param ymin: the lower bound integration bound for the second variable 0063 * @param ymax: the upper bound integration bound for the second variable 0064 * @return a pair containing the value of the integral computed 0065 * with the 15x15 method and the relative difference w.r.t. the 0066 * 7x7 one. 0067 */ 0068 std::pair<double, double> integrateGK(double const& xmin, double const& xmax, double const& ymin, double const& ymax) const; 0069 0070 /** 0071 * @brief Function for the integrand. 0072 * @param x: the first variable 0073 * @param y: the second variable 0074 * @return the integrand evaluated at x and y 0075 */ 0076 double integrand(double const& x, double const& y) const { return _func(x, y); }; 0077 0078 private: 0079 std::function<double(double const&, double const&)> const _func; //!< The integrand function 0080 Integrator::IntegrationMethod const _method; //!< The integration method 0081 }; 0082 }
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|