From da72335f43f3ac746f085be8cfbd6045604a090d Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Fri, 29 Mar 2013 20:30:38 +0000 Subject: [PATCH] fix step-42 git-svn-id: https://svn.dealii.org/trunk@29111 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-42/step-42.cc | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/deal.II/examples/step-42/step-42.cc b/deal.II/examples/step-42/step-42.cc index 6cfa030e67..37d5905fa7 100644 --- a/deal.II/examples/step-42/step-42.cc +++ b/deal.II/examples/step-42/step-42.cc @@ -717,17 +717,12 @@ namespace Step42 system_matrix_newton.reinit (sp); - // create a SP that only contains the diagonal - sp.reinit(locally_owned_dofs, mpi_communicator); - for (unsigned int idx=0; idx < locally_owned_dofs.n_elements();++idx) - { - unsigned int gidx = locally_owned_dofs.nth_index_in_set(idx); - sp.add(gidx, gidx); - } - sp.compress(); - - TrilinosWrappers::SparseMatrix mass_matrix; - mass_matrix.reinit (sp); + // we are going to reuse the system + // matrix for assembling the diagonal + // of the mass matrix so that we do not + // need to allocate two sparse matrices + // at the same time: + TrilinosWrappers::SparseMatrix & mass_matrix = system_matrix_newton; assemble_mass_matrix_diagonal (mass_matrix); const unsigned int start = (system_rhs_newton.local_range().first), @@ -735,8 +730,12 @@ namespace Step42 for (unsigned int j=start; j