From e8b83ac8be2f3fe4bca4b2e5b6f67d655e43360d Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Wed, 12 Feb 2020 15:38:26 +0100 Subject: [PATCH] FEEvaluation: Place exception about no block vector correctly --- include/deal.II/matrix_free/fe_evaluation.h | 23 ++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index ae16502ebc..c3e9e3486b 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -3799,7 +3799,17 @@ FEEvaluationBase:: Assert(matrix_info->indices_initialized() == true, ExcNotInitialized()); if (n_fe_components == 1) for (unsigned int comp = 0; comp < n_components; ++comp) - internal::check_vector_compatibility(*src[comp], *dof_info); + { + Assert(src[comp] != nullptr, + ExcMessage("The finite element underlying this FEEvaluation " + "object is scalar, but you requested " + + std::to_string(n_components) + + " components via the template argument in " + "FEEvaluation. In that case, you must pass an " + "std::vector or a BlockVector to " + + "read_dof_values and distribute_local_to_global.")); + internal::check_vector_compatibility(*src[comp], *dof_info); + } else { internal::check_vector_compatibility(*src[0], *dof_info); @@ -4049,17 +4059,6 @@ FEEvaluationBase:: if (n_components == 1 || n_fe_components == 1) { - for (unsigned int c = 0; c < n_components; ++c) - Assert(src[c] != nullptr, - ExcMessage( - "The finite element underlying this FEEvaluation " - "object is scalar, but you requested " + - std::to_string(n_components) + - " components via the template argument in " - "FEEvaluation. In that case, you must pass an " - "std::vector or a BlockVector to " + - "read_dof_values and distribute_local_to_global.")); - unsigned int ind_local = 0; for (; index_indicators != next_index_indicators; ++index_indicators) { -- 2.39.5