From: heister Date: Thu, 21 Mar 2013 17:43:29 +0000 (+0000) Subject: step-42: do not allocate a fat matrix we are not going to use X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2267a692432e96176c01db1651e1742577efe8bd;p=dealii-svn.git step-42: do not allocate a fat matrix we are not going to use git-svn-id: https://svn.dealii.org/trunk@28976 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 46e189af78..6cfa030e67 100644 --- a/deal.II/examples/step-42/step-42.cc +++ b/deal.II/examples/step-42/step-42.cc @@ -717,6 +717,15 @@ 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); assemble_mass_matrix_diagonal (mass_matrix);