24 #include "../../Atomicrex.h" 50 BOOST_ASSERT(delta > 0);
55 _xcutoff = delta * (N-1);
62 BOOST_ASSERT(i >=0 && i < _N);
76 double knotX(
int i)
const { BOOST_ASSERT(i >=0 && i < _N);
return _delta * i; }
79 double knotY(
int i)
const { BOOST_ASSERT(i >=0 && i < _N);
return Y[i]; }
82 double knotY2(
int i)
const { BOOST_ASSERT(i >=0 && i < _N);
return Y2[i]; }
85 bool parse(std::istream& stream);
91 double eval(
double x)
const;
94 double eval(
double x,
double& deriv)
const;
97 double cutoff()
const {
return _xcutoff; }
107 std::vector<double> Y;
108 std::vector<double> Y2;
double derivEnd() const
Returns first derivative of spline function at the last knot.
Definition: GridCubicSpline.h:73
double knotY2(int i) const
Returns the second derivative at the i-th knot.
Definition: GridCubicSpline.h:82
double eval(double x) const
Evaluates the spline function at position x.
Definition: GridCubicSpline.cpp:58
Definition: GridCubicSpline.h:40
bool parse(std::istream &stream)
Parses the spline knots from a file.
Definition: GridCubicSpline.cpp:110
double derivStart() const
Returns first derivative of spline function at knot 0.
Definition: GridCubicSpline.h:70
GridCubicSpline()
Default constructor.
Definition: GridCubicSpline.h:45
double cutoff() const
Returns the cutoff radius of this spline function.
Definition: GridCubicSpline.h:97
void writeGnuplot(const FPString &filename, const FPString &title) const
Create a Gnuplot script that displays the spline function.
Definition: GridCubicSpline.cpp:127
This file collects the definition of classes that define various simple crystal structures.
Definition: Atomicrex.h:67
double knotY(int i) const
Returns the Y coordinate of the i-th knot.
Definition: GridCubicSpline.h:79
std::string FPString
The default string type used throughout the code:
Definition: Atomicrex.h:70
double knotX(int i) const
Returns the X coordinate of the i-th knot.
Definition: GridCubicSpline.h:76
int knotCount() const
Returns the number of knots.
Definition: GridCubicSpline.h:67
void init(int N, double delta, double derivStart=0, double derivEnd=0)
Initialization of the spline function.
Definition: GridCubicSpline.h:48
void setKnot(int i, double y)
Sets the Y value of the function at a knot.
Definition: GridCubicSpline.h:61
void prepareSpline()
Calculates the second derivatives of the cubic spline.
Definition: GridCubicSpline.cpp:32