#include <tabulation.h>
A class for storing a one-dimensional lookup table of floating-point values.
Definition at line 35 of file tabulation.h.
Public Member Functions | |
| Tabulation () | |
| Construct an empty tabulation object. More... | |
| Tabulation (double x_min, double range, size_t num, std::function< double(double)> f) | |
| Construct a new tabulation object. More... | |
| bool | is_empty () const |
| double | get_value_step (double x) const |
| Look up a value from the tabulation (without any interpolation, simply using the closest tabulated value). More... | |
| double | get_value_linear (double x, Extrapolation extrapolation=Extrapolation::Linear) const |
| Look up a value from the tabulation using linear interpolation. More... | |
| void | write (std::ofstream &stream, sha256::Hash hash) const |
| Write a binary representation of the tabulation to a stream. More... | |
Static Public Member Functions | |
| static Tabulation | from_file (std::ifstream &stream, sha256::Hash hash) |
| Construct a tabulation object by reading binary data from a stream. More... | |
Protected Attributes | |
| std::vector< double > | values_ |
| vector for storing tabulated values More... | |
| double | x_min_ |
| lower bound for tabulation More... | |
| double | x_max_ |
| upper bound for tabulation More... | |
| double | inv_dx_ |
| inverse step size 1/dx More... | |
|
inline |
Construct an empty tabulation object.
Definition at line 40 of file tabulation.h.
| smash::Tabulation::Tabulation | ( | double | x_min, |
| double | range, | ||
| size_t | num, | ||
| std::function< double(double)> | f | ||
| ) |
Construct a new tabulation object.
| x_min | lower bound of tabulation domain |
| range | range (x_max-x_min) of tabulation domain |
| num | number of intervals (the number of tabulated points is actually num+1) |
| f | one-dimensional function f(x) which is supposed to be tabulated |
| if | less than two values are tabulated. |
Definition at line 12 of file tabulation.cc.
|
inline |
|
static |
Construct a tabulation object by reading binary data from a stream.
| stream | Stream containing the binary representation of the tabulation. |
| hash | Hash corresponding to the particle properties for which the tabulation was created. |
Definition at line 167 of file tabulation.cc.
| double smash::Tabulation::get_value_step | ( | double | x | ) | const |
Look up a value from the tabulation (without any interpolation, simply using the closest tabulated value).
If
| x | Argument to tabulated function. |
Definition at line 25 of file tabulation.cc.
| double smash::Tabulation::get_value_linear | ( | double | x, |
| Extrapolation | extrapolation = Extrapolation::Linear |
||
| ) | const |
Look up a value from the tabulation using linear interpolation.
If
| x | Argument to tabulated function. |
| extrapolation | Extrapolation that should be used for values outside the tabulation. |
Definition at line 38 of file tabulation.cc.
| void smash::Tabulation::write | ( | std::ofstream & | stream, |
| sha256::Hash | hash | ||
| ) | const |
Write a binary representation of the tabulation to a stream.
| stream | Stream to which the binary representation is written. |
| hash | Hash corresponding to the particle properties for which the tabulation was created. |
Definition at line 159 of file tabulation.cc.
|
protected |
vector for storing tabulated values
Definition at line 110 of file tabulation.h.
|
protected |
lower bound for tabulation
Definition at line 113 of file tabulation.h.
|
protected |
upper bound for tabulation
Definition at line 116 of file tabulation.h.
|
protected |
inverse step size 1/dx
Definition at line 119 of file tabulation.h.