Hermes2D
3.0
|
Public Member Functions | |
CubicSpline (std::vector< double > points, std::vector< double > values, double bc_left, double bc_right, bool first_der_left=true, bool first_der_right=true, bool extend_der_left=true, bool extend_der_right=true) | |
Constructor (general case). | |
CubicSpline (double const_value) | |
~CubicSpline () | |
Destructor. | |
void | free () |
void | calculate_coeffs () |
Calculates coefficients. | |
double | value (double x) const |
One-dimensional function value. | |
Hermes::Ord | value (Hermes::Ord x) const |
One-dimensional function integration order. | |
double | derivative (double x) const |
One-dimensional function derivative value. | |
Hermes::Ord | derivative (Hermes::Ord x) const |
One-dimensional function derivative integration order. | |
void | plot (const char *filename, double extension, bool plot_derivative=false, int subdiv=50) const |
Protected Member Functions | |
bool | find_interval (double x_in, int &m) const |
double | extrapolate_value (double point_end, double value_end, double derivative_end, double x_in) const |
Extrapolate the value of the spline outside of its interval of definition. | |
double | get_derivative_from_interval (double x_in, int m) const |
Gets derivative at a point that lies in interval 'm'. | |
double | get_value_from_interval (double x_in, int m) const |
Gets value at a point that lies in interval 'm'. | |
Protected Attributes | |
std::vector< double > | points |
Grid points, ordered. | |
std::vector< double > | values |
Values at the grid points. | |
double | bc_left |
Boundary conditions. | |
double | bc_right |
bool | first_der_left |
bool | first_der_right |
bool | extrapolate_der_left |
bool | extrapolate_der_right |
double | point_left |
Values and derivatives at end points for extrapolation purposes. | |
double | value_left |
double | derivative_left |
double | point_right |
double | value_right |
double | derivative_right |
std::vector< SplineCoeff > | coeffs |
A set of four coefficients a, b, c, d for an elementary cubic spline. | |
|
protected |
Uses a bisection method to locale interval where a given point lies. Returns false if point lies outside.
Definition at line 147 of file spline.cpp.
Referenced by derivative(), and value().
void Hermes::Hermes2D::CubicSpline::plot | ( | const char * | filename, |
double | extension, | ||
bool | plot_derivative = false , |
||
int | subdiv = 50 |
||
) | const |
Plots the spline in format for Pylab (just pairs x-coordinate and value per line). The interval of definition of the spline will be extended by "extension" both to the left and to the right. This allows the user to see how the code will handle the spline if used for points that lie outside of its interval of definition. If plot_value == false, derivative is plotted.
Definition at line 168 of file spline.cpp.
|
protected |
If extend_der_left == true then the spline is extended to the left of the interval of definition as a linear function whose slope matches the derivative at the left-most point. Otherwise the spline is extended as a constant value that matches the spline value at the left-most point. Analogously for the flag extend_der_right.
Definition at line 90 of file spline.h.
Referenced by derivative(), and value().
|
protected |
Flags that determine the meaning of the boundary constants. first_der_left == true means that the left BC is the first derivative. first_der_left == false means that the left BC is the second derivative. (same on the right)
Definition at line 84 of file spline.h.
Referenced by calculate_coeffs().