BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
RealIntegrator Class Reference
Collaboration diagram for RealIntegrator:

Public Member Functions

 RealIntegrator ()
 
 ~RealIntegrator ()
 
double integrate (const std::function< double(double)> &f, double lmin, double lmax)
 

Static Private Member Functions

static double m_Cfunction (double x, void *p)
 

Private Attributes

gsl_function m_gsl_f
 
gsl_integration_workspace * m_workspace
 

Detailed Description

To integrate a real function of a real variable.

Definition at line 23 of file Integrator.h.

Constructor & Destructor Documentation

◆ RealIntegrator()

RealIntegrator::RealIntegrator ( )

Definition at line 17 of file Integrator.cpp.

18  : m_gsl_f{m_Cfunction, nullptr}, m_workspace{gsl_integration_workspace_alloc(200)}
19 {
20 }
static double m_Cfunction(double x, void *p)
Definition: Integrator.h:31
gsl_integration_workspace * m_workspace
Definition: Integrator.h:36
gsl_function m_gsl_f
Definition: Integrator.h:34

◆ ~RealIntegrator()

RealIntegrator::~RealIntegrator ( )

Definition at line 22 of file Integrator.cpp.

23 {
24  gsl_integration_workspace_free(m_workspace);
25 }

References m_workspace.

Member Function Documentation

◆ integrate()

double RealIntegrator::integrate ( const std::function< double(double)> &  f,
double  lmin,
double  lmax 
)

◆ m_Cfunction()

static double RealIntegrator::m_Cfunction ( double  x,
void *  p 
)
inlinestaticprivate

Definition at line 31 of file Integrator.h.

32  {
33  return (*(const std::function<double(double)>*)(p))(x);
34  };

References anonymous_namespace{InterferenceFunctionHardDisk.cpp}::p.

Member Data Documentation

◆ m_gsl_f

gsl_function RealIntegrator::m_gsl_f
private

Definition at line 35 of file Integrator.h.

Referenced by integrate().

◆ m_workspace

gsl_integration_workspace* RealIntegrator::m_workspace
private

Definition at line 36 of file Integrator.h.

Referenced by integrate(), and ~RealIntegrator().


The documentation for this class was generated from the following files: