From: Martin Kronbichler Date: Thu, 13 Jun 2013 14:19:15 +0000 (+0000) Subject: Improved sparsity pattern generation. X-Git-Tag: v8.0.0~293 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd89e1da75aae45ea96a34c294b153e646423fd1;p=dealii.git Improved sparsity pattern generation. git-svn-id: https://svn.dealii.org/trunk@29816 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/dofs/dof_renumbering.cc b/deal.II/source/dofs/dof_renumbering.cc index 979cd02e91..0d0410bdb6 100644 --- a/deal.II/source/dofs/dof_renumbering.cc +++ b/deal.II/source/dofs/dof_renumbering.cc @@ -437,12 +437,24 @@ namespace DoFRenumbering { Assert(dof_handler.n_dofs(level) != numbers::invalid_dof_index, ExcNotInitialized()); -//TODO: we should be doing the same here as in the other compute_CMK function to preserve some memory // make the connection graph - SparsityPattern sparsity (dof_handler.n_dofs(level), - dof_handler.max_couplings_between_dofs()); - MGTools::make_sparsity_pattern (dof_handler, sparsity, level); + SparsityPattern sparsity; + if (DH::dimension < 2) + { + sparsity.reinit (dof_handler.n_dofs(), + dof_handler.n_dofs(), + dof_handler.max_couplings_between_dofs()); + MGTools::make_sparsity_pattern (dof_handler, sparsity, level); + sparsity.compress(); + } + else + { + CompressedSimpleSparsityPattern csp (dof_handler.n_dofs(level), + dof_handler.n_dofs(level)); + MGTools::make_sparsity_pattern (dof_handler, csp, level); + sparsity.copy_from (csp); + } std::vector new_indices(sparsity.n_rows()); SparsityTools::reorder_Cuthill_McKee (sparsity, new_indices,