CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
cbl::glob::FuncGrid2D Class Reference

The class FuncGrid2D. More...

#include "Headers/FuncGrid.h"

Public Member Functions

Constructors/destructors
 FuncGrid2D ()=default
 default constructor
 
 FuncGrid2D (const std::vector< double > x, const std::vector< double > y, const std::vector< std::vector< double >> fxy, const std::string interpType)
 constructor More...
 
 ~FuncGrid2D ()=default
 default destructor
 
Functions to get the private members of the class
std::vector< double > x () const
 get the private member FuncGrid::m_x More...
 
double x (const int i) const
 get the i-th element of the private member FuncGrid::m_x More...
 
std::vector< double > y () const
 get the private member FuncGrid::m_y More...
 
double y (const int i) const
 get the i-th element of the private member FuncGrid::m_y More...
 
double size_x () const
 get the private member FuncGrid::m_size More...
 
double xmin () const
 get the private member FuncGrid::m_xmin More...
 
double xmax () const
 get the private member FuncGrid::m_xmax More...
 
double size_y () const
 get the private member FuncGrid::m_size More...
 
double ymin () const
 get the private member FuncGrid::m_ymin More...
 
double ymax () const
 get the private member FuncGrid::m_ymax More...
 
Functions of generic usage
void free ()
 free the GSL objects
 
double operator() (const double xx, const double yy) const
 overloading of the () operator More...
 
std::vector< double > eval_func (const std::vector< std::vector< double >> xx) const
 evaluate the function at the xx points More...
 
double IntegrateVegas (const double xmin, const double xmax, const double ymin, const double ymax) const
 evaluate the 2D integral of the interpolated function using the Vegas routine from CUBA libraries More...
 
double IntegrateSuave (const double xmin, const double xmax, const double ymin, const double ymax) const
 evaluate the 2D integral of the interpolated function using the Suave routine from CUBA libraries More...
 
double IntegrateDivonne (const double xmin, const double xmax, const double ymin, const double ymax) const
 evaluate the 2D integral of the interpolated function using the Divonne routine from CUBA libraries More...
 
double IntegrateCuhre (const double xmin, const double xmax, const double ymin, const double ymax) const
 evaluate the 2D integral of the interpolated function using the Cuhre routine from CUBA libraries More...
 

Private Attributes

std::vector< double > m_x
 x values
 
std::vector< double > m_y
 y values
 
std::shared_ptr< double > m_fxy
 y values
 
size_t m_size_x
 size of the x vector
 
size_t m_size_y
 size of the x vector
 
std::string m_interpType
 method used to interpolate
 
const gsl_interp2d_type * m_type
 GSL object used to set the interpolation type.
 
std::shared_ptr< gsl_interp_accel > m_acc_x
 GSL accelerator object.
 
std::shared_ptr< gsl_interp_accel > m_acc_y
 GSL accelerator object.
 
std::shared_ptr< gsl_spline2d > m_spline
 GSL object used to interpolate.
 
double m_xmin
 minimum x value
 
double m_xmax
 maximum x value
 
double m_ymin
 minimum x value
 
double m_ymax
 maximum x value
 

Detailed Description

The class FuncGrid2D.

This class is used to handle 2D functions stored on a grid. Specifically, it contains member functions to interpolate.

Definition at line 301 of file FuncGrid.h.

Constructor & Destructor Documentation

◆ FuncGrid2D()

cbl::glob::FuncGrid2D::FuncGrid2D ( const std::vector< double >  x,
const std::vector< double >  y,
const std::vector< std::vector< double >>  fxy,
const std::string  interpType 
)

constructor

Parameters
xvector containing the x values
yvector containing the y values
fxymatrix containing the func values
interpTypeinterpolation method

Definition at line 253 of file FuncGrid.cpp.

Member Function Documentation

◆ eval_func()

std::vector< double > cbl::glob::FuncGrid2D::eval_func ( const std::vector< std::vector< double >>  xx) const

evaluate the function at the xx points

Parameters
xxthe values at which the function will be evaluated
Returns
the function evaluated at the xx points

Definition at line 341 of file FuncGrid.cpp.

◆ IntegrateCuhre()

double cbl::glob::FuncGrid2D::IntegrateCuhre ( const double  xmin,
const double  xmax,
const double  ymin,
const double  ymax 
) const

evaluate the 2D integral of the interpolated function using the Cuhre routine from CUBA libraries

