26 char misc_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Non_class_members/Utilities/misc.C,v 1.2 2019/12/02 14:51:37 j_novak Exp $" ;
55 while( getline(infile, line) ) {
56 if (line.find(pattern, 0) != string::npos)
66 double y0, y1, y2, x0, x1, x2, der;
80 der = y0*(2*x0-x1-x2)/(x0-x1)/(x0-x2) +
81 y1*(x0-x2)/(x1-x0)/(x1-x2) +
82 y2*(x0-x1)/(x2-x0)/(x2-x1) ;
86 for(
int i=1;i<np-1;i++) {
96 der = y0*(x1-x2)/(x0-x1)/(x0-x2) +
97 y1*(2*x1-x0-x2)/(x1-x0)/(x1-x2) +
98 y2*(x1-x0)/(x2-x0)/(x2-x1) ;
114 der = y0*(x2-x1)/(x0-x1)/(x0-x2) +
115 y1*(x2-x0)/(x1-x0)/(x1-x2) +
116 y2*(2*x2-x0-x1)/(x2-x0)/(x2-x1) ;
118 dydx.
set(np-1) = der ;
double & set(int i)
Read/write of a particular element (index i) (1D case)
bool search_file(ifstream &infile, const string &pattern)
A function that searches for a pattern in a file and places the file stream after the found pattern...
void compute_derivative(const Tbl &xx, const Tbl &ff, Tbl &dfdx)
Derives a function defined on an unequally-spaced grid, approximating it by piecewise parabolae...
int get_dim(int i) const
Gives the i-th dimension (ie dim.dim[i])