]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Use intermediate compressed sparsity pattern.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 24 Jun 2010 01:39:13 +0000 (01:39 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 24 Jun 2010 01:39:13 +0000 (01:39 +0000)
git-svn-id: https://svn.dealii.org/trunk@21304 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-45/step-45.cc

index 356d85a0a9b4b9705125848757964a9176dd6336..bc52cf6793ab51e5f3c4d39832e8e4422cbe671e 100644 (file)
@@ -26,6 +26,7 @@
 #include <lac/solver_control.h>
 #include <lac/sparse_matrix.h>
 #include <lac/sparsity_pattern.h>
+#include <lac/compressed_sparsity_pattern.h>
 
 #include <grid/grid_generator.h>
 #include <grid/tria.h>
@@ -236,16 +237,23 @@ void LaplaceProblem::make_grid_and_dofs ()
                                   // upper and lower parts of the boundary
                                   // and close the
                                   // <code>ConstraintMatrix</code> object.
-  VectorTools::interpolate_boundary_values (dof_handler, 1, ZeroFunction<2> (), constraints);
+  VectorTools::interpolate_boundary_values (dof_handler, 1,
+                                           ZeroFunction<2> (),
+                                           constraints);
   constraints.close ();
                                   // Then we create the sparsity pattern and
                                   // the system matrix and initialize the
                                   // solution and right-hand side vectors.
   const unsigned int n_dofs = dof_handler.n_dofs ();
-   
-  sparsity_pattern.reinit (n_dofs, n_dofs, dof_handler.max_couplings_between_dofs ());
-  DoFTools::make_sparsity_pattern (dof_handler, sparsity_pattern, constraints, false);
-  sparsity_pattern.compress ();
+
+  CompressedSparsityPattern c_sparsity_pattern (n_dofs, n_dofs);
+  DoFTools::make_sparsity_pattern (dof_handler,
+                                  c_sparsity_pattern,
+                                  constraints,
+                                  false);
+  c_sparsity_pattern.compress ();
+  sparsity_pattern.copy_from (c_sparsity_pattern);
+  
   system_matrix.reinit (sparsity_pattern);
   system_rhs.reinit (n_dofs);
   solution.reinit (n_dofs);

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.