]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix Trilinos SparseMatrix adding instead of inserting entries in parallel. Also leave...
authorTimo Heister <timo.heister@gmail.com>
Fri, 3 May 2013 15:15:18 +0000 (15:15 +0000)
committerTimo Heister <timo.heister@gmail.com>
Fri, 3 May 2013 15:15:18 +0000 (15:15 +0000)
git-svn-id: https://svn.dealii.org/trunk@29446 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/include/deal.II/lac/trilinos_sparse_matrix.h

index 415883084e18cc12284ea440d10ff6f3dca82ef6..572d9d1cb93b6c845dd996b74a07c4e4cbd837f1 100644 (file)
@@ -64,6 +64,12 @@ this function.
 
 
 <ol>
+  <li> Fixed: setting values in TrilinosWrappers::SparseMatrix
+  in parallel was adding the values instead.
+  <br>
+  (Bruno Turcksin, Timo Heister, 2013/05/03)
+  </li>
+
   <li> New: The step-49 tutorial program now also has a discussion on
   what to do once you have a coarse mesh and want to refine it.
   <br>
index 36a7123ceddf9a75e7f0222c2672c44c305f31a0..bc1c3091c7ebc50f12423b5a753c3406becee812 100644 (file)
@@ -543,7 +543,7 @@ namespace TrilinosWrappers
     typedef TrilinosScalar value_type;
 
     /**
-     * @name Constructors and initalization.
+     * @name Constructors and initialization.
      */
 //@{
     /**
@@ -769,7 +769,7 @@ namespace TrilinosWrappers
      * they might be spread out. The
      * second Epetra_Map is only used to
      * specify the number of columns and
-     * for internal arragements when
+     * for internal arrangements when
      * doing matrix-vector products with
      * vectors based on that column map.
      *
@@ -3032,12 +3032,32 @@ namespace TrilinosWrappers
 
   inline
   void
-  SparseMatrix::compress (::dealii::VectorOperation::values /*operation*/)
+  SparseMatrix::compress (::dealii::VectorOperation::values operation)
   {
+
+    Epetra_CombineMode mode = last_action;
+    if (last_action == Zero)
+      {
+        if (operation==::dealii::VectorOperation::add)
+          mode = Add;
+        else if (operation==::dealii::VectorOperation::insert)
+          mode = Insert;
+      }
+    else
+      {
+        Assert(
+            ((last_action == Add) && (operation==::dealii::VectorOperation::add))
+            ||
+            ((last_action == Insert) && (operation==::dealii::VectorOperation::insert)),
+            ExcMessage("operation and argument to compress() do not match"));
+      }
+
+    std::cout << "compress " << (mode==Add) << (mode==Insert) << std::endl;
+
     // flush buffers
     int ierr;
     ierr = matrix->GlobalAssemble (*column_space_map, matrix->RowMap(),
-                                   true);
+        true, mode);
 
     AssertThrow (ierr == 0, ExcTrilinosError(ierr));
 
@@ -3301,6 +3321,7 @@ namespace TrilinosWrappers
         // zero. However, these actions are done
         // in case we pass on to the other
         // function.
+        // TODO: fix this (do not run compress here, but fail)
         if (last_action == Insert)
           {
             int ierr;

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.