From: Simon Sticko Date: Thu, 28 Mar 2024 08:29:10 +0000 (+0100) Subject: Add assert on reinit() being called before get_present_fe_values() X-Git-Tag: v9.6.0-rc1~437^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c27d6f61d2fe49a9e463d9395be25ddf418ed5f5;p=dealii.git Add assert on reinit() being called before get_present_fe_values() If you call hp::FEValues::get_present_fe_values() and forgot to call reinit() first, you presently get a poor error message. Add an assert that present_fe_values_index is not invalid with a better error message. --- diff --git a/include/deal.II/hp/fe_values.h b/include/deal.II/hp/fe_values.h index a29400d1e4..c7fb10fbe0 100644 --- a/include/deal.II/hp/fe_values.h +++ b/include/deal.II/hp/fe_values.h @@ -693,6 +693,14 @@ namespace hp inline const FEValuesType & FEValuesBase::get_present_fe_values() const { + Assert( + present_fe_values_index != TableIndices<3>(numbers::invalid_unsigned_int, + numbers::invalid_unsigned_int, + numbers::invalid_unsigned_int), + ExcMessage( + "The indices of the present FEValues object are all invalid. The reason" + " is likely that you have forgotten to call the reinit() function.")); + return *fe_values_table(present_fe_values_index); }