20#include "fasp_functs.h"
64 REAL solve_start, solve_end;
67 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
68 printf(
"### DEBUG: rhs/sol size: %d %d\n", b->
row, x->
row);
74 ITS_CHECK(MaxIt, tol);
76 switch (itsolver_type) {
99 printf(
"### ERROR: Unknown iterative solver type %d! [%s]\n", itsolver_type,
104 if ((prtlvl >
PRINT_MIN) && (iter >= 0)) {
106 fasp_cputime(
"Iterative method", solve_end - solve_start);
110 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
136 REAL solve_start, solve_end;
139 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
150 fasp_cputime(
"Krylov method totally", solve_end - solve_start);
153 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
181 REAL solve_start, solve_end;
182 INT nc = A->
nc, nc2 = nc * nc, i;
201 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
210 fasp_cputime(
"Diag_Krylov method totally", solve_end - solve_start);
213 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
243 REAL setup_start, setup_end, setup_time;
244 REAL solve_start, solve_end, solve_time;
250 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
257 }
else if (ILU_lfil == 1) {
260 printf(
"### ERROR: Illegal level of ILU fill-in (>1)! [%s]\n", __FUNCTION__);
266 setup_time = setup_end - setup_start;
269 printf(
"Structrued ILU(%d) setup costs %f seconds.\n", ILU_lfil, setup_time);
275 }
else if (ILU_lfil == 1) {
278 printf(
"### ERROR: Illegal level of ILU fill-in (>1)! [%s]\n", __FUNCTION__);
290 solve_time = solve_end - solve_start;
291 printf(
"Iterative solver costs %f seconds.\n", solve_time);
292 fasp_cputime(
"ILU_Krylov method totally", setup_time + solve_time);
298 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
336 REAL setup_start, setup_end, setup_time = 0;
337 REAL solve_start, solve_end, solve_time = 0;
343 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
356 pcdata.
pivot = pivot;
357 pcdata.
order = order;
358 pcdata.
neigh = neigh;
367 setup_time = setup_end - setup_start;
368 printf(
"Preconditioner setup costs %f seconds.\n", setup_time);
377 solve_time = solve_end - solve_start;
381 fasp_cputime(
"BlockGS_Krylov method totally", setup_time + solve_time);
385 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
void fasp_darray_cp(const INT n, const REAL *x, REAL *y)
Copy an array to the other y=x.
void * fasp_mem_calloc(const unsigned int size, const unsigned int type)
Allocate, initiate, and check memory.
void fasp_cputime(const char *message, const REAL cputime)
Print CPU walltime.
void fasp_gettime(REAL *time)
Get system time.
void fasp_dvec_alloc(const INT m, dvector *u)
Create dvector data space of REAL type.
void fasp_ilu_dstr_setup0(dSTRmat *A, dSTRmat *LU)
Get ILU(0) decomposition of a structured matrix A.
void fasp_ilu_dstr_setup1(dSTRmat *A, dSTRmat *LU)
Get ILU(1) decoposition of a structured matrix A.
SHORT fasp_smat_inv(REAL *a, const INT n)
Compute the inverse matrix of a small full matrix a.
void fasp_dstr_free(dSTRmat *A)
Free STR sparse matrix data memeory space.
void fasp_generate_diaginv_block(dSTRmat *A, ivector *neigh, dvector *diaginv, ivector *pivot)
Generate inverse of diagonal block for block smoothers.
INT fasp_solver_dstr_pbcgs(dSTRmat *A, dvector *b, dvector *u, precond *pc, const REAL tol, const REAL abstol, const INT MaxIt, const SHORT StopType, const SHORT PrtLvl)
Preconditioned BiCGstab method for solving Au=b for STR matrix.
INT fasp_solver_dstr_pcg(dSTRmat *A, dvector *b, dvector *u, precond *pc, const REAL tol, const REAL abstol, const INT MaxIt, const SHORT StopType, const SHORT PrtLvl)
Preconditioned conjugate gradient method for solving Au=b.
INT fasp_solver_dstr_pgmres(dSTRmat *A, dvector *b, dvector *x, precond *pc, const REAL tol, const REAL abstol, const INT MaxIt, const SHORT restart, const SHORT StopType, const SHORT PrtLvl)
Preconditioned GMRES method for solving Au=b.
INT fasp_solver_dstr_pvgmres(dSTRmat *A, dvector *b, dvector *x, precond *pc, const REAL tol, const REAL abstol, const INT MaxIt, const SHORT restart, const SHORT StopType, const SHORT PrtLvl)
Right preconditioned GMRES method in which the restart parameter can be adaptively modified during it...
void fasp_precond_dstr_diag(REAL *r, REAL *z, void *data)
Diagonal preconditioner z=inv(D)*r.
void fasp_precond_dstr_blockgs(REAL *r, REAL *z, void *data)
CPR-type preconditioner (STR format)
void fasp_precond_dstr_ilu1(REAL *r, REAL *z, void *data)
Preconditioning using STR_ILU(1) decomposition.
void fasp_precond_dstr_ilu0(REAL *r, REAL *z, void *data)
Preconditioning using STR_ILU(0) decomposition.
INT fasp_solver_dstr_itsolver(dSTRmat *A, dvector *b, dvector *x, precond *pc, ITS_param *itparam)
Solve Ax=b by standard Krylov methods.
INT fasp_solver_dstr_krylov_diag(dSTRmat *A, dvector *b, dvector *x, ITS_param *itparam)
Solve Ax=b by diagonal preconditioned Krylov methods.
INT fasp_solver_dstr_krylov_blockgs(dSTRmat *A, dvector *b, dvector *x, ITS_param *itparam, ivector *neigh, ivector *order)
Solve Ax=b by diagonal preconditioned Krylov methods.
INT fasp_solver_dstr_krylov_ilu(dSTRmat *A, dvector *b, dvector *x, ITS_param *itparam, ILU_param *iluparam)
Solve Ax=b by structured ILU preconditioned Krylov methods.
INT fasp_solver_dstr_krylov(dSTRmat *A, dvector *b, dvector *x, ITS_param *itparam)
Solve Ax=b by standard Krylov methods.
Main header file for the FASP project.
#define SHORT
FASP integer and floating point numbers.
#define FASP_SUCCESS
Definition of return status and error messages.
#define ERROR_SOLVER_TYPE
#define PRINT_NONE
Print level for all subroutines – not including DEBUG output.
INT ILU_lfil
level of fill-in for ILUk
Parameters for iterative solvers.
Structure matrix of REAL type.
REAL * diag
diagonal entries (length is ngrid*(nc^2))
INT nc
size of each block (number of components)
Vector with n entries of REAL type.
REAL * val
actual vector entries
Vector with n entries of INT type.
Data for preconditioners in dSTRmat format.
ivector * neigh
array to store neighbor information
ivector * pivot
the pivot for the GS/block GS smoother (whole reservoir matrix)
dSTRmat * A_str
store the whole reservoir block in STR format
ivector * order
order for smoothing
dvector * diaginv
the inverse of the diagonals for GS/block GS smoother (whole reservoir matrix)
Data for diagonal preconditioners in dSTRmat format.
INT nc
number of components
dvector diag
diagonal elements
Preconditioner data and action.
void * data
data for preconditioner, void pointer
void(* fct)(REAL *, REAL *, void *)
action for preconditioner, void function pointer