#include <tablefunct.h>
Public Member Functions | |
long | compare (tablefunct &tf) |
void | copy (tablefunct &tf) |
void | datacheck () |
double | getderiv (double temp) |
double | getinvval (double temp) |
double | getval (double temp) |
double | getval2 (double temp, double &k) |
double | getval3 (double temp, double &k) |
double | inv_derivative (double temp) |
void | print (FILE *out) |
void | print_data_file (FILE *out) |
void | read (XFILE *in) |
void | read_data_file (XFILE *in) |
void | read_prop (FILE *in) |
void | readval (XFILE *in) |
tablefunct (long n, long it) | |
tablefunct (long n) | |
tablefunct () | |
~tablefunct () | |
Public Attributes | |
long | asize |
number of function values | |
char * | file1 |
data file for reading | |
interpoltype | itype |
type of interpolation | |
double * | x |
array of independent variable (usually denoted x) | |
double * | y |
array of function values (dependent variable, usually denoted y) | |
Private Member Functions | |
double | derivative (double temp) |
double | diracinterpol2 (double temp, double &k) |
double | diracinterpol2 (double temp) |
double | inverse_piecewise_linear_interpol (double temp) |
double | laginterpol (double temp) |
double | lininterpol2 (double temp, double &k) |
double | lininterpol3 (double temp, double &k) |
double | piecewise_const_interpol (double temp) |
double | piecewise_linear_interpol (double temp) |
the class tablefunct deals with function given by a table it means, the function is defined in discrete points only several interpolation techniques can be used it computes also first derivative
Definition at line 19 of file tablefunct.h.
tablefunct | ( | ) |
The constructor initializes data members to zero values
created 20.11.2001 by Martin Kulhavy, mkulhavy@cml.fsv.cvut.cz
Definition at line 20 of file tablefunct.cpp.
tablefunct | ( | long | n | ) |
The constructor allocates table with n items.
n | - the number of table items |
Created by TKo, 09.2010
Definition at line 38 of file tablefunct.cpp.
tablefunct | ( | long | n, | |
long | it | |||
) |
The constructor allocates table with n items.
n | - the number of table items | |
it | - type of interpolation |
Created by JK, 11. 10. 2013
Definition at line 56 of file tablefunct.cpp.
References asize, dirac2, itype, lagrange, piecewiseconst, piecewiselin, piecewiselin2, print_err(), x, and y.
~tablefunct | ( | ) |
The destructor deallocates the memory where the vectors x, y are stored Parameters:
created 20.11.2001 by Martin Kulhavy, mkulhavy@cml.fsv.cvut.cz
Definition at line 96 of file tablefunct.cpp.
long compare | ( | tablefunct & | 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 833 of file tablefunct.cpp.
References asize, itype, x, and y.
Referenced by gfunct::compare().
void copy | ( | tablefunct & | 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 798 of file tablefunct.cpp.
References asize, itype, x, and y.
Referenced by gfunct::copy().
void datacheck | ( | ) |
function checks whether the x components are in strictly increasing order there cannot be two identical x components and the following sequence must be satisfied x[0] < x[1] < x[2] < ... <x[asize-1]
JK, 23.9.2011
Definition at line 248 of file tablefunct.cpp.
References asize, print_err(), and x.
double derivative | ( | double | temp | ) | [private] |
function computes first derivative dy/dx
Parameters:
temp | is x-coordinate, where the function value will be found |
JK, 23.9.2011
Definition at line 553 of file tablefunct.cpp.
References asize, print_err(), x, and y.
Referenced by getderiv().
double diracinterpol2 | ( | double | temp, | |
double & | k | |||
) | [private] |
The function returns the interpolated value at exact point (temp) by Dirac 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 | |
k | - unused parametr is set to 0.0 |
created 8.8.2005 by Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 339 of file tablefunct.cpp.
double diracinterpol2 | ( | double | temp | ) | [private] |
The function returns the interpolated value at exact point (temp) by Dirac 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 |
created 8.8.2005 by Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 306 of file tablefunct.cpp.
double getderiv | ( | double | temp | ) |
function computes first derivative
temp | is x-coordinate, where the function value will be found |
JK, 23.9.2011
Definition at line 764 of file tablefunct.cpp.
References asize, derivative(), itype, piecewiselin, print_err(), x, and y.
Referenced by gfunct::getderiv().
double getinvval | ( | double | temp | ) |
The function returns the interpolated value at exact point (temp), interpolation is chosen according to variable itype. Dirac, linear and Lagrangian n-1 interpolations are supported, see tablefunct.h Parameters:
temp | is x-coordinate, where the function value will be found |
created 2. 10. 2013 by JK
Definition at line 660 of file tablefunct.cpp.
References asize, inverse_piecewise_linear_interpol(), itype, piecewiselin, print_err(), x, and y.
Referenced by gfunct::getinvval().
double getval | ( | double | temp | ) |
The function returns the interpolated value at exact point (temp), interpolation is chosen according to variable itype. Dirac, linear and Lagrangian n-1 interpolations are supported, see tablefunct.h Parameters:
temp | is x-coordinate, where the function value will be found |
created 20.11.2001 by Martin Kulhavy, mkulhavy@cml.fsv.cvut.cz
Definition at line 611 of file tablefunct.cpp.
References asize, dirac2, diracinterpol2(), dummy, itype, laginterpol(), lagrange, piecewise_const_interpol(), piecewise_linear_interpol(), piecewiseconst, piecewiselin, piecewiselin2, print_err(), x, and y.
Referenced by cebfip78::compliance(), aci78::compliance(), pvalt::getval(), gfunct::getval(), loadcaset::give_fact(), pedmat::inverse_sorption_isotherm_data_get_phi(), and loadcase::tempercontrib().
double getval2 | ( | double | temp, | |
double & | k | |||
) |
The function returns the interpolated value at exact point (temp), interpolation is chosen according to variable itype. Dirac, linear and Lagrangian n-1 interpolations are supported, see tablefunct.h Parameters:
temp | is x-coordinate, where the function value will be found | |
k | is derivative of the function at given interval |
created 05.2007 by Tomas Koudelka koudelka@cml.fsv.cvut.cz
Definition at line 693 of file tablefunct.cpp.
References asize, dirac2, diracinterpol2(), itype, lininterpol2(), piecewiselin2, x, and y.
Referenced by pedmat::inverse_sorption_isotherm_data_get_derivative(), graphmat::matstiff(), and graphmat::nlstresses().
double getval3 | ( | double | temp, | |
double & | k | |||
) |
The function returns the interpolated value at exact point (temp) of inverse function!!!, interpolation is chosen according to variable itype. Dirac, linear and Lagrangian n-1 interpolations are supported, see tablefunct.h Parameters:
temp | is x-coordinate, where the function value will be found | |
k | is derivative of the function at given interval |
modified 11.2007 by Tomas Krejci krejci@cml.fsv.cvut.cz
Definition at line 731 of file tablefunct.cpp.
References asize, itype, lininterpol3(), piecewiselin, piecewiselin2, print_err(), x, and y.
Referenced by pedmat::sorption_isotherm_data_get_w().
double inv_derivative | ( | double | temp | ) |
function computes first derivative dx/dy
Parameters:
temp | is y-coordinate, where the function value will be found |
JK, 23.9.2011
Definition at line 581 of file tablefunct.cpp.
References asize, print_err(), x, and y.
Referenced by gfunct::getinvderiv().
double inverse_piecewise_linear_interpol | ( | double | temp | ) | [private] |
function computes the interpolated value with the help of piecewise constant interpolation for x which satisfies x[i] <= x <= x[i+1], the function values has the form f(x)=(f(x[i+1])-f(x[i]))/(x[i+1]-x[i])*(x-x[i]) + f(x[i])
Parameters:
temp | is x-coordinate, where the function value will be found |
created 20.11.2001 by Martin Kulhavy, mkulhavy@cml.fsv.cvut.cz JK, 23.9.2011
Definition at line 408 of file tablefunct.cpp.
References asize, f, print_err(), x, and y.
Referenced by getinvval().
double laginterpol | ( | double | temp | ) | [private] |
The function returns the interpolated value at exact point (temp) by Lagrangian n-1 degree polynom Parameters:
temp | is x-coordinate, where the function value will be found |
created 20.11.2001 by Martin Kulhavy, mkulhavy@cml.fsv.cvut.cz
Definition at line 524 of file tablefunct.cpp.
Referenced by getval().
double lininterpol2 | ( | double | temp, | |
double & | k | |||
) | [private] |
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 | |
k | is derivative of linear function |
created 8.8.2005 by Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 438 of file tablefunct.cpp.
References asize, h(), print_err(), x, and y.
Referenced by getval2().
double lininterpol3 | ( | double | temp, | |
double & | k | |||
) | [private] |
The function returns the interpolated value at exact point (temp) by linear interpolation of inverse function!!!, 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 | |
k | is derivative of linear function |
modified 11.2.2007 by Tomas Krejci, krejci@cml.fsv.cvut.cz
Definition at line 482 of file tablefunct.cpp.
References asize, h(), print_err(), x, and y.
Referenced by getval3().
double piecewise_const_interpol | ( | double | temp | ) | [private] |
function computes the interpolated value with the help of piecewise constant interpolation for x which satisfies x[i] < x <= x[i+1], the function values has the form f(x)=f(x[i+1])
Parameters:
temp | is x-coordinate, where the function value will be found |
created 20.11.2001 by Martin Kulhavy, mkulhavy@cml.fsv.cvut.cz JK, 23.9.2011
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 278 of file tablefunct.cpp.
References asize, f, print_err(), x, and y.
Referenced by getval().
double piecewise_linear_interpol | ( | double | temp | ) | [private] |
function computes the interpolated value with the help of piecewise constant interpolation for x which satisfies x[i] <= x <= x[i+1], the function values has the form f(x)=(f(x[i+1])-f(x[i]))/(x[i+1]-x[i])*(x-x[i]) + f(x[i])
Parameters:
temp | is x-coordinate, where the function value will be found |
created 20.11.2001 by Martin Kulhavy, mkulhavy@cml.fsv.cvut.cz JK, 23.9.2011
Definition at line 375 of file tablefunct.cpp.
References asize, f, print_err(), x, and y.
Referenced by getval().
void print | ( | FILE * | out | ) |
The function writes input parameters (asize, x, y) for interpolation
Parameters:
out | - output file |
created 22.11.2002 by JK
Definition at line 191 of file tablefunct.cpp.
References asize, itype, x, and y.
Referenced by pvalt::print(), loadcaset::print(), gfunct::print(), and pedmat::sorption_isotherm_data_print().
void print_data_file | ( | FILE * | out | ) |
The function writes input parameters for interpolation from file
Parameters:
out | - output file |
created 24/06/2013 by TKr
Definition at line 209 of file tablefunct.cpp.
References file1.
Referenced by pvalt::print(), and gfunct::print().
void read | ( | XFILE * | in | ) |
The function allocates and reads (stores) input parameters (asize, x, y) for interpolation from the file Example: 1 4 0.0 100.0 200.0 300.0 2.4 1.6 8.9 10.0 = itype asize x[0] y[0] x[1] y[1] x[2] y[2] x[3] y[3]
Parameters:
in | - input file |
created 20.11.2001 by Martin Kulhavy, mkulhavy@cml.fsv.cvut.cz
Definition at line 114 of file tablefunct.cpp.
References asize, interpoltype_kwdset(), itype, readval(), x, xfscanf(), and y.
Referenced by pvalt::read(), loadcaset::read(), graphmat::read(), gfunct::read(), and pedmat::sorption_isotherm_data_read().
void read_data_file | ( | XFILE * | in | ) |
The function allocates and reads (stores) input parameters (asize, x, y) for interpolation from the data file Example: 1 4 0.0 100.0 200.0 300.0 2.4 1.6 8.9 10.0 = itype asize x[0] y[0] x[1] y[1] x[2] y[2] x[3] y[3]
Parameters:
in | is input file |
16/11/2013, TKr
Definition at line 138 of file tablefunct.cpp.
References asize, file1, interpoltype_kwdset(), itype, readval(), x, xfclose(), xfopen(), xfscanf(), and y.
Referenced by pvalt::read(), and gfunct::read().
void read_prop | ( | FILE * | in | ) |
The function allocates and reads (stores) input parameters (asize, x, y) for interpolation from the file Example: 1 4 0.0 100.0 200.0 300.0 2.4 1.6 8.9 10.0 = itype asize x[0] y[0] x[1] y[1] x[2] y[2] x[3] y[3]. It was used in the old version of preprocessor and it is obsolate now. Parameters:
in | is input file |
created 20.11.2002 by Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 224 of file tablefunct.cpp.
References asize, getdouble(), getint(), getlong(), itype, x, and y.
Referenced by gfunct::read_prop().
void readval | ( | XFILE * | in | ) |
function read values of the table
in | - input file |
created 22.9.2011 by TKo, JK
Definition at line 168 of file tablefunct.cpp.
References asize, x, xfscanf(), and y.
Referenced by read(), and read_data_file().
long asize |
number of function values
Definition at line 49 of file tablefunct.h.
Referenced by compare(), cebfip78::compliance(), aci78::compliance(), climatcond2::compute_values(), climatcond::compute_values(), copy(), kunmat::CorD(), datacheck(), derivative(), diracinterpol2(), getderiv(), getinvval(), getval(), getval2(), getval3(), gfunct::init_tab(), gfunct::initiate(), inv_derivative(), inverse_piecewise_linear_interpol(), laginterpol(), lininterpol2(), lininterpol3(), piecewise_const_interpol(), piecewise_linear_interpol(), print(), climatcond2::read(), climatcond::read(), read(), read_data_file(), read_prop(), readval(), tablefunct(), and loadcase::tempercontrib().
char* file1 |
data file for reading
Definition at line 55 of file tablefunct.h.
Referenced by print_data_file(), read_data_file(), tablefunct(), and ~tablefunct().
type of interpolation
Definition at line 47 of file tablefunct.h.
Referenced by compare(), cebfip78::compliance(), aci78::compliance(), copy(), getderiv(), getinvval(), entitybocon::getval(), getval(), getval2(), getval3(), gfunct::init_tab(), gfunct::initiate(), print(), read(), read_data_file(), read_prop(), tablefunct(), and loadcase::tempercontrib().
double* x |
array of independent variable (usually denoted x)
Definition at line 51 of file tablefunct.h.
Referenced by compare(), cebfip78::compliance(), aci78::compliance(), copy(), dampermeability::dampermeability(), datacheck(), derivative(), stochdriver::diagpostproc(), diracinterpol2(), getderiv(), getinvval(), entitybocon::getval(), getval(), getval2(), getval3(), gfunct::init_tab(), gfunct::initiate(), inv_derivative(), inverse_piecewise_linear_interpol(), laginterpol(), lininterpol2(), lininterpol3(), piecewise_const_interpol(), piecewise_linear_interpol(), print(), read(), climatcond2::read_climatic_files(), climatcond::read_climatic_files(), read_data_file(), read_prop(), readval(), tablefunct(), loadcase::tempercontrib(), and ~tablefunct().
double* y |
array of function values (dependent variable, usually denoted y)
Definition at line 53 of file tablefunct.h.
Referenced by compare(), cebfip78::compliance(), aci78::compliance(), copy(), kunmat::CorD(), dampermeability::dampermeability(), derivative(), stochdriver::diagpostproc(), diracinterpol2(), getderiv(), getinvval(), entitybocon::getval(), getval(), getval2(), getval3(), gfunct::init_tab(), gfunct::initiate(), inv_derivative(), inverse_piecewise_linear_interpol(), laginterpol(), lininterpol2(), lininterpol3(), piecewise_const_interpol(), piecewise_linear_interpol(), print(), read(), climatcond2::read_climatic_files(), climatcond::read_climatic_files(), read_data_file(), read_prop(), readval(), tablefunct(), loadcase::tempercontrib(), and ~tablefunct().