atomicrex  0.1
An advanced atomistic model building tool
Public Member Functions | List of all members
atomicrex::GridCubicSpline Class Reference

#include <GridCubicSpline.h>

Public Member Functions

 GridCubicSpline ()
 Default constructor.
 
void init (int N, double delta, double derivStart=0, double derivEnd=0)
 Initialization of the spline function.
 
void setKnot (int i, double y)
 Sets the Y value of the function at a knot.
 
int knotCount () const
 Returns the number of knots.
 
double derivStart () const
 Returns first derivative of spline function at knot 0.
 
double derivEnd () const
 Returns first derivative of spline function at the last knot.
 
double knotX (int i) const
 Returns the X coordinate of the i-th knot.
 
double knotY (int i) const
 Returns the Y coordinate of the i-th knot.
 
double knotY2 (int i) const
 Returns the second derivative at the i-th knot.
 
bool parse (std::istream &stream)
 Parses the spline knots from a file.
 
void prepareSpline ()
 Calculates the second derivatives of the cubic spline.
 
double eval (double x) const
 Evaluates the spline function at position x.
 
double eval (double x, double &deriv) const
 Evaluates the spline function and its first derivative at position x.
 
double cutoff () const
 Returns the cutoff radius of this spline function.
 
void writeGnuplot (const FPString &filename, const FPString &title) const
 Create a Gnuplot script that displays the spline function.
 

Detailed Description

A one-dimensional cubic spline function.

The spline consists of N knots with coordinates (x,y).

Knots are positioned on a regular grid on the X axis, i.e., the X position of a knot is given by its index times the grid spacing. The first knot is always at X=0.

The first derivative of the function must be explicitly specified at the first and the last knot.


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