22#include "fasp_functs.h"
53 dvector *b = &mgl[0].
b, *x = &mgl[0].
x, *r = &mgl[0].
w;
61 REAL solve_start, solve_end;
62 REAL relres1 = 1.0, absres0 = sumb, absres, factor;
66 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
67 printf(
"### DEBUG: nrow = %d, ncol = %d, nnz = %d\n",
68 mgl[0].A.row, mgl[0].
A.
col, mgl[0].
A.
nnz);
80 while ( (iter++ < MaxIt) & (sumb >
SMALLREAL) ) {
97 factor = absres/absres0;
104 if ( relres1 < tol )
break;
108 ITS_FINAL(iter, MaxIt, relres1);
114 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
146 dvector *b = &mgl[0].
b, *x = &mgl[0].
x, *r = &mgl[0].
w;
154 REAL solve_start, solve_end;
155 REAL relres1 = 1.0, absres0 = sumb, absres, factor;
159 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
160 printf(
"### DEBUG: nrow = %d, ncol = %d, nnz = %d\n",
161 mgl[0].A.row, mgl[0].
A.
col, mgl[0].
A.
nnz);
173 while ( (iter++ < MaxIt) & (sumb >
SMALLREAL) ) {
185 factor = absres/absres0;
192 if ( relres1 < tol )
break;
196 ITS_FINAL(iter, MaxIt, relres1);
202 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
234 dvector *b = &mgl[0].
b, *x = &mgl[0].
x, *r = &mgl[0].
w;
242 REAL solve_start, solve_end;
243 REAL relres1 = 1.0, absres0 = sumb, absres, factor;
247 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
248 printf(
"### DEBUG: nrow = %d, ncol = %d, nnz = %d\n",
249 mgl[0].A.row, mgl[0].
A.
col, mgl[0].
A.
nnz);
260 while ( (iter++ < MaxIt) & (sumb >
SMALLREAL) )
271 factor = absres/absres0;
276 if ( relres1 < tol )
break;
282 ITS_FINAL(iter, MaxIt, relres1);
284 fasp_cputime(
"Nonlinear AMLI solve", solve_end - solve_start);
288 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
312 dvector *b = &mgl[0].
b, *x = &mgl[0].
x, *r = &mgl[0].
w;
318 REAL solve_start, solve_end;
319 REAL relres1 = 1.0, absres;
322 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
323 printf(
"### DEBUG: nrow = %d, ncol = %d, nnz = %d\n",
324 mgl[0].A.row, mgl[0].
A.
col, mgl[0].
A.
nnz);
344 printf(
"FMG finishes with relative residual %e.\n", relres1);
350 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
void fasp_cputime(const char *message, const REAL cputime)
Print CPU walltime.
void fasp_itinfo(const INT ptrlvl, const INT stop_type, const INT iter, const REAL relres, const REAL absres, const REAL factor)
Print out iteration information for iterative solvers.
void fasp_gettime(REAL *time)
Get system time.
void fasp_dvec_set(INT n, dvector *x, const REAL val)
Initialize dvector x[i]=val for i=0:n-1.
void fasp_dvec_cp(const dvector *x, dvector *y)
Copy dvector x to dvector y.
void fasp_blas_dcsr_aAxpy(const REAL alpha, const dCSRmat *A, const REAL *x, REAL *y)
Matrix-vector multiplication y = alpha*A*x + y.
REAL fasp_blas_dvec_norm2(const dvector *x)
L2 norm of dvector x.
void fasp_solver_fmgcycle(AMG_data *mgl, AMG_param *param)
Solve Ax=b with non-recursive full multigrid K-cycle.
void fasp_solver_mgcycle(AMG_data *mgl, AMG_param *param)
Solve Ax=b with non-recursive multigrid cycle.
void fasp_solver_namli(AMG_data *mgl, AMG_param *param, INT l, INT num_levels)
Solve Ax=b with recursive nonlinear AMLI-cycle.
void fasp_solver_amli(AMG_data *mgl, AMG_param *param, INT l)
Solve Ax=b with recursive AMLI-cycle.
void fasp_solver_mgrecur(AMG_data *mgl, AMG_param *param, INT level)
Solve Ax=b with recursive multigrid K-cycle.
INT fasp_amg_solve_amli(AMG_data *mgl, AMG_param *param)
AMLI – SOLVE phase.
INT fasp_amg_solve_namli(AMG_data *mgl, AMG_param *param)
Nonlinear AMLI – SOLVE phase.
INT fasp_amg_solve(AMG_data *mgl, AMG_param *param)
AMG – SOLVE phase.
void fasp_famg_solve(AMG_data *mgl, AMG_param *param)
FMG – SOLVE phase.
Main header file for the FASP project.
#define SHORT
FASP integer and floating point numbers.
#define MAX(a, b)
Definition of max, min, abs.
#define ERROR_SOLVER_MAXIT
#define STOP_REL_RES
Definition of iterative solver stopping criteria types.
#define PRINT_NONE
Print level for all subroutines – not including DEBUG output.
dCSRmat A
pointer to the matrix at level level_num
dvector b
pointer to the right-hand side at level level_num
dvector x
pointer to the iterative solution at level level_num
dvector w
temporary work space
Parameters for AMG methods.
SHORT print_level
print level for AMG
REAL tol
stopping tolerance for AMG solver
INT maxit
max number of iterations of AMG
Sparse matrix of REAL type in CSR format.
INT col
column of matrix A, n
REAL * val
nonzero entries of A
INT nnz
number of nonzero entries
Vector with n entries of REAL type.