From a8730d26a10ee27bad40a437b6cddbef325b5676 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Thu, 21 Mar 2013 17:43:29 +0000 Subject: [PATCH] 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 --- deal.II/examples/step-42/step-42.cc | 9 +++++++++ 1 file changed, 9 insertions(+) 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); -- 2.39.5