00001 #ifndef GFUNCT_H 00002 #define GFUNCT_H 00003 00004 #include <stdio.h> 00005 #include "iotools.h" 00006 #include "parser.h" 00007 #include "galias.h" 00008 class tablefunct; 00009 class itablefunct; 00010 class gfunct; 00011 struct vector; 00012 00013 /** 00014 This class represents general type of function which can be described 00015 by general string expression or by table with function values. 00016 String expression is processed by the Parser and table is processed by the 00017 tablefunct. In case of string expression, there is allowed to have several 00018 expressions for different ranges of the variable. 00019 00020 */ 00021 class gfunct 00022 { 00023 public: 00024 gfunct(); 00025 gfunct(generalfunct tf,long nr); 00026 ~gfunct(); 00027 00028 long read(XFILE *in); 00029 double getval(double t); 00030 double getinvval(double t); 00031 double getval(vector &p, char *namevar[]); 00032 double getval(double t, double t0); 00033 long getval_long (double t); 00034 double getderiv (double t); 00035 double getinvderiv (double t); 00036 00037 long read_prop(FILE *in); 00038 long print(FILE *out); 00039 void initiate (gfunct &gf); 00040 00041 void init_tab (long nr); 00042 /// copies function from the parameter to the actual object 00043 void copy (gfunct &gf); 00044 /// merges function from the parameter with the actual object 00045 void merge (gfunct &gf); 00046 /// compares function from the parameter to the actual object 00047 long compare (gfunct &gf); 00048 00049 /// type of general function 00050 generalfunct tfunc; 00051 /// number of expression sets 00052 long neqs; 00053 /// number of general functions 00054 long ngf; 00055 /// constant value 00056 double f; 00057 00058 /// strings with expressions 00059 char **func; 00060 /// binary tree parser for an expressions 00061 Equation **eq; 00062 /// array with pointers arrays with pointers to expression variables 00063 variable ***var; 00064 /// array with limit values for pars_set 00065 double *limval; 00066 /// function defined by table (all values are real numbers) 00067 tablefunct *tabf; 00068 /// function defined by table (x values are real numbers while y values are integers) 00069 itablefunct *itabf; 00070 /// function is defined by set of general functions 00071 gfunct *gfs; 00072 }; 00073 00074 #endif