BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IntegratorGK.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Base/Math/IntegratorGK.h
6 //! @brief Defines classes RealIntegrator, ComplexIntegrator.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_BASE_MATH_INTEGRATORGK_H
21 #define BORNAGAIN_BASE_MATH_INTEGRATORGK_H
22 
23 #include "Base/Types/Complex.h"
24 #include <functional>
25 #include <gsl/gsl_integration.h>
26 
27 //! To integrate a real function of a real variable.
29 public:
32  double integrate(const std::function<double(double)>& f, double lmin, double lmax);
33 
34 private:
35  static double m_Cfunction(double x, void* p)
36  {
37  return (*(const std::function<double(double)>*)(p))(x);
38  };
39  gsl_function m_gsl_f;
40  gsl_integration_workspace* m_workspace;
41 };
42 
43 //! To integrate a complex function of a real variable.
45 public:
46  complex_t integrate(const std::function<complex_t(double)>& f, double lmin, double lmax);
47 
48 private:
51 };
52 
53 #endif // BORNAGAIN_BASE_MATH_INTEGRATORGK_H
54 #endif // USER_API
Defines complex_t, and a few elementary functions.
std::complex< double > complex_t
Definition: Complex.h:20
To integrate a complex function of a real variable.
Definition: IntegratorGK.h:44
complex_t integrate(const std::function< complex_t(double)> &f, double lmin, double lmax)
RealIntegrator realPart
Definition: IntegratorGK.h:49
RealIntegrator imagPart
Definition: IntegratorGK.h:50
To integrate a real function of a real variable.
Definition: IntegratorGK.h:28
double integrate(const std::function< double(double)> &f, double lmin, double lmax)
static double m_Cfunction(double x, void *p)
Definition: IntegratorGK.h:35
gsl_integration_workspace * m_workspace
Definition: IntegratorGK.h:40
gsl_function m_gsl_f
Definition: IntegratorGK.h:38