14 #ifdef MFEM_USE_MKL_PARDISO 49 mtype = MatType::REAL_NONSYMMETRIC;
58 MFEM_ASSERT(mat,
"Must pass SparseMatrix as Operator");
66 nnz = mat->NumNonZeroElems();
68 const int *Ap = mat->HostReadI();
69 const int *Ai = mat->HostReadJ();
70 const double *Ax = mat->HostReadData();
72 csr_rowptr =
new int[m + 1];
73 reordered_csr_colind =
new int[nnz];
74 reordered_csr_nzval =
new double[nnz];
76 for (
int i = 0; i <= m; i++)
78 csr_rowptr[i] = Ap[i];
82 mat->SortColumnIndices();
84 for (
int i = 0; i < nnz; i++)
86 reordered_csr_colind[i] = Ai[i];
87 reordered_csr_nzval[i] = Ax[i];
92 PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &m, reordered_csr_nzval, csr_rowptr,
93 reordered_csr_colind, &idum, &nrhs,
94 iparm, &msglvl, &ddum, &ddum, &error);
96 MFEM_ASSERT(error == 0,
"Pardiso symbolic factorization error");
100 PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &m, reordered_csr_nzval, csr_rowptr,
101 reordered_csr_colind, &idum, &nrhs,
102 iparm, &msglvl, &ddum, &ddum, &error);
104 MFEM_ASSERT(error == 0,
"Pardiso numerical factorization error");
111 PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &m, reordered_csr_nzval, csr_rowptr,
112 reordered_csr_colind, &idum, &nrhs,
113 iparm, &msglvl,
b.GetData(), x.
GetData(), &error);
115 MFEM_ASSERT(error == 0,
"Pardiso solve error");
120 msglvl = print_level;
132 PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &m, reordered_csr_nzval, csr_rowptr,
133 reordered_csr_colind, &idum, &nrhs,
134 iparm, &msglvl, &ddum, &ddum, &error);
136 MFEM_ASSERT(error == 0,
"Pardiso free error");
139 delete[] reordered_csr_colind;
140 delete[] reordered_csr_nzval;
145 #endif // MFEM_USE_MKL_PARDISO void Mult(const Vector &b, Vector &x) const override
Solve.
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
void SetMatrixType(MatType mat_type)
Set the matrix type.
PardisoSolver()
Construct a new PardisoSolver object.
void SetPrintLevel(int print_lvl)
Set the print level for MKL Pardiso.
double * GetData() const
Return a pointer to the beginning of the Vector data.
void SetOperator(const Operator &op) override
Set the Operator object and perform factorization.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int height
Dimension of the output / number of rows in the matrix.
int width
Dimension of the input / number of columns in the matrix.