TheBoussinesqModel
3.2.1
|
Go to the source code of this file.
Macros | |
#define | NRANSI |
#define | THRESH 0 |
#define | ITOL 3 |
#define | TOL 0.00001 |
#define | ITMAX 1000 |
#define | SQR(a) ((sqrarg=(a)) == 0.0 ? 0.0 : sqrarg*sqrarg) |
#define | SWAP(a, b) tempr=(a);(a)=(b);(b)=tempr |
#define | EPS 1.0e-14 |
#define | TINY 1.0E-20 |
Functions | |
void | convlv (FLOATVECTOR *data, unsigned long n, FLOATVECTOR *respns, unsigned long m, int isign, double delta_time, FLOATVECTOR *ans) |
void | four1 (FLOATVECTOR *data, unsigned long nn, int isign) |
void | ludcmp (SHORTVECTOR *indx, DOUBLEMATRIX *var) |
void | lubksb (DOUBLEMATRIX *var, SHORTVECTOR *indx, DOUBLEVECTOR *gam) |
void | realft (FLOATVECTOR *data, unsigned long n, int isign) |
void | twofft (FLOATVECTOR *data1, FLOATVECTOR *data2, FLOATVECTOR *fft1, FLOATVECTOR *fft2, unsigned long n) |
void | sprsin (double **, int, float, long, double *, long *) |
DOUBLEMATRIX * | vett_mat (double *d, double *ds, double *di, int n) |
double | snrm (long n, double sx[], int itol) |
void | atimes (long n, double x[], double r[], int itrnsp, double sa[], long ija[]) |
void | asolve (long n, double b[], double x[], double sa[]) |
void | dsprsax (double sa[], long ija[], double x[], double b[], long n) |
void | dsprstx (double sa[], long ija[], double x[], double b[], long n) |
float | integration (float(*fun)(float), float, float, int) |
#define EPS 1.0e-14 |
Definition at line 8 of file linearalgebra.h.
#define ITMAX 1000 |
Definition at line 5 of file linearalgebra.h.
#define ITOL 3 |
Definition at line 3 of file linearalgebra.h.
#define NRANSI |
Definition at line 1 of file linearalgebra.h.
#define SQR | ( | a) | ((sqrarg=(a)) == 0.0 ? 0.0 : sqrarg*sqrarg) |
Definition at line 6 of file linearalgebra.h.
Referenced by convlv().
#define SWAP | ( | a, | |
b | |||
) | tempr=(a);(a)=(b);(b)=tempr |
Definition at line 7 of file linearalgebra.h.
Referenced by four1().
#define THRESH 0 |
Definition at line 2 of file linearalgebra.h.
#define TINY 1.0E-20 |
Definition at line 9 of file linearalgebra.h.
Referenced by ludcmp().
#define TOL 0.00001 |
Definition at line 4 of file linearalgebra.h.
void asolve | ( | long | n, |
double | b[], | ||
double | x[], | ||
double | sa[] | ||
) |
Name: asolve
Version:
Synopsis: void asolve(long n, double b[], double x[], int itrnsp,double sa[], long ija[])
Description:
References: DA NUMERICAL RECIPES IN C. (Second Edition - Cambridge Univ. Press). pag 89
Definition at line 635 of file linearalgebra.c.
void atimes | ( | long | n, |
double | x[], | ||
double | r[], | ||
int | itrnsp, | ||
double | sa[], | ||
long | ija[] | ||
) |
Name: atimes
Version:
Synopsis: void atimes(long n, double x[], double r[], int itrnsp,double sa[], long ija[]);
Description:
References: DA NUMERICAL RECIPES IN C. (Second Edition - Cambridge Univ. Press). pag 88
Notes:
Definition at line 615 of file linearalgebra.c.
void convlv | ( | FLOATVECTOR * | data, |
unsigned long | n, | ||
FLOATVECTOR * | respns, | ||
unsigned long | m, | ||
int | isign, | ||
double | delta_time, | ||
FLOATVECTOR * | ans | ||
) |
Name: convlv
Synopsis: void convlv(FLOATVECTOR *data,unsigned long n,FLOATVECTOR *respns,unsigned long m,int isign, double delta_time,FLOATVECTOR *ans);
Description: Convolves or deconvolves a real data set data [1..n] with a responce function respns[1..n] The responce function must be stored in wrap-around order in the first element of respns, where m is an odd integer <=n. Wrap-around order means that the first half of the array respns contains the impulse responce function at positive times, while the second half of the array contains the impulceresponce function at negative times, counting down from the highest element respns[m]. On input isign is +1 for convolution, -1 for deconvolution. The answer is returned in the first n componenets of ans. However, ans must be supplied in the calling program with dimension [1..2*n], for consistency with twofft. n MUST be an integer power of two.
Authors & Date: Angelo Zacchia, Marco Pegoretti, 1998
Inputs: data is a complex array of lenght n
FILE: LIBRARIES/LINEARALGEBRA/linearalgebra.c, LIBRARIES/LINEARALGEBRA/linearalgebra.h
Notes: It is a modified version of the routine in Numerical Recipes, second edition
Definition at line 6 of file linearalgebra.c.
References FLOATVECTOR::co, free_floatvector(), new_floatvector(), realft(), SQR, t_error(), and twofft().
void dsprsax | ( | double | sa[], |
long | ija[], | ||
double | x[], | ||
double | b[], | ||
long | n | ||
) |
Name: dsprsax
Version:
Synopsis: void dsprsax(double sa[], long ija[], double x[], double b[], long n)
Description: Questa funzione moltiplica una matrice, memoririzzata alla maniera di N.R., per un vettore x[]. Il risultato e' un vettore b[].
Inputs:
Return:
References: DA NUMERICAL RECIPES IN C. (Second Edition - Cambridge Univ. Press). pag 89
Definition at line 654 of file linearalgebra.c.
References t_error().
Referenced by atimes().
void dsprstx | ( | double | sa[], |
long | ija[], | ||
double | x[], | ||
double | b[], | ||
long | n | ||
) |
Name: dsprstx
Synopsis: void dsprsax(double sa[], long ija[], double x[], double b[], long n)
Description: Questa funzione moltiplica la trasposta di una matrice, memoririzzata alla maniera di N.R., per un vettore x[]. Il risultato e' un vettore b[].
Inputs:
Return:
Needs:
Related Routines:
See Also:
References: DA NUMERICAL RECIPES IN C. (Second Edition - Cambridge Univ. Press). pag 80
Definition at line 677 of file linearalgebra.c.
References t_error().
Referenced by atimes().
void four1 | ( | FLOATVECTOR * | data, |
unsigned long | nn, | ||
int | isign | ||
) |
Name: four1
Synopsis: void four1(FLOATVECTOR *data,unsigned long nn,int isign)
Description: Replaces data[1..2*nn] by its discrete Fourier transform,if isign is input as 1; or replaces data[1..2*nn] by nn times its inverse discrete Fourier transform, if isign is input as -1, data is a complex array of lenght nn or, equivalently, a real array of lenght 2*nn: nn MUST be an integer power of 2(this is not checked for).
Authors & Date: Angelo Zacchia, Marco Pegoretti, 1998
Inputs: data is a complex array of lenght n
FILE: LIBRARIES/LINEARALGEBRA/linearalgebra.c, LIBRARIES/LINEARALGEBRA/linearalgebra.h
Notes: It is a modified version of the routine in Numerical Recipes, second edition
Definition at line 48 of file linearalgebra.c.
References FLOATVECTOR::co, and SWAP.
float integration | ( | float(*)(float) | fun, |
float | , | ||
float | , | ||
int | |||
) |
Name: integration
Synopsis: float integration(float (*func)(float), float a, float b, int n);
Description: Questa funzione calcola l'integrale con il metodo dei trapezi
Inputs:
Return:
Needs:
Related Routines:
See Also:
References: DA NUMERICAL RECIPES IN C. (Second Edition - Cambridge Univ. Press). pag 137
Definition at line 697 of file linearalgebra.c.
void lubksb | ( | DOUBLEMATRIX * | var, |
SHORTVECTOR * | indx, | ||
DOUBLEVECTOR * | gam | ||
) |
Name: lubksb
Synopsis: int lubksb(DOUBLEMATRIX *var, SHORTVECTOR *indx,DOUBLEVECTOR *gam)
Description: Convolves or deconvolves a real data set data [1..n] with a responce function respns[1..n] The responce function must be stored in wrap-around order in the first element of respns, where m is an odd integer <=n. Wrap-around order means that the first half of the array respns contains the impulse responce function at positive times, while the second half of the array contains the impulceresponce function at negative times, counting down from the highest element respns[m]. On input isign is +1 for convolution, -1 for deconvolution. The answer is returned in the first n componenets of ans. However, ans must be supplied in the calling program with dimension [1..2*n], for consistency with twofft. n MUST be an integer power of two.
Authors & Date: Angelo Zacchia, Marco Pegoretti, 1998
Inputs: data is a complex array of lenght n
FILE: LIBRARIES/LINEARALGEBRA/linearalgebra.c, LIBRARIES/LINEARALGEBRA/linearalgebra.h
Notes: It is a modified version of the routine in Numerical Recipes, second edition
Examples:
References: Pegoretti, Marco, Geomodel, implementazione di un modello scalabile di deflusso e bilancio idrologico di bacino, 1997
Definition at line 169 of file linearalgebra.c.
References SHORTVECTOR::co, DOUBLEVECTOR::co, DOUBLEMATRIX::co, and DOUBLEMATRIX::nrh.
Referenced by ordi_kriging2().
void ludcmp | ( | SHORTVECTOR * | indx, |
DOUBLEMATRIX * | var | ||
) |
Name: ludcmp
Synopsis: int ludcmp(SHORTVECTOR *indx, DOUBLEMATRIX *var)
Description: Convolves or deconvolves a real data set data [1..n] with a responce function respns[1..n] The responce function must be stored in wrap-around order in the first element of respns, where m is an odd integer <=n. Wrap-around order means that the first half of the array respns contains the impulse responce function at positive times, while the second half of the array contains the impulceresponce function at negative times, counting down from the highest element respns[m]. On input isign is +1 for convolution, -1 for deconvolution. The answer is returned in the first n componenets of ans. However, ans must be supplied in the calling program with dimension [1..2*n], for consistency with twofft. n MUST be an integer power of two.
Authors & Date: Angelo Zacchia, Marco Pegoretti, 1998
Inputs:
FILE: LIBRARIES/LINEARALGEBRA/linearalgebra.c, LIBRARIES/LINEARALGEBRA/linearalgebra.h
Notes: It is a modified version of the routine in Numerical Recipes, second edition
Examples:
References: Pegoretti, Marco, Geomodel, implementazione di un modello scalabile di deflusso e bilancio idrologico di bacino, 1997
Definition at line 97 of file linearalgebra.c.
References SHORTVECTOR::co, DOUBLEVECTOR::co, DOUBLEMATRIX::co, free_doublevector(), new_doublevector(), DOUBLEMATRIX::nrh, and TINY.
Referenced by ordi_kriging2().
void realft | ( | FLOATVECTOR * | data, |
unsigned long | n, | ||
int | isign | ||
) |
Name: realft
Synopsis: void realft(FLOATVECTOR *data,unsigned long n,int isign);
Description: Calculates the Fourier transform of a set of n real-value data points. Replaces this data (which is stored in array data[1..n]) by the positive frequency half of its complex Fourier transform. The real-valued first and last components of the complex transform are returned as elements data[1] data[2], respectively, n must be a power of 2. This routine also calculates the inverse transform of a complex data array if it is the transform of real data (result in this case must be multiplied by 2/n).
Authors & Date: modified from NR by Marco Pegoretti and Angelo Zacchia, 1998
FILE: LIBRARIES/LINEARALGEBRA/linearalgebra.c, LIBRARIES/LINEARALGEBRA/linearalgebra.h
Definition at line 202 of file linearalgebra.c.
References FLOATVECTOR::co, and four1().
Referenced by convlv().
double snrm | ( | long | n, |
double | sx[], | ||
int | itol | ||
) |
Name: snrm
Version:
Synopsis: double snrm(long n, double sx[], int itol);
Description:
Questa funzione calcola la norma di un vettore con la modalita' specificata dal parametro itol
Authors & Date: Angelo Zacchia, June 1998
FILE: LIBRARIES/LINEARALGEBRA/linearalgebra.c, LIBRARIES/LINEARALGEBRA/linearalgebra.h
References: DA NUMERICAL RECIPES IN C. (Second Edition - Cambridge Univ. Press). pag 88
Bugs & limitations:
Definition at line 579 of file linearalgebra.c.
void sprsin | ( | double ** | , |
int | , | ||
float | , | ||
long | , | ||
double * | , | ||
long * | |||
) |
Name: ris_sistema
Synopsis:
void ris_sistema (double d[], double ds[], double di[], double b[], double x[], int n);
Version:0.9
Description: This solves the specified linear system. Questa funzione innesca la soluzione del sistema lineare. Ha solo lo scopo di ricevere gli argomenti necessari dal programma principale, allocare e deallocare le strutture necessarie e di restituire il risultato.
Definizione dei parametri:
Inputs: In input riceve gli elementi delle diagonali principale d[], superiore ds[], inferiore di[], il vettore dei termini noti b[], una soluzione di primo tentativo x[] e la dimensione del sistema, n.
Return: Vengono restituiti gli elementi del vettore soluzione del sistema x[].
Tutti vettori sopra menzionati devono essere variabili globali, sono quindi dichiarati all'interno del programma principale.
Authors & Date: Angelo Zacchia, June 1998
FILE: LIBRARIES/LINEARALGEBRA/linearalgebra.c, LIBRARIES/LINEARALGEBRA/linearalgebra.h
Name: sprsin
Synopsis:
void sprsin(double **,int,float,long,double *,long *);
Description: Funzione che ordina una matrice sparsa (in questo caso tridiagonale) alla maniera di Num. Rec. Questa funzione converte una matrice memorizzata nel modo convenzionale in un vettore sa[] che contiene solo i valori non nulli della matrice e in un vettore ija[] che permette di individuare la posizione originale degli elementi di sa[].
Inputs:
Return:
Authors & Date: Angelo Zacchia, June 1998
FILE: LIBRARIES/LINEARALGEBRA/linearalgebra.c, LIBRARIES/LINEARALGEBRA/linearalgebra.h
References: DA NUMERICAL RECIPES IN C. (Second Edition - Cambridge Univ. Press).
void twofft | ( | FLOATVECTOR * | data1, |
FLOATVECTOR * | data2, | ||
FLOATVECTOR * | fft1, | ||
FLOATVECTOR * | fft2, | ||
unsigned long | n | ||
) |
Name: twofft
Synopsis: voidtwofft(FLOATVECTOR *data1,FLOATVECTOR *data2,FLOATVECTOR *fft1,FLOATVECTOR *fft2,unsigned long n);
Description: Given two real input array data1[1..2n] and data2[1..2n] this routine calls four1 and return two complex output arrays, fft1[1..2n] and fft2[1..2n], each of complex lenght n, which contain the discrete Fourier transforms of the respective data arrays. n MUST be an integer power of 2
Authors & Date: For the Numerical Recipes,1998.
FILE: LIBRARIES/LINEARALGEBRA/linearalgebra.c, LIBRARIES/LINEARALGEBRA/linearalgebra.h
Definition at line 247 of file linearalgebra.c.
References FLOATVECTOR::co, and four1().
Referenced by convlv().
DOUBLEMATRIX* vett_mat | ( | double * | d, |
double * | ds, | ||
double * | di, | ||
int | n | ||
) |
Name: linbcg
Description: Questa funzione consente di risolvere di risolvere un sistema lineare del tipo A x = b con il metodo iterativo del gradiente coniugato.
Inputs:
Oltre alla soluzione la funzione calcola anche il numero di iterazione effetuate ( iter ) e l'errore commesso ( err ).
Authors & Date: Angelo Zacchia, June 1998
FILE: LIBRARIES/LINEARALGEBRA/linearalgebra.c, LIBRARIES/LINEARALGEBRA/linearalgebra.h
References: NUMERICAL RECIPES IN C. (Second Edition - Cambridge Univ. Press). pag 86-88 Bugs & limitations:
Name: vett_mat
Version:
Synopsis:
Description:
Questa funzione converte tre vettori in una matrice quadrata tridiagonale.
Inputs: Bisogna passare alla funzione i puntatori agli elementi dei vettori
Return: La funzione restituisce il puntatore alla matrice.
Authors & Date: Angelo Zacchia, June 1998
FILE: LIBRARIES/LINEARALGEBRA/linearalgebra.c, LIBRARIES/LINEARALGEBRA/linearalgebra.h
Definition at line 369 of file linearalgebra.c.
References DOUBLEMATRIX::co, and new_doublematrix().