#include "sopnamsp.h" #include "machdefs.h" #include #include #include #include #include #include #include "pexceptions.h" #include "functab.h" /*! \class SOPHYA::FuncTab \ingroup NTools Function tabulation */ /* --Methode-- */ //! Constructor /*! \param func : function to be tabulated \param ntab : number of tabulated points \param xmin xmax : tabulate from xmin to max \verbatim - Tabul[1] contient func(xmin), Tabul[NTab] contient func(xmax) - ATTENTION: Tabul[i] contient func(xmin + (i-1)*Dx) Tabul[i+1] contient func(xmin + i*Dx) - Tabul[0] et Tabul[NTab+1] servent pour interpoler rapidement Par defaut Tabul[0] contient Tabul[1] (=func(xmin)) Tabul[NTab+1] contient Tabul[NTab] (=func(xmax)) Ces valeurs peuvent etre changees avec les methodes SetLimVal Si la fonction existe pour xxmax alors le mieux est d'utiliser la methode SetLimVal(void): Tabul[0] = func(xmin-dx) Tabul[NTab+1] = func(xmax+dx) Si la fonction n'existe pas pour xxmax utiliser la methode SetLimVal(val0,valn): Tabul[0] = val0 Tabul[NTab+1] = valn \endverbatim */ FuncTab::FuncTab(double (*func)(double const),uint_4 ntab,r_8 xmin,r_8 xmax) { cout<<"func="<=xmax) {xmin=0.; xmax=1.;} NTab = ntab; XMin = xmin; XMax = xmax; Func = func; Dx = (r_8)(XMax-XMin)/(r_8)(NTab-1); Tabul = new r_8[NTab+2]; for(int_4 i=0;i