LORENE
|
() More...
Functions | |
void | Lorene::arrete (int a=0) |
Setting a stop point in a code. More... | |
bool | Lorene::zero_premier (double(*f)(double, const Param &), const Param &par, double a, double b, int n, double &a0, double &b0) |
Locates the sub-interval containing the first zero of a function in a given interval. More... | |
double | Lorene::zerosec (double(*f)(double, const Param &), const Param &par, double a, double b, double precis, int nitermax, int &niter, bool abort=true) |
Finding the zero a function. More... | |
double | Lorene::zerosec_b (double(*f)(double, const Param &), const Param &par, double a, double b, double precis, int nitermax, int &niter) |
Finding the zero a function on a bounded domain. More... | |
void | Lorene::zero_list (double(*f)(double, const Param &), const Param &par, double xmin, double xmax, int nsub, Tbl *&az, Tbl *&bz) |
Locates approximatively all the zeros of a function in a given interval. More... | |
Tbl | Lorene::integ1D (const Tbl &xx, const Tbl &ff) |
Integrates a function defined on an unequally-spaced grid, approximating it by piecewise parabolae. More... | |
void | Lorene::compute_derivative (const Tbl &xx, const Tbl &ff, Tbl &dfdx) |
Derives a function defined on an unequally-spaced grid, approximating it by piecewise parabolae. More... | |
Tbl | Lorene::poly_regression (const Tbl &, const Tbl &, int) |
Polynomial regression, giving Chebyshev coefficients. More... | |
int | Lorene::fwrite_be (const int *aa, int size, int nb, FILE *fich) |
Writes integer(s) into a binary file according to the big endian convention. More... | |
int | Lorene::fwrite_be (const double *aa, int size, int nb, FILE *fich) |
Writes double precision number(s) into a binary file according to the big endian convention. More... | |
int | Lorene::fread_be (int *aa, int size, int nb, FILE *fich) |
Reads integer(s) from a binary file according to the big endian convention. More... | |
int | Lorene::fread_be (double *aa, int size, int nb, FILE *fich) |
Reads double precision number(s) from a binary file according to the big endian convention. More... | |
char * | Lorene::load_file (char *fname) |
Read file into memory and returns pointer to data. More... | |
char * | Lorene::load_file_buffered (char *fname) |
Returns pointer to data from a file using a buffer. More... | |
int | Lorene::read_variable (const char *fname, const char *var_name, char *fmt, void *varp) |
Reads a variable from file. More... | |
int | Lorene::read_variable (const char *fname, const char *var_name, int &var) |
Read an integer-variable from file (cf read_variable(char *, char *, char *, void *) ). More... | |
int | Lorene::read_variable (const char *fname, const char *var_name, bool &var) |
Read a bool variable from file (cf read_variable(char *, char *, char *, void *) ). More... | |
int | Lorene::read_variable (const char *fname, const char *var_name, double &var) |
Read a double variable from file (cf read_variable(char *, char *, char *, void *) ). More... | |
int | Lorene::read_variable (const char *fname, const char *var_name, char **str) |
Read a (ANSI C) string variable from file. More... | |
void * | Lorene::MyMalloc (long bytes) |
'Improved' malloc that sets memory to 0 and also auto-terminates on error. More... | |
int | Lorene::FS_filelength (FILE *f) |
A portable routine to determine the length of a file. More... | |
void | Lorene::c_est_pas_fait (const char *) |
Helpful function to say something is not implemented yet. More... | |
bool | Lorene::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. More... | |
bool | Lorene::read_compose_table (const string &tablename, Tbl *&p_ental, Tbl *&p_entro, Tbl *&p_press, Tbl *&p_ener, Tbl *&p_nb, Tbl *&p_temp, Tbl *&p_ye) |
A function to read CompOSE table and return themro quantities in Lorene units. More... | |
bool | Lorene::admissible_fft (int) |
Checks whether or not a given number of degrees of freedom is compatible with the FFT transform. More... | |
()
bool Lorene::admissible_fft | ( | int | ) |
Checks whether or not a given number of degrees of freedom is compatible with the FFT transform.
Definition at line 58 of file FFT991/admissible_fft.C.
void Lorene::arrete | ( | int | a = 0 | ) |
void Lorene::c_est_pas_fait | ( | const char * | fichier | ) |
Helpful function to say something is not implemented yet.
Definition at line 76 of file c_est_pas_fait.C.
Derives a function defined on an unequally-spaced grid, approximating it by piecewise parabolae.
This function performs the numerical derivative of a function given by its values on a unequally-spaced grid, by means of local parabolic approximation.
xx | [input] Tbl containing the grid abscissas |
ff | [input] Tbl containing the values of the function to be derived, on the grid points |
dfdx | [output] Tbl with the values of the derivative of ff at the grid points. |
Definition at line 64 of file misc.C.
References Lorene::Tbl::get_dim(), and Lorene::Tbl::set().
int Lorene::fread_be | ( | int * | aa, |
int | size, | ||
int | nb, | ||
FILE * | fich | ||
) |
Reads integer(s) from a binary file according to the big endian convention.
This function has the same prototype and return value than the fread
function of the stdio
C library. The difference is that it assumes that the binary file is written in the big endian format, whatever the system is using little endian or big endian.
aa | [output] integer array to be read (in case of one element, address of this integer) |
size | [input] number of bytes of one int (must be 4) |
nb | [input] number of elements in the array aa |
fich | [input] binary file (must have been open by fopen ) |
Definition at line 72 of file fread_be.C.
int Lorene::fread_be | ( | double * | aa, |
int | size, | ||
int | nb, | ||
FILE * | fich | ||
) |
Reads double precision number(s) from a binary file according to the big endian convention.
This function has the same prototype and return value than the fread
function of the stdio
C library. The difference is that it assumes that the binary file is written in the big endian format, whatever the system is using little endian or big endian.
aa | [output] array of double to be read (in case of one element, address of this double ) |
size | [input] number of bytes of one double (must be 8) |
nb | [input] number of elements in the array aa |
fich | [input] binary file (must have been open by fopen ) |
double
effectively read in the file Definition at line 120 of file fread_be.C.
int Lorene::FS_filelength | ( | FILE * | f | ) |
A portable routine to determine the length of a file.
Definition at line 272 of file read_variable.C.
int Lorene::fwrite_be | ( | const int * | aa, |
int | size, | ||
int | nb, | ||
FILE * | fich | ||
) |
Writes integer(s) into a binary file according to the big endian convention.
This function has the same prototype and return value than the fwrite
function of the stdio
C library. The difference is that it ensures that the binary file is written in the big endian format, whatever the system is using little endian or big endian.
aa | [input] integer array to be written (in case of one element, address of this integer) |
size | [input] number of bytes of one int (must be 4) |
nb | [input] number of elements in the array aa |
fich | [input] binary file (must have been open by fopen ) |
Definition at line 73 of file fwrite_be.C.
int Lorene::fwrite_be | ( | const double * | aa, |
int | size, | ||
int | nb, | ||
FILE * | fich | ||
) |
Writes double precision number(s) into a binary file according to the big endian convention.
This function has the same prototype and return value than the fwrite
function of the stdio
C library. The difference is that it ensures that the binary file is written in the big endian format, whatever the system is using little endian or big endian.
aa | [input] array of double to be written (in case of one element, address of this double ) |
size | [input] number of bytes of one double (must be 8) |
nb | [input] number of elements in the array aa |
fich | [input] binary file (must have been open by fopen ) |
double
effectively written in the file Definition at line 123 of file fwrite_be.C.
Integrates a function defined on an unequally-spaced grid, approximating it by piecewise parabolae.
This function performs the numerical integration of a function given by its values on a unequally-spaced grid, by means of local parabolic approximation. The resulting primitive is set to 0 on the lower end of the integration interval.
xx | [input] Tbl containing the grid abscissas |
ff | [input] Tbl containing the values of the function to be integrated, on the grid points |
Tbl
with the values of the primitive of ff
at the grid points, such that it is zero at the first grid point. Definition at line 50 of file integrate_1D.C.
char* Lorene::load_file | ( | char * | fname | ) |
Read file into memory and returns pointer to data.
NOTE: don't forget to free the memory after use !
char* Lorene::load_file_buffered | ( | char * | fname | ) |
Returns pointer to data from a file using a buffer.
This function only reads from disk if the file has not been buffered yet. If a new file is read, the buffer is free'ed and the new data allocated.
fname | [input] name of file to read in. You can use NULL for previous file. |
NOTE: do NEVER free the (buffer-)data pointer, or the next call will crash!!
void * Lorene::MyMalloc | ( | long | bytes | ) |
'Improved' malloc that sets memory to 0 and also auto-terminates on error.
Definition at line 293 of file read_variable.C.
Polynomial regression, giving Chebyshev coefficients.
Definition at line 71 of file poly_regression.C.
References Lorene::Tbl::annule_hard(), Lorene::Tbl::get_dim(), Lorene::Tbl::get_ndim(), Lorene::Tbl::get_taille(), Lorene::Matrice::inverse(), Lorene::Matrice::set(), Lorene::Tbl::set(), Lorene::Matrice::set_etat_qcq(), Lorene::Tbl::set_etat_qcq(), and Lorene::Matrice::set_lu().
bool Lorene::read_compose_table | ( | const string & | tablename, |
Tbl *& | p_ental, | ||
Tbl *& | p_entro, | ||
Tbl *& | p_press, | ||
Tbl *& | p_ener, | ||
Tbl *& | p_nb, | ||
Tbl *& | p_temp, | ||
Tbl *& | p_ye | ||
) |
A function to read CompOSE table and return themro quantities in Lorene units.
Definition at line 34 of file read_compose_table.C.
References Lorene::Tbl::set(), Lorene::Tbl::set_etat_qcq(), and Lorene::Tbl::t.
int Lorene::read_variable | ( | const char * | fname, |
const char * | var_name, | ||
char * | fmt, | ||
void * | varp | ||
) |
Reads a variable from file.
Variable definitions can be of the type "variable = value", all other lines are ignored as comments. (alternatively, you can use ":" or whitespace instead of "=")
NOTE: the variable-definition has to be at the beginning of a line (modulo whitespace), or it will be considered a comment!
fname | [input] Name of config-file to read from. Use NULL to use buffered file. |
var_name | [input] Variable-name to read from config-file |
fmt | [input] C-style format string for reading (see sscanf ). |
varp | [output] Pointer to C-variable to read value into (has to be big enough!!) |
NOTE: rather use one of the type-specific overloaded functions below whenever possible (safer due to type-checking)
Definition at line 110 of file read_variable.C.
References Lorene::load_file_buffered(), and Lorene::MyMalloc().
int Lorene::read_variable | ( | const char * | fname, |
const char * | var_name, | ||
int & | var | ||
) |
Read an integer-variable from file (cf read_variable(char *, char *, char *, void *)
).
Definition at line 211 of file read_variable.C.
References Lorene::read_variable().
int Lorene::read_variable | ( | const char * | fname, |
const char * | var_name, | ||
bool & | var | ||
) |
Read a bool variable from file (cf read_variable(char *, char *, char *, void *)
).
Definition at line 221 of file read_variable.C.
References Lorene::read_variable().
int Lorene::read_variable | ( | const char * | fname, |
const char * | var_name, | ||
double & | var | ||
) |
Read a double variable from file (cf read_variable(char *, char *, char *, void *)
).
Definition at line 234 of file read_variable.C.
References Lorene::read_variable().
int Lorene::read_variable | ( | const char * | fname, |
const char * | var_name, | ||
char ** | str | ||
) |
Read a (ANSI C) string variable from file.
Definition at line 244 of file read_variable.C.
References Lorene::read_variable().
bool Lorene::search_file | ( | ifstream & | infile, |
const string & | pattern | ||
) |
void Lorene::zero_list | ( | double(*)(double, const Param &) | f, |
const Param & | par, | ||
double | xmin, | ||
double | xmax, | ||
int | nsub, | ||
Tbl *& | az, | ||
Tbl *& | bz | ||
) |
Locates approximatively all the zeros of a function in a given interval.
The N zeros are located in N intervals [az(i), bz(i)] with .
(*f)(double,const | Param&) [input] Function the zeros of which are to be located: a zero x0 is defined by f(x0, par) = 0 , where par are the parameters of the function f, stored in an object of the Lorene class Param . |
par | [input] Parameters of the function f. |
xmin | [input] Lower bound of the search interval |
xmax | [input] Higher bound of the search interval |
nsub | [input] Number of subdivision of the interval [xmin, xmax] to locate the zeros |
az | [output] 1-D array (Lorene Tbl ) contain the lower bounds of the intervals containing a zero. This Tbl \ is allocated by the routine via a new Tbl \ command (hence the pointer type). |
bz | [output] 1-D array (Lorene Tbl ) contain the higher bounds of the intervals containing a zero. This Tbl \ is allocated by the routine via a new Tbl \ command (hence the pointer type). |
Definition at line 60 of file zero_list.C.
References Lorene::Tbl::set(), and Lorene::Tbl::set_etat_qcq().
bool Lorene::zero_premier | ( | double(*)(double, const Param &) | f, |
const Param & | par, | ||
double | a, | ||
double | b, | ||
int | n, | ||
double & | a0, | ||
double & | b0 | ||
) |
Locates the sub-interval containing the first zero of a function in a given interval.
(*f)(double,const | Param&) [input] Function the zero of which is to be searched: f(x0, par) = 0 , where par are the parameters of the function f, stored in an object of the Lorene class Param . |
a | [input] Lower bound of the search interval [a, b] |
b | [input] Higher bound of the search interval [a, b] |
n | [input] Number of subdivisions of the interval [a, b] |
a0 | [output] Lower bound of the first (i.e. closest to a) interval [a0, b0] which contains a zero of f |
b0 | [output] Higher bound of the first (i.e. closest to a) interval [a0, b0] which contains a zero of f |
Definition at line 64 of file zero_premier.C.
double Lorene::zerosec | ( | double(*)(double, const Param &) | f, |
const Param & | par, | ||
double | a, | ||
double | b, | ||
double | precis, | ||
int | nitermax, | ||
int & | niter, | ||
bool | abort = true |
||
) |
Finding the zero a function.
This routine locates a zero by means of the secant method.
(*f)(double,const | Param&) [input] Function the zero of which is to be searched: the routine computes x0 in a given interval [a, b] such that f(x0, par) = 0 , where par are the parameters of the function f, stored in an object of the Lorene class Param . |
par | [input] Parameters of the function f. |
a | [input] Lower bound of the search interval [a, b] |
b | [input] Higher bound of the search interval [a, b] |
precis | [input] Required precision in the determination of x0 : the returned solution will be x0 +/- precis |
nitermax | [input] Maximum number of iterations in the secant method to compute x0. |
niter | [output] Number of iterations effectively used in computing x0 |
abort | [input] Should the function abort if the maximal number of iterations has been reached? |
double Lorene::zerosec_b | ( | double(*)(double, const Param &) | f, |
const Param & | par, | ||
double | a, | ||
double | b, | ||
double | precis, | ||
int | nitermax, | ||
int & | niter | ||
) |
Finding the zero a function on a bounded domain.
Same as zerosec
but insures that all calls to the function f are within [x1,x2]. Namely, it requires that f(x1)*f(x2)<0.
(*f)(double,const | Param&) [input] Function the zero of which is to be searched: the routine computes x0 in a given interval [a, b] such that f(x0, par) = 0 , where par are the parameters of the function f, stored in an object of the Lorene class Param . |
par | [input] Parameters of the function f. |
a | [input] Lower bound of the search interval [a, b] |
b | [input] Higher bound of the search interval [a, b] |
precis | [input] Required precision in the determination of x0 : the returned solution will be x0 +/- precis |
nitermax | [input] Maximum number of iterations in the secant method to compute x0. |
niter | [output] Number of iterations effectively used in computing x0 |
Definition at line 71 of file zerosec_borne.C.