68 MFEM_ASSERT(hypreParMat,
"Must pass HypreParMatrix as Operator");
70 auto parcsr_op =
static_cast<hypre_ParCSRMatrix *
>(
73 hypreParMat.HostRead();
74 hypre_CSRMatrix *csr_op = hypre_MergeDiagAndOffd(parcsr_op);
75 hypreParMat.HypreRead();
76#if MFEM_HYPRE_VERSION >= 21600
77 hypre_CSRMatrixBigJtoJ(csr_op);
80 m = parcsr_op->global_num_rows;
81 first_row = parcsr_op->first_row_index;
82 nnz_loc = csr_op->num_nonzeros;
83 m_loc = csr_op->num_rows;
88 real_t *csr_nzval = csr_op->data;
89 int *csr_colind = csr_op->j;
92 delete[] reordered_csr_colind;
93 delete[] reordered_csr_nzval;
94 csr_rowptr =
new int[m_loc + 1];
95 reordered_csr_colind =
new int[nnz_loc];
96 reordered_csr_nzval =
new real_t[nnz_loc];
98 for (
int i = 0; i <= m_loc; i++)
100 csr_rowptr[i] = (csr_op->i)[i];
104 std::vector<int> permutation_idx(nnz_loc);
105 std::iota(permutation_idx.begin(), permutation_idx.end(), 0);
106 for (
int i = 0; i < m_loc; i++)
108 std::sort(permutation_idx.begin() + csr_rowptr[i],
109 permutation_idx.begin() + csr_rowptr[i + 1],
110 [csr_colind](
int i1,
int i2)
112 return csr_colind[i1] < csr_colind[i2];
116 for (
int i = 0; i < nnz_loc; i++)
118 reordered_csr_colind[i] = csr_colind[permutation_idx[i]];
119 reordered_csr_nzval[i] = csr_nzval[permutation_idx[i]];
122 hypre_CSRMatrixDestroy(csr_op);
126 iparm[40] = first_row;
130 iparm[41] = first_row + m_loc - 1;
134 cluster_sparse_solver(pt,
142 reordered_csr_colind,
152 MFEM_ASSERT(error == 0,
"CPardiso analyze input error");
156 cluster_sparse_solver(pt,
164 reordered_csr_colind,
174 MFEM_ASSERT(error == 0,
"CPardiso factorization input error");