From af8d0194d1eb789a9d70be6487006279f8d904b0 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 14 Jun 2021 16:56:26 -0600 Subject: [PATCH] Add an exception to check that an element exists. --- source/lac/petsc_vector_base.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/lac/petsc_vector_base.cc b/source/lac/petsc_vector_base.cc index de27a60c3b..d4aae2a97a 100644 --- a/source/lac/petsc_vector_base.cc +++ b/source/lac/petsc_vector_base.cc @@ -73,6 +73,11 @@ namespace PETScWrappers else { // ghost entry + Assert(vector.ghost_indices.is_element(index), + ExcMessage( + "You are trying to access an element of a vector " + "that is neither a locally owned element nor a " + "ghost element of the vector.")); const size_type ghostidx = vector.ghost_indices.index_within_set(index); -- 2.39.5