]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
When Trilinos matrices are based on the same sparsity pattern, they can share the...
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 18 Feb 2009 12:14:56 +0000 (12:14 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 18 Feb 2009 12:14:56 +0000 (12:14 +0000)
git-svn-id: https://svn.dealii.org/trunk@18394 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-31/step-31.cc
deal.II/lac/include/lac/trilinos_sparse_matrix.h
deal.II/lac/source/trilinos_sparse_matrix.cc

index 0d1da76c1611ba6f3d258ed102efae7c7ca7edc7..eead40b5175f6fe2a62a0262a4200f862f3e25b3 100644 (file)
@@ -1272,7 +1272,19 @@ void BoussinesqFlowProblem<dim>::setup_dofs ()
                                   // of the Stokes matrix &ndash; except
                                   // that it is much easier here since we
                                   // do not need to take care of any blocks
-                                  // or coupling between components:
+                                  // or coupling between components. Note
+                                  // how we initialize the three
+                                  // temperature matrices: We only use the
+                                  // sparsity pattern for reinitialization
+                                  // of the first matrix, whereas we use
+                                  // the previously generated matrix for
+                                  // the two remaining reinits. The reason
+                                  // for doing so is that reinitialization
+                                  // from an already generated matrix
+                                  // allows Trilinos to reuse the sparsity
+                                  // pattern instead of generating a new
+                                  // one for each copy. This saves both
+                                  // some time and memory.
   {
     temperature_mass_matrix.clear ();
     temperature_stiffness_matrix.clear ();
@@ -1283,8 +1295,8 @@ void BoussinesqFlowProblem<dim>::setup_dofs ()
                                     temperature_constraints, false);
 
     temperature_matrix.reinit (csp);
-    temperature_mass_matrix.reinit (csp);
-    temperature_stiffness_matrix.reinit (csp);
+    temperature_mass_matrix.reinit (temperature_matrix);
+    temperature_stiffness_matrix.reinit (temperature_matrix);
   }
 
                                   // Lastly, we set the vectors for the
index ecd9b56e96918110c16b846c14892cf1bf5430cd..922aa01c2959560d46c458a9618121e7c35eff88 100755 (executable)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2008 by the deal.II authors
+//    Copyright (C) 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -290,7 +290,7 @@ namespace TrilinosWrappers
  * 
  * @ingroup TrilinosWrappers
  * @ingroup Matrix1
- * @author Martin Kronbichler, Wolfgang Bangerth, 2008
+ * @author Martin Kronbichler, Wolfgang Bangerth, 2008, 2009
  */
   class SparseMatrix : public Subscriptor
   {
index 580bcb552b52286b7a9bb23718b82c800af6f640..74de21cb8e94b9812c49a719bc20670b7acb1594 100755 (executable)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2008 by the deal.II authors
+//    Copyright (C) 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -251,6 +251,7 @@ namespace TrilinosWrappers
     row_map = m.row_map;
     col_map = m.col_map;
     *matrix = *m.matrix;
+    compress();
     return *this;
   }
   
@@ -563,9 +564,10 @@ namespace TrilinosWrappers
 
     row_map = sparse_matrix.row_map;
     col_map = sparse_matrix.col_map;
-    matrix = std::auto_ptr<Epetra_FECrsMatrix>(new Epetra_FECrsMatrix(
-                                                  *sparse_matrix.matrix));
-    compressed = true;
+    matrix = std::auto_ptr<Epetra_FECrsMatrix>
+      (new Epetra_FECrsMatrix(Copy, sparse_matrix.matrix->Graph(), false));
+
+    compress();
   }
 
 

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.