22#include "fasp_functs.h"
65 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) {
106 printf(
"### ERROR: Unknown iterative solver type %d! [%s]\n", itsolver_type,
111 if ((prtlvl >=
PRINT_MIN) && (iter >= 0)) {
113 fasp_cputime(
"Iterative method", solve_end - solve_start);
117 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
144 REAL solve_start, solve_end;
147 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
158 fasp_cputime(
"Krylov method totally", solve_end - solve_start);
161 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
196 REAL setup_start, setup_end;
197 REAL solve_start, solve_end;
209 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
217 if (precond_type > 20 && precond_type < 30) {
222 for (i = 0; i < 3; i++) {
228 printf(
"Factorization for %d-th diagnol: \n", i);
229 LU_diag[i] = fasp_umfpack_factorize(&A_diag[i], prtlvl);
237 else if (precond_type > 30 && precond_type < 40) {
241 for (i = 0; i < 3; i++) {
279 if (precond_type > 20 && precond_type < 30) {
285 else if (precond_type > 30 && precond_type < 40) {
293 prec.
data = &precdata;
295 switch (precond_type) {
344 fasp_cputime(
"Krylov method totally", solve_end - solve_start);
348 if (precond_type > 20 && precond_type < 30) {
350 for (i = 0; i < 3; i++) fasp_umfpack_free_numeric(LU_diag[i]);
354 else if (precond_type > 30 && precond_type < 40) {
363 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
398 REAL setup_start, setup_end;
399 REAL solve_start, solve_end;
402 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
415 if (precond_type > 20 && precond_type < 30) {
421 for (i = 0; i < 4; i++) {
427 printf(
"Factorization for %d-th diagnol: \n", i);
428 LU_diag[i] = fasp_umfpack_factorize(&A_diag[i], prtlvl);
448 prec.
data = &precdata;
450 switch (precond_type) {
471 fasp_cputime(
"Krylov method totally", solve_end - solve_start);
475 for (i = 0; i < 4; i++) fasp_umfpack_free_numeric(LU_diag[i]);
479 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
514 REAL setup_start, setup_end;
515 REAL solve_start, solve_end;
517 void** local_LU = NULL;
520 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
533 for (l = 0; l < NumLayers; l++) {
539 printf(
"Factorization for layer %d: \n", l);
540 local_LU[l] = fasp_umfpack_factorize(&local_A[l], prtlvl);
557 prec.
data = &precdata;
571 fasp_cputime(
"Krylov method totally", solve_end - solve_start);
575 for (l = 0; l < NumLayers; l++) fasp_umfpack_free_numeric(local_LU[l]);
579 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 REAL abstol, 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 REAL abstol, 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 REAL abstol, 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 REAL abstol, 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 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...
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