16#include "fasp_functs.h"
51 printf(
"%6d | %13.6e | %13.6e | %10.4f\n", iter, relres, absres, factor);
54 printf(
"-----------------------------------------------------------\n");
57 printf(
"It Num | ||r||/||b|| | ||r|| | Conv. Factor\n");
60 printf(
"It Num | ||r||_B/||b||_B | ||r||_B | Conv. Factor\n");
63 printf(
"It Num | ||r||/||x|| | ||r|| | Conv. Factor\n");
66 printf(
"-----------------------------------------------------------\n");
67 printf(
"%6d | %13.6e | %13.6e | -.-- \n", iter, relres, absres);
89 REAL gridcom = 0.0, opcom = 0.0;
93 printf(
"-----------------------------------------------------------\n");
94 printf(
" Level Num of rows Num of nonzeros Avg. NNZ / row \n");
95 printf(
"-----------------------------------------------------------\n");
97 for ( level = 0; level < max_levels; ++level) {
98 const REAL AvgNNZ = (
REAL) mgl[level].A.nnz/mgl[level].
A.
row;
99 printf(
"%5d %13d %17d %14.2f\n",
100 level, mgl[level].A.row, mgl[level].
A.
nnz, AvgNNZ);
101 gridcom += mgl[level].
A.
row;
102 opcom += mgl[level].
A.
nnz;
105 char matA[max_levels], rhsb[max_levels];
107 sprintf(matA,
"A%d.coo", level);
108 sprintf(rhsb,
"b%d.coo", level);
113 printf(
"-----------------------------------------------------------\n");
115 gridcom /= mgl[0].
A.
row;
116 opcom /= mgl[0].
A.
nnz;
117 printf(
" Grid complexity = %.3f |", gridcom);
118 printf(
" Operator complexity = %.3f\n", opcom);
120 printf(
"-----------------------------------------------------------\n");
141 REAL gridcom = 0.0, opcom = 0.0;
145 printf(
"-----------------------------------------------------------\n");
146 printf(
" Level Num of rows Num of nonzeros Avg. NNZ / row \n");
147 printf(
"-----------------------------------------------------------\n");
149 for ( level = 0; level < max_levels; ++level ) {
150 const REAL AvgNNZ = (
REAL) mgl[level].A.NNZ/mgl[level].
A.
ROW;
151 printf(
"%5d %13d %17d %14.2f\n",
152 level,mgl[level].A.ROW, mgl[level].
A.
NNZ, AvgNNZ);
153 gridcom += mgl[level].
A.
ROW;
154 opcom += mgl[level].
A.
NNZ;
156 printf(
"-----------------------------------------------------------\n");
158 gridcom /= mgl[0].
A.
ROW;
159 opcom /= mgl[0].
A.
NNZ;
160 printf(
" Grid complexity = %.3f |", gridcom);
161 printf(
" Operator complexity = %.3f\n", opcom);
163 printf(
"-----------------------------------------------------------\n");
182 printf(
"%s costs %.4f seconds\n", message, cputime);
199 if ( ptrlvl >
PRINT_NONE ) printf(
"%s", message);
216 if ( status >= 0 )
return;
220 printf(
"### ERROR: Cannot read file! [%s]\n", fctname);
223 printf(
"### ERROR: Cannot open file! [%s]\n", fctname);
226 printf(
"### ERROR: Unknown file format! [%s]\n", fctname);
229 printf(
"### ERROR: Unknown input argument! [%s]\n", fctname);
232 printf(
"### ERROR: Regression test failed! [%s]\n", fctname);
235 printf(
"### ERROR: Cannot allocate memory! [%s]\n", fctname);
238 printf(
"### ERROR: Unexpected number of blocks! [%s]\n", fctname);
241 printf(
"### ERROR: Wrong data structure! [%s]\n", fctname);
244 printf(
"### ERROR: Matrix has zero diagonal entries! [%s]\n", fctname);
247 printf(
"### ERROR: Unknown input argument! [%s]\n", fctname);
250 printf(
"### ERROR: Unknown AMG interpolation type! [%s]\n", fctname);
253 printf(
"### ERROR: Unknown AMG coarsening type! [%s]\n", fctname);
256 printf(
"### ERROR: Unknown AMG smoother type! [%s]\n", fctname);
259 printf(
"### ERROR: Unknown solver type! [%s]\n", fctname);
262 printf(
"### ERROR: Unknown preconditioner type! [%s]\n", fctname);
265 printf(
"### ERROR: Solver stagnation! [%s]\n", fctname);
268 printf(
"### ERROR: Solution close to zero! [%s]\n", fctname);
271 printf(
"### ERROR: Convergence tolerance too small! [%s]\n", fctname);
274 printf(
"### ERROR: ILU setup failed! [%s]\n", fctname);
277 printf(
"### ERROR: Max iteration number reached! [%s]\n", fctname);
280 printf(
"### ERROR: Iterative solver failed! [%s]\n", fctname);
283 printf(
"### ERROR: Unknown solver runtime error! [%s]\n", fctname);
286 printf(
"### ERROR: Miscellaneous error! [%s]\n", fctname);
289 printf(
"### ERROR: Unknown quadrature rules! [%s]\n", fctname);
292 printf(
"### ERROR: Num of quad points not supported! [%s]\n", fctname);
295 printf(
"### ERROR: Unknown error! [%s]\n", fctname);
void fasp_cputime(const char *message, const REAL cputime)
Print CPU walltime.
void fasp_amgcomplexity(const AMG_data *mgl, const SHORT prtlvl)
Print level and complexity information of AMG.
void fasp_amgcomplexity_bsr(const AMG_data_bsr *mgl, const SHORT prtlvl)
Print complexities of AMG method for BSR matrices.
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_chkerr(const SHORT status, const char *fctname)
Check error status and print out error messages before quit.
void fasp_message(const INT ptrlvl, const char *message)
Print output information if necessary.
void fasp_dcsrvec_write2(const char *filemat, const char *filerhs, dCSRmat *A, dvector *b)
Write A and b to two separate disk files.
Main header file for the FASP project.
#define SHORT
FASP integer and floating point numbers.
#define ERROR_SOLVER_STAG
#define ERROR_AMG_INTERP_TYPE
#define ERROR_SOLVER_MAXIT
#define ERROR_AMG_SMOOTH_TYPE
#define ERROR_SOLVER_ILUSETUP
#define STOP_REL_RES
Definition of iterative solver stopping criteria types.
#define ERROR_SOLVER_TYPE
#define ERROR_SOLVER_MISC
#define ERROR_SOLVER_SOLSTAG
#define ERROR_SOLVER_PRECTYPE
#define ERROR_DATA_STRUCTURE
#define ERROR_AMG_COARSE_TYPE
#define PRINT_NONE
Print level for all subroutines – not including DEBUG output.
#define ERROR_SOLVER_EXIT
#define ERROR_SOLVER_TOLSMALL
#define ERROR_DATA_ZERODIAG
Data for multigrid levels in dBSRmat format.
dBSRmat A
pointer to the matrix at level level_num
INT num_levels
number of levels in use <= max_levels
dCSRmat A
pointer to the matrix at level level_num
SHORT num_levels
number of levels in use <= max_levels
INT NNZ
number of nonzero sub-blocks in matrix A, NNZ
INT ROW
number of rows of sub-blocks in matrix A, M
INT row
row number of matrix A, m
INT nnz
number of nonzero entries