From 3a52c4dceea767e277f38444a0b0b646f1296c6e Mon Sep 17 00:00:00 2001 From: kronbichler Date: Tue, 23 Aug 2011 09:42:53 +0000 Subject: [PATCH] Speed up initialization of MG transfer matrices by using a CompressedSimpleSparsityPattern that is later copied to a SparsityPattern. git-svn-id: https://svn.dealii.org/trunk@24172 0785d39b-7218-0410-832d-ea1e28bc413d --- .../source/multigrid/mg_transfer_prebuilt.cc | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/deal.II/source/multigrid/mg_transfer_prebuilt.cc b/deal.II/source/multigrid/mg_transfer_prebuilt.cc index 951f1b7342..56de732bc7 100644 --- a/deal.II/source/multigrid/mg_transfer_prebuilt.cc +++ b/deal.II/source/multigrid/mg_transfer_prebuilt.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -200,10 +201,9 @@ void MGTransferPrebuilt::build_matrices ( // increment dofs_per_cell // since a useless diagonal // element will be stored - prolongation_sparsities[level]->reinit (sizes[level+1], - sizes[level], - dofs_per_cell+1); - + CompressedSimpleSparsityPattern csp (sizes[level+1], + sizes[level]); + std::vector entries (dofs_per_cell); for (typename MGDoFHandler::cell_iterator cell=mg_dof.begin(level); cell != mg_dof.end(level); ++cell) if (cell->has_children()) @@ -229,15 +229,19 @@ void MGTransferPrebuilt::build_matrices ( // matrix which will be used // for this pair of parent/child for (unsigned int i=0; iadd (dof_indices_child[i], - dof_indices_parent[j]); + { + entries.resize(0); + for (unsigned int j=0; jcompress (); - + prolongation_sparsities[level]->copy_from (csp); + csp.reinit(0,0); prolongation_matrices[level]->reinit (*prolongation_sparsities[level]); // now actually build the matrices -- 2.39.5