]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
step-42: do not allocate a fat matrix we are not going to use
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 21 Mar 2013 17:43:29 +0000 (17:43 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 21 Mar 2013 17:43:29 +0000 (17:43 +0000)
git-svn-id: https://svn.dealii.org/trunk@28976 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-42/step-42.cc

index 46e189af7864c2648fe311cb0d13a449e30b7974..6cfa030e6772dce8535a8b5f56deeb74e1ede49c 100644 (file)
@@ -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);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.