From 5e80a435fdc8e9925b57fc8e0560f1bca359fe7a Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Wed, 24 Mar 2021 11:30:16 +0100 Subject: [PATCH] MatrixFreeTools::compute_matrix() for PETScWrappers::MPI::SparseMatrix --- include/deal.II/matrix_free/tools.h | 11 ++--------- tests/matrix_free/compute_diagonal_util.h | 4 ++++ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/deal.II/matrix_free/tools.h b/include/deal.II/matrix_free/tools.h index d3498fba29..7040ffffd8 100644 --- a/include/deal.II/matrix_free/tools.h +++ b/include/deal.II/matrix_free/tools.h @@ -826,7 +826,8 @@ namespace MatrixFreeTools for (unsigned int v = 0; v < n_filled_lanes; ++v) { - const auto cell_v = matrix_free.get_cell_iterator(cell, v); + const auto cell_v = + matrix_free.get_cell_iterator(cell, v, dof_no); if (matrix_free.get_mg_level() != numbers::invalid_unsigned_int) cell_v->get_mg_dof_indices(dof_indices); @@ -837,7 +838,6 @@ namespace MatrixFreeTools dof_indices_mf[j] = dof_indices[lexicographic_numbering[j]]; constraints.distribute_local_to_global(matrices[v], - dof_indices_mf, dof_indices_mf, dst); } @@ -847,13 +847,6 @@ namespace MatrixFreeTools matrix); matrix.compress(VectorOperation::add); - - for (auto &entry : matrix) - if (entry.row() == entry.column() && entry.value() == 0.0) - { - Assert(constraints.is_constrained(entry.row()), ExcNotImplemented()); - entry.value() = 1.0; - } } template row() == a1->column() && + constraints.is_constrained(a1->row())) + continue; + Assert(std::abs(a1->value() - a_ref->value()) < 1e-6, ExcNotImplemented()); Assert(std::abs(a2->value() - a_ref->value()) < 1e-6, -- 2.39.5