#include <CubicSpline.hpp>
|
int | locate (const double x) |
|
int | hunt (const double x) |
|
double | interpolate (int jlo, double x) const |
|
int | y2ValsInit (const double *xv, const double *yv, double y1_0, double y1_n) |
|
|
unsigned | valsCount |
| velikost dat x
|
|
unsigned | lastVal |
|
int | jsav |
| ??? Poslední nalezená souřadnice
|
|
int | cor |
| ??? bool - jestli je |jl - jsav| > dj;, udává, jestli se aktivuje hunt() nebo locate()
|
|
int | dj |
| ??? Celkov2 heuristika pro vyhledávání koeficientů
|
|
int | ascnd |
| ??? Zbytečně se počítalo v locate...
|
|
double * | xVals |
|
double * | yVals |
| xx, yy
|
|
double * | y2Vals |
|
int | initOK |
|
Definition at line 14 of file CubicSpline.hpp.
app::CubicSpline::CubicSpline |
( |
double const * |
x, |
|
|
double const * |
y, |
|
|
unsigned |
count, |
|
|
double |
y1_0 = 1.e99 , |
|
|
double |
y1_n = 1.e99 |
|
) |
| |
Definition at line 6 of file CubicSpline.cpp.
{
if (count < 2) {
initOK = 0;
return; }
if (x == NULL) {
initOK = 0;
return; }
if (y == NULL) {
initOK = 0;
return; }
xVals = (
double *) malloc((
unsigned long int)(
valsCount *
sizeof(double)));
memcpy(
xVals, x, (
unsigned long int)(count *
sizeof(
double)));
yVals = (
double *) malloc((
unsigned long int)(
valsCount *
sizeof(double)));
memcpy(
yVals, y, (
unsigned long int)(count *
sizeof(
double)));
y2Vals = (
double *) malloc((
unsigned long int)(
valsCount *
sizeof(double)));
}
app::CubicSpline::~CubicSpline |
( |
| ) |
|
|
virtual |
double app::CubicSpline::getValueAt |
( |
double |
x | ) |
|
int app::CubicSpline::hunt |
( |
const double |
x | ) |
|
|
protected |
Definition at line 82 of file CubicSpline.cpp.
{
int jm, ju;
int inc = 1;
jl = 0;
} else {
while (1) {
ju = jl + inc;
if (ju >= lastVal) {
break;
break;
else {
jl = ju;
inc += inc;
}
}
} else {
ju = jl;
while (1) {
jl = jl - inc;
if (jl <= 0) {
jl = 0;
break;
break;
else {
ju = jl;
inc += inc;
}
}
}
}
while (ju - jl > 1) {
jm = (ju + jl) >> 1;
jl = jm;
else
ju = jm;
}
retVal = (retVal < jl) ? retVal : jl;
return (retVal > 0) ? retVal : 0;
}
double app::CubicSpline::interpolate |
( |
int |
jlo, |
|
|
double |
x |
|
) |
| const |
|
protected |
Definition at line 174 of file CubicSpline.cpp.
{
int klo = jl, khi = jl + 1;
double y, h, b, a;
a = (xVals[khi] - x) / h;
b = (x - xVals[klo]) / h;
+ ((a * a * a - a) *
y2Vals[klo] + (b * b * b - b) *
y2Vals[khi]) * (h * h)
/ 6.0;
return y;
}
int app::CubicSpline::isOK |
( |
| ) |
const |
|
inline |
int app::CubicSpline::locate |
( |
const double |
x | ) |
|
|
protected |
Definition at line 58 of file CubicSpline.cpp.
{
int jl = 0;
int jm = 0;
while (ju - jl > 1) {
jm = (ju + jl) >> 1;
jl = jm;
} else {
ju = jm;
}
}
retVal = (retVal < jl) ? retVal : jl;
return (retVal > 0) ? retVal : 0;
}
int app::CubicSpline::y2ValsInit |
( |
const double * |
xv, |
|
|
const double * |
yv, |
|
|
double |
y1_0, |
|
|
double |
y1_n |
|
) |
| |
|
protected |
Definition at line 138 of file CubicSpline.cpp.
{
int i, k;
double p, qn, sig, un;
double * u = (
double *) malloc ((
unsigned long int)((
lastVal) *
sizeof(
double)));
if (u == NULL) { return 1; }
if (y1_0 > 0.99e99) {
} else {
u[0] = (3.0 / (xv[1] - xv[0]))
* ((yv[1] - yv[0]) / (xv[1] - xv[0]) - y1_0);
}
sig = (xv[i] - xv[i - 1]) / (xv[i + 1] - xv[i - 1]);
p = sig *
y2Vals[i - 1] + 2.0;
u[i] = (yv[i + 1] - yv[i]) / (xv[i + 1] - xv[i])
- (yv[i] - yv[i - 1]) / (xv[i] - xv[i - 1]);
u[i] = (6.0 * u[i] / (xv[i + 1] - xv[i - 1]) - sig * u[i - 1]) / p;
}
if (y1_n > 0.99e99) {
qn = un = 0.0;
} else {
qn = 0.5;
}
}
free(u);
return 0;
}
int app::CubicSpline::ascnd |
|
protected |
int app::CubicSpline::cor |
|
protected |
??? Celkov2 heuristika pro vyhledávání koeficientů
Definition at line 20 of file CubicSpline.hpp.
int app::CubicSpline::initOK |
|
protected |
int app::CubicSpline::jsav |
|
protected |
unsigned app::CubicSpline::lastVal |
|
protected |
unsigned app::CubicSpline::valsCount |
|
protected |
double* app::CubicSpline::xVals |
|
protected |
double* app::CubicSpline::y2Vals |
|
protected |
double * app::CubicSpline::yVals |
|
protected |
The documentation for this class was generated from the following files:
- /home/xxx/eclipse_workspaces/app/appcore/jni/app/pointops_new/CubicSpline.hpp
- /home/xxx/eclipse_workspaces/app/appcore/jni/app/pointops_new/CubicSpline.cpp