]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Use CompressedSimpleSparsityPattern to create mass matrix sparsity pattern in project...
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 14 Jan 2009 15:18:38 +0000 (15:18 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 14 Jan 2009 15:18:38 +0000 (15:18 +0000)
git-svn-id: https://svn.dealii.org/trunk@18223 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/vectors.templates.h

index c347cb5fa425c7a08d35f29f6c46cfac9dde205b..6f4616b6d34a513af81843c1c4b8c7ad45686f17 100644 (file)
@@ -19,6 +19,7 @@
 #include <lac/vector.h>
 #include <lac/block_vector.h>
 #include <lac/sparse_matrix.h>
+#include <lac/compressed_simple_sparsity_pattern.h>
 #include <lac/precondition.h>
 #include <lac/solver_cg.h>
 #include <lac/vector_memory.h>
@@ -460,12 +461,18 @@ void VectorTools::project (const Mapping<dim, spacedim>       &mapping,
 
                                   // set up mass matrix and right hand side
   Vector<double> 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<double> mass_matrix (sparsity);
   Vector<double> tmp (mass_matrix.n());
 

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.