16 #include <deal.II/base/memory_consumption.h> 17 #include <deal.II/base/thread_management.h> 19 #include <deal.II/lac/block_sparse_matrix.h> 20 #include <deal.II/lac/sparse_direct.h> 21 #include <deal.II/lac/sparse_matrix.h> 22 #include <deal.II/lac/vector.h> 31 DEAL_II_NAMESPACE_OPEN
35 #ifdef DEAL_II_WITH_UMFPACK 52 #ifdef DEAL_II_WITH_UMFPACK 57 , symbolic_decomposition(nullptr)
58 , numeric_decomposition(nullptr)
59 , control(UMFPACK_CONTROL)
61 umfpack_dl_defaults(
control.data());
76 if (numeric_decomposition !=
nullptr)
78 umfpack_dl_free_numeric(&numeric_decomposition);
79 numeric_decomposition =
nullptr;
83 std::vector<long int> tmp;
88 std::vector<long int> tmp;
93 std::vector<double> tmp;
97 umfpack_dl_defaults(
control.data());
102 template <
typename number>
113 for (
size_type row = 0; row < matrix.m(); ++row)
126 long int cursor =
Ap[row];
127 while ((cursor <
Ap[row + 1] - 1) && (Ai[cursor] > Ai[cursor + 1]))
138 template <
typename number>
143 for (
size_type row = 0; row < matrix.m(); ++row)
145 long int cursor =
Ap[row];
146 while ((cursor <
Ap[row + 1] - 1) && (Ai[cursor] > Ai[cursor + 1]))
157 template <
typename number>
166 for (
size_type row = 0; row < matrix.m(); ++row)
168 long int cursor =
Ap[row];
169 for (
size_type block = 0; block < matrix.n_block_cols(); ++block)
172 while ((cursor <
Ap[row + 1] - 1) && (Ai[cursor] < Ai[cursor + 1]))
176 if (cursor ==
Ap[row + 1] - 1)
181 long int element = cursor;
182 while ((element <
Ap[row + 1] - 1) && (Ai[element] > Ai[element + 1]))
194 template <
class Matrix>
226 Ai.resize(matrix.n_nonzero_elements());
227 Ax.resize(matrix.n_nonzero_elements());
232 Ap[row] =
Ap[row - 1] + matrix.get_row_length(row - 1);
242 std::vector<long int> row_pointers =
Ap;
246 for (
size_type row = 0; row < matrix.m(); ++row)
248 for (
typename Matrix::const_iterator p = matrix.begin(row);
249 p != matrix.end(row);
253 Ai[row_pointers[row]] = p->column();
254 Ax[row_pointers[row]] = p->value();
272 status = umfpack_dl_symbolic(N,
283 status = umfpack_dl_numeric(
Ap.data(),
287 &numeric_decomposition,
308 rhs = rhs_and_solution;
316 const int status = umfpack_dl_solve(
transpose ? UMFPACK_A : UMFPACK_At,
320 rhs_and_solution.
begin(),
322 numeric_decomposition,
338 tmp = rhs_and_solution;
340 rhs_and_solution = tmp;
345 template <
class Matrix>
356 template <
class Matrix>
373 , symbolic_decomposition(nullptr)
374 , numeric_decomposition(nullptr)
384 template <
class Matrix>
391 "To call this function you need UMFPACK, but you configured deal.II without passing the necessary switch to 'cmake'. Please consult the installation instructions in doc/readme.html."));
401 "To call this function you need UMFPACK, but you configured deal.II without passing the necessary switch to 'cmake'. Please consult the installation instructions in doc/readme.html."));
412 "To call this function you need UMFPACK, but you configured deal.II without passing the necessary switch to 'cmake'. Please consult the installation instructions in doc/readme.html."));
416 template <
class Matrix>
423 "To call this function you need UMFPACK, but you configured deal.II without passing the necessary switch to 'cmake'. Please consult the installation instructions in doc/readme.html."));
428 template <
class Matrix>
435 "To call this function you need UMFPACK, but you configured deal.II without passing the necessary switch to 'cmake'. Please consult the installation instructions in doc/readme.html."));
441 template <
class Matrix>
472 this->
solve(dst,
true);
482 this->
solve(dst,
true);
501 #define InstantiateUMFPACK(MatrixType) \ 502 template void SparseDirectUMFPACK::factorize(const MatrixType &); \ 503 template void SparseDirectUMFPACK::solve(const MatrixType &, \ 506 template void SparseDirectUMFPACK::solve(const MatrixType &, \ 507 BlockVector<double> &, \ 509 template void SparseDirectUMFPACK::initialize(const MatrixType &, \ 510 const AdditionalData) 520 DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcUMFPACKError(std::string arg1, int arg2)
void * symbolic_decomposition
static ::ExceptionBase & ExcNotInitialized()
#define AssertThrow(cond, exc)
void factorize(const Matrix &matrix)
void vmult(Vector< double > &dst, const Vector< double > &src) const
static ::ExceptionBase & ExcMessage(std::string arg1)
void solve(Vector< double > &rhs_and_solution, const bool transpose=false) const
#define Assert(cond, exc)
types::global_dof_index size_type
SymmetricTensor< rank_, dim, Number > transpose(const SymmetricTensor< rank_, dim, Number > &t)
std::vector< double > control
static ::ExceptionBase & ExcNotQuadratic()
void swap(Vector< Number > &u, Vector< Number > &v)
void initialize(const SparsityPattern &sparsity_pattern)
std::vector< types::suitesparse_index > Ap
~SparseDirectUMFPACK() override
void Tvmult(Vector< double > &dst, const Vector< double > &src) const
void sort_arrays(const SparseMatrixEZ< number > &)
static ::ExceptionBase & ExcInternalError()