]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Circumvent a bug in Trilinos 11.10 182/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 29 Sep 2014 14:35:54 +0000 (16:35 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 29 Sep 2014 14:35:54 +0000 (16:35 +0200)
If we avoid calling GlobalAssemble when copying from an Epetra_FECrsMatrix that uses a
non-local matrix (enabled for Trilinos 11.9 and greater), we do not run into some bad
code in Trilinos causing a segfault. At this point of the code, it is enough if we only
call FillComplete because there should be no communication after all.

source/lac/trilinos_sparse_matrix.cc

index 76667226c34a0f09964b51b3867f7370c889f36a..aaebb8ea1354852be979d1298854de12283a610f 100644 (file)
@@ -392,12 +392,13 @@ namespace TrilinosWrappers
     nonlocal_matrix.reset();
     nonlocal_matrix_exporter.reset();
 
-    // check whether we need to update the
-    // partitioner or can just copy the data:
-    // in case we have the same distribution,
-    // we can just copy the data.
-    if (local_range() == m.local_range())
-      *matrix = *m.matrix;
+    // check whether we need to update the partitioner or can just copy the
+    // data: in case we have the same distribution, we can just copy the data.
+    if (&matrix->Graph() == &m.matrix->Graph() && m.matrix->Filled())
+      {
+        std::memcpy(matrix->ExpertExtractValues(), m.matrix->ExpertExtractValues(),
+                    matrix->NumMyNonzeros()*sizeof(*matrix->ExpertExtractValues()));
+      }
     else
       {
         column_space_map.reset (new Epetra_Map (m.domain_partitioner()));
@@ -410,7 +411,7 @@ namespace TrilinosWrappers
     if (m.nonlocal_matrix.get() != 0)
       nonlocal_matrix.reset(new Epetra_CrsMatrix(Copy, m.nonlocal_matrix->Graph()));
 
-    compress();
+    matrix->FillComplete(*column_space_map, matrix->RowMap());
   }
 
 

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.