Parameters
xminlower limit for x variable
xmaxupper limit for x variable
yminlower limit for y variable
ymaxupper limit for y variable
Returns
the 2D integrale of the interpolated function

Definition at line 403 of file FuncGrid.cpp.

◆ IntegrateDivonne()

double cbl::glob::FuncGrid2D::IntegrateDivonne ( const double  xmin,
const double  xmax,
const double  ymin,
const double  ymax 
) const

evaluate the 2D integral of the interpolated function using the Divonne routine from CUBA libraries

Parameters
xminlower limit for x variable
xmaxupper limit for x variable
yminlower limit for y variable
ymaxupper limit for y variable
Returns
the 2D integrale of the interpolated function

Definition at line 387 of file FuncGrid.cpp.

◆ IntegrateSuave()

double cbl::glob::FuncGrid2D::IntegrateSuave ( const double  xmin,
const double  xmax,
const double  ymin,
const double  ymax 
) const

evaluate the 2D integral of the interpolated function using the Suave routine from CUBA libraries

Parameters
xminlower limit for x variable
xmaxupper limit for x variable
yminlower limit for y variable
ymaxupper limit for y variable
Returns
the 2D integrale of the interpolated function

Definition at line 371 of file FuncGrid.cpp.

◆ IntegrateVegas()

double cbl::glob::FuncGrid2D::IntegrateVegas ( const double  xmin,
const double  xmax,
const double  ymin,
const double  ymax 
) const

evaluate the 2D integral of the interpolated function using the Vegas routine from CUBA libraries

Parameters
xminlower limit for x variable
xmaxupper limit for x variable
yminlower limit for y variable
ymaxupper limit for y variable
Returns
the 2D integrale of the interpolated function

Definition at line 355 of file FuncGrid.cpp.

◆ operator()()

double cbl::glob::FuncGrid2D::operator() ( const double  xx,
const double  yy 
) const

overloading of the () operator

Parameters
xxthe value at which the function will be evaluated
yythe value at which the function will be evaluated
Returns
the function evaluated at xx, yy

Definition at line 319 of file FuncGrid.cpp.

◆ size_x()

double cbl::glob::FuncGrid2D::size_x ( ) const
inline

get the private member FuncGrid::m_size

Returns
the size of the x

Definition at line 417 of file FuncGrid.h.

◆ size_y()

double cbl::glob::FuncGrid2D::size_y ( ) const
inline

get the private member FuncGrid::m_size

Returns
the size of the y vector

Definition at line 435 of file FuncGrid.h.

◆ x() [1/2]

std::vector<double> cbl::glob::FuncGrid2D::x ( ) const
inline

get the private member FuncGrid::m_x

Returns
the vector containing the x values

Definition at line 389 of file FuncGrid.h.

◆ x() [2/2]

double cbl::glob::FuncGrid2D::x ( const int  i) const
inline

get the i-th element of the private member FuncGrid::m_x

Parameters
ithe i-th index
Returns
the i-th value of x

Definition at line 397 of file FuncGrid.h.

◆ xmax()

double cbl::glob::FuncGrid2D::xmax ( ) const
inline

get the private member FuncGrid::m_xmax

Returns
maximum x value

Definition at line 429 of file FuncGrid.h.

◆ xmin()

double cbl::glob::FuncGrid2D::xmin ( ) const
inline

get the private member FuncGrid::m_xmin

Returns
minimum x value

Definition at line 423 of file FuncGrid.h.

◆ y() [1/2]

std::vector<double> cbl::glob::FuncGrid2D::y ( ) const
inline

get the private member FuncGrid::m_y

Returns
the vector containing the y values

Definition at line 403 of file FuncGrid.h.

◆ y() [2/2]

double cbl::glob::FuncGrid2D::y ( const int  i) const
inline

get the i-th element of the private member FuncGrid::m_y

Parameters
ithe i-th index
Returns
the i-th value of y

Definition at line 411 of file FuncGrid.h.

◆ ymax()

double cbl::glob::FuncGrid2D::ymax ( ) const
inline

get the private member FuncGrid::m_ymax

Returns
maximum y value

Definition at line 447 of file FuncGrid.h.

◆ ymin()

double cbl::glob::FuncGrid2D::ymin ( ) const
inline

get the private member FuncGrid::m_ymin

Returns
minimum y value

Definition at line 441 of file FuncGrid.h.


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