This gets around an issue where, if one is using a sparsity pattern
created by make_flux_sparsity_pattern and the 'nonzero' coupling option,
one may end up trying to add zeros to entries that do not exist in the
sparsity pattern on the current processor. This problem shows up when
adding fluxes between locally owned and ghost cells.
This commit sidesteps the issue by exiting early if there is
nothing (i.e., the only thing to do is add zero) to do.
<h3>Specific improvements</h3>
<ol>
+ <li> Fixed: TrilinosWrappers::SparseMatrix will now exit early if there are no
+ entries to add to the matrix. This usually occurs when zero elision is on. This
+ fixes a bug where the matrix raises an exception if there are no entries to add
+ to a matrix and the provided row and column values are not locally stored.
+ <br>
+ (David Wells, 2016/04/24)
+ </li>
+
<li> Fixed: TrilinosWrappers::MPI::Vector and TrilinosWrappers::Vector could
access invalid memory in the reinit() method if the MPI communicator was
deleted before termination of the program. This usually happened when using
Assert(n_columns <= (TrilinosWrappers::types::int_type)n_cols, ExcInternalError());
}
+ // Exit early if there is nothing to do
+ if (n_columns == 0)
+ {
+ return;
+ }
// If the calling processor owns the row to which we want to add values, we
// can directly call the Epetra_CrsMatrix input function, which is much
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