#include <itablefunct.h>
Public Member Functions | |
long | compare (itablefunct &tf) |
void | copy (itablefunct &tf) |
long | getval (double temp) |
itablefunct () | |
void | print (FILE *out) |
void | read (XFILE *in) |
void | read_prop (FILE *in) |
~itablefunct () | |
Public Attributes | |
long | asize |
number of function values | |
double * | x |
array of time values | |
long * | y |
array of function values |
This file declares the class of tablefunct, which implements various types of interpolation. The values for interpolation are given by the table.
Definition at line 12 of file itablefunct.h.
itablefunct | ( | ) |
The constructor defines arrays for interpolation. Parameters:
asize | is the size of vectors x, y | |
x | is the vector where time values are stored | |
y | is the vector where the function values are stored |
10.2.2006, JK, TKo
Definition at line 24 of file itablefunct.cpp.
~itablefunct | ( | ) |
The destructor deallocates the memory where the vectors x, y are stored Parameters:
10.2.2006, JK, TKo
Definition at line 37 of file itablefunct.cpp.
long compare | ( | itablefunct & | tf | ) |
The function compares all data from subroutine argument with the actual object
tf | - object of tablefunct for comparison |
0 | - objects are identical | |
1 | - objects differs |
TKo, 09.2010
Definition at line 194 of file itablefunct.cpp.
Referenced by gfunct::compare().
void copy | ( | itablefunct & | tf | ) |
The function copies all data from subroutine argument to the actual object.
tf | - object of tablefunct for comparison |
JK, 15.11.2008
Definition at line 161 of file itablefunct.cpp.
Referenced by gfunct::copy().
long getval | ( | double | temp | ) |
The function returns the interpolated value at exact point (temp) by linear interpolation, if the point lies out of the range, extrapolation from the limit intervals takes effect.
Parameters:
temp | is x-coordinate, where the function value will be found |
10.20.2006, JK, TKo TKo+JK 4.7.2013 changed evaluation of piecewise const function from (x_i; x_{i+1}> => y[i+1] to <x_i; x_{i+1}) => y[i]
Definition at line 129 of file itablefunct.cpp.
Referenced by gfunct::getval_long().
void print | ( | FILE * | out | ) |
The function writes input parameters (asize, x, y) for interpolation
Parameters:
out | - output file |
10.2. 2006, JK, TKo
Definition at line 83 of file itablefunct.cpp.
Referenced by gfunct::print().
void read | ( | XFILE * | in | ) |
function reads data
Example:
function is equal to y1 for x from -infinity to x less than x1 function is equal to y2 for x from x1 to x less than x2 function is equal to y3 for x from x2 to x less than x3 function is equal to y4 for x from x3 to infinity
asize is equal to 4 for this example
in | is input file |
10.2.2006, JK, TKo
Definition at line 61 of file itablefunct.cpp.
References asize, x, xfscanf(), and y.
Referenced by gfunct::read().
void read_prop | ( | FILE * | in | ) |
Parameters:
in | is input file |
10.2.2006, TKo
Definition at line 101 of file itablefunct.cpp.
References asize, getdouble(), getlong(), x, and y.
Referenced by gfunct::read_prop().
long asize |
number of function values
Definition at line 28 of file itablefunct.h.
Referenced by compare(), copy(), getval(), itablefunct(), print(), read(), and read_prop().
double* x |
array of time values
Definition at line 30 of file itablefunct.h.
Referenced by compare(), copy(), getval(), itablefunct(), print(), read(), read_prop(), and ~itablefunct().
long* y |
array of function values
Definition at line 32 of file itablefunct.h.
Referenced by compare(), copy(), getval(), itablefunct(), print(), read(), read_prop(), and ~itablefunct().