|
FML
|
This is a wrapper class for easy use of GSL splines It is (OpenMP) thread safe as long as splines are not created by a subthread and later tried to be used by more than that thread! More...
#include <Spline.h>
Public Member Functions | |
| GSLSpline ()=default | |
| GSLSpline (std::string name) | |
| Construct giving the spline a name (useful for error/warning messages) More... | |
| GSLSpline (double *x, double *y, int nx, std::string splinename="NoName", const gsl_interp_type *interpoltype=SPLINE_FIDUCIAL_INTERPOL_TYPE) | |
| Construct a spline from pointers to x and y. Both must have nx elements. More... | |
| GSLSpline (const DVector &x, const DVector &y, std::string splinename="NoName", const gsl_interp_type *interpoltype=SPLINE_FIDUCIAL_INTERPOL_TYPE) | |
| Construct a spline from vectors x and y. Both must have the same size. More... | |
| GSLSpline (const GSLSpline &rhs) | |
| GSLSpline & | operator= (const GSLSpline &rhs) |
| ~GSLSpline () | |
| operator bool () const | |
| Is the spline created or not? More... | |
| void | create (const double *x, const double *y, int nx, std::string splinename="NoName", const gsl_interp_type *interpoltype=SPLINE_FIDUCIAL_INTERPOL_TYPE) |
| Create a spline from pointers to x and y. Both must have nx elements. More... | |
| void | create (const DVector &x, const DVector &y, std::string splinename="NoName", const gsl_interp_type *interpoltype=SPLINE_FIDUCIAL_INTERPOL_TYPE) |
| Create a spline from vectors x and y. Both must have the same size. More... | |
| double | operator() (double x) const |
| Overload of the () operator for easy evaluation of the spline. More... | |
| double | eval (double x) const |
| Get the value of the spline (if out of bounds we use the closest value) More... | |
| double | eval_deriv (double x, int deriv) const |
| double | deriv_x (double x) const |
| Get the value of the first derivative of the spline. More... | |
| double | deriv_xx (double x) const |
| Get the value of the second derivative of the spline. More... | |
| std::pair< double, double > | get_xrange () const |
| Get the range the spline was created on. More... | |
| std::string | get_name () const |
| Get the name of the spline. More... | |
| void | set_out_of_bounds_warning (bool v) |
| Turn on/off warnings if we try to evaluate out of bounds (we use closest value in that case) More... | |
| DVector | get_x_data () |
| Get the raw GSL data for x used to create the spline. More... | |
| DVector | get_y_data () |
| Get the raw GSL data for y=f(x) used to create the spline. More... | |
| void | free () |
| Free up memory associated with the spline. More... | |
This is a wrapper class for easy use of GSL splines It is (OpenMP) thread safe as long as splines are not created by a subthread and later tried to be used by more than that thread!
The fiducial splines are cubic splines for 1D and bicubic for 2D assuming natural (y''=0) boundary conditions at the end-points
The fiducial choice allows to get the function value and up to second order derivatives. NB: if you change the fiducial choice to a lower order spline, e.g to gsl_interp_linear, then the second derivative deriv_xx etc. will not work
If evaluating out of bounds it will return the closest value. To get a warning when this happens call set_out_of_bounds_warning(true) before using the spline or set the define SPLINE_FIDUCIAL_SPLINE_WARNING to be true
Errors are handled via the throw_error function
Compile time defines:
USE_MPI : Use MPI (only effect is in on how errors are handled)
USE_OMP : Use OpenMP
SPLINE_FIDUCIAL_INTERPOL_TYPE : Cubic spline is the fiducial choice
SPLINE_FIDUCIAL_INTERPOL_TYPE_2D : Bicubic is the fiducial choice
SPLINE_FIDUCIAL_SPLINE_WARNING : Show warnings if we evaluate out of bounds
|
default |
| FML::INTERPOLATION::SPLINE::GSLSpline::GSLSpline | ( | std::string | name | ) |
Construct giving the spline a name (useful for error/warning messages)
Definition at line 37 of file Spline.cpp.
| FML::INTERPOLATION::SPLINE::GSLSpline::GSLSpline | ( | double * | x, |
| double * | y, | ||
| int | nx, | ||
| std::string | splinename = "NoName", |
||
| const gsl_interp_type * | interpoltype = SPLINE_FIDUCIAL_INTERPOL_TYPE |
||
| ) |
Construct a spline from pointers to x and y. Both must have nx elements.
Definition at line 39 of file Spline.cpp.
| FML::INTERPOLATION::SPLINE::GSLSpline::GSLSpline | ( | const DVector & | x, |
| const DVector & | y, | ||
| std::string | splinename = "NoName", |
||
| const gsl_interp_type * | interpoltype = SPLINE_FIDUCIAL_INTERPOL_TYPE |
||
| ) |
Construct a spline from vectors x and y. Both must have the same size.
Definition at line 47 of file Spline.cpp.
| FML::INTERPOLATION::SPLINE::GSLSpline::GSLSpline | ( | const GSLSpline & | rhs | ) |
Definition at line 75 of file Spline.cpp.
| FML::INTERPOLATION::SPLINE::GSLSpline::~GSLSpline | ( | ) |
Definition at line 284 of file Spline.cpp.
| void FML::INTERPOLATION::SPLINE::GSLSpline::create | ( | const double * | x, |
| const double * | y, | ||
| int | nx, | ||
| std::string | splinename = "NoName", |
||
| const gsl_interp_type * | interpoltype = SPLINE_FIDUCIAL_INTERPOL_TYPE |
||
| ) |
Create a spline from pointers to x and y. Both must have nx elements.
Definition at line 89 of file Spline.cpp.
| void FML::INTERPOLATION::SPLINE::GSLSpline::create | ( | const DVector & | x, |
| const DVector & | y, | ||
| std::string | splinename = "NoName", |
||
| const gsl_interp_type * | interpoltype = SPLINE_FIDUCIAL_INTERPOL_TYPE |
||
| ) |
Create a spline from vectors x and y. Both must have the same size.
Definition at line 163 of file Spline.cpp.
| double FML::INTERPOLATION::SPLINE::GSLSpline::deriv_x | ( | double | x | ) | const |
Get the value of the first derivative of the spline.
Definition at line 275 of file Spline.cpp.
| double FML::INTERPOLATION::SPLINE::GSLSpline::deriv_xx | ( | double | x | ) | const |
| double FML::INTERPOLATION::SPLINE::GSLSpline::eval | ( | double | x | ) | const |
Get the value of the spline (if out of bounds we use the closest value)
Definition at line 183 of file Spline.cpp.
| double FML::INTERPOLATION::SPLINE::GSLSpline::eval_deriv | ( | double | x, |
| int | deriv | ||
| ) | const |
Definition at line 203 of file Spline.cpp.
| void FML::INTERPOLATION::SPLINE::GSLSpline::free | ( | ) |
Free up memory associated with the spline.
Definition at line 240 of file Spline.cpp.
| std::string FML::INTERPOLATION::SPLINE::GSLSpline::get_name | ( | ) | const |
|
inline |
| std::pair< double, double > FML::INTERPOLATION::SPLINE::GSLSpline::get_xrange | ( | ) | const |
Get the range the spline was created on.
Definition at line 277 of file Spline.cpp.
|
inline |
|
explicit |
Is the spline created or not?
Definition at line 84 of file Spline.cpp.
| double FML::INTERPOLATION::SPLINE::GSLSpline::operator() | ( | double | x | ) | const |
Overload of the () operator for easy evaluation of the spline.
Definition at line 181 of file Spline.cpp.
Definition at line 60 of file Spline.cpp.
| void FML::INTERPOLATION::SPLINE::GSLSpline::set_out_of_bounds_warning | ( | bool | v | ) |
Turn on/off warnings if we try to evaluate out of bounds (we use closest value in that case)
Definition at line 279 of file Spline.cpp.