BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ROOT::Math::GSLFunctionWrapper Class Reference

Description

Wrapper class to the gsl_function C structure. This class to fill the GSL C structure gsl_function with the C++ function objcet. Use the class ROOT::Math::GSLFunctionAdapter to adapt the C++ function object to the right signature (function pointer type) requested by GSL

Definition at line 57 of file GSLFunctionWrapper.h.

Public Member Functions

 GSLFunctionWrapper ()
 
GSLFuncPointer FunctionPtr ()
 
gsl_function * GetFunc ()
 
bool IsValid ()
 check if function is valid (has been set) More...
 
double operator() (double x)
 
void SetFuncPointer (GSLFuncPointer f)
 set in the GSL C struct the pointer to the function evaluation More...
 
template<class FuncType >
void SetFunction (const FuncType &f)
 fill the GSL C struct from a generic C++ callable object implementing operator() More...
 
void SetParams (void *p)
 set in the GSL C struct the extra-object pointer More...
 

Private Attributes

gsl_function fFunc
 

Constructor & Destructor Documentation

◆ GSLFunctionWrapper()

ROOT::Math::GSLFunctionWrapper::GSLFunctionWrapper ( )
inline

Definition at line 61 of file GSLFunctionWrapper.h.

62  {
63  fFunc.function = 0;
64  fFunc.params = 0;
65  }

References fFunc.

Member Function Documentation

◆ FunctionPtr()

GSLFuncPointer ROOT::Math::GSLFunctionWrapper::FunctionPtr ( )
inline

Definition at line 85 of file GSLFunctionWrapper.h.

85 { return fFunc.function; }

References fFunc.

◆ GetFunc()

gsl_function* ROOT::Math::GSLFunctionWrapper::GetFunc ( )
inline

Definition at line 83 of file GSLFunctionWrapper.h.

83 { return &fFunc; }

References fFunc.

◆ IsValid()

bool ROOT::Math::GSLFunctionWrapper::IsValid ( )
inline

check if function is valid (has been set)

Definition at line 91 of file GSLFunctionWrapper.h.

91  {
92  return (fFunc.function != 0) ? true : false;
93  }

References fFunc.

◆ operator()()

double ROOT::Math::GSLFunctionWrapper::operator() ( double  x)
inline

Definition at line 88 of file GSLFunctionWrapper.h.

88 { return GSL_FN_EVAL(&fFunc, x); }

References fFunc.

◆ SetFuncPointer()

void ROOT::Math::GSLFunctionWrapper::SetFuncPointer ( GSLFuncPointer  f)
inline

set in the GSL C struct the pointer to the function evaluation

Definition at line 68 of file GSLFunctionWrapper.h.

68 { fFunc.function = f; }

References fFunc.

Referenced by SetFunction().

◆ SetFunction()

template<class FuncType >
void ROOT::Math::GSLFunctionWrapper::SetFunction ( const FuncType &  f)
inline

fill the GSL C struct from a generic C++ callable object implementing operator()

Definition at line 76 of file GSLFunctionWrapper.h.

76  {
77  const void * p = &f;
78  assert (p != 0);
80  SetParams(const_cast<void *>(p));
81  }
static double F(double x, void *p)
void SetFuncPointer(GSLFuncPointer f)
set in the GSL C struct the pointer to the function evaluation
void SetParams(void *p)
set in the GSL C struct the extra-object pointer

References SetFuncPointer(), and SetParams().

Here is the call graph for this function:

◆ SetParams()

void ROOT::Math::GSLFunctionWrapper::SetParams ( void *  p)
inline

set in the GSL C struct the extra-object pointer

Definition at line 71 of file GSLFunctionWrapper.h.

71 { fFunc.params = p; }

References fFunc.

Referenced by SetFunction().

Member Data Documentation

◆ fFunc

gsl_function ROOT::Math::GSLFunctionWrapper::fFunc
private

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