22#include "fasp_functs.h"
67 REAL solve_start, solve_end;
71 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
72 printf(
"### DEBUG: rhs/sol size: %d %d\n", b->
row, x->
row);
78 ITS_CHECK ( MaxIt, tol );
80 switch (itsolver_type) {
103 printf(
"### ERROR: Unknown iterative solver type %d! [%s]\n",
104 itsolver_type, __FUNCTION__);
109 if ( (prtlvl >=
PRINT_MIN) && (iter >= 0) ) {
111 fasp_cputime(
"Iterative method", solve_end - solve_start);
115 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
145 REAL solve_start, solve_end;
148 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
159 fasp_cputime(
"Krylov method totally", solve_end - solve_start);
162 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
200 REAL setup_start, setup_end;
201 REAL solve_start, solve_end;
213 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
221 if ( precond_type > 20 && precond_type < 30 ) {
232 printf(
"Factorization for %d-th diagnol: \n", i);
233 LU_diag[i] = fasp_umfpack_factorize(&A_diag[i], prtlvl);
242 else if ( precond_type > 30 && precond_type < 40 ) {
249 m = A_diag[i].
row; n = A_diag[i].
col; nnz = A_diag[i].
nnz;
277 if ( precond_type > 20 && precond_type < 30 ) {
283 else if ( precond_type > 30 && precond_type < 40 ) {
293 switch (precond_type) {
333 fasp_cputime(
"Krylov method totally", solve_end - solve_start);
337 if ( precond_type > 20 && precond_type < 30 ) {
339 for (i=0; i<3; i++) fasp_umfpack_free_numeric(LU_diag[i]);
343 else if ( precond_type > 30 && precond_type < 40 ) {
352 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
390 REAL setup_start, setup_end;
391 REAL solve_start, solve_end;
394 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
407 if ( precond_type > 20 && precond_type < 30 ) {
419 printf(
"Factorization for %d-th diagnol: \n", i);
420 LU_diag[i] = fasp_umfpack_factorize(&A_diag[i], prtlvl);
443 switch (precond_type)
465 fasp_cputime(
"Krylov method totally", solve_end - solve_start);
469 for (i=0; i<4; i++) fasp_umfpack_free_numeric(LU_diag[i]);
473 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
513 REAL setup_start, setup_end;
514 REAL solve_start, solve_end;
516 void **local_LU = NULL;
519 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
532 for ( l=0; l<NumLayers; l++ ) {
538 printf(
"Factorization for layer %d: \n", l);
539 local_LU[l] = fasp_umfpack_factorize(&local_A[l], prtlvl);
570 fasp_cputime(
"Krylov method totally", solve_end - solve_start);
574 for (l=0; l<NumLayers; l++) fasp_umfpack_free_numeric(local_LU[l]);
578 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
void fasp_mem_free(void *mem)
Free up previous allocated memory body and set pointer to NULL.
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_chkerr(const SHORT status, const char *fctname)
Check error status and print out error messages before quit.
void fasp_gettime(REAL *time)
Get system time.
dvector fasp_dvec_create(const INT m)
Create dvector data space of REAL type.
dCSRmat fasp_dcsr_create(const INT m, const INT n, const INT nnz)
Create CSR sparse matrix data memory space.
void fasp_dcsr_free(dCSRmat *A)
Free CSR sparse matrix data memory space.
void fasp_dcsr_transz(dCSRmat *A, INT *p, dCSRmat *AT)
Generalized transpose of A: (n x m) matrix given in dCSRmat format.
void fasp_dcsr_cp(const dCSRmat *A, dCSRmat *B)
copy a dCSRmat to a new one B=A
INT fasp_solver_dblc_pbcgs(dBLCmat *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 BLC matrix.
INT fasp_solver_dblc_pgmres(dBLCmat *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_dblc_pminres(dBLCmat *A, dvector *b, dvector *u, precond *pc, const REAL tol, const INT MaxIt, const SHORT StopType, const SHORT PrtLvl)
A preconditioned minimal residual (Minres) method for solving Au=b.
INT fasp_solver_dblc_pvfgmres(dBLCmat *A, dvector *b, dvector *x, precond *pc, const REAL tol, const INT MaxIt, const SHORT restart, const SHORT StopType, const SHORT PrtLvl)
Solve "Ax=b" using PFGMRES (right preconditioned) iterative method in which the restart parameter can...
INT fasp_solver_dblc_pvgmres(dBLCmat *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...
SHORT fasp_amg_setup_rs(AMG_data *mgl, AMG_param *param)
Setup phase of Ruge and Stuben's classic AMG.
SHORT fasp_amg_setup_sa(AMG_data *mgl, AMG_param *param)
Set up phase of smoothed aggregation AMG.
SHORT fasp_amg_setup_ua(AMG_data *mgl, AMG_param *param)
Set up phase of unsmoothed aggregation AMG.
void fasp_precond_dblc_upper_3(REAL *r, REAL *z, void *data)
block upper triangular preconditioning (3x3 blocks)
void fasp_precond_dblc_SGS_3(REAL *r, REAL *z, void *data)
Block symmetric GS preconditioning (3x3 blocks)
void fasp_precond_dblc_diag_4(REAL *r, REAL *z, void *data)
Block diagonal preconditioning (4x4 blocks)
void fasp_precond_dblc_lower_3(REAL *r, REAL *z, void *data)
block lower triangular preconditioning (3x3 blocks)
void fasp_precond_dblc_SGS_3_amg(REAL *r, REAL *z, void *data)
Block symmetric GS preconditioning (3x3 blocks)
void fasp_precond_dblc_diag_3_amg(REAL *r, REAL *z, void *data)
Block diagonal preconditioning (3x3 blocks)
void fasp_precond_dblc_lower_4(REAL *r, REAL *z, void *data)
block lower triangular preconditioning (4x4 blocks)
void fasp_precond_dblc_upper_3_amg(REAL *r, REAL *z, void *data)
block upper triangular preconditioning (3x3 blocks)
void fasp_precond_dblc_lower_3_amg(REAL *r, REAL *z, void *data)
block lower triangular preconditioning (3x3 blocks)
void fasp_precond_dblc_diag_3(REAL *r, REAL *z, void *data)
Block diagonal preconditioner (3x3 blocks)
void fasp_precond_dblc_sweeping(REAL *r, REAL *z, void *data)
Sweeping preconditioner for Maxwell equations.
AMG_data * fasp_amg_data_create(SHORT max_levels)
Create and initialize AMG_data for classical and SA AMG.
void fasp_amg_data_free(AMG_data *mgl, AMG_param *param)
Free AMG_data data memeory space.
INT fasp_solver_dblc_krylov(dBLCmat *A, dvector *b, dvector *x, ITS_param *itparam)
Solve Ax = b by standard Krylov methods.
INT fasp_solver_dblc_itsolver(dBLCmat *A, dvector *b, dvector *x, precond *pc, ITS_param *itparam)
Solve Ax = b by standard Krylov methods.
INT fasp_solver_dblc_krylov_block4(dBLCmat *A, dvector *b, dvector *x, ITS_param *itparam, AMG_param *amgparam, dCSRmat *A_diag)
Solve Ax = b by standard Krylov methods.
INT fasp_solver_dblc_krylov_block3(dBLCmat *A, dvector *b, dvector *x, ITS_param *itparam, AMG_param *amgparam, dCSRmat *A_diag)
Solve Ax = b by standard Krylov methods.
INT fasp_solver_dblc_krylov_sweeping(dBLCmat *A, dvector *b, dvector *x, ITS_param *itparam, INT NumLayers, dBLCmat *Ai, dCSRmat *local_A, ivector *local_index)
Solve Ax = b by standard Krylov methods.
Main header file for the FASP project.
#define SHORT
FASP integer and floating point numbers.
Header file for FASP block matrices.
#define FASP_SUCCESS
Definition of return status and error messages.
#define ERROR_SOLVER_TYPE
#define ERROR_SOLVER_PRECTYPE
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
Parameters for AMG methods.
SHORT AMG_type
type of AMG method
SHORT max_levels
max number of levels of AMG
Parameters for iterative solvers.
Block REAL CSR matrix format.
Sparse matrix of REAL type in CSR format.
INT col
column of matrix A, n
INT row
row number of matrix A, m
INT nnz
number of nonzero entries
Vector with n entries of REAL type.
Vector with n entries of INT type.
Data for block preconditioners in dBLCmat format.
Data for sweeping preconditioner.
Preconditioner data and action.
void * data
data for preconditioner, void pointer
void(* fct)(REAL *, REAL *, void *)
action for preconditioner, void function pointer