From fd89e1da75aae45ea96a34c294b153e646423fd1 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Thu, 13 Jun 2013 14:19:15 +0000 Subject: [PATCH] Improved sparsity pattern generation. git-svn-id: https://svn.dealii.org/trunk@29816 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/dofs/dof_renumbering.cc | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) 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, -- 2.39.5