From: Martin Kronbichler Date: Wed, 12 Feb 2020 14:38:26 +0000 (+0100) Subject: FEEvaluation: Place exception about no block vector correctly X-Git-Tag: v9.2.0-rc1~526^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8b83ac8be2f3fe4bca4b2e5b6f67d655e43360d;p=dealii.git FEEvaluation: Place exception about no block vector correctly --- 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) {