17#include "fasp_functs.h"
66 max_levels =
MAX(1, max_levels);
71 for (i = 0; i < max_levels; ++i) {
78 mgl[i].GS_Theta = 0.0E-2;
103 const INT max_levels =
MAX(1, mgl[0].num_levels);
115 &mgl[max_levels - 1].x,
116 &mgl[max_levels - 1].mumps);
126 mgl[max_levels - 1].
Numeric = NULL;
135 fasp_pardiso_free_internal_mem(&mgl[max_levels - 1].pdata);
144 for (i = 0; i < max_levels; ++i) {
147 if (max_levels > 1) {
168 if (param == NULL)
return;
197 const INT max_levels =
MAX(1, mgl[0].num_levels);
209 &mgl[max_levels - 1].x,
210 &mgl[max_levels - 1].mumps);
220 mgl[max_levels - 1].
Numeric = NULL;
229 fasp_pardiso_free_internal_mem(&mgl[max_levels - 1].pdata);
238 for (i = 0; i < max_levels; ++i) {
242 if (max_levels > 1) {
263 if (param == NULL)
return;
285 max_levels =
MAX(1, max_levels);
291 for (i = 0; i < max_levels; ++i) {
318 const INT max_levels =
MAX(1, mgl[0].num_levels);
329 &mgl[max_levels - 1].x,
330 &mgl[max_levels - 1].mumps);
340 mgl[max_levels - 1].
Numeric = NULL;
349 fasp_pardiso_free_internal_mem(&mgl[max_levels - 1].pdata);
358 for (i = 0; i < max_levels; ++i) {
362 if (max_levels > 1) {
414 printf(
"### DEBUG: [-Begin-] %s ...\n", __FUNCTION__);
415 printf(
"### DEBUG: iwk=%d, nwork=%d \n", iwk, nwork);
427 printf(
"### DEBUG: %s ...... %d [End]\n", __FUNCTION__, __LINE__);
447 if (iludata == NULL)
return;
450 iludata->
ijlu = NULL;
452 iludata->
luval = NULL;
454 iludata->
work = NULL;
456 iludata->
ilevL = NULL;
458 iludata->
jlevL = NULL;
460 iludata->
ilevU = NULL;
462 iludata->
jlevU = NULL;
466 if (iludata->
A != NULL) {
469 const INT nnz = iludata->
A->
nnz;
471 for (k = 0; k < nnz; k++) {
473 iludata->
A->
JA[k] = iperm[iludata->
A->
JA[k]] - 1;
478 iludata->
iperm = NULL;
498 if (swzdata == NULL)
return;
516 swzdata->
mask = NULL;
518 swzdata->
maxa = NULL;
521 if (swzdata->
mumps == NULL)
return;
523 for (i = 0; i < swzdata->
nblk; ++i) fasp_mumps_free(&((swzdata->
mumps)[i]));
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_dvec_free(dvector *u)
Free vector data space of REAL type.
void fasp_ivec_free(ivector *u)
Free vector data space of INT type.
void fasp_dbsr_free(dBSRmat *A)
Free memory space for BSR format sparse matrix.
void fasp_dcsr_free(dCSRmat *A)
Free CSR sparse matrix data memory space.
void fasp_precond_data_init(precond_data *pcdata)
Initialize precond_data.
void fasp_swz_data_free(SWZ_data *swzdata)
Free SWZ_data data memeory space.
void fasp_ilu_data_create(const INT iwk, const INT nwork, ILU_data *iludata)
Allocate workspace for ILU factorization.
AMG_data * fasp_amg_data_create(SHORT max_levels)
Create and initialize AMG_data for classical and SA AMG.
AMG_data_bsr * fasp_amg_data_bsr_create(SHORT max_levels)
Create and initialize AMG_data data sturcture for AMG/SAMG (BSR format)
void fasp_amg_data_free(AMG_data *mgl, AMG_param *param)
Free AMG_data data memeory space.
void fasp_amg_data_free1(AMG_data *mgl, AMG_param *param)
Free AMG_data data memeory space.
void fasp_ilu_data_free(ILU_data *iludata)
Create ILU_data sturcture.
int fasp_solver_mumps_steps(dCSRmat *ptrA, dvector *b, dvector *u, Mumps_data *mumps)
Solve Ax=b by MUMPS in three steps.
Main header file for the FASP project.
#define SHORT
FASP integer and floating point numbers.
#define MAX(a, b)
Definition of max, min, abs.
#define V_CYCLE
Definition of cycle types.
#define CLASSIC_AMG
Definition of AMG types.
#define ON
Definition of switch.
#define PRINT_NONE
Print level for all subroutines – not including DEBUG output.
Data for multigrid levels in dBSRmat format.
INT near_kernel_dim
dimension of the near kernel for SAMG
REAL * pw
pointer to the auxiliary vectors for pressure block
dCSRmat * A_nk
Matrix data for near kernal.
Mumps_data mumps
data for MUMPS
REAL ** near_kernel_basis
basis of near kernel space for SAMG
void * Numeric
pointer to the numerical dactorization from UMFPACK
INT num_levels
number of levels in use <= max_levels
dCSRmat * R_nk
Resriction for near kernal.
INT max_levels
max number of levels
dCSRmat * P_nk
Prolongation for near kernal.
REAL * sw
pointer to the auxiliary vectors for saturation block
INT near_kernel_dim
dimension of the near kernel for SAMG
Mumps_data mumps
data for MUMPS
REAL ** near_kernel_basis
basis of near kernel space for SAMG
void * Numeric
pointer to the numerical factorization from UMFPACK
SHORT max_levels
max number of levels
SHORT num_levels
number of levels in use <= max_levels
Parameters for AMG methods.
REAL * amli_coef
coefficients of the polynomial used by AMLI cycle
SHORT coarse_solver
coarse solver type
SHORT cycle_type
type of AMG cycle
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 nlevU
number of colors for upper triangle
INT nb
block size for BSR type only
INT row
row number of matrix LU, m
INT nlevL
number of colors for lower triangle
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
Data for Schwarz methods.
INT memt
working space size
dCSRmat A
pointer to the original coefficient matrix
dvector rhsloc1
local right hand side
dvector xloc1
local solution
dCSRmat * blk_data
matrix for each partition
INT * jblock
column index of blocks
Mumps_data * mumps
param for MUMPS
INT * iblock
row index of blocks
INT nnz
number of nonzero entries
INT * JA
integer array of column indexes, the size is nnz
Data for preconditioners.
SHORT print_level
print level in AMG preconditioner
SHORT coarsening_type
switch of scaling of the coarse grid correction
SHORT nl_amli_krylov_type
type of Krylov method used by Nonlinear AMLI cycle
SHORT coarse_scaling
switch of scaling of the coarse grid correction
SHORT AMG_type
type of AMG method
REAL tol
tolerance for AMG preconditioner
REAL relaxation
relaxation parameter for SOR smoother
SHORT smoother
AMG smoother type.
SHORT cycle_type
AMG cycle type.
SHORT amli_degree
degree of the polynomial used by AMLI cycle
SHORT postsmooth_iter
number of postsmoothing
SHORT max_levels
max number of AMG levels
SHORT presmooth_iter
number of presmoothing
INT maxit
max number of iterations of AMG preconditioner
SHORT smooth_order
AMG smoother ordering.