From: Martin Kronbichler Date: Mon, 29 Sep 2014 14:35:54 +0000 (+0200) Subject: Circumvent a bug in Trilinos 11.10 X-Git-Tag: v8.2.0-rc1~121^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=280c52af49859920a5e7da91fa3fa0c208b5724c;p=dealii.git Circumvent a bug in Trilinos 11.10 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. --- diff --git a/source/lac/trilinos_sparse_matrix.cc b/source/lac/trilinos_sparse_matrix.cc index 76667226c3..aaebb8ea13 100644 --- a/source/lac/trilinos_sparse_matrix.cc +++ b/source/lac/trilinos_sparse_matrix.cc @@ -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()); }