From fd2e5e8b353965fdb3ae150ce556576c533bcd7b Mon Sep 17 00:00:00 2001 From: kronbichler Date: Wed, 14 Jan 2009 15:18:38 +0000 Subject: [PATCH] Use CompressedSimpleSparsityPattern to create mass matrix sparsity pattern in project function, which uses less memory. git-svn-id: https://svn.dealii.org/trunk@18223 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/numerics/vectors.templates.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/deal.II/deal.II/include/numerics/vectors.templates.h b/deal.II/deal.II/include/numerics/vectors.templates.h index c347cb5fa4..6f4616b6d3 100644 --- a/deal.II/deal.II/include/numerics/vectors.templates.h +++ b/deal.II/deal.II/include/numerics/vectors.templates.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -460,12 +461,18 @@ void VectorTools::project (const Mapping &mapping, // set up mass matrix and right hand side Vector vec (dof.n_dofs()); - SparsityPattern sparsity(dof.n_dofs(), - dof.n_dofs(), - dof.max_couplings_between_dofs()); - DoFTools::make_sparsity_pattern (dof, sparsity); - constraints.condense (sparsity); - + SparsityPattern sparsity; + + // use csp to consume less memory and to + // still be fast + { + CompressedSimpleSparsityPattern csp (dof.n_dofs(), dof.n_dofs()); + DoFTools::make_sparsity_pattern (dof, csp); + constraints.condense(csp); + + sparsity.copy_from (csp); + } + SparseMatrix mass_matrix (sparsity); Vector tmp (mass_matrix.n()); -- 2.39.5