From: Wolfgang Bangerth Date: Mon, 14 Jun 2021 22:56:26 +0000 (-0600) Subject: Add an exception to check that an element exists. X-Git-Tag: v9.4.0-rc1~1221^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af8d0194d1eb789a9d70be6487006279f8d904b0;p=dealii.git Add an exception to check that an element exists. --- 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);