Thermal-FIST 1.5
Package for hadron resonance gas model applications
Loading...
Searching...
No Matches
thermalfist::SplineFunction Class Reference

Class implementing a simple linear spline. More...

#include <SplineFunction.h>

Public Member Functions

 SplineFunction ()
 
 SplineFunction (std::vector< double > x, std::vector< double > y)
 
void add_val (double x, double val)
 
double f (double arg) const
 
double df (double arg) const
 
double fsquare (double arg)
 
void clear ()
 
void clearall ()
 
void fill (std::vector< double > x, std::vector< double > y)
 
void setConstant (double val)
 

Detailed Description

Class implementing a simple linear spline.

This class implements a simple linear spline function f(x) of one argument. It is used to model a function f(x) which is defined by a set of (x,y) pairs. The function is evaluated using linear interpolation between the provided (x,y) pairs.

Definition at line 20 of file SplineFunction.h.

Constructor & Destructor Documentation

◆ SplineFunction() [1/2]

thermalfist::SplineFunction::SplineFunction ( )
inline

Default constructor. Empty function.

Definition at line 26 of file SplineFunction.h.

◆ SplineFunction() [2/2]

thermalfist::SplineFunction::SplineFunction ( std::vector< double > x,
std::vector< double > y )
inline

Constructor which sets the data from the provided vectors.

Parameters
xA vector of x values.
yA vector of y values. Data must be sorted in non-descending order of x values.

Definition at line 36 of file SplineFunction.h.

Member Function Documentation

◆ add_val()

void thermalfist::SplineFunction::add_val ( double x,
double val )
inline

Adds a new pair of x,y values.

Parameters
xThe x-coordinate.
valThe y-coordinate (function value at x). Adds a new (x,y) pair to the function. The function is sorted after adding the new value.

Definition at line 52 of file SplineFunction.h.

◆ clear()

void thermalfist::SplineFunction::clear ( )
inline

Clears all data and fills the function with a constant function f(x) = 0.

Definition at line 122 of file SplineFunction.h.

◆ clearall()

void thermalfist::SplineFunction::clearall ( )
inline

Just clear all data.

Definition at line 133 of file SplineFunction.h.

◆ df()

double thermalfist::SplineFunction::df ( double arg) const
inline

Evaluates slope (derivative) at x = arg.

Parameters
argThe point at which to evaluate the derivative.
Returns
The value of the derivative at x = arg. Evaluates the derivative of the function at x = arg using linear interpolation between the provided (x,y) pairs.

Definition at line 93 of file SplineFunction.h.

◆ f()

double thermalfist::SplineFunction::f ( double arg) const
inline

Evaluates interpolated function at x = arg.

Parameters
argThe point at which to evaluate the function.
Returns
The value of the function at x = arg. Evaluates the function at x = arg using linear interpolation between the provided (x,y) pairs.

Definition at line 66 of file SplineFunction.h.

◆ fill()

void thermalfist::SplineFunction::fill ( std::vector< double > x,
std::vector< double > y )
inline

Fill (x,y) pairs from provided vectors.

Parameters
xA vector of x values.
yA vector of y values. Data must be sorted in non-descending order of x values.

Definition at line 144 of file SplineFunction.h.

◆ fsquare()

double thermalfist::SplineFunction::fsquare ( double arg)
inline

Evaluates f(arg)^2.

Parameters
argThe point at which to evaluate the function.
Returns
The value of the function at x = arg squared. Evaluates the function at x = arg using linear interpolation between the provided (x,y) pairs and returns the square of the result.

Definition at line 113 of file SplineFunction.h.

◆ setConstant()

void thermalfist::SplineFunction::setConstant ( double val)
inline

Models constant f(x) == val function.

Parameters
valThe value of the constant function. Clears all data and fills the function with a constant function f(x) = val.

Definition at line 160 of file SplineFunction.h.


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