From: heister Date: Fri, 29 Mar 2013 20:30:38 +0000 (+0000) Subject: fix step-42 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a602dadedab6b2fc13d0c8f29bbf3640a71647d0;p=dealii-svn.git fix step-42 git-svn-id: https://svn.dealii.org/trunk@29111 0785d39b-7218-0410-832d-ea1e28bc413d --- 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