From 69fc877e54d94dbb6f15ed838856c08cb64d546f Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 25 Feb 2022 14:31:08 -0700 Subject: [PATCH] Provide a second error for Trilinos sparsity pattern problems. --- source/lac/trilinos_sparsity_pattern.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/source/lac/trilinos_sparsity_pattern.cc b/source/lac/trilinos_sparsity_pattern.cc index 71111b2b6e..692c623d7b 100644 --- a/source/lac/trilinos_sparsity_pattern.cc +++ b/source/lac/trilinos_sparsity_pattern.cc @@ -710,7 +710,25 @@ namespace TrilinosWrappers AssertThrow(ierr == 0, ExcTrilinosError(ierr)); } - ierr = graph->OptimizeStorage(); + try + { + ierr = graph->OptimizeStorage(); + } + catch (const int error_code) + { + AssertThrow( + false, + ExcMessage( + "The Epetra_CrsGraph::OptimizeStorage() function " + "has thrown an error with code " + + std::to_string(error_code) + + ". You will have to look up the exact meaning of this error " + "in the Trilinos source code, but oftentimes, this function " + "throwing an error indicates that you are trying to allocate " + "more than 2,147,483,647 nonzero entries in the sparsity " + "pattern on the local process; this will not work because " + "Epetra indexes entries with a simple 'signed int'.")); + } AssertThrow(ierr == 0, ExcTrilinosError(ierr)); } -- 2.39.5