18#include "fasp_functs.h"
45 const INT n = A->
col, nnz = A->
nnz, mbloc = n;
51 INT ierr, iwk, nzlu, nwork, *ijlu, *iperm;
54 REAL setup_start, setup_end, setup_duration;
58 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
59 printf(
"### DEBUG: m=%d, n=%d, nnz=%d\n", A->
row, n, nnz);
68 lfilt=(int)floor(n*0.5)+1;
72 lfilt=(int)floor(n*0.5)+1;
75 if (lfil == 0) iwk=nnz+500;
76 else iwk=(lfil+5)*nnz;
82 printf(
"### DEBUG: fill-in = %d, iwk = %d, nwork = %d\n", lfil, iwk, nwork);
87 iludata->
row = iludata->
col = n;
90 iludata->
iperm = NULL;
96 printf(
"### DEBUG: memory usage after %s: \n", __FUNCTION__);
101 ijlu = iludata->
ijlu;
102 luval = iludata->
luval;
112 iperm = iludata->
iperm;
114 mbloc, luval, ijlu, iperm, iwk, &ierr, &nzlu);
127 printf(
"### DEBUG: memory usage after ILU setup: \n");
131 iludata->
nzlu = nzlu;
132 iludata->
nwork = nwork;
135 printf(
"### DEBUG: iwk = %d, nzlu = %d\n", iwk, nzlu);
139 printf(
"### ERROR: ILU setup failed (ierr=%d)! [%s]\n", ierr, __FUNCTION__);
145 printf(
"### ERROR: ILU needs more RAM %d! [%s]\n", iwk-nzlu, __FUNCTION__);
152 setup_duration = setup_end - setup_start;
156 printf(
"ILUt setup costs %f seconds.\n", setup_duration);
159 printf(
"ILUtp setup costs %f seconds.\n", setup_duration);
162 printf(
"ILUk setup costs %f seconds.\n", setup_duration);
170 printf(
"### DEBUG: [--End--] %s ...\n", __FUNCTION__);
void fasp_mem_usage(void)
Show total allocated memory currently.
void fasp_gettime(REAL *time)
Get system time.
SHORT fasp_ilu_dcsr_setup(dCSRmat *A, ILU_data *iludata, ILU_param *iluparam)
Get ILU decomposition of a CSR matrix A.
void fasp_iluk(INT n, REAL *a, INT *ja, INT *ia, INT lfil, REAL *alu, INT *jlu, INT iwk, INT *ierr, INT *nzlu)
Get ILU factorization with level of fill-in k (ilu(k)) for a CSR matrix A.
void fasp_ilutp(INT n, REAL *a, INT *ja, INT *ia, INT lfil, REAL droptol, REAL permtol, INT mbloc, REAL *alu, INT *jlu, INT *iperm, INT iwk, INT *ierr, INT *nz)
Get incomplete LU factorization with pivoting dual truncations of a CSR matrix A.
void fasp_ilut(INT n, REAL *a, INT *ja, INT *ia, INT lfil, REAL droptol, REAL *alu, INT *jlu, INT iwk, INT *ierr, INT *nz)
Get incomplete LU factorization with dual truncations of a CSR matrix A.
void fasp_dcsr_shift(dCSRmat *A, const INT offset)
Re-index a REAL matrix in CSR format to make the index starting from 0 or 1.
void fasp_ilu_data_create(const INT iwk, const INT nwork, ILU_data *iludata)
Allocate workspace for ILU factorization.
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_ILUSETUP
#define PRINT_NONE
Print level for all subroutines – not including DEBUG output.
INT * ijlu
integer array of row pointers and column indexes, the size is nzlu
REAL * luval
nonzero entries of LU
INT col
column of matrix LU, n
INT * jlevU
mapping from row to color for upper triangle
INT row
row number of matrix LU, m
INT * iperm
permutation arrays for ILUtp
INT nzlu
number of nonzero entries
INT * jlevL
mapping from row to color for lower triangle
INT * ilevL
number of vertices in each color for lower triangle
dCSRmat * A
pointer to the original coefficient matrix
INT * ilevU
number of vertices in each color for upper triangle
INT ILU_lfil
level of fill-in for ILUk
SHORT print_level
print level
SHORT ILU_type
ILU type for decomposition.
REAL ILU_droptol
drop tolerance for ILUt
REAL ILU_permtol
permuted if permtol*|a(i,j)| > |a(i,i)|
Sparse matrix of REAL type in CSR format.
INT col
column of matrix A, n
REAL * val
nonzero entries of A
INT row
row number of matrix A, m
INT * IA
integer array of row pointers, the size is m+1
INT nnz
number of nonzero entries
INT * JA
integer array of column indexes, the size is nnz