20#include "fasp_functs.h"
66 REAL solve_start, solve_end;
69 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
70 printf(
"### DEBUG: rhs/sol size: %d %d\n", b->
row, x->
row);
76 ITS_CHECK ( MaxIt, tol );
78 switch (itsolver_type) {
97 printf(
"### ERROR: Unknown iterative solver type %d! [%s]\n",
98 itsolver_type, __FUNCTION__);
103 if ( (prtlvl >
PRINT_MIN) && (iter >= 0) ) {
105 fasp_cputime(
"Iterative method", solve_end - solve_start);
109 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
138 REAL solve_start, solve_end;
141 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
152 fasp_cputime(
"Krylov method totally", solve_end - solve_start);
155 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
186 REAL solve_start, solve_end;
187 INT nc = A->
nc, nc2 = nc*nc, i;
206 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
215 fasp_cputime(
"Diag_Krylov method totally", solve_end - solve_start);
218 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
251 REAL setup_start, setup_end, setup_time;
252 REAL solve_start, solve_end, solve_time;
258 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
266 else if (ILU_lfil == 1) {
270 printf(
"### ERROR: Illegal level of ILU fill-in (>1)! [%s]\n", __FUNCTION__);
276 setup_time = setup_end - setup_start;
279 printf(
"Structrued ILU(%d) setup costs %f seconds.\n", ILU_lfil, setup_time);
285 else if (ILU_lfil == 1) {
289 printf(
"### ERROR: Illegal level of ILU fill-in (>1)! [%s]\n", __FUNCTION__);
301 solve_time = solve_end - solve_start;
302 printf(
"Iterative solver costs %f seconds.\n", solve_time);
303 fasp_cputime(
"ILU_Krylov method totally", setup_time+solve_time);
309 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
351 REAL setup_start, setup_end, setup_time = 0;
352 REAL solve_start, solve_end, solve_time = 0;
358 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
371 pcdata.
pivot = pivot;
372 pcdata.
order = order;
373 pcdata.
neigh = neigh;
380 setup_time = setup_end - setup_start;
381 printf(
"Preconditioner setup costs %f seconds.\n", setup_time);
390 solve_time = solve_end - solve_start;
394 fasp_cputime(
"BlockGS_Krylov method totally", setup_time + solve_time);
398 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 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 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 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 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